From 6042b7b66583c8c087a564c80af7540cc5fe7fa0 Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Mon, 2 Mar 2009 19:55:03 +0000 Subject: [PATCH] added 'block_acc' option in nvidia.settings to completely disable the acceleration engine. This lets my G72 run (not crash) for the first time when enabled. Note: Haiku becomes very slow in drawing in 32bit mode when the driver is running this way compared to vesa mode. I am assuming this is because of (too) fine-grained calling of the engine management functions. Never saw this effect AFAIK in BeOS. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29381 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../private/graphics/nvidia/DriverInterface.h | 5 ++-- .../accelerants/nvidia/EngineManagment.c | 13 +++++++---- .../accelerants/nvidia/GetAccelerantHook.c | 6 ++--- .../accelerants/nvidia/InitAccelerant.c | 6 ++--- .../accelerants/nvidia/SetDisplayMode.c | 12 ++++++---- .../accelerants/nvidia/engine/nv_general.c | 2 +- .../kernel/drivers/graphics/nvidia/driver.c | 5 +++- .../drivers/graphics/nvidia/nvidia.settings | 23 ++++++++++--------- 8 files changed, 41 insertions(+), 31 deletions(-) diff --git a/headers/private/graphics/nvidia/DriverInterface.h b/headers/private/graphics/nvidia/DriverInterface.h index ae5e789cfe..0009cb0306 100644 --- a/headers/private/graphics/nvidia/DriverInterface.h +++ b/headers/private/graphics/nvidia/DriverInterface.h @@ -5,7 +5,7 @@ Other authors: Mark Watson; Apsed; - Rudolf Cornelissen 10/2002-6/2008. + Rudolf Cornelissen 10/2002-3/2009. */ #ifndef DRIVERINTERFACE_H @@ -205,7 +205,7 @@ typedef struct { uint32 size; } int_buf_info; -typedef struct { // apsed, see comments in nv.settings +typedef struct { // apsed, see comments in nvidia.settings // for driver char accelerant[B_FILE_NAME_LENGTH]; char primary[B_FILE_NAME_LENGTH]; @@ -224,6 +224,7 @@ typedef struct { // apsed, see comments in nv.settings bool vga_on_tv; bool force_sync; bool force_ws; + bool block_acc; uint32 gpu_clk; uint32 ram_clk; } nv_settings; diff --git a/src/add-ons/accelerants/nvidia/EngineManagment.c b/src/add-ons/accelerants/nvidia/EngineManagment.c index f0b78b5dd0..acfa5285f9 100644 --- a/src/add-ons/accelerants/nvidia/EngineManagment.c +++ b/src/add-ons/accelerants/nvidia/EngineManagment.c @@ -4,7 +4,7 @@ other authors: Mark Watson - Rudolf Cornelissen 3/2004-2/2005 + Rudolf Cornelissen 3/2004-3/2009 */ /* @@ -34,8 +34,8 @@ status_t ACQUIRE_ENGINE_PIO(uint32 capabilities, uint32 max_wait, sync_token *st /* sync if required */ if (st) SYNC_TO_TOKEN(st); - /* make sure all needed engine cmd's are mapped to the FIFO */ - nv_acc_assert_fifo(); + /* make sure all needed engine cmd's are mapped to the FIFO if acceleration isn't blocked */ + if (!si->settings.block_acc) nv_acc_assert_fifo(); /* return an engine token */ *et = &nv_engine_token; @@ -49,8 +49,8 @@ status_t ACQUIRE_ENGINE_DMA(uint32 capabilities, uint32 max_wait, sync_token *st /* sync if required */ if (st) SYNC_TO_TOKEN(st); - /* make sure all needed engine cmd's are mapped to the FIFO */ - nv_acc_assert_fifo_dma(); + /* make sure all needed engine cmd's are mapped to the FIFO if acceleration isn't blocked */ + if (!si->settings.block_acc) nv_acc_assert_fifo_dma(); /* return an engine token */ *et = &nv_engine_token; @@ -69,6 +69,9 @@ status_t RELEASE_ENGINE(engine_token *et, sync_token *st) void WAIT_ENGINE_IDLE(void) { + /* do nothing if acceleration is te be blocked */ + if (si->settings.block_acc) return; + /*wait for the engine to be totally idle*/ if (!si->settings.dma_acc) nv_acc_wait_idle(); diff --git a/src/add-ons/accelerants/nvidia/GetAccelerantHook.c b/src/add-ons/accelerants/nvidia/GetAccelerantHook.c index d6d8774c33..02ec80c5cc 100644 --- a/src/add-ons/accelerants/nvidia/GetAccelerantHook.c +++ b/src/add-ons/accelerants/nvidia/GetAccelerantHook.c @@ -4,7 +4,7 @@ Other authors: Mark Watson, - Rudolf Cornelissen 10/2002-1/2006 + Rudolf Cornelissen 10/2002-3/2009 */ #define MODULE_BIT 0x08000000 @@ -227,8 +227,8 @@ status_t check_acc_capability(uint32 feature) } /* hardware acceleration is only supported in modes with upto a certain - * memory pitch.. */ - if (si->acc_mode) + * memory pitch.. and acceleration must not be blocked */ + if (si->acc_mode && !si->settings.block_acc) { LOG(4, ("Acc: Exporting hook %s.\n", msg)); return B_OK; diff --git a/src/add-ons/accelerants/nvidia/InitAccelerant.c b/src/add-ons/accelerants/nvidia/InitAccelerant.c index 712afba4d9..d57f58777f 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-4/2006. + Rudolf Cornelissen 10/2002-3/2009. */ #define MODULE_BIT 0x00800000 @@ -42,8 +42,8 @@ static status_t init_common(int the_fd) { si->settings.logmask, si->settings.memory, si->settings.hardcursor, si->settings.usebios, si->settings.switchhead, si->settings.force_pci)); LOG(4,("init_common: dumprom %d, unhide_fw %d, pgm_panel %d, dma_acc %d, tv_output %d, vga_on_tv %d\n", si->settings.dumprom, si->settings.unhide_fw, si->settings.pgm_panel, si->settings.dma_acc, si->settings.tv_output, si->settings.vga_on_tv)); - LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d\n", - si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws)); + LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d, block_acc %d\n", + si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws, si->settings.block_acc)); /*Check for R4.5.0 and if it is running, use work around*/ { diff --git a/src/add-ons/accelerants/nvidia/SetDisplayMode.c b/src/add-ons/accelerants/nvidia/SetDisplayMode.c index 4309688c2d..0f4e4fab86 100644 --- a/src/add-ons/accelerants/nvidia/SetDisplayMode.c +++ b/src/add-ons/accelerants/nvidia/SetDisplayMode.c @@ -6,7 +6,7 @@ Other authors: Mark Watson, Apsed, - Rudolf Cornelissen 11/2002-6/2008 + Rudolf Cornelissen 11/2002-3/2009 */ #define MODULE_BIT 0x00200000 @@ -292,10 +292,12 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) /* note: * Maybe later we can forget about non-DMA mode (depends on 3D acceleration * attempts). */ - if (!si->settings.dma_acc) - nv_acc_init(); - else - nv_acc_init_dma(); + if (!si->settings.block_acc) { + if (!si->settings.dma_acc) + nv_acc_init(); + else + nv_acc_init_dma(); + } /* set up overlay unit for this mode */ nv_bes_init(); diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index 34b94f457c..3011b90a3d 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_general.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c @@ -92,7 +92,7 @@ status_t nv_general_powerup() { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.85 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.86 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c index cf8f2fe277..924305fade 100644 --- a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c +++ b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c @@ -4,7 +4,7 @@ Other authors: Mark Watson; - Rudolf Cornelissen 3/2002-6/2008. + Rudolf Cornelissen 3/2002-3/2009. */ @@ -383,6 +383,7 @@ static nv_settings sSettings = { // see comments in nvidia.settings false, // vga_on_tv false, // force_sync true, // force_ws + false, // block_acc 0, // gpu_clk 0, // ram_clk }; @@ -1441,6 +1442,8 @@ init_driver(void) "force_sync", false, false); sSettings.force_ws = get_driver_boolean_parameter(settings, "force_ws", false, false); + sSettings.block_acc = get_driver_boolean_parameter(settings, + "block_acc", false, false); item = get_driver_parameter(settings, "gpu_clk", "0", "0"); value = strtoul(item, &end, 0); diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings b/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings index 87e48391b8..8474fd7303 100644 --- a/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings +++ b/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings @@ -4,29 +4,30 @@ # ~/config/settings/kernel/drivers/ # -# nv.driver parameters: +# nvidia driver parameters: #accelerant "nvidia.accelerant" # if enabled selects accelerant filename to be used #primary "10de_0110_010000" # if enabled selects device to be used as primary device ('hack') dumprom false # dump bios rom to file (in home folder) -# nv.accelerant parameters: -usebios true # if true rely on bios to coldstart the card +# nvidia.accelerant parameters: +usebios true # if true rely on bios to coldstart the card #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 to file (in home folder) #logmask 0xffffffff # log everything to file (in home folder) -switchhead false # switch head assignment (dualhead cards only) -force_pci false # block AGP mode use if true (AGP cards only) -dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) +switchhead false # switch head assignment (dualhead cards only) +force_pci false # block AGP mode use if true (AGP cards only) +dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) #tv_output 0 # disabled or 0 = autodetect, 1 = Y/C (and CVBS if possible), 2 = CVBS -force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace -force_ws true # if true forces widescreen type detection for all connected screens +force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace +force_ws true # if true forces widescreen type detection for all connected screens +block_acc false # if true disables the acceleration engine # 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 -pgm_panel false # if false don't program DVI and laptop panel pixelclocks (refreshrates) -vga_on_tv false # if true enables VGA output on the head outputting to TV +unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide it +pgm_panel false # if false don't program DVI and laptop panel pixelclocks (refreshrates) +vga_on_tv false # if true enables VGA output on the head outputting to TV #gpu_clk 150 # in Mhz, (tries to) override default GPU clockspeed (be carefull!!!) #ram_clk 150 # in Mhz, (tries to) override default cardRAM clockspeed (be carefull!!!)