added overlay colorkeying. Working OK in 15,16 and 32bit spaces. Works (with a tweak) in 8 bit space. The VIA hardware wants the colorpalette INDEX as key instead of the displayed color(cd obos_svn/trunk/src/add-ons/accelerants/via/). Unfortunately a reverse lookup isn't conclusive, as BeOS and Zeta use two palette entries for white. I'll try to find a hardware setup so that it wants a displayed color in 8-bit mode, but no guarantees yet. If this turns out to not be possible, I suggest adding the color-index of the current displayed mode (valid only in indexed mode, so CMAP8) to the system's overlay_window information struct, alongside the displayed color. Somehow (would break compatibility with other BeOS versions?). Anyway, I'll search for a different hardware setup for this. Keep your fingers crossed :)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14224 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rudolf Cornelissen 2005-09-22 18:05:35 +00:00
parent f10cba9aec
commit b96e7791c1
4 changed files with 65 additions and 39 deletions

View File

@ -60,9 +60,8 @@ uint32 OVERLAY_SUPPORTED_FEATURES(uint32 a_color_space)
switch (a_color_space)
{
default:
return
( B_OVERLAY_KEYING_USES_ALPHA |
B_OVERLAY_COLOR_KEY |
return
( B_OVERLAY_COLOR_KEY |
B_OVERLAY_HORIZONTAL_FILTERING |
B_OVERLAY_VERTICAL_FILTERING );
}

View File

@ -884,46 +884,74 @@ status_t eng_configure_bes
BESW(VID1_CTL, 0x000f0081);
}
//fixme: best move this instruction to be the last one done (so do after keying)
/* enable colorkeying (b0 = 1), enable chromakeying (b1 = 1), Vid1 on top of Vid3 (b20 = 0),
* all registers are loaded during the next 'BES-'VBI (b28 = 1), Vid1 cmds fire (b31 = 1) */
BESW(COMPOSE, 0x90000000);
/**************************
*** setup color keying ***
**************************/
/* setup colorkeying */
switch(si->dm.space)
/* setup colorkeying */
switch(si->dm.space)
{
case B_CMAP8:
{
case B_RGB15_LITTLE:
// BESW(NV04_COLKEY, (
// ((ow->blue.value & ow->blue.mask) << 0) |
// ((ow->green.value & ow->green.mask) << 5) |
// ((ow->red.value & ow->red.mask) << 10) |
// ((ow->alpha.value & ow->alpha.mask) << 15)
// ));
break;
case B_RGB16_LITTLE:
// BESW(NV04_COLKEY, (
// ((ow->blue.value & ow->blue.mask) << 0) |
// ((ow->green.value & ow->green.mask) << 5) |
// ((ow->red.value & ow->red.mask) << 11)
/* this space has no alpha bits */
// ));
break;
case B_CMAP8:
case B_RGB32_LITTLE:
default:
// BESW(NV04_COLKEY, (
// ((ow->blue.value & ow->blue.mask) << 0) |
// ((ow->green.value & ow->green.mask) << 8) |
// ((ow->red.value & ow->red.mask) << 16) |
// ((ow->alpha.value & ow->alpha.mask) << 24)
// ));
break;
/* do color palette index lookup for current colorkey */
/* note:
* since apparantly some hardware works with color indexes instead of colors,
* it might be a good idea(!!) to include the colorindex in the system's
* overlay_window struct. */
static uint8 *r,*g,*b;
static uint32 idx;
r = si->color_data;
g = r + 256;
b = g + 256;
/* if index 1 doesn't help us, we assume 0 will (got to program something anyway) */
//fixme, note, find a workaround or better HW setup:
//I'm counting down for a reason:
//BeOS assigns the color white (0x00ffffff) to two indexes in the palette:
//index 0x3f and 0xff. In the framebuffer index 0xff is used (apparantly).
//The hardware compares framebuffer to given key, so the BES must receive 0xff.
for (idx = 255; idx > 0; idx--)
{
if ((r[idx] == ow->red.value) &&
(g[idx] == ow->green.value) &&
(b[idx] == ow->blue.value))
break;
}
LOG(4,("Overlay: colorkey's palette index is $%02x\n", idx));
/* program color palette index into BES engine */
BESW(COLKEY, idx);
}
break;
case B_RGB15_LITTLE:
BESW(COLKEY, (
((ow->blue.value & ow->blue.mask) << 0) |
((ow->green.value & ow->green.mask) << 5) |
((ow->red.value & ow->red.mask) << 10)
/* alpha keying is not supported here */
));
break;
case B_RGB16_LITTLE:
BESW(COLKEY, (
((ow->blue.value & ow->blue.mask) << 0) |
((ow->green.value & ow->green.mask) << 5) |
((ow->red.value & ow->red.mask) << 11)
/* this space has no alpha bits */
));
break;
case B_RGB32_LITTLE:
default:
BESW(COLKEY, (
((ow->blue.value & ow->blue.mask) << 0) |
((ow->green.value & ow->green.mask) << 8) |
((ow->red.value & ow->red.mask) << 16)
/* alpha keying is not supported here */
));
break;
}
/* enable colorkeying (b0 = 1), disable chromakeying (b1 = 0), Vid1 on top of Vid3 (b20 = 0),
* all registers are loaded during the next 'BES-'VBI (b28 = 1), Vid1 cmds fire (b31 = 1) */
BESW(COMPOSE, 0x90000001);
/* note that overlay is in use (for eng_bes_move_overlay()) */
si->overlay.active = true;

View File

@ -120,7 +120,7 @@ status_t eng_dac_palette(uint8 r[256],uint8 g[256],uint8 b[256])
LOG(8,("DAC: PAL write index incorrect after programming\n"));
return B_ERROR;
}
if (1)
if (0)
{//reread LUT
uint8 R, G, B;
@ -131,7 +131,6 @@ if (1)
R = ENG_REG8(RG8_PALDATA);
G = ENG_REG8(RG8_PALDATA);
B = ENG_REG8(RG8_PALDATA);
/* only compare the most significant 6 bits */
if ((r[i] != R) || (g[i] != G) || (b[i] != B))
LOG(1,("DAC palette %d: w %x %x %x, r %x %x %x\n", i, r[i], g[i], b[i], R, G, B)); // apsed
}

View File

@ -90,7 +90,7 @@ status_t eng_general_powerup()
{
status_t status;
LOG(1,("POWERUP: Haiku VIA Accelerant 0.14 running.\n"));
LOG(1,("POWERUP: Haiku VIA Accelerant 0.15 running.\n"));
/* preset no laptop */
si->ps.laptop = false;