Fix in CopyBox. Thanks, Georg :)
[cake.git] / arch / common / hidd.radeon / ati_class.c
blobb2634526db49478376cd39d157288261997d3511
1 /*
2 Copyright © 2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <utility/tagitem.h>
8 #include <proto/exec.h>
9 #include <proto/oop.h>
10 #include <proto/utility.h>
12 #include "ati.h"
13 #include "radeon.h"
14 #include "radeon_reg.h"
15 #include "radeon_bios.h"
16 #include "radeon_accel.h"
17 #include "radeon_macros.h"
19 #define DEBUG 0
20 #include <aros/debug.h>
22 #define sd ((struct ati_staticdata*)SD(cl))
24 #undef HiddPCIDeviceAttrBase
25 #undef HiddGfxAttrBase
26 #undef HiddPixFmtAttrBase
27 #undef HiddSyncAttrBase
28 #undef HiddBitMapAttrBase
29 #define HiddPCIDeviceAttrBase (sd->pciAttrBase)
30 #define HiddATIBitMapAttrBase (sd->atiBitMapAttrBase)
31 #define HiddBitMapAttrBase (sd->bitMapAttrBase)
32 #define HiddPixFmtAttrBase (sd->pixFmtAttrBase)
33 #define HiddGfxAttrBase (sd->gfxAttrBase)
34 #define HiddSyncAttrBase (sd->syncAttrBase)
36 #define ToRGB8888(alp,c) ((c) | ((alp) << 24))
38 #if AROS_BIG_ENDIAN
40 #define CURSOR_SWAPPING_DECL_MMIO ULONG __temp_surface_cntl = INREG(RADEON_SURFACE_CNTL)
41 #define CURSOR_SWAPPING_START() \
42 OUTREG(RADEON_SURFACE_CNTL, \
43 (__temp_surface_cntl | \
44 RADEON_NONSURF_AP0_SWP_32BPP) & \
45 ~RADEON_NONSURF_AP0_SWP_16BPP)
46 #define CURSOR_SWAPPING_END() (OUTREG(RADEON_SURFACE_CNTL, \
47 __temp_surface_cntl))
49 #else
51 #define CURSOR_SWAPPING_DECL_MMIO
52 #define CURSOR_SWAPPING_START()
53 #define CURSOR_SWAPPING_END()
55 #endif
57 #define MAKE_SYNC(name,clock,hdisp,hstart,hend,htotal,vdisp,vstart,vend,vtotal,descr) \
58 struct TagItem sync_ ## name[]={ \
59 { aHidd_Sync_PixelClock, clock*1000 }, \
60 { aHidd_Sync_HDisp, hdisp }, \
61 { aHidd_Sync_HSyncStart, hstart }, \
62 { aHidd_Sync_HSyncEnd, hend }, \
63 { aHidd_Sync_HTotal, htotal }, \
64 { aHidd_Sync_VDisp, vdisp }, \
65 { aHidd_Sync_VSyncStart, vstart }, \
66 { aHidd_Sync_VSyncEnd, vend }, \
67 { aHidd_Sync_VTotal, vtotal }, \
68 { aHidd_Sync_Description, (IPTR)descr}, \
69 { TAG_DONE, 0UL }}
72 OOP_Object *METHOD(ATI, Hidd_Gfx, Show)
74 OOP_Object *fb = NULL;
75 if (msg->bitMap)
77 atiBitMap *bm = OOP_INST_DATA(OOP_OCLASS(msg->bitMap), msg->bitMap);
78 if (bm->state)
80 /* Suppose bm has properly allocated state structure */
81 if (bm->fbgfx)
83 bm->usecount++;
85 LOCK_HW
86 LoadState(sd, bm->state);
87 DPMS(sd, sd->dpms);
89 fb = bm->BitMap;
90 ShowHideCursor(sd, sd->Card.cursorVisible);
92 RADEONEngineReset(sd);
93 RADEONEngineRestore(sd);
95 UNLOCK_HW
100 if (!fb)
101 fb = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
103 return fb;
106 OOP_Object *METHOD(ATI, Hidd_Gfx, NewBitMap)
108 BOOL displayable, framebuffer;
109 OOP_Class *classptr = NULL;
110 struct TagItem mytags[2];
111 struct pHidd_Gfx_NewBitMap mymsg;
113 /* Displayable bitmap ? */
114 displayable = GetTagData(aHidd_BitMap_Displayable, FALSE, msg->attrList);
115 framebuffer = GetTagData(aHidd_BitMap_FrameBuffer, FALSE, msg->attrList);
117 if (framebuffer)
119 /* If the user asks for a framebuffer map we must ALLWAYS supply a class */
120 classptr = sd->OnBMClass;
122 else if (displayable)
124 classptr = sd->OnBMClass; //offbmclass;
126 else
128 HIDDT_ModeID modeid;
130 For the non-displayable case we can either supply a class ourselves
131 if we can optimize a certain type of non-displayable bitmaps. Or we
132 can let the superclass create on for us.
134 The attributes that might come from the user deciding the bitmap
135 pixel format are:
136 - aHidd_BitMap_ModeID: a modeid. create a nondisplayable
137 bitmap with the size and pixelformat of a gfxmode.
138 - aHidd_BitMap_StdPixFmt: a standard pixelformat as described in
139 hidd/graphics.h
140 - aHidd_BitMap_Friend: if this is supplied and none of the two above
141 are supplied, then the pixel format of the created bitmap
142 will be the same as the one of the friend bitmap.
144 These tags are listed in prioritized order, so if
145 the user supplied a ModeID tag, then you should not care about StdPixFmt
146 or Friend. If there is no ModeID, but a StdPixFmt tag supplied,
147 then you should not care about Friend because you have to
148 create the correct pixelformat. And as said above, if only Friend
149 is supplied, you can create a bitmap with same pixelformat as Frien
152 modeid = (HIDDT_ModeID)GetTagData(aHidd_BitMap_ModeID, vHidd_ModeID_Invalid, msg->attrList);
154 if (vHidd_ModeID_Invalid != modeid)
156 /* User supplied a valid modeid. We can use our offscreen class */
157 classptr = sd->OnBMClass;
159 else
162 We may create an offscreen bitmap if the user supplied a friend
163 bitmap. But we need to check that he did not supplied a StdPixFmt
165 HIDDT_StdPixFmt stdpf = (HIDDT_StdPixFmt)GetTagData(aHidd_BitMap_StdPixFmt, vHidd_StdPixFmt_Unknown, msg->attrList);
167 if (vHidd_StdPixFmt_Plane == stdpf)
169 classptr = sd->PlanarBMClass;
171 else if (vHidd_StdPixFmt_Unknown == stdpf)
173 /* No std pixfmt supplied */
174 OOP_Object *friend;
176 /* Did the user supply a friend bitmap ? */
177 friend = (OOP_Object *)GetTagData(aHidd_BitMap_Friend, 0, msg->attrList);
178 if (NULL != friend)
180 OOP_Object * gfxhidd;
181 /* User supplied friend bitmap. Is the friend bitmap a Ati Gfx hidd bitmap ? */
182 OOP_GetAttr(friend, aHidd_BitMap_GfxHidd, (APTR)&gfxhidd);
183 if (gfxhidd == o)
185 /* Friend was NVidia hidd bitmap. Now we can supply our own class */
186 classptr = sd->OffBMClass;
193 D(bug("[ATI] classptr = %p\n", classptr));
195 /* Do we supply our own class ? */
196 if (NULL != classptr)
198 /* Yes. We must let the superclass not that we do this. This is
199 done through adding a tag in the frot of the taglist */
200 mytags[0].ti_Tag = aHidd_BitMap_ClassPtr;
201 mytags[0].ti_Data = (IPTR)classptr;
202 mytags[1].ti_Tag = TAG_MORE;
203 mytags[1].ti_Data = (IPTR)msg->attrList;
205 /* Like in Gfx::New() we init a new message struct */
206 mymsg.mID = msg->mID;
207 mymsg.attrList = mytags;
209 /* Pass the new message to the superclass */
210 msg = &mymsg;
213 return (OOP_Object*)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
216 void METHOD(ATI, Hidd_Gfx, CopyBox)
218 ULONG mode = GC_DRMD(msg->gc);
219 IPTR src=0, dst=0;
221 /* Check whether we can get Drawable attribute of our nVidia class */
222 OOP_GetAttr(msg->src, aHidd_ATIBitMap_Drawable, &src);
223 OOP_GetAttr(msg->dest, aHidd_ATIBitMap_Drawable, &dst);
225 if (!dst || !src)
227 /* No. One of the bitmaps is not nVidia bitmap */
228 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
230 else
233 /* Yes. Get the instance data of both bitmaps */
234 atiBitMap *bm_src = OOP_INST_DATA(OOP_OCLASS(msg->src), msg->src);
235 atiBitMap *bm_dst = OOP_INST_DATA(OOP_OCLASS(msg->dest), msg->dest);
237 D(bug("[ATI] CopyBox(src(%p,%d:%d@%d),dst(%p,%d:%d@%d),%d:%d\n",
238 bm_src->framebuffer,msg->srcX,msg->srcY,bm_src->depth,
239 bm_dst->framebuffer,msg->destX,msg->destY,bm_dst->depth,
240 msg->width, msg->height));
242 /* Case -1: (To be fixed) one of the bitmaps have chunky outside GFX mem */
243 if (!bm_src->fbgfx || !bm_dst->fbgfx)
245 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
247 /* Case 0: one of bitmaps is 8bpp, whereas the other is TrueColor one */
248 else if ((bm_src->depth <= 8 || bm_dst->depth <= 8) &&
249 (bm_src->depth != bm_dst->depth))
251 /* Unsupported case */
252 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
253 return;
255 /* Case 1: both bitmaps have the same depth - use Blit engine */
256 else if (bm_src->depth == bm_dst->depth)
258 int xdir = 0, ydir = 0;
259 WORD xa = msg->srcX;
260 WORD ya = msg->srcY;
261 WORD xb = msg->destX;
262 WORD yb = msg->destY;
263 WORD w = msg->width;
264 WORD h = msg->height;
266 if (bm_src->pitch_offset == bm_dst->pitch_offset)
268 xdir = xa - xb;
269 ydir = ya - yb;
271 if (xdir < 0) xa += w - 1, xb += w - 1;
272 if (ydir < 0) ya += h - 1, yb += h - 1;
275 LOCK_MULTI_BITMAP
276 LOCK_BITMAP_BM(bm_src)
277 LOCK_BITMAP_BM(bm_dst)
278 UNLOCK_MULTI_BITMAP
280 LOCK_HW
282 RADEONWaitForFifo(sd, 2);
283 OUTREG(RADEON_DST_PITCH_OFFSET, bm_dst->pitch_offset);
284 OUTREG(RADEON_SRC_PITCH_OFFSET, bm_src->pitch_offset);
286 bm_dst->dp_gui_master_cntl_clip = (bm_dst->dp_gui_master_cntl
287 | RADEON_GMC_BRUSH_NONE
288 | RADEON_GMC_SRC_DATATYPE_COLOR
289 | RADEON_GMC_SRC_PITCH_OFFSET_CNTL
290 | RADEON_ROP[mode].rop
291 | RADEON_DP_SRC_SOURCE_MEMORY);
293 RADEONWaitForFifo(sd, 6);
294 OUTREG(RADEON_DP_GUI_MASTER_CNTL, bm_dst->dp_gui_master_cntl_clip);
295 OUTREG(RADEON_DP_WRITE_MASK, ~0);
296 OUTREG(RADEON_DP_CNTL,
297 ((xdir >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) |
298 (ydir >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0)));
300 OUTREG(RADEON_SRC_Y_X, (ya << 16) | (UWORD)xa);
301 OUTREG(RADEON_DST_Y_X, (yb << 16) | (UWORD)xb);
302 OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | (UWORD)w);
304 UNLOCK_HW
306 UNLOCK_BITMAP_BM(bm_src)
307 UNLOCK_BITMAP_BM(bm_dst)
309 else /* Case 2: different bitmaps. HELP? */
311 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
314 bm_src->usecount++;
315 bm_dst->usecount++;
321 BOOL METHOD(ATI, Hidd_Gfx, SetCursorShape)
323 D(bug("[ATI] Set cursor shape %08x\n", msg->shape));
325 if (msg->shape == NULL)
327 ShowHideCursor(sd, 0);
328 sd->Card.cursorVisible = 0;
330 else
332 OOP_Object *pfmt;
333 OOP_Object *colormap;
334 HIDDT_StdPixFmt pixfmt;
335 HIDDT_Color color;
337 ULONG width, height, x, y;
338 ULONG maxw,maxh;
339 ULONG save1=0, save2=0;
341 ULONG *curimg = (ULONG*)((IPTR)sd->Card.CursorStart + (IPTR)sd->Card.FrameBuffer);
343 CURSOR_SWAPPING_DECL_MMIO;
345 struct pHidd_BitMap_GetPixel __gp = {
346 mID: OOP_GetMethodID((STRPTR)CLID_Hidd_BitMap, moHidd_BitMap_GetPixel)
347 }, *getpixel = &__gp;
349 struct pHidd_ColorMap_GetColor __gc = {
350 mID: OOP_GetMethodID((STRPTR)CLID_Hidd_ColorMap, moHidd_ColorMap_GetColor),
351 colorReturn: &color,
352 }, *getcolor = &__gc;
354 OOP_GetAttr(msg->shape, aHidd_BitMap_Width, &width);
355 OOP_GetAttr(msg->shape, aHidd_BitMap_Height, &height);
356 OOP_GetAttr(msg->shape, aHidd_BitMap_PixFmt, (APTR)&pfmt);
357 OOP_GetAttr(pfmt, aHidd_PixFmt_StdPixFmt, &pixfmt);
358 OOP_GetAttr(msg->shape, aHidd_BitMap_ColorMap, (APTR)&colormap);
360 if (width > 64) width = 64;
361 if (height > 64) height = 64;
363 maxw = 64;
364 maxh = 64;
366 LOCK_HW
368 if (!sd->Card.IsSecondary) {
369 save1 = INREG(RADEON_CRTC_GEN_CNTL) & ~(ULONG)(RADEON_CRTC_ARGB_EN|RADEON_CRTC_ARGB_EN);
370 save1 |= RADEON_CRTC_ARGB_EN;
371 OUTREG(RADEON_CRTC_GEN_CNTL, save1 & (ULONG)~RADEON_CRTC_CUR_EN);
374 if (sd->Card.IsSecondary) {
375 save2 = INREG(RADEON_CRTC_GEN_CNTL) & ~(ULONG)(RADEON_CRTC_ARGB_EN|RADEON_CRTC_ARGB_EN);
376 save2 |= RADEON_CRTC_ARGB_EN;
377 OUTREG(RADEON_CRTC2_GEN_CNTL, save2 & (ULONG)~RADEON_CRTC2_CUR_EN);
380 CURSOR_SWAPPING_START();
382 for (x = 0; x < maxw*maxh; x++)
383 curimg[x] = 0;
385 for (y = 0; y < height; y++)
387 for (x = 0; x < width; x++)
389 HIDDT_Pixel pixel;
390 getpixel->x = x;
391 getpixel->y = y;
392 pixel = OOP_DoMethod(msg->shape, (OOP_Msg)getpixel);
394 if (pixfmt == vHidd_StdPixFmt_LUT8)
396 if (pixel)
398 getcolor->colorNo = pixel;
399 OOP_DoMethod(colormap, (OOP_Msg)getcolor);
400 pixel = ((color.red << 8) & 0xff0000) |
401 ((color.green) & 0x00ff00) |
402 ((color.blue >> 8) & 0x0000ff);
403 *curimg++ = ToRGB8888(0xe0, pixel);
405 else *curimg++ = ToRGB8888(0,0);
408 for (x=width; x < maxw; x++, curimg++)
409 *curimg = 0;
412 for (y=height; y < maxh; y++)
413 for (x=0; x < maxw; x++)
414 { if (*curimg!=0x50000000) *curimg = 0; curimg++; }
416 CURSOR_SWAPPING_END();
418 if (!sd->Card.IsSecondary)
419 OUTREG(RADEON_CRTC_GEN_CNTL, save1);
421 if (sd->Card.IsSecondary)
422 OUTREG(RADEON_CRTC2_GEN_CNTL, save2);
424 UNLOCK_HW
427 return TRUE;
430 void METHOD(ATI, Hidd_Gfx, SetCursorVisible)
432 ShowHideCursor(sd, msg->visible);
433 sd->Card.cursorVisible = msg->visible;
436 void METHOD(ATI, Hidd_Gfx, SetCursorPos)
438 D(bug("[ATI] Set cursor pos %d:%d\n", msg->x, msg->y));
440 if (!sd->Card.IsSecondary) {
441 OUTREG(RADEON_CUR_HORZ_VERT_OFF, RADEON_CUR_LOCK);
442 OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK
443 | (msg->x << 16)
444 | (msg->y & 0xffff)));
445 OUTREG(RADEON_CUR_OFFSET, sd->Card.CursorStart);
447 D(bug("[ATI] OFF=%08x, HV_OFF=%08x, HV_POSN=%08x\n",
448 INREG(RADEON_CUR_OFFSET),
449 INREG(RADEON_CUR_HORZ_VERT_OFF),
450 INREG(RADEON_CUR_HORZ_VERT_POSN)));
452 } else {
453 OUTREG(RADEON_CUR2_HORZ_VERT_OFF, RADEON_CUR2_LOCK);
454 OUTREG(RADEON_CUR2_HORZ_VERT_POSN, (RADEON_CUR2_LOCK
455 | (msg->x << 16)
456 | (msg->y & 0xffff)));
457 OUTREG(RADEON_CUR2_OFFSET, sd->Card.CursorStart /* + addend???? */);
461 OOP_Object *METHOD(ATI, Root, New)
463 struct TagItem pftags_24bpp[] = {
464 { aHidd_PixFmt_RedShift, 8 }, /* 0 */
465 { aHidd_PixFmt_GreenShift, 16 }, /* 1 */
466 { aHidd_PixFmt_BlueShift, 24 }, /* 2 */
467 { aHidd_PixFmt_AlphaShift, 0 }, /* 3 */
468 { aHidd_PixFmt_RedMask, 0x00ff0000 }, /* 4 */
469 { aHidd_PixFmt_GreenMask, 0x0000ff00 }, /* 5 */
470 { aHidd_PixFmt_BlueMask, 0x000000ff }, /* 6 */
471 { aHidd_PixFmt_AlphaMask, 0x00000000 }, /* 7 */
472 { aHidd_PixFmt_ColorModel, vHidd_ColorModel_TrueColor }, /* 8 */
473 { aHidd_PixFmt_Depth, 24 }, /* 9 */
474 { aHidd_PixFmt_BytesPerPixel, 4 }, /* 10 */
475 { aHidd_PixFmt_BitsPerPixel, 24 }, /* 11 */
476 { aHidd_PixFmt_StdPixFmt, vHidd_StdPixFmt_Native }, /* 12 Native */
477 // { aHidd_PixFmt_StdPixFmt, vHidd_StdPixFmt_BGR032 }, /* 12 Native */
478 { aHidd_PixFmt_BitMapType, vHidd_BitMapType_Chunky }, /* 15 */
479 { TAG_DONE, 0UL }
482 struct TagItem pftags_16bpp[] = {
483 { aHidd_PixFmt_RedShift, 16 }, /* 0 */
484 { aHidd_PixFmt_GreenShift, 21 }, /* 1 */
485 { aHidd_PixFmt_BlueShift, 27 }, /* 2 */
486 { aHidd_PixFmt_AlphaShift, 0 }, /* 3 */
487 { aHidd_PixFmt_RedMask, 0x0000f800 }, /* 4 */
488 { aHidd_PixFmt_GreenMask, 0x000007e0 }, /* 5 */
489 { aHidd_PixFmt_BlueMask, 0x0000001f }, /* 6 */
490 { aHidd_PixFmt_AlphaMask, 0x00000000 }, /* 7 */
491 { aHidd_PixFmt_ColorModel, vHidd_ColorModel_TrueColor }, /* 8 */
492 { aHidd_PixFmt_Depth, 16 }, /* 9 */
493 { aHidd_PixFmt_BytesPerPixel, 2 }, /* 10 */
494 { aHidd_PixFmt_BitsPerPixel, 16 }, /* 11 */
495 { aHidd_PixFmt_StdPixFmt, vHidd_StdPixFmt_Native }, /* 12 */
496 // { aHidd_PixFmt_StdPixFmt, vHidd_StdPixFmt_RGB16_LE }, /* 12 */
497 { aHidd_PixFmt_BitMapType, vHidd_BitMapType_Chunky }, /* 15 */
498 { TAG_DONE, 0UL }
501 struct TagItem pftags_15bpp[] = {
502 { aHidd_PixFmt_RedShift, 17 }, /* 0 */
503 { aHidd_PixFmt_GreenShift, 22 }, /* 1 */
504 { aHidd_PixFmt_BlueShift, 27 }, /* 2 */
505 { aHidd_PixFmt_AlphaShift, 0 }, /* 3 */
506 { aHidd_PixFmt_RedMask, 0x00007c00 }, /* 4 */
507 { aHidd_PixFmt_GreenMask, 0x000003e0 }, /* 5 */
508 { aHidd_PixFmt_BlueMask, 0x0000001f }, /* 6 */
509 { aHidd_PixFmt_AlphaMask, 0x00000000 }, /* 7 */
510 { aHidd_PixFmt_ColorModel, vHidd_ColorModel_TrueColor }, /* 8 */
511 { aHidd_PixFmt_Depth, 15 }, /* 9 */
512 { aHidd_PixFmt_BytesPerPixel, 2 }, /* 10 */
513 { aHidd_PixFmt_BitsPerPixel, 15 }, /* 11 */
514 { aHidd_PixFmt_StdPixFmt, vHidd_StdPixFmt_Native }, /* 12 */
515 // { aHidd_PixFmt_StdPixFmt, vHidd_StdPixFmt_RGB15_LE }, /* 12 */
516 { aHidd_PixFmt_BitMapType, vHidd_BitMapType_Chunky }, /* 15 */
517 { TAG_DONE, 0UL }
520 MAKE_SYNC(640x480_60, 25174,
521 640, 656, 752, 800,
522 480, 490, 492, 525,
523 "ATI:640x480");
525 MAKE_SYNC(800x600_56, 36000, // 36000
526 800, 824, 896, 1024,
527 600, 601, 603, 625,
528 "ATI:800x600");
530 MAKE_SYNC(1024x768_60, 65000, //78654=60kHz, 75Hz. 65000=50kHz,62Hz
531 1024, 1048, 1184, 1344,
532 768, 771, 777, 806,
533 "ATI:1024x768");
535 MAKE_SYNC(1152x864_60, 80000,
536 1152, 1216, 1328, 1456,
537 864, 870, 875, 916,
538 "ATI:1152x864");
540 MAKE_SYNC(1280x1024_60, 108880,
541 1280, 1360, 1496, 1712,
542 1024, 1025, 1028, 1060,
543 "ATI:1280x1024");
545 MAKE_SYNC(1600x1200_60, 155982,
546 1600, 1632, 1792, 2048,
547 1200, 1210, 1218, 1270,
548 "ATI:1600x1200");
550 /* "new" 16:10 modes */
552 MAKE_SYNC(1280x800_60, 83530,
553 1280, 1344, 1480, 1680,
554 800, 801, 804, 828,
555 "ATI:1280x800");
557 MAKE_SYNC(1440x900_60, 106470,
558 1440, 1520, 1672, 1904,
559 900, 901, 904, 932,
560 "ATI:1440x900");
562 MAKE_SYNC(1680x1050_60, 147140,
563 1680, 1784, 1968, 2256,
564 1050, 1051, 1054, 1087,
565 "ATI:1680x1050");
567 MAKE_SYNC(1920x1200_60, 162090,
568 1920, 1984, 2176, 2480,
569 1200, 1201, 1204, 1250,
570 "ATI:1920x1200");
572 // MAKE_SYNC(1920x1200_60, 193160,
573 // 1920, 2048, 2256, 2592,
574 // 1200, 1201, 1204, 1242,
575 // "ATI:1920x1200");
577 struct TagItem modetags[] = {
578 { aHidd_Gfx_PixFmtTags, (IPTR)pftags_24bpp },
579 { aHidd_Gfx_PixFmtTags, (IPTR)pftags_16bpp },
580 { aHidd_Gfx_PixFmtTags, (IPTR)pftags_15bpp },
581 { aHidd_Gfx_SyncTags, (IPTR)sync_1280x1024_60 },
582 { aHidd_Gfx_SyncTags, (IPTR)sync_640x480_60 },
583 { aHidd_Gfx_SyncTags, (IPTR)sync_800x600_56 },
584 { aHidd_Gfx_SyncTags, (IPTR)sync_1024x768_60 },
585 { aHidd_Gfx_SyncTags, (IPTR)sync_1152x864_60 },
586 { aHidd_Gfx_SyncTags, (IPTR)sync_1600x1200_60 },
587 { aHidd_Gfx_SyncTags, (IPTR)sync_1280x800_60 },
588 { aHidd_Gfx_SyncTags, (IPTR)sync_1440x900_60 },
589 { aHidd_Gfx_SyncTags, (IPTR)sync_1680x1050_60 },
590 { aHidd_Gfx_SyncTags, (IPTR)sync_1920x1200_60 },
592 { TAG_DONE, 0UL }
595 struct TagItem mytags[] = {
596 { aHidd_Gfx_ModeTags, (IPTR)modetags },
597 { TAG_MORE, (IPTR)msg->attrList }
600 struct pRoot_New mymsg;
602 mymsg.mID = msg->mID;
603 mymsg.attrList = mytags;
605 msg = &mymsg;
607 o = (OOP_Object *)OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
608 if (o)
610 sd->AtiObject = o;
613 EnterFunc(bug("[ATI] RadeonDriver::New()=%08x\n",o));
615 return o;
618 void METHOD(ATI, Root, Get)
620 ULONG idx;
621 BOOL found = FALSE;
623 if (IS_GFX_ATTR(msg->attrID, idx))
625 switch (idx)
627 case aoHidd_Gfx_SupportsHWCursor:
628 *msg->storage = (IPTR)TRUE;
629 found = TRUE;
630 break;
632 case aoHidd_Gfx_DPMSLevel:
633 *msg->storage = sd->dpms;
634 found = TRUE;
635 break;
639 if (!found)
640 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);
642 return;
645 void METHOD(ATI, Root, Set)
647 ULONG idx;
648 struct TagItem *tag;
649 const struct TagItem *tags = msg->attrList;
651 while ((tag = NextTagItem(&tags)))
653 if (IS_GFX_ATTR(tag->ti_Tag, idx))
655 switch(idx)
657 case aoHidd_Gfx_DPMSLevel:
658 LOCK_HW
660 DPMS(sd, tag->ti_Data);
661 sd->dpms = tag->ti_Data;
663 UNLOCK_HW
664 break;
669 OOP_DoSuperMethod(cl, o, (OOP_Msg)msg);