Skip to content

Commit

Permalink
Millennium and Millennium 2: Enable gamma correction only for 24+ bpp
Browse files Browse the repository at this point in the history
TVP3026 datasheet poorly or doesn't document at all gamma correction for 15/16 bpp
  • Loading branch information
Cacodemon345 committed Dec 29, 2023
1 parent 148e466 commit 4d7fd68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/video/vid_mga.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,12 @@ mystique_recalctimings(svga_t *svga)
svga->hdisp = (svga->crtc[1] + 1) << 3;
svga->hdisp_time = svga->hdisp;
svga->rowoffset = svga->crtc[0x13] | ((mystique->crtcext_regs[0] & CRTCX_R0_OFFSET_MASK) << 4);
svga->lut_map = !!(mystique->xmiscctrl & XMISCCTRL_RAMCS);

if (mystique->type != MGA_2164W && mystique->type != MGA_2064W)
svga->lut_map = !!(mystique->xmiscctrl & XMISCCTRL_RAMCS);

if (mystique->type >= MGA_1064SG)
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd];
svga->ma_latch = ((mystique->crtcext_regs[0] & CRTCX_R0_STARTADD_MASK) << 16) | (svga->crtc[0xc] << 8) | svga->crtc[0xd];

if ((mystique->pci_regs[0x41] & (OPTION_INTERLEAVE >> 8))) {
svga->rowoffset <<= 1;
Expand Down
2 changes: 2 additions & 0 deletions src/video/vid_tvp3026_ramdac.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ tvp3026_recalctimings(void *priv, svga_t *svga)
const tvp3026_ramdac_t *ramdac = (tvp3026_ramdac_t *) priv;

svga->interlace = (ramdac->ccr & 0x40);
/* TODO: Figure out gamma correction for 15/16 bpp color. */
svga->lut_map = !!(svga->bpp >= 24 && (ramdac->true_color & 0xf0) != 0x00);
}

void
Expand Down

0 comments on commit 4d7fd68

Please sign in to comment.