From 8fa1f9b48d856cb962c8cdb3c0aec70927781e1f Mon Sep 17 00:00:00 2001 From: Rudolf Cornelissen Date: Tue, 20 Sep 2005 18:13:49 +0000 Subject: [PATCH] added vertical downscaling for overlay. This completes scaling. Quality wise this engine is like the Neomagic engine, and TNT engine with the added prescaling downscaling feature added. This is the 'video 1' engine. There is also a video 3 engine (which should be the same quality, but lacks YUV12 support in hardware). And (newer?) VIA unichrome chipsets have a 'HQV: high quality video' engine as well: which supports setting specific filters (with taps). this latter engine would be nice to use instead, maybe in the future. For now we use the video 1 engine. Note: lacking are virtualscreen support and colorkeying in the driver. Next up. Apart from that overlay is now complete (yuy2 only supported at this time, as 'always' with my drivers :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14213 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/via/engine/bes.c | 52 +++++++++++++++++--- src/add-ons/accelerants/via/engine/general.c | 2 +- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/add-ons/accelerants/via/engine/bes.c b/src/add-ons/accelerants/via/engine/bes.c index 552ab2d221..4fda133971 100644 --- a/src/add-ons/accelerants/via/engine/bes.c +++ b/src/add-ons/accelerants/via/engine/bes.c @@ -594,7 +594,7 @@ status_t eng_configure_bes LOG(4,("Overlay: horizontal scaling factor too large, clamping at %f\n", (float)65536 / hiscalv)); } /* VIA has a 'downscaling' limit of 1.0, but seperate prescaling to 1/16th can be done. - * (scaler has 11bit register with 0.11 format value, with special 1.0 scaling factor setting; + * (X-scaler has 11bit register with 0.11 format value, with special 1.0 scaling factor setting; * prescaler has fixed 1x, 1/2x, 1/4x, 1/8x and 1/16x settings.) */ if (hiscalv > 0x00100000) { @@ -699,17 +699,53 @@ status_t eng_configure_bes viscalv = 0x00002000; LOG(4,("Overlay: vertical scaling factor too large, clamping at %f\n", (float)65536 / viscalv)); } - /* VIA has a 'downscaling' limit of 1.0 - * (10bit register with 0.10 format value, with special 1.0 scaling factor setting) */ - //fixme: add downscaling 'trick' solution as supported by VIA (1/16 is min. size). - scale_y = true; - if (viscalv > 0x00010000) + /* VIA has a 'downscaling' limit of 1.0, but seperate prescaling to 1/16th can be done. + * (Y-scaler has 10bit register with 0.10 format value, with special 1.0 scaling factor setting; + * prescaler has fixed 1x, 1/2x, 1/4x, 1/8x and 1/16x settings.) */ + if (viscalv > 0x00100000) { /* (non-inverse) factor too small, set factor to min. valid value */ - viscalv = 0x00010000; - scale_y = false; + viscalv = 0x00100000; LOG(4,("Overlay: vertical scaling factor too small, clamping at %f\n", (float)1024 / (viscalv >> 6))); } + + /* setup pre-downscaling if 'requested' */ + if ((viscalv > 0x00010000) && (viscalv <= 0x00020000)) + { + /* instruct BES to horizontal prescale 0.5x */ + minictrl |= 0x00010000; + /* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */ + viscalv >>= 1; + } + else + if ((viscalv > 0x00020000) && (viscalv <= 0x00040000)) + { + /* instruct BES to horizontal prescale 0.25x */ + minictrl |= 0x00030000; + /* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */ + viscalv >>= 2; + } + else + if ((viscalv > 0x00040000) && (viscalv <= 0x00080000)) + { + /* instruct BES to horizontal prescale 0.125x */ + minictrl |= 0x00050000; + /* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */ + viscalv >>= 3; + } + else + if ((viscalv > 0x00080000) && (viscalv <= 0x00100000)) + { + /* instruct BES to horizontal prescale 0.125x */ + minictrl |= 0x00070000; + /* correct normal scalingfactor so total scaling is 0.5 <= factor < 1.0x */ + viscalv >>= 4; + } + + /* only instruct normal scaler to scale if it must do so */ + scale_y = true; + if (viscalv == 0x00010000) scale_y = false; + /* AND below is required by hardware */ viscalv &= 0x0000ffc0; diff --git a/src/add-ons/accelerants/via/engine/general.c b/src/add-ons/accelerants/via/engine/general.c index 3f8dd23ef8..e6ecc04c85 100644 --- a/src/add-ons/accelerants/via/engine/general.c +++ b/src/add-ons/accelerants/via/engine/general.c @@ -90,7 +90,7 @@ status_t eng_general_powerup() { status_t status; - LOG(1,("POWERUP: Haiku VIA Accelerant 0.13 running.\n")); + LOG(1,("POWERUP: Haiku VIA Accelerant 0.14 running.\n")); /* preset no laptop */ si->ps.laptop = false;