diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c index 36db20cf21..2b820e03ac 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c @@ -1,6 +1,6 @@ /* CTRC functionality */ /* Author: - Rudolf Cornelissen 11/2002-1/2005 + Rudolf Cornelissen 11/2002-2/2005 */ #define MODULE_BIT 0x00040000 @@ -701,9 +701,8 @@ status_t nv_crtc_cursor_init() /* select 32x32 pixel, 16bit color cursorbitmap, no doublescan */ NV_REG32(NV32_CURCONF) = 0x02000100; - /* activate hardware-sync between cursor updates and vertical retrace */ - /* note: - * on pre-NV10 cards hardware sync is hardwired ON */ + /* activate hardware-sync between cursor updates and vertical retrace where + * available */ if (si->ps.card_arch >= NV10A) DACW(NV10_CURSYNC, (DACR(NV10_CURSYNC) | 0x02000000)); @@ -806,7 +805,42 @@ status_t nv_crtc_cursor_define(uint8* andMask,uint8* xorMask) /* position the cursor */ status_t nv_crtc_cursor_position(uint16 x, uint16 y) { - /* the cursor position is updated during retrace by card hardware */ + /* the cursor position is updated during retrace by card hardware except for + * pre-GeForce cards */ + if (si->ps.card_arch < NV10A) + { + uint16 yhigh; + + /* make sure we are beyond the first line of the cursorbitmap being drawn during + * updating the position to prevent distortions: no double buffering feature */ + /* Note: + * we need to return as quick as possible or some apps will exhibit lagging.. */ + + /* read the old cursor Y position */ + yhigh = ((DACR(CURPOS) & 0x0fff0000) >> 16); + /* make sure we will wait until we are below both the old and new Y position: + * visible cursorbitmap drawing needs to be done at least... */ + if (y > yhigh) yhigh = y; + + if (yhigh < (si->dm.timing.v_display - 16)) + { + /* we have vertical lines below old and new cursorposition to spare. So we + * update the cursor postion 'mid-screen', but below that area. */ + while (((uint16)(NV_REG32(NV32_RASTER) & 0x000007ff)) < (yhigh + 16)) + { + snooze(10); + } + } + else + { + /* no room to spare, just wait for retrace (is relatively slow) */ + while ((NV_REG32(NV32_RASTER) & 0x000007ff) < si->dm.timing.v_display) + { + /* don't snooze much longer or retrace might get missed! */ + snooze(10); + } + } + } /* update cursorposition */ DACW(CURPOS, ((x & 0x0fff) | ((y & 0x0fff) << 16)));