From 58fa391ee438a2b62d2aac543545b9ed21dd70d0 Mon Sep 17 00:00:00 2001
From: Rudolf Cornelissen
Date: Tue, 6 Jul 2004 10:58:25 +0000
Subject: [PATCH] completed unhide_fw and pgm_panel option stuff
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8333 a95241bf-73f2-0310-859d-f6bbb57e9c96
---
.../private/graphics/nvidia/DriverInterface.h | 2 +-
.../accelerants/nvidia/InitAccelerant.c | 2 +-
src/add-ons/accelerants/nvidia/engine/nv_agp.c | 18 +++++++++++++++++-
src/add-ons/accelerants/nvidia/engine/nv_dac.c | 16 +++++++++++++---
.../accelerants/nvidia/engine/nv_dac2.c | 16 +++++++++++++---
.../accelerants/nvidia/engine/nv_general.c | 7 +++++--
.../accelerants/nvidia/engine/nv_info.c | 10 ++++------
.../kernel/drivers/graphics/nvidia/UPDATE.html | 10 +++++++---
.../kernel/drivers/graphics/nvidia/driver.c | 4 ++--
.../kernel/drivers/graphics/nvidia/nv.settings | 10 +++++-----
10 files changed, 68 insertions(+), 27 deletions(-)
diff --git a/headers/private/graphics/nvidia/DriverInterface.h b/headers/private/graphics/nvidia/DriverInterface.h
index cca4621844..98e97d8ef8 100644
--- a/headers/private/graphics/nvidia/DriverInterface.h
+++ b/headers/private/graphics/nvidia/DriverInterface.h
@@ -81,7 +81,6 @@ typedef struct settings { // apsed, see comments in nv.settings
// for driver
char accelerant[B_FILE_NAME_LENGTH];
bool dumprom;
- bool unhide_fw;
// for accelerant
uint32 logmask;
uint32 memory;
@@ -89,6 +88,7 @@ typedef struct settings { // apsed, see comments in nv.settings
bool hardcursor;
bool switchhead;
bool force_pci;
+ bool unhide_fw;
bool pgm_panel;
} settings;
diff --git a/src/add-ons/accelerants/nvidia/InitAccelerant.c b/src/add-ons/accelerants/nvidia/InitAccelerant.c
index 18451cb4cf..059c64b749 100644
--- a/src/add-ons/accelerants/nvidia/InitAccelerant.c
+++ b/src/add-ons/accelerants/nvidia/InitAccelerant.c
@@ -4,7 +4,7 @@
Other authors:
Mark Watson,
- Rudolf Cornelissen 10/2002-6/2004.
+ Rudolf Cornelissen 10/2002-7/2004.
*/
#define MODULE_BIT 0x00800000
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_agp.c b/src/add-ons/accelerants/nvidia/engine/nv_agp.c
index f6b730e0da..c27e4950b9 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_agp.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_agp.c
@@ -2,7 +2,7 @@
Rudolf Cornelissen 6/2004-7/2004
Note:
- This stuff will probably be relocated to the AGP busmanager module later on,
+ Most of this stuff will probably be relocated to the AGP busmanager module later on,
but for now we have something to test with...
*/
@@ -40,6 +40,22 @@ status_t nv_agp_setup(void)
((ai_card.config.agp_cap_id & AGP_rev_major) >> AGP_rev_major_shift),
((ai_card.config.agp_cap_id & AGP_rev_minor) >> AGP_rev_minor_shift)));
+ /* try to enable FW support if user requested this ('unsupported' tweak!) */
+ if (si->settings.unhide_fw)
+ {
+ uint32 reg;
+
+ LOG(4, ("AGP: STRAPINFO2 contains $%08x\n", NV_REG32(NV32_NVSTRAPINFO2)));
+
+ LOG(4, ("AGP: attempting to enable fastwrite support..\n"));
+ /* 'force' FW support */
+ reg = (NV_REG32(NV32_NVSTRAPINFO2) & ~0x00000800);
+ /* enable strapinfo overwrite */
+ NV_REG32(NV32_NVSTRAPINFO2) = (reg | 0x80000000);
+
+ LOG(4, ("AGP: STRAPINFO2 now contains $%08x\n", NV_REG32(NV32_NVSTRAPINFO2)));
+ }
+
nv_agp_list_caps(ai_card);
/* check for motherboard AGP host bridge */
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_dac.c b/src/add-ons/accelerants/nvidia/engine/nv_dac.c
index 27dea89740..8af9409bc3 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_dac.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_dac.c
@@ -143,13 +143,23 @@ status_t nv_dac_set_pix_pll(display_mode target)
float pix_setting, req_pclk;
status_t result;
- /* fix a DVI or laptop flatpanel to 61Hz refresh!
- * (we can't risk getting below 60.0Hz as some panels shut-off then!) */
+ /* we offer this option because some panels have very tight restrictions,
+ * and there's no overlapping settings range that makes them all work.
+ * note:
+ * this assumes the cards BIOS correctly programmed the panel (is likely) */
+ //fixme: when VESA DDC EDID stuff is implemented, this option can be deleted...
+ if (si->ps.tmds1_active && !si->settings.pgm_panel)
+ {
+ LOG(4,("DAC: Not programming DFP refresh (specified in nv.settings)\n"));
+ return B_OK;
+ }
+
+ /* fix a DVI or laptop flatpanel to 60Hz refresh! */
/* Note:
* The pixelclock drives the flatpanel modeline, not the CRTC modeline. */
if (si->ps.tmds1_active)
{
- LOG(4,("DAC: Fixing DFP refresh to 61Hz!\n"));
+ LOG(4,("DAC: Fixing DFP refresh to 60Hz!\n"));
/* use the panel's modeline to determine the needed pixelclock */
target.timing.pixel_clock = si->ps.p1_timing.pixel_clock;
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_dac2.c b/src/add-ons/accelerants/nvidia/engine/nv_dac2.c
index ef4d756347..07d7f421bf 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_dac2.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_dac2.c
@@ -149,13 +149,23 @@ status_t nv_dac2_set_pix_pll(display_mode target)
float pix_setting, req_pclk;
status_t result;
- /* fix a DVI or laptop flatpanel to 61Hz refresh!
- * (we can't risk getting below 60.0Hz as some panels shut-off then!) */
+ /* we offer this option because some panels have very tight restrictions,
+ * and there's no overlapping settings range that makes them all work.
+ * note:
+ * this assumes the cards BIOS correctly programmed the panel (is likely) */
+ //fixme: when VESA DDC EDID stuff is implemented, this option can be deleted...
+ if (si->ps.tmds2_active && !si->settings.pgm_panel)
+ {
+ LOG(4,("DAC2: Not programming DFP refresh (specified in nv.settings)\n"));
+ return B_OK;
+ }
+
+ /* fix a DVI or laptop flatpanel to 60Hz refresh! */
/* Note:
* The pixelclock drives the flatpanel modeline, not the CRTC modeline. */
if (si->ps.tmds2_active)
{
- LOG(4,("DAC2: Fixing DFP refresh to 61Hz!\n"));
+ LOG(4,("DAC2: Fixing DFP refresh to 60Hz!\n"));
/* use the panel's modeline to determine the needed pixelclock */
target.timing.pixel_clock = si->ps.p2_timing.pixel_clock;
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c
index e7f4fe5c6b..05dc08b2d8 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.18 running.\n"));
+ LOG(1,("POWERUP: nVidia (open)BeOS Accelerant 0.19 running.\n"));
/* preset no laptop */
si->ps.laptop = false;
@@ -1129,7 +1129,10 @@ static status_t nv_general_bios_to_powergraphics()
* (NOTE: testsignal function block resides in DAC1 only (!)) */
if (si->ps.secondary_head) DAC2W(TSTCTRL, (DAC2R(TSTCTRL) & 0xfffeefff));
- /* setup AGP */
+ /* setup AGP:
+ * Note:
+ * This may only be done when no transfers are in progress on the bus, so now
+ * is probably a good time.. */
nv_agp_setup();
/* turn screen one on */
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c
index 65526ae64d..dc1ef12bfc 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_info.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c
@@ -482,10 +482,9 @@ static void detect_panels()
if (DACR(FP_TG_CTRL) & 0x00000001) si->ps.p1_timing.flags |= B_POSITIVE_VSYNC;
if (DACR(FP_TG_CTRL) & 0x00000010) si->ps.p1_timing.flags |= B_POSITIVE_HSYNC;
/* refreshrate:
- * fix a DVI or laptop flatpanel to 61Hz refresh!
- * (we can't risk getting below 60.0Hz as some panels shut-off then!) */
+ * fix a DVI or laptop flatpanel to 60Hz refresh! */
si->ps.p1_timing.pixel_clock =
- (si->ps.p1_timing.h_total * si->ps.p1_timing.v_total * 61) / 1000;
+ (si->ps.p1_timing.h_total * si->ps.p1_timing.v_total * 60) / 1000;
}
if (si->ps.tmds2_active)
{
@@ -505,10 +504,9 @@ static void detect_panels()
if (DAC2R(FP_TG_CTRL) & 0x00000001) si->ps.p2_timing.flags |= B_POSITIVE_VSYNC;
if (DAC2R(FP_TG_CTRL) & 0x00000010) si->ps.p2_timing.flags |= B_POSITIVE_HSYNC;
/* refreshrate:
- * fix a DVI or laptop flatpanel to 61Hz refresh!
- * (we can't risk getting below 60.0Hz as some panels shut-off then!) */
+ * fix a DVI or laptop flatpanel to 60Hz refresh! */
si->ps.p2_timing.pixel_clock =
- (si->ps.p2_timing.h_total * si->ps.p2_timing.v_total * 61) / 1000;
+ (si->ps.p2_timing.h_total * si->ps.p2_timing.v_total * 60) / 1000;
}
/* dump some panel configuration registers... */
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
index 4561f3bbb9..160344dbe1 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.18), (Rudolf)
+head (0.19), (Rudolf)
- Added AGP mode capability on AGP cards along with the option to block it in nv.settings. No GART and AGP aperture support; but if your card and system AGP host bridge support the 'fastwrite' (FW) feature, you'll notice a nice speedup of unaccelerated graphics.
@@ -12,7 +12,7 @@
- Also tested video playback using bitmap output mode: CPU load drops considerably depending on desktop colordepth and resolution of the video played back.
- 2D acceleration will not speedup because it's working 'local', so within the graphics cards engine and it's RAM only.
-Note please :
+Note please:
- You need the new AGP kernel driver I setup for this feature, without it you will remain using PCI mode as usual.
- This AGP stuff BTW will be re-setup later on (as a module) to be graphics driver-independant so all AGP cards, even AGP cards running in VESA mode, can profit from it.
@@ -21,7 +21,11 @@
- Updated CRTC modeline tuning for panels: this should fix the 'right-shifted' picture on some panels in their native modes;
- Fixed BIOS ROM dump (to file) option;
- Fixed GET_TIMING_CONSTRAINTS and GET_ACCELERANT_DEVICE_INFO accelerant hooks to return valid data; updated modeline checking and modification code (used by ProposeDisplayMode) to adhere to one more timing constraint
-
- Lowered fixed refreshrate setting for panels to be 61Hz now: it turns out panels exist that are picky 'on the high side' as well.
+
- Lowered fixed refreshrate setting for panels to be 60Hz now: it turns out panels exist that are picky 'on the high side' as well;
+
- Added option in nv.settings to block refreshrate programming if a flatpanel is active: this should enable support on picky panels;
+
- Added option in nv.settings to 'unhide' fastwrite support in AGP cards. Some older cards support FW even though normally they don't show it so it won't get activated (confirmed GeForce2 MX400, NV11).
+ NOTE please:
+ This is a tweak that you can enable, but you do so at your own risk (of course)!
nv_driver 0.10, (Rudolf)
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c
index dca1f52f87..c4b2e151ea 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c
@@ -258,7 +258,6 @@ static settings current_settings = { // see comments in nv.settings
// for driver
DRIVER_PREFIX ".accelerant",
false, // dumprom
- false, // unhide_fw
// for accelerant
0x00000000, // logmask
0, // memory
@@ -266,6 +265,7 @@ static settings current_settings = { // see comments in nv.settings
false, // hardcursor
false, // switchhead
false, // force_pci
+ false, // unhide_fw
true, // pgm_panel
};
@@ -379,7 +379,6 @@ init_driver(void) {
strcpy (current_settings.accelerant, item);
}
current_settings.dumprom = get_driver_boolean_parameter (settings_handle, "dumprom", false, false);
- current_settings.unhide_fw = get_driver_boolean_parameter (settings_handle, "unhide_fw", false, false);
// for accelerant
item = get_driver_parameter (settings_handle, "logmask", "0x00000000", "0x00000000");
@@ -394,6 +393,7 @@ init_driver(void) {
current_settings.usebios = get_driver_boolean_parameter (settings_handle, "usebios", false, false);
current_settings.switchhead = get_driver_boolean_parameter (settings_handle, "switchhead", false, false);
current_settings.force_pci = get_driver_boolean_parameter (settings_handle, "force_pci", false, false);
+ current_settings.unhide_fw = get_driver_boolean_parameter (settings_handle, "unhide_fw", false, false);
current_settings.pgm_panel = get_driver_boolean_parameter (settings_handle, "pgm_panel", false, false);
unload_driver_settings (settings_handle);
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/nv.settings b/src/add-ons/kernel/drivers/graphics/nvidia/nv.settings
index ac8fe10550..23b9a17af9 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/nv.settings
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/nv.settings
@@ -8,25 +8,25 @@
# accelerant "nv.accelerant"
# nv.accelerant parameters
-usebios false # if true rely on bios to coldstart the card: not working yet, so always true
+usebios false # if true rely on bios to coldstart the card: not working, so always true
#memory 2 # in MB, override builtin memory size detection
hardcursor true # if true use on-chip cursor capabilities
-#logmask 0x00000000 # nothing logged, is default
-#logmask 0x08000604 # log overlay use in full
+#logmask 0x00000000 # nothing logged, is default
+#logmask 0x08000604 # log overlay use in full
#logmask 0xffffffff # log everything
dumprom false # dump bios rom in ~/nv.rom
switchhead false # switch head assignment (dualhead cards only)
force_pci false # block AGP mode use if true (AGP cards only)
# WARNING: tweak alert! modify stuff below on your own risk...
-unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide, it
+unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide it
pgm_panel true # if false don't program DVI and laptop panel pixelclocks (refreshrates)
#--------- that's all.
#logmask setup info:
#log level select:
-#logmask 0x0000000x # lowest digit: bitmask to select logging level.
+#logmask 0x0000000x # lowest digit: bitmask to select logging level.
#log modules select:
#logmask 0xxxxxxxx0 # highest 7 digits: bitmask to select individual modules to log.