2 Copyright 2010 Haiku, Inc. All rights reserved.
3 Distributed under the terms of the MIT license.
10 #include "accelerant.h"
18 TDFX_ShowCursor(bool bShow
)
20 // Turn cursor on/off.
22 uint32 config
= INREG32(VIDEO_PROC_CONFIG
);
24 config
|= CURSOR_ENABLE
;
26 config
&= ~CURSOR_ENABLE
;
29 OUTREG32(VIDEO_PROC_CONFIG
, config
);
34 TDFX_SetCursorPosition(int x
, int y
)
37 OUTREG32(HW_CURSOR_LOC
, ((y
+ 63) << 16) | (x
+ 63));
42 TDFX_LoadCursorImage(int width
, int height
, uint8
* andMask
, uint8
* xorMask
)
44 SharedInfo
& si
= *gInfo
.sharedInfo
;
46 if (andMask
== NULL
|| xorMask
== NULL
)
49 uint64
* fbCursor64
= (uint64
*)((addr_t
)si
.videoMemAddr
+ si
.cursorOffset
);
51 // Initialize the hardware cursor as completely transparent.
53 for (int i
= 0; i
< CURSOR_BYTES
; i
+= 16) {
54 *fbCursor64
++ = ~0; // and bits
55 *fbCursor64
++ = 0; // xor bits
58 // Now load the AND & XOR masks for the cursor image into the cursor
59 // buffer. Note that a particular bit in these masks will have the
60 // following effect upon the corresponding cursor pixel:
64 // 1 0 Screen color (for transparency)
65 // 1 1 Reverse screen color to black or white
67 uint8
* fbCursor
= (uint8
*)((addr_t
)si
.videoMemAddr
+ si
.cursorOffset
);
69 for (int row
= 0; row
< height
; row
++) {
70 for (int colByte
= 0; colByte
< width
/ 8; colByte
++) {
71 fbCursor
[row
* 16 + colByte
] = *andMask
++;
72 fbCursor
[row
* 16 + colByte
+ 8] = *xorMask
++;
76 // Set the cursor colors which are white background and black foreground.
79 OUTREG32(HW_CURSOR_COLOR0
, 0xffffff);
80 OUTREG32(HW_CURSOR_COLOR1
, 0);