2d and overlay restrictions update, 'comments doc' update

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8525 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen
2004-08-02 11:45:53 +00:00
parent 612899f22c
commit c60b4ca002
4 changed files with 47 additions and 81 deletions
+4 -4
View File
@@ -1,4 +1,4 @@
/* Written by Rudolf Cornelissen 05-2002/03-2004 */ /* Written by Rudolf Cornelissen 05-2002/08-2004 */
/* Note on 'missing features' in BeOS 5.0.3 and DANO: /* Note on 'missing features' in BeOS 5.0.3 and DANO:
* BeOS needs to define more colorspaces! It would be nice if BeOS would support the FourCC 'definitions' * BeOS needs to define more colorspaces! It would be nice if BeOS would support the FourCC 'definitions'
@@ -423,11 +423,11 @@ status_t GET_OVERLAY_CONSTRAINTS
} }
/* NeoMagic scaling restrictions */ /* NeoMagic scaling restrictions */
/* Note: NM BES does not support downscaling! */ /* Note: official max is 8.0, and NM BES does not support downscaling! */
oc->h_scale.min = 1.0; oc->h_scale.min = 1.0;
oc->h_scale.max = 1024/(float)(ob->width - si->overlay.myBufInfo[offset].slopspace); oc->h_scale.max = 8.0;
oc->v_scale.min = 1.0; oc->v_scale.min = 1.0;
oc->v_scale.max = 1024/(float)ob->height; oc->v_scale.max = 8.0;
return B_OK; return B_OK;
} }
@@ -1,7 +1,7 @@
/* nm Acceleration functions */ /* nm Acceleration functions */
/* Author: /* Author:
Rudolf Cornelissen 3/2004-7/2004. Rudolf Cornelissen 3/2004-8/2004.
*/ */
/* /*
@@ -170,10 +170,10 @@ status_t nm_acc_init()
// so: // so:
nm_acc_wait_idle(); nm_acc_wait_idle();
/* setup engine depth and pixel pitch */ /* setup engine depth and engine destination-pitch */
ACCW(STATUS, ((si->engine.control & 0x0000ffff) << 16)); ACCW(STATUS, ((si->engine.control & 0x0000ffff) << 16));
/* setup memory pitch */ /* setup engine source-pitch */
ACCW(2200_PITCH, ACCW(2200_SRC_PITCH,
((si->fbc.bytes_per_row << 16) | (si->fbc.bytes_per_row & 0x0000ffff))); ((si->fbc.bytes_per_row << 16) | (si->fbc.bytes_per_row & 0x0000ffff)));
break; break;
default: default:
@@ -1,5 +1,5 @@
/* NeoMagic Back End Scaler functions */ /* NeoMagic Back End Scaler functions */
/* Written by Rudolf Cornelissen 05/2002-07/2004 */ /* Written by Rudolf Cornelissen 05/2002-08/2004 */
#define MODULE_BIT 0x00000200 #define MODULE_BIT 0x00000200
@@ -197,10 +197,11 @@ status_t nm_configure_bes
LOG(4,("Overlay: horizontal scaling factor is %f\n", (float)4096 / ifactor)); LOG(4,("Overlay: horizontal scaling factor is %f\n", (float)4096 / ifactor));
/* check scaling factor (and modify if needed) to be within scaling limits */ /* check scaling factor (and modify if needed) to be within scaling limits */
if (((((uint32)my_ov.width) << 12) / 1024) > bi.hiscalv) /* the upscaling limit is 8.0 (see official Neomagic specsheets) */
if (bi.hiscalv < 0x00000200)
{ {
/* (non-inverse) factor too large, set factor to max. valid value */ /* (non-inverse) factor too large, set factor to max. valid value */
bi.hiscalv = ((((uint32)my_ov.width) << 12) / 1024); bi.hiscalv = 0x00000200;
LOG(4,("Overlay: horizontal scaling factor too large, clamping at %f\n", (float)4096 / bi.hiscalv)); LOG(4,("Overlay: horizontal scaling factor too large, clamping at %f\n", (float)4096 / bi.hiscalv));
} }
/* horizontal downscaling cannot be done by NM BES hardware */ /* horizontal downscaling cannot be done by NM BES hardware */
@@ -245,8 +246,6 @@ status_t nm_configure_bes
} }
/* take zoom into account */ /* take zoom into account */
bi.hsrcstv += ((uint32)my_ov.h_start) << 16; bi.hsrcstv += ((uint32)my_ov.h_start) << 16;
/* AND below required by hardware */
bi.hsrcstv &= 0x03fffffc;
LOG(4,("Overlay: first hor. (sub)pixel of input bitmap contributing %f\n", bi.hsrcstv / (float)65536)); LOG(4,("Overlay: first hor. (sub)pixel of input bitmap contributing %f\n", bi.hsrcstv / (float)65536));
@@ -292,13 +291,6 @@ status_t nm_configure_bes
LOG(4,("Overlay: last horizontal (sub)pixel of input bitmap contributing %f\n", bi.hsrcendv / (float)65536)); LOG(4,("Overlay: last horizontal (sub)pixel of input bitmap contributing %f\n", bi.hsrcendv / (float)65536));
/* setup horizontal source last position excluding slopspace:
* this is the last pixel that will be used for calculating interpolated pixels */
bi.hsrclstv = ((ob->width - 1) - si->overlay.myBufInfo[offset].slopspace) << 16;
/* AND below required by hardware */
bi.hsrclstv &= 0x03ff0000;
/******************************************* /*******************************************
*** setup vertical scaling and clipping *** *** setup vertical scaling and clipping ***
*******************************************/ *******************************************/
@@ -314,10 +306,11 @@ status_t nm_configure_bes
bi.viscalv = ifactor; bi.viscalv = ifactor;
/* check scaling factor (and modify if needed) to be within scaling limits */ /* check scaling factor (and modify if needed) to be within scaling limits */
if (((((uint32)my_ov.height) << 12) / 1024) > bi.viscalv) /* the upscaling limit is 8.0 (see official Neomagic specsheets) */
if (bi.viscalv < 0x00000200)
{ {
/* (non-inverse) factor too large, set factor to max. valid value */ /* (non-inverse) factor too large, set factor to max. valid value */
bi.viscalv = ((((uint32)my_ov.height) << 12) / 1024); bi.viscalv = 0x00000200;
LOG(4,("Overlay: vertical scaling factor too large, clamping at %f\n", (float)4096 / bi.viscalv)); LOG(4,("Overlay: vertical scaling factor too large, clamping at %f\n", (float)4096 / bi.viscalv));
} }
/* vertical downscaling cannot be done by NM BES hardware */ /* vertical downscaling cannot be done by NM BES hardware */
@@ -374,23 +367,15 @@ status_t nm_configure_bes
/* take zoom into account */ /* take zoom into account */
bi.a1orgv += (my_ov.v_start * ob->bytes_per_row); bi.a1orgv += (my_ov.v_start * ob->bytes_per_row);
bi.weight += (((uint32)my_ov.v_start) << 16); bi.weight += (((uint32)my_ov.v_start) << 16);
/* now include 'pixel precise' left clipping...
* (subpixel precision is not supported by NeoMagic cards) */
bi.a1orgv += ((bi.hsrcstv >> 16) * 2);
/* we need to step in 4-byte (2 pixel) granularity due to the nature of yuy2 */
bi.a1orgv &= ~0x03;
LOG(4,("Overlay: 'contributing part of buffer' origin is (cardRAM offset) $%08x\n",bi.a1orgv)); LOG(4,("Overlay: 'contributing part of buffer' origin is (cardRAM offset) $%08x\n",bi.a1orgv));
LOG(4,("Overlay: first vert. (sub)pixel of input bitmap contributing %f\n", bi.weight / (float)65536)); LOG(4,("Overlay: first vert. (sub)pixel of input bitmap contributing %f\n", bi.weight / (float)65536));
/* AND below is required by NM hardware. */
/* Buffer A topleft corner of field 1 (origin)(field 1 contains our full frames) */
bi.a1orgv &= 0x00fffff0;
/* field 1 weight: AND below required by hardware, also make sure 'sign' is always 'positive' */
bi.v1wghtv = bi.weight & 0x0000fffc;
/* setup field 1 (is our complete frame) vertical source last position.
* this is the last pixel that will be used for calculating interpolated pixels */
bi.v1srclstv = (ob->height - 1);
/* AND below required by hardware */
bi.v1srclstv &= 0x000003ff;
/***************************** /*****************************
*** log color keying info *** *** log color keying info ***
@@ -460,13 +445,13 @@ status_t nm_configure_bes
LOG(4,("Overlay: accelerant is programming BES\n")); LOG(4,("Overlay: accelerant is programming BES\n"));
/* unlock card overlay sequencer registers (b5 = 1) */ /* unlock card overlay sequencer registers (b5 = 1) */
PCIGRPHW(GENLOCK, (PCIGRPHR(GENLOCK) | 0x20)); PCIGRPHW(GENLOCK, (PCIGRPHR(GENLOCK) | 0x20));
/* destination rectangle */ /* destination rectangle #1 (output window position and size) */
PCIGRPHW(HDCOORD1L, ((bi.hcoordv >> 16) & 0xff)); PCIGRPHW(HD1COORD1L, ((bi.hcoordv >> 16) & 0xff));
PCIGRPHW(HDCOORD2L, (bi.hcoordv & 0xff)); PCIGRPHW(HD1COORD2L, (bi.hcoordv & 0xff));
PCIGRPHW(HDCOORD21H, (((bi.hcoordv >> 4) & 0xf0) | ((bi.hcoordv >> 24) & 0x0f))); PCIGRPHW(HD1COORD21H, (((bi.hcoordv >> 4) & 0xf0) | ((bi.hcoordv >> 24) & 0x0f)));
PCIGRPHW(VDCOORD1L, ((bi.vcoordv >> 16) & 0xff)); PCIGRPHW(VD1COORD1L, ((bi.vcoordv >> 16) & 0xff));
PCIGRPHW(VDCOORD2L, (bi.vcoordv & 0xff)); PCIGRPHW(VD1COORD2L, (bi.vcoordv & 0xff));
PCIGRPHW(VDCOORD21H, (((bi.vcoordv >> 4) & 0xf0) | ((bi.vcoordv >> 24) & 0x0f))); PCIGRPHW(VD1COORD21H, (((bi.vcoordv >> 4) & 0xf0) | ((bi.vcoordv >> 24) & 0x0f)));
/* scaling */ /* scaling */
PCIGRPHW(XSCALEL, (bi.hiscalv & 0xff)); PCIGRPHW(XSCALEL, (bi.hiscalv & 0xff));
PCIGRPHW(XSCALEH, ((bi.hiscalv >> 8) & 0xff)); PCIGRPHW(XSCALEH, ((bi.hiscalv >> 8) & 0xff));
@@ -474,16 +459,11 @@ status_t nm_configure_bes
PCIGRPHW(YSCALEH, ((bi.viscalv >> 8) & 0xff)); PCIGRPHW(YSCALEH, ((bi.viscalv >> 8) & 0xff));
/* inputbuffer #1 origin */ /* inputbuffer #1 origin */
/* (we don't program buffer #2 as it's unused.) */ /* (we don't program buffer #2 as it's unused.) */
/* first include 'pixel precise' left clipping...
* (subpixel precision is not supported by NeoMagic cards) */
bi.a1orgv += ((bi.hsrcstv >> 16) * 2);
/* we need to step in 4-byte (2 pixel) granularity due to the nature of yuy2 */
bi.a1orgv &= ~0x03;
/* now setup buffer startadress and horizontal source end (minimizes used bandwidth) */
if (si->ps.card_type < NM2200) if (si->ps.card_type < NM2200)
{ {
bi.a1orgv >>= 1; bi.a1orgv >>= 1;
/* horizontal source end does not use subpixelprecision: granularity is 8 pixels */ /* horizontal source end does not use subpixelprecision: granularity is 8 pixels */
/* (horizontal source end minimizes used bandwidth) */
PCIGRPHW(0xbc, (((((bi.hsrcendv >> 16) + 7) & ~8) / 8) - 1)); PCIGRPHW(0xbc, (((((bi.hsrcendv >> 16) + 7) & ~8) / 8) - 1));
} }
else else
@@ -491,6 +471,7 @@ status_t nm_configure_bes
/* NM2200 and later cards use bytes to define buffer pitch */ /* NM2200 and later cards use bytes to define buffer pitch */
buf_pitch <<= 1; buf_pitch <<= 1;
/* horizontal source end does not use subpixelprecision: granularity is 16 pixels */ /* horizontal source end does not use subpixelprecision: granularity is 16 pixels */
/* (horizontal source end minimizes used bandwidth) */
//fixme? divide by 16 instead of 8 (if >= NM2200 owners report trouble then use 8!) //fixme? divide by 16 instead of 8 (if >= NM2200 owners report trouble then use 8!)
//fixme? check if overlaybuffer width should also have granularity of 16 now! //fixme? check if overlaybuffer width should also have granularity of 16 now!
PCIGRPHW(0xbc, (((((bi.hsrcendv >> 16) + 15) & ~16) / 16) - 1)); PCIGRPHW(0xbc, (((((bi.hsrcendv >> 16) + 15) & ~16) / 16) - 1));
@@ -504,11 +485,8 @@ status_t nm_configure_bes
/* b2 = 0: don't use horizontal mirroring (NM2160) */ /* b2 = 0: don't use horizontal mirroring (NM2160) */
/* other bits do ??? */ /* other bits do ??? */
PCIGRPHW(0xbf, 0x02); PCIGRPHW(0xbf, 0x02);
/* (subpixel precise) source rect clipping is not supported on NeoMagic cards;
* so we do 'pixel precise' left clipping via modification of buffer /* destination rectangle #2 (output window position and size) */
* startadress above instead.
* (pixel precise top clipping is also done this way..) */
//fixme: checkout real pixel precise clipping on NM2200 and later cards!!!
/* /*
{ {
uint16 left = 0; uint16 left = 0;
@@ -516,17 +494,12 @@ status_t nm_configure_bes
uint16 top = 0; uint16 top = 0;
uint16 bottom = 128; uint16 bottom = 128;
left = (bi.hsrcstv >> 16); PCISEQW(HD2COORD1L, (left & 0xff));
right = (bi.hsrclstv >> 16); PCISEQW(HD2COORD2L, (right & 0xff));
top = (bi.weight >> 16); PCISEQW(HD2COORD21H, (((right >> 4) & 0xf0) | ((left >> 8) & 0x0f)));
bottom = (bi.v1srclstv >> 16); PCISEQW(VD2COORD1L, (top & 0xff));
PCISEQW(VD2COORD2L, (bottom & 0xff));
PCISEQW(HSCOORD1L, (left & 0xff)); PCISEQW(VD2COORD21H, (((bottom >> 4) & 0xf0) | ((top >> 8) & 0x0f)));
PCISEQW(HSCOORD2L, (right & 0xff));
PCISEQW(HSCOORD21H, (((right >> 4) & 0xf0) | ((left >> 8) & 0x0f)));
PCISEQW(VSCOORD1L, (top & 0xff));
PCISEQW(VSCOORD2L, (bottom & 0xff));
PCISEQW(VSCOORD21H, (((bottom >> 4) & 0xf0) | ((top >> 8) & 0x0f)));
} }
*/ */
/* ??? */ /* ??? */
@@ -537,8 +510,10 @@ status_t nm_configure_bes
/* b1 = 0: disable alternating hardware buffers (NM2160) */ /* b1 = 0: disable alternating hardware buffers (NM2160) */
/* other bits do ??? */ /* other bits do ??? */
PCISEQW(0x09, 0x11); PCISEQW(0x09, 0x11);
/* ??? */ /* we don't use PCMCIA Zoomed Video port capturing, set 1:1 scale just in case */
PCISEQW(0x0a, 0x00); /* (b6-4 = Y downscale = 100%, b2-0 = X downscale = 100%;
* downscaling selectable in 12.5% steps on increasing setting by 1) */
PCISEQW(ZVCAP_DSCAL, 0x00);
/* global BES control */ /* global BES control */
PCIGRPHW(BESCTRL1, (bi.globctlv & 0xff)); PCIGRPHW(BESCTRL1, (bi.globctlv & 0xff));
PCISEQW(BESCTRL2, ((bi.globctlv >> 8) & 0xff)); PCISEQW(BESCTRL2, ((bi.globctlv >> 8) & 0xff));
@@ -1,5 +1,5 @@
/* Author: /* Author:
Rudolf Cornelissen 4/2003-7/2004 Rudolf Cornelissen 4/2003-8/2004
*/ */
#define MODULE_BIT 0x00008000 #define MODULE_BIT 0x00008000
@@ -485,8 +485,8 @@ status_t nm_general_validate_pic_size (display_mode *target, uint32 *bytes_per_r
/* check if we can setup this mode with acceleration: */ /* check if we can setup this mode with acceleration: */
*acc_mode = true; *acc_mode = true;
/* NM2230 and later cards only support accelerated 24bit modes */ /* pre-NM2200 cards don't support accelerated 24bit modes */
if ((si->ps.card_type < NM2230) && (target->space == B_RGB24)) *acc_mode = false; if ((si->ps.card_type < NM2200) && (target->space == B_RGB24)) *acc_mode = false;
/* virtual_width */ /* virtual_width */
if (si->ps.card_type == NM2070) if (si->ps.card_type == NM2070)
@@ -500,17 +500,8 @@ status_t nm_general_validate_pic_size (display_mode *target, uint32 *bytes_per_r
if (target->virtual_width > 1600) *acc_mode = false; if (target->virtual_width > 1600) *acc_mode = false;
} }
/* virtual_height */ /* virtual_height (confirmed NM2070, NM2097, NM2160 and NM2200 */
if (si->ps.card_type < NM2200) if (target->virtual_height > 1024) *acc_mode = false;
{
/* confirmed NM2070, NM2097 and NM2160 */
if (target->virtual_height > 1024) *acc_mode = false;
}
else
{
/* fixme: needs confirmation, assuming this height will still work.. */
if (target->virtual_height > 2048) *acc_mode = false;
}
/* now check virtual_size based on CRTC constraints and modify if needed */ /* now check virtual_size based on CRTC constraints and modify if needed */
//fixme: checkout cardspecs here!! (NM2160 can do 8192 _bytes_ at least (in theory)) //fixme: checkout cardspecs here!! (NM2160 can do 8192 _bytes_ at least (in theory))