5 Copyright � 2004-2015, The AROS Development Team. All rights reserved.
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>
19 #include <devices/timer.h>
21 #include <aros/libcall.h>
22 #include <aros/asmcall.h>
24 #include <hidd/graphics.h>
28 #include <aros/arossupportbase.h>
29 #include <exec/execbase.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
;
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)
59 struct SignalSemaphore bmLock
;
61 OOP_Object
*BitMap
; // BitMap OOP Object
62 IPTR framebuffer
; // Points to pixel data
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
;
83 struct CardState
*state
;
86 struct ati_staticdata
{
87 struct SignalSemaphore HWLock
; /* Hardware exclusive semaphore */
88 struct SignalSemaphore MultiBMLock
; /* To lock more than one bitmap at a time */
91 struct timerequest tr
;
95 struct SignalSemaphore CardMemLock
;
96 struct MemHeader CardMem
;
100 struct MemHeaderExt managedMem
;
103 struct CardState
*poweron_state
;
107 OOP_Object
*AtiObject
;
108 OOP_Object
*PCIObject
;
109 OOP_Object
*PCIDevice
;
110 OOP_Object
*PCIDriver
;
112 OOP_Class
*basebm
; /* baseclass for CreateObject */
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
;
153 struct Library LibNode
;
154 struct ati_staticdata sd
;
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; }