force CC/CXX to the passed in compiler to use.
[AROS.git] / workbench / hidds / radeon / ati.h
blob4074c927a927b91bfb30d5f32845e15829bbbec7
1 #ifndef _ATI_H
2 #define _ATI_H
4 /*
5 Copyright © 2004-2017, 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/gfx.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 "hidd.gfx.radeon"
34 #define IID_Hidd_BitMap_ATI "hidd.bitmap.radeon"
35 #define CLID_Hidd_Gfx_Ati "hidd.gfx.radeon"
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 hiddAttrBase;
121 OOP_AttrBase pciAttrBase;
122 OOP_AttrBase atiBitMapAttrBase;
123 OOP_AttrBase bitMapAttrBase;
124 OOP_AttrBase pixFmtAttrBase;
125 OOP_AttrBase gfxAttrBase;
126 OOP_AttrBase syncAttrBase;
127 OOP_AttrBase i2cAttrBase;
128 OOP_AttrBase i2cDeviceAttrBase;
129 OOP_AttrBase planarAttrBase;
131 OOP_MethodID mid_ReadLong;
132 OOP_MethodID mid_CopyMemBox8;
133 OOP_MethodID mid_CopyMemBox16;
134 OOP_MethodID mid_CopyMemBox32;
135 OOP_MethodID mid_PutMem32Image8;
136 OOP_MethodID mid_PutMem32Image16;
137 OOP_MethodID mid_GetMem32Image8;
138 OOP_MethodID mid_GetMem32Image16;
139 OOP_MethodID mid_GetImage;
140 OOP_MethodID mid_Clear;
141 OOP_MethodID mid_PutMemTemplate8;
142 OOP_MethodID mid_PutMemTemplate16;
143 OOP_MethodID mid_PutMemTemplate32;
144 OOP_MethodID mid_PutMemPattern8;
145 OOP_MethodID mid_PutMemPattern16;
146 OOP_MethodID mid_PutMemPattern32;
147 OOP_MethodID mid_CopyLUTMemBox16;
148 OOP_MethodID mid_CopyLUTMemBox32;
150 HIDDT_DPMSLevel dpms;
153 struct atibase {
154 struct Library LibNode;
155 struct ati_staticdata sd;
158 struct planarbm_data
160 UBYTE **planes;
161 ULONG planebuf_size;
162 ULONG bytesperrow;
163 ULONG rows;
164 UBYTE depth;
165 BOOL planes_alloced;
168 #define BASE(lib) ((struct atibase*)(lib))
170 #define SD(cl) (&BASE(cl->UserData)->sd)
172 #define METHOD(base, id, name) \
173 base ## __ ## id ## __ ## name (OOP_Class *cl, OOP_Object *o, struct p ## id ## _ ## name *msg)
175 #define METHOD_NAME(base, id, name) \
176 base ## __ ## id ## __ ## name
178 #define METHOD_NAME_S(base, id, name) \
179 # base "__" # id "__" # name
181 #define LOCK_HW { ObtainSemaphore(&sd->HWLock); }
182 #define UNLOCK_HW { ReleaseSemaphore(&sd->HWLock); }
184 #define LOCK_BITMAP { ObtainSemaphore(&bm->bmLock); }
185 #define UNLOCK_BITMAP { ReleaseSemaphore(&bm->bmLock); }
187 #define LOCK_BITMAP_BM(bm) { ObtainSemaphore(&(bm)->bmLock); }
188 #define UNLOCK_BITMAP_BM(bm) { ReleaseSemaphore(&(bm)->bmLock); }
190 #define LOCK_MULTI_BITMAP { ObtainSemaphore(&sd->MultiBMLock); }
191 #define UNLOCK_MULTI_BITMAP { ReleaseSemaphore(&sd->MultiBMLock); }
193 //#define LOCK_HW { while (sd->HWLock.ss_QueueCount) Reschedule(FindTask(NULL)); sd->HWLock.ss_QueueCount=1; }
194 //#define UNLOCK_HW { sd->HWLock.ss_QueueCount=0; }
196 //#define LOCK_BITMAP { while (bm->bmLock.ss_QueueCount) Reschedule(FindTask(NULL)); bm->bmLock.ss_QueueCount=1; }
197 //#define UNLOCK_BITMAP { bm->bmLock.ss_QueueCount=0; }
199 //#define LOCK_BITMAP_BM(bm) { while (bm->bmLock.ss_QueueCount) Reschedule(FindTask(NULL)); bm->bmLock.ss_QueueCount=1; }
200 //#define UNLOCK_BITMAP_BM(bm) { bm->bmLock.ss_QueueCount=0; }
202 //#define LOCK_MULTI_BITMAP { while (sd->MultiBMLock.ss_QueueCount) Reschedule(FindTask(NULL)); sd->MultiBMLock.ss_QueueCount=1; }
203 //#define UNLOCK_MULTI_BITMAP { sd->MultiBMLock.ss_QueueCount=0; }
205 #endif /* _ATI_H */