2 Haiku ATI video driver adapted from the X.org ATI driver.
4 Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
5 Precision Insight, Inc., Cedar Park, Texas, and
6 VA Linux Systems Inc., Fremont, California.
8 Copyright 2009 Haiku, Inc. All rights reserved.
9 Distributed under the terms of the MIT license.
16 #include "accelerant.h"
22 Rage128_ShowCursor(bool bShow
)
24 // Turn cursor on/off.
26 OUTREGM(R128_CRTC_GEN_CNTL
, bShow
? R128_CRTC_CUR_EN
: 0, R128_CRTC_CUR_EN
);
31 Rage128_SetCursorPosition(int x
, int y
)
33 SharedInfo
& si
= *gInfo
.sharedInfo
;
35 // xOffset & yOffset are used for displaying partial cursors on screen edges.
41 xOffset
= (( -x
) & 0xFE);
46 yOffset
= (( -y
) & 0xFE);
50 OUTREG(R128_CUR_HORZ_VERT_OFF
, R128_CUR_LOCK
| (xOffset
<< 16) | yOffset
);
51 OUTREG(R128_CUR_HORZ_VERT_POSN
, R128_CUR_LOCK
| (x
<< 16) | y
);
52 OUTREG(R128_CUR_OFFSET
, si
.cursorOffset
+ yOffset
* 16);
57 Rage128_LoadCursorImage(int width
, int height
, uint8
* andMask
, uint8
* xorMask
)
59 SharedInfo
& si
= *gInfo
.sharedInfo
;
61 if (andMask
== NULL
|| xorMask
== NULL
)
64 // Initialize the hardware cursor as completely transparent.
66 uint32
* fbCursor32
= (uint32
*)((addr_t
)si
.videoMemAddr
+ si
.cursorOffset
);
68 for (int i
= 0; i
< CURSOR_BYTES
; i
+= 16) {
69 *fbCursor32
++ = ~0; // and bits
71 *fbCursor32
++ = 0; // xor bits
75 // Now load the AND & XOR masks for the cursor image into the cursor
76 // buffer. Note that a particular bit in these masks will have the
77 // following effect upon the corresponding cursor pixel:
81 // 1 0 Screen color (for transparency)
82 // 1 1 Reverse screen color to black or white
84 uint8
* fbCursor
= (uint8
*)((addr_t
)si
.videoMemAddr
+ si
.cursorOffset
);
86 for (int row
= 0; row
< height
; row
++) {
87 for (int colByte
= 0; colByte
< width
/ 8; colByte
++) {
88 fbCursor
[row
* 16 + colByte
] = *andMask
++;
89 fbCursor
[row
* 16 + colByte
+ 8] = *xorMask
++;
93 // Set the cursor colors which are white background and black foreground.
95 OUTREG(R128_CUR_CLR0
, ~0);
96 OUTREG(R128_CUR_CLR1
, 0);