diff --git a/src/add-ons/accelerants/via/Overlay.c b/src/add-ons/accelerants/via/Overlay.c index af41487163..f894c9f497 100644 --- a/src/add-ons/accelerants/via/Overlay.c +++ b/src/add-ons/accelerants/via/Overlay.c @@ -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 ); } diff --git a/src/add-ons/accelerants/via/engine/bes.c b/src/add-ons/accelerants/via/engine/bes.c index 4fda133971..2db561624b 100644 --- a/src/add-ons/accelerants/via/engine/bes.c +++ b/src/add-ons/accelerants/via/engine/bes.c @@ -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; diff --git a/src/add-ons/accelerants/via/engine/dac.c b/src/add-ons/accelerants/via/engine/dac.c index 9d73604068..e3a380f98a 100644 --- a/src/add-ons/accelerants/via/engine/dac.c +++ b/src/add-ons/accelerants/via/engine/dac.c @@ -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 } diff --git a/src/add-ons/accelerants/via/engine/general.c b/src/add-ons/accelerants/via/engine/general.c index e6ecc04c85..1c1e01575c 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.14 running.\n")); + LOG(1,("POWERUP: Haiku VIA Accelerant 0.15 running.\n")); /* preset no laptop */ si->ps.laptop = false;