New bitmap method SetRGBConversionFunction which can be used to
[tangerine.git] / arch / common / hidd.radeon / ati.h
blob5365147bba98ec7bbf09fffc1257620b08c8777d
1 #ifndef _ATI_H
2 #define _ATI_H
4 /*
5 Copyright © 2004, 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 <dos/bptr.h>
18 #include <aros/libcall.h>
19 #include <aros/asmcall.h>
21 #include <hidd/graphics.h>
23 #include <oop/oop.h>
25 #include <aros/arossupportbase.h>
26 #include <exec/execbase.h>
28 #include "radeon.h"
30 #include LC_LIBDEFS_FILE
32 #define IID_Hidd_Gfx_Ati "IRadeonDriver"
33 #define IID_Hidd_ATIBitMap "IRadeonBitmap"
34 #define CLID_Hidd_Gfx_Ati "RadeonDriver"
36 extern OOP_AttrBase HiddPCIDeviceAttrBase;
37 extern OOP_AttrBase HiddBitMapAttrBase;
38 extern OOP_AttrBase HiddPixFmtAttrBase;
39 extern OOP_AttrBase HiddSyncAttrBase;
40 extern OOP_AttrBase HiddGfxAttrBase;
41 extern OOP_AttrBase HiddATIBitMapAttrBase;
42 extern OOP_AttrBase HiddI2CAttrBase;
43 extern OOP_AttrBase HiddI2CDeviceAttrBase;
44 extern OOP_AttrBase __IHidd_PlanarBM;
46 enum {
47 aoHidd_ATIBitMap_Drawable,
49 num_Hidd_ATIBitMap_Attrs
52 #define aHidd_ATIBitMap_Drawable (HiddATIBitMapAttrBase + aoHidd_ATIBitMap_Drawable)
54 #define IS_BM_ATTR(attr, idx) (((idx)=(attr)-HiddBitMapAttrBase) < num_Hidd_BitMap_Attrs)
55 #define IS_ATIBM_ATTR(attr, idx) (((idx)=(attr)-HiddATIBitMapAttrBase) < num_Hidd_ATIBitMap_Attrs)
57 typedef struct __bm {
58 struct SignalSemaphore bmLock;
60 OOP_Object *BitMap; // BitMap OOP Object
61 IPTR framebuffer; // Points to pixel data
62 ULONG width; // Bitmap width
63 ULONG height; // Bitmap height
64 ULONG pitch; // BytesPerRow aligned
65 UBYTE depth; // Bitmap depth
66 UBYTE bpp; // BytesPerPixel
67 UBYTE onbm; // is onbitmap?
68 UBYTE fbgfx; // is framebuffer in gfx memory
69 ULONG usecount; // counts BitMap accesses
71 ULONG dp_gui_master_cntl;
72 ULONG dp_gui_master_cntl_clip;
73 ULONG pitch_offset;
74 UBYTE datatype;
76 ULONG surface_format;
77 ULONG pattern_format;
78 ULONG rect_format;
79 ULONG line_format;
81 struct CardState *state;
82 } atiBitMap;
84 struct ati_staticdata {
85 struct ExecBase *sysbase;
87 struct SignalSemaphore HWLock; /* Hardware exclusive semaphore */
88 struct SignalSemaphore MultiBMLock; /* To lock more than one bitmap at a time */
90 APTR memPool;
92 struct MemHeader CardMem;
94 struct Card Card;
95 struct CardState *poweron_state;
96 IPTR scratch_buffer;
98 OOP_Object *AtiObject;
99 OOP_Object *PCIObject;
100 OOP_Object *PCIDevice;
101 OOP_Object *PCIDriver;
103 OOP_Class *AtiClass;
104 OOP_Class *AtiI2C;
105 OOP_Class *OnBMClass;
106 OOP_Class *OffBMClass;
107 OOP_Class *PlanarBMClass;
109 OOP_AttrBase pciAttrBase;
110 OOP_AttrBase atiBitMapAttrBase;
111 OOP_AttrBase bitMapAttrBase;
112 OOP_AttrBase pixFmtAttrBase;
113 OOP_AttrBase gfxAttrBase;
114 OOP_AttrBase syncAttrBase;
115 OOP_AttrBase i2cAttrBase;
116 OOP_AttrBase i2cDeviceAttrBase;
117 OOP_AttrBase planarAttrBase;
119 OOP_MethodID mid_ReadLong;
120 OOP_MethodID mid_CopyMemBox8;
121 OOP_MethodID mid_CopyMemBox16;
122 OOP_MethodID mid_CopyMemBox32;
123 OOP_MethodID mid_PutMem32Image8;
124 OOP_MethodID mid_PutMem32Image16;
125 OOP_MethodID mid_GetMem32Image8;
126 OOP_MethodID mid_GetMem32Image16;
127 OOP_MethodID mid_GetImage;
128 OOP_MethodID mid_Clear;
129 OOP_MethodID mid_PutMemTemplate8;
130 OOP_MethodID mid_PutMemTemplate16;
131 OOP_MethodID mid_PutMemTemplate32;
132 OOP_MethodID mid_PutMemPattern8;
133 OOP_MethodID mid_PutMemPattern16;
134 OOP_MethodID mid_PutMemPattern32;
135 OOP_MethodID mid_CopyLUTMemBox16;
136 OOP_MethodID mid_CopyLUTMemBox32;
138 HIDDT_DPMSLevel dpms;
141 struct atibase {
142 struct Library LibNode;
143 struct ExecBase *sysbase;
144 BPTR seglist;
145 struct ati_staticdata sd;
148 struct planarbm_data
150 UBYTE **planes;
151 ULONG planebuf_size;
152 ULONG bytesperrow;
153 ULONG rows;
154 UBYTE depth;
155 BOOL planes_alloced;
158 #define BASE(lib) ((struct atibase*)(lib))
160 #define SD(cl) (&BASE(cl->UserData)->sd)
162 #define METHOD(base, id, name) \
163 base ## __ ## id ## __ ## name (OOP_Class *cl, OOP_Object *o, struct p ## id ## _ ## name *msg)
165 #define METHOD_NAME(base, id, name) \
166 base ## __ ## id ## __ ## name
168 #define METHOD_NAME_S(base, id, name) \
169 # base "__" # id "__" # name
172 #define LOCK_HW { ObtainSemaphore(&sd->HWLock); }
173 #define UNLOCK_HW { ReleaseSemaphore(&sd->HWLock); }
175 #define LOCK_BITMAP { ObtainSemaphore(&bm->bmLock); }
176 #define UNLOCK_BITMAP { ReleaseSemaphore(&bm->bmLock); }
178 #define LOCK_BITMAP_BM(bm) { ObtainSemaphore(&(bm)->bmLock); }
179 #define UNLOCK_BITMAP_BM(bm) { ReleaseSemaphore(&(bm)->bmLock); }
181 #define LOCK_MULTI_BITMAP { ObtainSemaphore(&sd->MultiBMLock); }
182 #define UNLOCK_MULTI_BITMAP { ReleaseSemaphore(&sd->MultiBMLock); }
184 #endif /* _ATI_H */