From 21545d001fe1bfc6c6330c390f4b027061b525ba Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Sun, 19 Jun 2005 15:10:49 +0000 Subject: [PATCH] added/modified shared_info to (better) support upto 32 3D accelants. Needs to be improved/expanded later though. Bumped version to 0.53. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13210 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../accelerants/nvidia/InitAccelerant.c | 10 ++++---- .../accelerants/nvidia/SetDisplayMode.c | 25 +++++++++++-------- .../accelerants/nvidia/engine/nv_acc_dma.c | 16 ++++++------ .../accelerants/nvidia/engine/nv_general.c | 2 +- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/add-ons/accelerants/nvidia/InitAccelerant.c b/src/add-ons/accelerants/nvidia/InitAccelerant.c index 26d8854f54..cec15c92d6 100644 --- a/src/add-ons/accelerants/nvidia/InitAccelerant.c +++ b/src/add-ons/accelerants/nvidia/InitAccelerant.c @@ -163,8 +163,8 @@ status_t INIT_ACCELERANT(int the_fd) { si->engine.last_idle = si->engine.count = 0; /* no 3D clones are currently loaded */ si->engine.threeD.clones = 0; - /* tell all 3D add-ons that they should reload their rendering states */ - si->engine.threeD.reload_state_3D = 0xffffffff; + /* tell 3D add-ons that they should reload their rendering states and surfaces */ + si->engine.threeD.reload = 0xffffffff; INIT_BEN(si->engine.lock); INIT_BEN(si->overlay.lock); @@ -195,9 +195,9 @@ status_t INIT_ACCELERANT(int the_fd) { /* make sure a possible 3D add-on will block rendering and re-initialize itself. * note: update in _this_ order only */ /* SET_DISPLAY_MODE will reset this flag when it's done. */ - si->mode_changing = true; - /* the 3D add-on will reset this flag when it's done. */ - si->mode_changed = true; + si->engine.threeD.mode_changing = true; + /* every 3D add-on will reset this bit-flag when it's done. */ + si->engine.threeD.newmode = 0xffffffff; /* a winner! */ result = B_OK; diff --git a/src/add-ons/accelerants/nvidia/SetDisplayMode.c b/src/add-ons/accelerants/nvidia/SetDisplayMode.c index 1f6c0468e7..8521cc7fbc 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-5/2005 + Rudolf Cornelissen 11/2002-6/2005 */ #define MODULE_BIT 0x00200000 @@ -80,9 +80,12 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) /* make sure a possible 3D add-on will block rendering and re-initialize itself. * note: update in _this_ order only */ /* SET_DISPLAY_MODE will reset this flag when it's done. */ - si->mode_changing = true; - /* the 3D add-on will reset this flag when it's done. */ - si->mode_changed = true; + si->engine.threeD.mode_changing = true; + /* every 3D add-on will reset this bit-flag when it's done. */ + si->engine.threeD.newmode = 0xffffffff; + /* every 3D clone needs to reclaim a slot. + * note: this also cleans up reserved channels for killed 3D clones.. */ + si->engine.threeD.clones = 0x00000000; /* disable interrupts using the kernel driver */ interrupt_enable(false); @@ -332,13 +335,13 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) /* note freemem range */ /* first free adress follows hardcursor and workspace */ - si->mem_low = si->fbc.bytes_per_row * si->dm.virtual_height; - if (si->settings.hardcursor) si->mem_low += 2048; + si->engine.threeD.mem_low = si->fbc.bytes_per_row * si->dm.virtual_height; + if (si->settings.hardcursor) si->engine.threeD.mem_low += 2048; /* last free adress is end-of-ram minus max space needed for overlay bitmaps */ //fixme possible: //if overlay buffers are allocated subtract buffersize from mem_high; //only allocate overlay buffers if 3D is not in use. (block overlay during 3D) - si->mem_high = si->ps.memory_size - 1; + si->engine.threeD.mem_high = si->ps.memory_size - 1; /* don't touch the DMA acceleration engine command buffer if it exists */ /* note: * the buffer is 32kB in size. Keep some extra distance for safety (faulty apps). */ @@ -347,7 +350,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) if (si->ps.card_arch < NV40A) { /* keeping 32kB distance from the DMA buffer */ - si->mem_high -= (64 * 1024); + si->engine.threeD.mem_high -= (64 * 1024); } else { @@ -357,10 +360,10 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) * if you get too close to the DMA command buffer on NV40 and NV43 at * least (both confirmed), the source DMA instance will mess-up for * at least engine cmd NV_IMAGE_BLIT and NV12_IMAGE_BLIT. */ - si->mem_high -= (512 * 1024); + si->engine.threeD.mem_high -= (512 * 1024); } } - si->mem_high -= (MAXBUFFERS * 1024 * 1024 * 2); /* see overlay.c file */ + si->engine.threeD.mem_high -= (MAXBUFFERS * 1024 * 1024 * 2); /* see overlay.c file */ LOG(1,("SETMODE: booted since %f mS\n", system_time()/1000.0)); @@ -368,7 +371,7 @@ status_t SET_DISPLAY_MODE(display_mode *mode_to_set) interrupt_enable(true); /* make sure a possible 3D add-on will re-initialize itself by signalling ready */ - si->mode_changing = false; + si->engine.threeD.mode_changing = false; /* optimize memory-access if needed */ // head1_mem_priority(colour_depth1); diff --git a/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c b/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c index f11e395cde..5bcbe14ed7 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_acc_dma.c @@ -1623,8 +1623,8 @@ void SCREEN_TO_SCREEN_BLIT_DMA(engine_token *et, blit_params *list, uint32 count nv_start_dma(); } - /* tell all 3D add-ons that they should reload their rendering states */ - si->engine.threeD.reload_state_3D = 0xffffffff; + /* tell 3D add-ons that they should reload their rendering states and surfaces */ + si->engine.threeD.reload = 0xffffffff; } /* rectangle fill - i.e. workspace and window background color */ @@ -1675,8 +1675,8 @@ void FILL_RECTANGLE_DMA(engine_token *et, uint32 colorIndex, fill_rect_params *l nv_start_dma(); } - /* tell all 3D add-ons that they should reload their rendering states */ - si->engine.threeD.reload_state_3D = 0xffffffff; + /* tell 3D add-ons that they should reload their rendering states and surfaces */ + si->engine.threeD.reload = 0xffffffff; } /* span fill - i.e. (selected) menuitem background color (Dano) */ @@ -1726,8 +1726,8 @@ void FILL_SPAN_DMA(engine_token *et, uint32 colorIndex, uint16 *list, uint32 cou nv_start_dma(); } - /* tell all 3D add-ons that they should reload their rendering states */ - si->engine.threeD.reload_state_3D = 0xffffffff; + /* tell 3D add-ons that they should reload their rendering states and surfaces */ + si->engine.threeD.reload = 0xffffffff; } /* rectangle invert - i.e. text cursor and text selection */ @@ -1778,6 +1778,6 @@ void INVERT_RECTANGLE_DMA(engine_token *et, fill_rect_params *list, uint32 count nv_start_dma(); } - /* tell all 3D add-ons that they should reload their rendering states */ - si->engine.threeD.reload_state_3D = 0xffffffff; + /* tell 3D add-ons that they should reload their rendering states and surfaces */ + si->engine.threeD.reload = 0xffffffff; } diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c index 721cf88f12..042d30c76d 100644 --- a/src/add-ons/accelerants/nvidia/engine/nv_general.c +++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c @@ -90,7 +90,7 @@ status_t nv_general_powerup() { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.52 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.53 running.\n")); /* preset no laptop */ si->ps.laptop = false;