From e0dd08e80ca4fcf1bae8ba3fc0d3fc1b5b900e5f Mon Sep 17 00:00:00 2001
From: Rudolf Cornelissen
Date: Mon, 26 Jan 2004 20:20:18 +0000
Subject: [PATCH] fixed move_display distortions (both heads)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6333 a95241bf-73f2-0310-859d-f6bbb57e9c96
---
src/add-ons/accelerants/nvidia/engine/nv_crtc.c | 14 +++++++++++---
src/add-ons/accelerants/nvidia/engine/nv_crtc2.c | 15 +++++++++++----
.../accelerants/nvidia/engine/nv_general.c | 2 +-
.../kernel/drivers/graphics/nvidia/UPDATE.html | 5 +++--
4 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c
index 569d614ff4..810d8dbdd9 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_crtc.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc.c
@@ -383,6 +383,7 @@ status_t nv_crtc_set_display_pitch()
status_t nv_crtc_set_display_start(uint32 startadd,uint8 bpp)
{
uint8 temp;
+ uint32 timeout = 0;
LOG(4,("CRTC: setting card RAM to be displayed bpp %d\n", bpp));
@@ -390,7 +391,15 @@ status_t nv_crtc_set_display_start(uint32 startadd,uint8 bpp)
LOG(2,("CRTC: frameRAM: $%08x\n", si->framebuffer));
LOG(2,("CRTC: framebuffer: $%08x\n", si->fbc.frame_buffer));
- /* retrace sync not needed here: doublebuffering in hardware */
+ /* we might have no retraces during setmode! */
+ /* wait 25mS max. for retrace to occur (refresh > 40Hz) */
+ while (((NV_REG32(NV32_RASTER) & 0x000007ff) < si->dm.timing.v_display) &&
+ (timeout < (25000/10)))
+ {
+ /* don't snooze much longer or retrace might get missed! */
+ snooze(10);
+ timeout++;
+ }
/* enable access to CRTC1 on dualhead cards */
if (si->ps.secondary_head) CRTCW(OWNER, 0x00);
@@ -424,8 +433,7 @@ status_t nv_crtc_set_display_start(uint32 startadd,uint8 bpp)
}
/* set NV4/NV10 byte adress: (b0 - 1) */
- temp = (ATBR(HORPIXPAN) & 0xf9);
- ATBW(HORPIXPAN, (temp | ((startadd & 0x00000003) << 1)));
+ ATBW(HORPIXPAN, ((startadd & 0x00000003) << 1));
return B_OK;
}
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c
index e5c882461a..759be2c678 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_crtc2.c
@@ -364,7 +364,7 @@ status_t nv_crtc2_set_display_pitch()
status_t nv_crtc2_set_display_start(uint32 startadd,uint8 bpp)
{
- uint8 temp;
+ uint32 timeout = 0;
LOG(4,("CRTC2: setting card RAM to be displayed bpp %d\n", bpp));
@@ -372,7 +372,15 @@ status_t nv_crtc2_set_display_start(uint32 startadd,uint8 bpp)
LOG(2,("CRTC2: frameRAM: $%08x\n", si->framebuffer));
LOG(2,("CRTC2: framebuffer: $%08x\n", si->fbc.frame_buffer));
- /* retrace sync not needed here: doublebuffering in hardware */
+ /* we might have no retraces during setmode! */
+ /* wait 25mS max. for retrace to occur (refresh > 40Hz) */
+ while (((NV_REG32(NV32_RASTER2) & 0x000007ff) < si->dm.timing.v_display) &&
+ (timeout < (25000/10)))
+ {
+ /* don't snooze much longer or retrace might get missed! */
+ snooze(10);
+ timeout++;
+ }
/* enable access to CRTC2 */
CRTC2W(OWNER, 0x03);
@@ -386,8 +394,7 @@ status_t nv_crtc2_set_display_start(uint32 startadd,uint8 bpp)
NV_REG32(NV32_NV10FB2STADD32) = (startadd & 0xfffffffc);
/* set byte adress: (b0 - 1) */
- temp = (ATB2R(HORPIXPAN) & 0xf9);
- ATB2W(HORPIXPAN, (temp | ((startadd & 0x00000003) << 1)));
+ ATB2W(HORPIXPAN, ((startadd & 0x00000003) << 1));
return B_OK;
}
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c
index d7afa3bd6e..72058d2407 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_general.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c
@@ -80,7 +80,7 @@ status_t nv_general_powerup()
{
status_t status;
- LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.08-7 running.\n"));
+ LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.08-8 running.\n"));
/* preset no laptop */
si->ps.laptop = false;
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
index cc55b0b9bf..0bd50116ea 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
@@ -4,7 +4,7 @@
Changes done for each driverversion:
-head (0.08-7, Rudolf)
+head (0.08-8, Rudolf)
- Fixed GeForceFX 5600 and FX 5700 monitor 'refresh out of range' / shutoff fault. nVidia changed the pixelPLL for the NV31 and NV36;
- Fixed acceleration engine restrictions code to adhere to GeForceFX 5600 restrictions: those are still NV20 style for this card;
@@ -18,7 +18,8 @@
- Improved startup code: this should (could) fix random trouble on some cards like for instance hardcursor trouble on especially laptops;
- Added dualhead support (use Mark Watson's 'G400 Dualhead Setup' from BeBits for now): Note that dualhead switch mode still has to be setup, and overlay is fixed to the primary head for now;
- Updated mode granularity and max virtual size checking/limiting to adhere to new CRTC setup for dualhead cards;
-
- Added dualhead support for 8- and 16bit colordepths.
+
- Added dualhead support for 8- and 16bit colordepths;
+
- Fixed move_display distortions in virtualscreens especially visible in 8-bit colordepth (for both heads).
nv_driver 0.07 (Rudolf)