From 3f17567e639293e5a03e4a2ec26f86abad31a9c9 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Wed, 9 Feb 2005 18:08:03 +0000 Subject: [PATCH] reverting to software retrace-sync for cursor position updates on pre-GeForce cards: it turns out there's no hardware sync here after all. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11299 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/engine/nv_crtc.c | 44 ++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) 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)));