2 Copyright © 2004, The AROS Development Team. All rights reserved.
8 #include "radeon_reg.h"
9 #include "radeon_bios.h"
10 #include "radeon_accel.h"
11 #include "radeon_macros.h"
14 #include <hidd/graphics.h>
15 #include <hidd/hidd.h>
17 #include <proto/oop.h>
18 #include <proto/utility.h>
21 #include <aros/debug.h>
23 #define sd ((struct ati_staticdata*)SD(cl))
25 #undef HiddPCIDeviceAttrBase
26 #undef HiddGfxAttrBase
27 #undef HiddPixFmtAttrBase
28 #undef HiddSyncAttrBase
29 #undef HiddBitMapAttrBase
30 #define HiddPCIDeviceAttrBase (sd->pciAttrBase)
31 #define HiddATIBitMapAttrBase (sd->atiBitMapAttrBase)
32 #define HiddBitMapAttrBase (sd->bitMapAttrBase)
33 #define HiddPixFmtAttrBase (sd->pixFmtAttrBase)
34 #define HiddGfxAttrBase (sd->gfxAttrBase)
35 #define HiddSyncAttrBase (sd->syncAttrBase)
37 struct pRoot_Dispose
{
41 OOP_Object
*METHOD(ATIOffBM
, Root
, New
)
42 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Root
, New
))));
44 OOP_Object
*METHOD(ATIOnBM
, Root
, New
)
46 if (cl
== sd
->OnBMClass
)
47 EnterFunc(bug("[ATIBitMap] OnBitmap::New()\n"));
49 EnterFunc(bug("[ATIBitMap] OffBitmap::New()\n"));
51 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
54 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
56 ULONG width
, height
, depth
;
62 InitSemaphore(&bm
->bmLock
);
64 D(bug("[ATIBitMap] Super called. o=%p\n", o
));
66 bm
->onbm
= (cl
== sd
->OnBMClass
);
68 OOP_GetAttr(o
, aHidd_BitMap_Width
, &width
);
69 OOP_GetAttr(o
, aHidd_BitMap_Height
, &height
);
70 OOP_GetAttr(o
, aHidd_BitMap_PixFmt
, (APTR
)&pf
);
71 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
72 fb
= GetTagData(aHidd_BitMap_FrameBuffer
, FALSE
, msg
->attrList
);
74 D(bug("[ATIBitmap] width=%d height=%d depth=%d\n", width
, height
, depth
));
76 if (width
== 0 || height
== 0 || depth
== 0)
78 bug("[ATIBitMap] size mismatch!\n");
98 bm
->pitch
= (width
* bytesPerPixel
+ 63) & ~63;
100 bm
->bpp
= bytesPerPixel
;
101 bm
->framebuffer
= AllocBitmapArea(sd
, bm
->width
, bm
->height
, bm
->bpp
, TRUE
);
107 if (bm
->framebuffer
!= -1)
109 ULONG pitch64
= ((bm
->pitch
)) >> 6;
126 bm
->dp_gui_master_cntl
=
127 ((bm
->datatype
<< RADEON_GMC_DST_DATATYPE_SHIFT
)
128 |RADEON_GMC_CLR_CMP_CNTL_DIS
129 |RADEON_GMC_DST_PITCH_OFFSET_CNTL
);
131 bm
->pitch_offset
= ((bm
->framebuffer
>> 10) | (bm
->pitch
<< 16));
133 D(bug("[ATIBitMap] PITCH_OFFSET=%08x\n", bm
->pitch_offset
));
136 if (cl
== sd
->OnBMClass
)
138 if (fb
&& bm
->framebuffer
!= -1)
140 bm
->state
= (struct CardState
*)AllocPooled(sd
->memPool
,
141 sizeof(struct CardState
));
143 bzero((APTR
)(sd
->Card
.FrameBuffer
+ bm
->framebuffer
), 640*480*2);
149 InitMode(sd
, bm
->state
, 640, 480, 16, 25200, bm
->framebuffer
,
154 LoadState(sd
, bm
->state
);
157 RADEONEngineReset(sd
);
158 RADEONEngineRestore(sd
);
165 else if (bm
->framebuffer
!= -1)
170 /* We should be able to get modeID from the bitmap */
171 OOP_GetAttr(o
, aHidd_BitMap_ModeID
, &modeid
);
173 D(bug("[ATIBitMap] BM_ModeID=%x\n", modeid
));
175 if (modeid
!= vHidd_ModeID_Invalid
)
178 ULONG hdisp
, vdisp
, hstart
, hend
, htotal
, vstart
, vend
, vtotal
;
180 /* Get Sync and PixelFormat properties */
181 struct pHidd_Gfx_GetMode __getmodemsg
= {
185 }, *getmodemsg
= &__getmodemsg
;
187 getmodemsg
->mID
= OOP_GetMethodID((STRPTR
)CLID_Hidd_Gfx
, moHidd_Gfx_GetMode
);
188 OOP_DoMethod(sd
->AtiObject
, (OOP_Msg
)getmodemsg
);
190 OOP_GetAttr(sync
, aHidd_Sync_PixelClock
, &pixel
);
191 OOP_GetAttr(sync
, aHidd_Sync_HDisp
, &hdisp
);
192 OOP_GetAttr(sync
, aHidd_Sync_VDisp
, &vdisp
);
193 OOP_GetAttr(sync
, aHidd_Sync_HSyncStart
, &hstart
);
194 OOP_GetAttr(sync
, aHidd_Sync_VSyncStart
, &vstart
);
195 OOP_GetAttr(sync
, aHidd_Sync_HSyncEnd
, &hend
);
196 OOP_GetAttr(sync
, aHidd_Sync_VSyncEnd
, &vend
);
197 OOP_GetAttr(sync
, aHidd_Sync_HTotal
, &htotal
);
198 OOP_GetAttr(sync
, aHidd_Sync_VTotal
, &vtotal
);
200 bm
->state
= (struct CardState
*)AllocPooled(sd
->memPool
,
201 sizeof(struct CardState
));
209 InitMode(sd
, bm
->state
, width
, height
, depth
, pixel
, bm
->framebuffer
,
211 hstart
, hend
, htotal
,
212 vstart
, vend
, vtotal
);
214 LoadState(sd
, bm
->state
);
217 RADEONEngineReset(sd
);
218 RADEONEngineRestore(sd
);
229 if (bm
->framebuffer
== -1)
231 bm
->framebuffer
= (IPTR
)AllocMem(bm
->pitch
* bm
->height
,
232 MEMF_PUBLIC
| MEMF_CLEAR
);
238 if ((bm
->framebuffer
!= 0xffffffff) && (bm
->framebuffer
!= 0))
244 OOP_MethodID disp_mid
= OOP_GetMethodID((STRPTR
)IID_Root
, moRoot_Dispose
);
245 OOP_CoerceMethod(cl
, o
, (OOP_Msg
) &disp_mid
);
252 VOID
METHOD(ATIOffBM
, Root
, Dispose
)
253 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Root
, Dispose
))));
255 VOID
METHOD(ATIOnBM
, Root
, Dispose
)
257 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
261 // NVDmaKickoff(&sd->Card);
262 RADEONWaitForIdleMMIO(sd
);
266 FreeBitmapArea(sd
, bm
->framebuffer
, bm
->width
, bm
->height
, bm
->bpp
);
268 bm
->framebuffer
= -1;
272 FreeMem((APTR
)bm
->framebuffer
, bm
->pitch
* bm
->height
);
275 FreePooled(sd
->memPool
, bm
->state
, sizeof(struct CardState
));
282 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
286 VOID
METHOD(ATIOffBM
, Root
, Get
)
287 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Root
, Get
))));
289 VOID
METHOD(ATIOnBM
, Root
, Get
)
291 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
294 if (IS_ATIBM_ATTR(msg
->attrID
, idx
))
298 case aoHidd_ATIBitMap_Drawable
:
300 *msg
->storage
= bm
->framebuffer
+ (IPTR
)sd
->Card
.FrameBuffer
;
302 *msg
->storage
= bm
->framebuffer
;
306 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
311 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
316 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, Clear
)
317 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, Clear
))));
319 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, Clear
)
321 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
323 D(bug("[ATI] Clear(%p)\n",
331 sd
->Card
.Busy
= TRUE
;
334 RADEONWaitForFifo(sd
, 1);
335 OUTREG(RADEON_DST_PITCH_OFFSET
, bm
->pitch_offset
);
337 bm
->dp_gui_master_cntl_clip
= (bm
->dp_gui_master_cntl
338 | RADEON_GMC_BRUSH_SOLID_COLOR
339 | RADEON_GMC_SRC_DATATYPE_COLOR
340 | RADEON_ROP
[GC_DRMD(vHidd_GC_DrawMode_Copy
)].pattern
);
342 RADEONWaitForFifo(sd
, 4);
344 OUTREG(RADEON_DP_GUI_MASTER_CNTL
, bm
->dp_gui_master_cntl_clip
);
345 OUTREG(RADEON_DP_BRUSH_FRGD_CLR
, GC_BG(msg
->gc
));
346 OUTREG(RADEON_DP_WRITE_MASK
, ~0);
347 OUTREG(RADEON_DP_CNTL
, (RADEON_DST_X_LEFT_TO_RIGHT
348 | RADEON_DST_Y_TOP_TO_BOTTOM
));
350 RADEONWaitForFifo(sd
, 2);
352 OUTREG(RADEON_DST_Y_X
, 0);
353 OUTREG(RADEON_DST_WIDTH_HEIGHT
, (bm
->width
<< 16) | bm
->height
);
359 ULONG
*ptr
= (ULONG
*)bm
->framebuffer
;
361 int i
= (bm
->pitch
* bm
->height
) >> 2;
366 val
= GC_BG(msg
->gc
) << 16 | (GC_BG(msg
->gc
) & 0xffff);
370 val
= GC_BG(msg
->gc
) << 16 | (GC_BG(msg
->gc
) & 0xffff);
374 do { *ptr
++ = val
; } while(--i
);
380 struct pHidd_BitMap_FillRect
{
381 struct pHidd_BitMap_DrawRect dr
;
384 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, FillRect
)
385 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, FillRect
))));
387 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, FillRect
)
389 OOP_Object
*gc
= msg
->dr
.gc
;
390 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
392 D(bug("[ATI] FillRect(%p, %d:%d - %d:%d)\n",
393 bm
->framebuffer
, msg
->dr
.minX
, msg
->dr
.minY
, msg
->dr
.maxX
, msg
->dr
.maxY
));
400 sd
->Card
.Busy
= TRUE
;
403 RADEONWaitForFifo(sd
, 1);
404 OUTREG(RADEON_DST_PITCH_OFFSET
, bm
->pitch_offset
);
406 bm
->dp_gui_master_cntl_clip
= (bm
->dp_gui_master_cntl
407 | RADEON_GMC_BRUSH_SOLID_COLOR
408 | RADEON_GMC_SRC_DATATYPE_COLOR
409 | RADEON_ROP
[GC_DRMD(gc
)].pattern
);
411 RADEONWaitForFifo(sd
, 4);
413 OUTREG(RADEON_DP_GUI_MASTER_CNTL
, bm
->dp_gui_master_cntl_clip
);
414 OUTREG(RADEON_DP_BRUSH_FRGD_CLR
, GC_FG(gc
));
415 OUTREG(RADEON_DP_WRITE_MASK
, ~0);
416 OUTREG(RADEON_DP_CNTL
, (RADEON_DST_X_LEFT_TO_RIGHT
417 | RADEON_DST_Y_TOP_TO_BOTTOM
));
419 RADEONWaitForFifo(sd
, 2);
421 OUTREG(RADEON_DST_Y_X
, (msg
->dr
.minY
<< 16) | msg
->dr
.minX
);
422 OUTREG(RADEON_DST_WIDTH_HEIGHT
, ((msg
->dr
.maxX
- msg
->dr
.minX
+ 1) << 16) | (msg
->dr
.maxY
- msg
->dr
.minY
+ 1));
428 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
436 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, DrawLine
)
437 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, DrawLine
))));
439 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, DrawLine
)
441 OOP_Object
*gc
= msg
->gc
;
442 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
444 D(bug("[ATI] DrawLine(%p, %d:%d - %d:%d) %08x\n",
445 bm
->framebuffer
, msg
->x1
, msg
->y1
, msg
->x2
, msg
->y2
,GC_FG(gc
)));
449 if ((GC_LINEPAT(gc
) =! (UWORD
)~0) || !bm
->fbgfx
)
451 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
456 sd
->Card
.Busy
= TRUE
;
459 RADEONWaitForFifo(sd
, 1);
460 OUTREG(RADEON_DST_PITCH_OFFSET
, bm
->pitch_offset
);
462 bm
->dp_gui_master_cntl_clip
= (bm
->dp_gui_master_cntl
463 | RADEON_GMC_BRUSH_SOLID_COLOR
464 | RADEON_GMC_SRC_DATATYPE_COLOR
465 | RADEON_ROP
[GC_DRMD(gc
)].pattern
);
467 if (sd
->Card
.Type
>= RV200
) {
468 RADEONWaitForFifo(sd
, 1);
469 OUTREG(RADEON_DST_LINE_PATCOUNT
,
470 0x55 << RADEON_BRES_CNTL_SHIFT
);
475 bm
->dp_gui_master_cntl_clip
|= RADEON_GMC_DST_CLIPPING
;
479 x2
= GC_CLIPX2(gc
) + 1;
480 y2
= GC_CLIPY2(gc
) + 1;
482 RADEONWaitForFifo(sd
, 2);
483 OUTREG(RADEON_SC_TOP_LEFT
, (y1
<< 16) | x1
);
484 OUTREG(RADEON_SC_BOTTOM_RIGHT
, (y2
<< 16) | x2
);
487 RADEONWaitForFifo(sd
, 3);
489 OUTREG(RADEON_DP_GUI_MASTER_CNTL
, bm
->dp_gui_master_cntl_clip
);
490 OUTREG(RADEON_DP_BRUSH_FRGD_CLR
, GC_FG(gc
));
491 OUTREG(RADEON_DP_WRITE_MASK
, ~0);
493 RADEONWaitForFifo(sd
, 4);
495 OUTREG(RADEON_DST_LINE_START
, (msg
->y1
<< 16) | msg
->x1
);
496 OUTREG(RADEON_DST_LINE_END
, (msg
->y2
<< 16) | msg
->x2
);
497 OUTREG(RADEON_DST_LINE_START
, (msg
->y2
<< 16) | msg
->x2
);
498 OUTREG(RADEON_DST_LINE_END
, ((msg
->y2
+1) << 16) | (msg
->x2
+1));
507 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, DrawRect
)
508 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, DrawRect
))));
510 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, DrawRect
)
512 OOP_Object
*gc
= msg
->gc
;
513 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
516 D(bug("[ATI] DrawRect(%p, %d:%d - %d:%d)\n",
517 bm
->framebuffer
, msg
->minX
, msg
->minY
, msg
->maxX
, msg
->maxY
));
519 if (msg
->minX
== msg
->maxX
) addX
= 1; else addX
= 0;
520 if (msg
->minY
== msg
->maxY
) addY
= 1; else addY
= 0;
524 if ((GC_LINEPAT(gc
) =! (UWORD
)~0) || !bm
->fbgfx
)
526 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
531 sd
->Card
.Busy
= TRUE
;
534 RADEONWaitForFifo(sd
, 1);
535 OUTREG(RADEON_DST_PITCH_OFFSET
, bm
->pitch_offset
);
537 bm
->dp_gui_master_cntl_clip
= (bm
->dp_gui_master_cntl
538 | RADEON_GMC_BRUSH_SOLID_COLOR
539 | RADEON_GMC_SRC_DATATYPE_COLOR
540 | RADEON_ROP
[GC_DRMD(gc
)].pattern
);
542 if (sd
->Card
.Type
>= RV200
) {
543 RADEONWaitForFifo(sd
, 1);
544 OUTREG(RADEON_DST_LINE_PATCOUNT
,
545 0x55 << RADEON_BRES_CNTL_SHIFT
);
550 bm
->dp_gui_master_cntl_clip
|= RADEON_GMC_DST_CLIPPING
;
554 x2
= GC_CLIPX2(gc
) + 1;
555 y2
= GC_CLIPY2(gc
) + 1;
557 RADEONWaitForFifo(sd
, 2);
558 OUTREG(RADEON_SC_TOP_LEFT
, (y1
<< 16) | x1
);
559 OUTREG(RADEON_SC_BOTTOM_RIGHT
, (y2
<< 16) | x2
);
562 RADEONWaitForFifo(sd
, 3);
564 OUTREG(RADEON_DP_GUI_MASTER_CNTL
, bm
->dp_gui_master_cntl_clip
);
565 OUTREG(RADEON_DP_BRUSH_FRGD_CLR
, GC_FG(gc
));
566 OUTREG(RADEON_DP_WRITE_MASK
, ~0);
568 RADEONWaitForFifo(sd
, 8);
570 OUTREG(RADEON_DST_LINE_START
, (msg
->minY
<< 16) | (msg
->minX
& 0xffff));
571 OUTREG(RADEON_DST_LINE_END
, (msg
->minY
<< 16) | (msg
->maxX
& 0xffff));
573 OUTREG(RADEON_DST_LINE_START
, ((msg
->minY
+ addY
) << 16) | (msg
->maxX
& 0xffff));
574 OUTREG(RADEON_DST_LINE_END
, ((msg
->maxY
<< 16)) | (msg
->maxX
& 0xffff));
576 OUTREG(RADEON_DST_LINE_START
, ((msg
->maxY
<< 16)) | ((msg
->maxX
- addX
) & 0xffff));
577 OUTREG(RADEON_DST_LINE_END
, ((msg
->maxY
<< 16)) | ((msg
->minX
) & 0xffff));
579 OUTREG(RADEON_DST_LINE_START
, ((msg
->maxY
- addY
) << 16) | (msg
->minX
& 0xffff));
580 OUTREG(RADEON_DST_LINE_END
, ((msg
->minY
+ addY
) << 16) | (msg
->minX
& 0xffff));
589 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, DrawPolygon
)
590 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, DrawPolygon
))));
592 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, DrawPolygon
)
594 OOP_Object
*gc
= msg
->gc
;
595 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
598 D(bug("[ATI] DrawPolygon(%p)\n",
603 if ((GC_LINEPAT(gc
) =! (UWORD
)~0) || !bm
->fbgfx
)
605 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
610 sd
->Card
.Busy
= TRUE
;
613 RADEONWaitForFifo(sd
, 1);
614 OUTREG(RADEON_DST_PITCH_OFFSET
, bm
->pitch_offset
);
616 bm
->dp_gui_master_cntl_clip
= (bm
->dp_gui_master_cntl
617 | RADEON_GMC_BRUSH_SOLID_COLOR
618 | RADEON_GMC_SRC_DATATYPE_COLOR
619 | RADEON_ROP
[GC_DRMD(gc
)].pattern
);
621 if (sd
->Card
.Type
>= RV200
) {
622 RADEONWaitForFifo(sd
, 1);
623 OUTREG(RADEON_DST_LINE_PATCOUNT
,
624 0x55 << RADEON_BRES_CNTL_SHIFT
);
629 bm
->dp_gui_master_cntl_clip
|= RADEON_GMC_DST_CLIPPING
;
633 x2
= GC_CLIPX2(gc
) + 1;
634 y2
= GC_CLIPY2(gc
) + 1;
636 RADEONWaitForFifo(sd
, 2);
637 OUTREG(RADEON_SC_TOP_LEFT
, (y1
<< 16) | x1
);
638 OUTREG(RADEON_SC_BOTTOM_RIGHT
, (y2
<< 16) | x2
);
641 RADEONWaitForFifo(sd
, 3);
643 OUTREG(RADEON_DP_GUI_MASTER_CNTL
, bm
->dp_gui_master_cntl_clip
);
644 OUTREG(RADEON_DP_BRUSH_FRGD_CLR
, GC_FG(gc
));
645 OUTREG(RADEON_DP_WRITE_MASK
, ~0);
647 for (i
= 2; i
< (2 * msg
->n
); i
+=2)
649 RADEONWaitForFifo(sd
, 2);
650 OUTREG(RADEON_DST_LINE_START
, (msg
->coords
[i
-1] << 16) | msg
->coords
[i
-2]);
651 OUTREG(RADEON_DST_LINE_END
, (msg
->coords
[i
+1] << 16) | msg
->coords
[i
]);
662 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, PutPixel
)
663 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, PutPixel
))));
665 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, PutPixel
)
667 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
671 UBYTE
*ptr
= (UBYTE
*)((IPTR
)bm
->framebuffer
+ bm
->bpp
* msg
->x
+ bm
->pitch
* msg
->y
);
675 ptr
+= (IPTR
)sd
->Card
.FrameBuffer
;
679 #warning TODO: NVSync(sd)
680 RADEONWaitForIdleMMIO(sd
);
691 *(UWORD
*)ptr
= msg
->pixel
;
694 *(ULONG
*)ptr
= msg
->pixel
;
702 HIDDT_Pixel
METHOD(ATIOffBM
, Hidd_BitMap
, GetPixel
)
703 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, GetPixel
))));
705 HIDDT_Pixel
METHOD(ATIOnBM
, Hidd_BitMap
, GetPixel
)
708 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
712 UBYTE
*ptr
= (UBYTE
*)((IPTR
)bm
->framebuffer
+ bm
->bpp
* msg
->x
+ bm
->pitch
* msg
->y
);
716 ptr
+= (IPTR
)sd
->Card
.FrameBuffer
;
720 #warning TODO: NVSync(sd)
721 RADEONWaitForIdleMMIO(sd
);
732 pixel
= *(UWORD
*)ptr
;
735 pixel
= *(ULONG
*)ptr
;
741 /* Get pen number from colortab */
746 ULONG
METHOD(ATIOffBM
, Hidd_BitMap
, BytesPerLine
)
747 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, BytesPerLine
))));
749 ULONG
METHOD(ATIOnBM
, Hidd_BitMap
, BytesPerLine
)
751 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
753 return (bm
->bpp
* msg
->width
+ 255) & ~255;
757 BOOL
METHOD(ATIOffBM
, Hidd_BitMap
, ObtainDirectAccess
)
758 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, ObtainDirectAccess
))));
760 BOOL
METHOD(ATIOnBM
, Hidd_BitMap
, ObtainDirectAccess
)
762 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
765 IPTR VideoData
= bm
->framebuffer
;
769 VideoData
+= (IPTR
)sd
->Card
.FrameBuffer
;
773 #warning TODO: NVSync(sd)
774 RADEONWaitForIdleMMIO(sd
);
779 *msg
->addressReturn
= (UBYTE
*)VideoData
;
780 *msg
->widthReturn
= bm
->pitch
/ bm
->bpp
;
781 *msg
->heightReturn
= bm
->height
;
782 *msg
->bankSizeReturn
= *msg
->memSizeReturn
= bm
->pitch
* bm
->height
;
787 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, ReleaseDirectAccess
)
788 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, ReleaseDirectAccess
))));
790 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, ReleaseDirectAccess
)
792 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
799 * Unaccelerated methods
802 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, PutImageLUT
)
803 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, PutImageLUT
))));
805 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, PutImageLUT
)
807 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
811 IPTR VideoData
= bm
->framebuffer
;
815 VideoData
+= (IPTR
)sd
->Card
.FrameBuffer
;
820 #warning TODO: NVSync(sd)
821 RADEONWaitForIdleMMIO(sd
);
830 struct pHidd_BitMap_CopyLUTMemBox16 __m
= {
831 sd
->mid_CopyLUTMemBox16
,
845 OOP_DoMethod(o
, (OOP_Msg
)m
);
851 struct pHidd_BitMap_CopyLUTMemBox32 __m
= {
852 sd
->mid_CopyLUTMemBox32
,
866 OOP_DoMethod(o
, (OOP_Msg
)m
);
871 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
874 } /* switch(data->bytesperpix) */
880 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, PutImage
)
881 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, PutImage
))));
883 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, PutImage
)
885 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
889 IPTR VideoData
= bm
->framebuffer
;
893 VideoData
+= (IPTR
)sd
->Card
.FrameBuffer
;
898 #warning TODO: NVSync(sd)
899 RADEONWaitForIdleMMIO(sd
);
906 case vHidd_StdPixFmt_Native
:
911 struct pHidd_BitMap_CopyMemBox8 __m
= {
925 OOP_DoMethod(o
, (OOP_Msg
)m
);
931 struct pHidd_BitMap_CopyMemBox16 __m
= {
932 sd
->mid_CopyMemBox16
,
945 OOP_DoMethod(o
, (OOP_Msg
)m
);
951 struct pHidd_BitMap_CopyMemBox32 __m
= {
952 sd
->mid_CopyMemBox32
,
965 OOP_DoMethod(o
, (OOP_Msg
)m
);
969 } /* switch(data->bytesperpix) */
972 case vHidd_StdPixFmt_Native32
:
977 struct pHidd_BitMap_PutMem32Image8 __m
= {
978 sd
->mid_PutMem32Image8
,
988 OOP_DoMethod(o
, (OOP_Msg
)m
);
994 struct pHidd_BitMap_PutMem32Image16 __m
= {
995 sd
->mid_PutMem32Image16
,
1005 OOP_DoMethod(o
, (OOP_Msg
)m
);
1011 struct pHidd_BitMap_CopyMemBox32 __m
= {
1012 sd
->mid_CopyMemBox32
,
1025 OOP_DoMethod(o
, (OOP_Msg
)m
);
1029 } /* switch(data->bytesperpix) */
1033 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
1035 } /* switch(msg->pixFmt) */
1040 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, GetImage
)
1041 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, GetImage
))));
1043 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, GetImage
)
1045 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
1049 IPTR VideoData
= bm
->framebuffer
;
1053 VideoData
+= (IPTR
)sd
->Card
.FrameBuffer
;
1057 #warning TODO: NVSync(sd)
1058 RADEONWaitForIdleMMIO(sd
);
1065 case vHidd_StdPixFmt_Native
:
1070 struct pHidd_BitMap_CopyMemBox8 __m
= {
1071 sd
->mid_CopyMemBox8
,
1084 OOP_DoMethod(o
, (OOP_Msg
)m
);
1090 struct pHidd_BitMap_CopyMemBox16 __m
= {
1091 sd
->mid_CopyMemBox16
,
1104 OOP_DoMethod(o
, (OOP_Msg
)m
);
1110 struct pHidd_BitMap_CopyMemBox32 __m
= {
1111 sd
->mid_CopyMemBox32
,
1124 OOP_DoMethod(o
, (OOP_Msg
)m
);
1128 } /* switch(data->bytesperpix) */
1131 case vHidd_StdPixFmt_Native32
:
1136 struct pHidd_BitMap_GetMem32Image8 __m
= {
1137 sd
->mid_GetMem32Image8
,
1148 OOP_DoMethod(o
, (OOP_Msg
)m
);
1154 struct pHidd_BitMap_GetMem32Image16 __m
= {
1155 sd
->mid_GetMem32Image16
,
1166 OOP_DoMethod(o
, (OOP_Msg
)m
);
1172 struct pHidd_BitMap_CopyMemBox32 __m
= {
1173 sd
->mid_CopyMemBox32
,
1186 OOP_DoMethod(o
, (OOP_Msg
)m
);
1190 } /* switch(data->bytesperpix) */
1194 OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
1197 } /* switch(msg->pixFmt) */
1203 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, PutTemplate
)
1204 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, PutTemplate
))));
1206 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, PutTemplate
)
1208 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
1212 IPTR VideoData
= bm
->framebuffer
;
1216 VideoData
+= (IPTR
)sd
->Card
.FrameBuffer
;
1220 #warning TODO: NVSync(sd)
1221 RADEONWaitForIdleMMIO(sd
);
1231 struct pHidd_BitMap_PutMemTemplate8 __m
= {
1232 sd
->mid_PutMemTemplate8
,
1246 OOP_DoMethod(o
, (OOP_Msg
)m
);
1252 struct pHidd_BitMap_PutMemTemplate16 __m
= {
1253 sd
->mid_PutMemTemplate16
,
1267 OOP_DoMethod(o
, (OOP_Msg
)m
);
1273 struct pHidd_BitMap_PutMemTemplate32 __m
= {
1274 sd
->mid_PutMemTemplate32
,
1288 OOP_DoMethod(o
, (OOP_Msg
)m
);
1291 } /* switch(bm->bpp) */
1296 VOID
METHOD(ATIOffBM
, Hidd_BitMap
, PutPattern
)
1297 __attribute__((alias(METHOD_NAME_S(ATIOnBM
, Hidd_BitMap
, PutPattern
))));
1299 VOID
METHOD(ATIOnBM
, Hidd_BitMap
, PutPattern
)
1301 atiBitMap
*bm
= OOP_INST_DATA(cl
, o
);
1305 IPTR VideoData
= bm
->framebuffer
;
1309 VideoData
+= (IPTR
)sd
->Card
.FrameBuffer
;
1313 #warning TODO: NVSync(sd)
1314 RADEONWaitForIdleMMIO(sd
);
1324 struct pHidd_BitMap_PutMemPattern8 __m
= {
1325 sd
->mid_PutMemPattern8
,
1345 OOP_DoMethod(o
, (OOP_Msg
)m
);
1351 struct pHidd_BitMap_PutMemPattern16 __m
= {
1352 sd
->mid_PutMemPattern16
,
1372 OOP_DoMethod(o
, (OOP_Msg
)m
);
1378 struct pHidd_BitMap_PutMemPattern32 __m
= {
1379 sd
->mid_PutMemPattern32
,
1399 OOP_DoMethod(o
, (OOP_Msg
)m
);
1402 } /* switch(bm->bpp) */