Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / hidds / radeon / ati.h
blobd65dbf86340b9a36578e9b5851ff20623dc55b4f
1 #ifndef _ATI_H
2 #define _ATI_H
4 /*
5 Copyright � 2004-2015, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <exec/types.h>
10 #include <exec/libraries.h>
11 #include <exec/execbase.h>
12 #include <exec/nodes.h>
13 #include <exec/lists.h>
14 #include <exec/semaphores.h>
15 #include <exec/memory.h>
16 #include <exec/memheaderext.h>
17 #include <dos/bptr.h>
19 #include <devices/timer.h>
21 #include <aros/libcall.h>
22 #include <aros/asmcall.h>
24 #include <hidd/graphics.h>
26 #include <oop/oop.h>
28 #include <aros/arossupportbase.h>
29 #include <exec/execbase.h>
31 #include "radeon.h"
33 #define IID_Hidd_Gfx_Ati "IRadeonDriver"
34 #define IID_Hidd_ATIBitMap "IRadeonBitmap"
35 #define CLID_Hidd_Gfx_Ati "RadeonDriver"
37 extern OOP_AttrBase HiddPCIDeviceAttrBase;
38 extern OOP_AttrBase HiddBitMapAttrBase;
39 extern OOP_AttrBase HiddPixFmtAttrBase;
40 extern OOP_AttrBase HiddSyncAttrBase;
41 extern OOP_AttrBase HiddGfxAttrBase;
42 extern OOP_AttrBase HiddATIBitMapAttrBase;
43 extern OOP_AttrBase HiddI2CAttrBase;
44 extern OOP_AttrBase HiddI2CDeviceAttrBase;
45 extern OOP_AttrBase __IHidd_PlanarBM;
47 enum {
48 aoHidd_ATIBitMap_Drawable,
50 num_Hidd_ATIBitMap_Attrs
53 #define aHidd_ATIBitMap_Drawable (HiddATIBitMapAttrBase + aoHidd_ATIBitMap_Drawable)
55 #define IS_BM_ATTR(attr, idx) (((idx)=(attr)-HiddBitMapAttrBase) < num_Hidd_BitMap_Attrs)
56 #define IS_ATIBM_ATTR(attr, idx) (((idx)=(attr)-HiddATIBitMapAttrBase) < num_Hidd_ATIBitMap_Attrs)
58 typedef struct __bm {
59 struct SignalSemaphore bmLock;
61 OOP_Object *BitMap; // BitMap OOP Object
62 IPTR framebuffer; // Points to pixel data
63 void **addresses;
64 ULONG width; // Bitmap width
65 ULONG height; // Bitmap height
66 ULONG pitch; // BytesPerRow aligned
67 UBYTE depth; // Bitmap depth
68 UBYTE bpp; // BytesPerPixel
69 UBYTE onbm; // is onbitmap?
70 UBYTE fbgfx; // is framebuffer in gfx memory
71 ULONG usecount; // counts BitMap accesses
73 ULONG dp_gui_master_cntl;
74 ULONG dp_gui_master_cntl_clip;
75 ULONG pitch_offset;
76 UBYTE datatype;
78 ULONG surface_format;
79 ULONG pattern_format;
80 ULONG rect_format;
81 ULONG line_format;
83 struct CardState *state;
84 } atiBitMap;
86 struct ati_staticdata {
87 struct SignalSemaphore HWLock; /* Hardware exclusive semaphore */
88 struct SignalSemaphore MultiBMLock; /* To lock more than one bitmap at a time */
90 struct MsgPort mp;
91 struct timerequest tr;
93 APTR memPool;
95 struct SignalSemaphore CardMemLock;
96 struct MemHeader CardMem;
97 ULONG *CardMemBmp;
98 LONG CardMemSize;
100 struct MemHeaderExt managedMem;
102 struct Card Card;
103 struct CardState *poweron_state;
104 IPTR scratch_buffer;
105 UBYTE *cpuscratch;
107 OOP_Object *AtiObject;
108 OOP_Object *PCIObject;
109 OOP_Object *PCIDevice;
110 OOP_Object *PCIDriver;
112 OOP_Class *basebm; /* baseclass for CreateObject */
114 OOP_Class *AtiClass;
115 OOP_Class *AtiI2C;
116 OOP_Class *OnBMClass;
117 OOP_Class *OffBMClass;
118 OOP_Class *PlanarBMClass;
120 OOP_AttrBase pciAttrBase;
121 OOP_AttrBase atiBitMapAttrBase;
122 OOP_AttrBase bitMapAttrBase;
123 OOP_AttrBase pixFmtAttrBase;
124 OOP_AttrBase gfxAttrBase;
125 OOP_AttrBase syncAttrBase;
126 OOP_AttrBase i2cAttrBase;
127 OOP_AttrBase i2cDeviceAttrBase;
128 OOP_AttrBase planarAttrBase;
130 OOP_MethodID mid_ReadLong;
131 OOP_MethodID mid_CopyMemBox8;
132 OOP_MethodID mid_CopyMemBox16;
133 OOP_MethodID mid_CopyMemBox32;
134 OOP_MethodID mid_PutMem32Image8;
135 OOP_MethodID mid_PutMem32Image16;
136 OOP_MethodID mid_GetMem32Image8;
137 OOP_MethodID mid_GetMem32Image16;
138 OOP_MethodID mid_GetImage;
139 OOP_MethodID mid_Clear;
140 OOP_MethodID mid_PutMemTemplate8;
141 OOP_MethodID mid_PutMemTemplate16;
142 OOP_MethodID mid_PutMemTemplate32;
143 OOP_MethodID mid_PutMemPattern8;
144 OOP_MethodID mid_PutMemPattern16;
145 OOP_MethodID mid_PutMemPattern32;
146 OOP_MethodID mid_CopyLUTMemBox16;
147 OOP_MethodID mid_CopyLUTMemBox32;
149 HIDDT_DPMSLevel dpms;
152 struct atibase {
153 struct Library LibNode;
154 struct ati_staticdata sd;
157 struct planarbm_data
159 UBYTE **planes;
160 ULONG planebuf_size;
161 ULONG bytesperrow;
162 ULONG rows;
163 UBYTE depth;
164 BOOL planes_alloced;
167 #define BASE(lib) ((struct atibase*)(lib))
169 #define SD(cl) (&BASE(cl->UserData)->sd)
171 #define METHOD(base, id, name) \
172 base ## __ ## id ## __ ## name (OOP_Class *cl, OOP_Object *o, struct p ## id ## _ ## name *msg)
174 #define METHOD_NAME(base, id, name) \
175 base ## __ ## id ## __ ## name
177 #define METHOD_NAME_S(base, id, name) \
178 # base "__" # id "__" # name
180 #define LOCK_HW { ObtainSemaphore(&sd->HWLock); }
181 #define UNLOCK_HW { ReleaseSemaphore(&sd->HWLock); }
183 #define LOCK_BITMAP { ObtainSemaphore(&bm->bmLock); }
184 #define UNLOCK_BITMAP { ReleaseSemaphore(&bm->bmLock); }
186 #define LOCK_BITMAP_BM(bm) { ObtainSemaphore(&(bm)->bmLock); }
187 #define UNLOCK_BITMAP_BM(bm) { ReleaseSemaphore(&(bm)->bmLock); }
189 #define LOCK_MULTI_BITMAP { ObtainSemaphore(&sd->MultiBMLock); }
190 #define UNLOCK_MULTI_BITMAP { ReleaseSemaphore(&sd->MultiBMLock); }
192 //#define LOCK_HW { while (sd->HWLock.ss_QueueCount) Reschedule(FindTask(NULL)); sd->HWLock.ss_QueueCount=1; }
193 //#define UNLOCK_HW { sd->HWLock.ss_QueueCount=0; }
195 //#define LOCK_BITMAP { while (bm->bmLock.ss_QueueCount) Reschedule(FindTask(NULL)); bm->bmLock.ss_QueueCount=1; }
196 //#define UNLOCK_BITMAP { bm->bmLock.ss_QueueCount=0; }
198 //#define LOCK_BITMAP_BM(bm) { while (bm->bmLock.ss_QueueCount) Reschedule(FindTask(NULL)); bm->bmLock.ss_QueueCount=1; }
199 //#define UNLOCK_BITMAP_BM(bm) { bm->bmLock.ss_QueueCount=0; }
201 //#define LOCK_MULTI_BITMAP { while (sd->MultiBMLock.ss_QueueCount) Reschedule(FindTask(NULL)); sd->MultiBMLock.ss_QueueCount=1; }
202 //#define UNLOCK_MULTI_BITMAP { sd->MultiBMLock.ss_QueueCount=0; }
204 #endif /* _ATI_H */