# HG changeset patch # User arpi # Date 1027637571 0 # Node ID 963f266ce7ccbb1926c3b9cb679a3696c338a1b1 # Parent 1ac83dfb6725893ab662a97ef32f0d377ab43d8f vide EQ fixed - lumactl register is not readable! diff -r 1ac83dfb6725 -r 963f266ce7cc vidix/drivers/mga_vid.c --- a/vidix/drivers/mga_vid.c Thu Jul 25 22:37:55 2002 +0000 +++ b/vidix/drivers/mga_vid.c Thu Jul 25 22:52:51 2002 +0000 @@ -1435,11 +1435,6 @@ int vixPlaybackSetEq( const vidix_video_eq_t * eq) { - uint32_t luma = 0; - float factor = 256.0 / 2000; - static int32_t prev_br = 0; - static int32_t prev_c = 0; - /* contrast and brightness control isn't supported on G200 - alex */ if (!is_g400) { @@ -1447,22 +1442,27 @@ return(ENOTSUP); } - if (eq->cap & VEQ_CAP_BRIGHTNESS) { prev_br=eq->brightness; if ( prev_br == 1000 ) prev_br=999; } - if (eq->cap & VEQ_CAP_CONTRAST) { prev_c=eq->contrast; if ( prev_c == 1000 ) prev_c=999; } + // only brightness&contrast are supported: + if(!(eq->cap & (VEQ_CAP_BRIGHTNESS|VEQ_CAP_CONTRAST))) + return(ENOTSUP); + + //regs.beslumactl = readl(mga_mmio_base + BESLUMACTL); +// printf("LUMA = %08X \n",regs.beslumactl); + if (eq->cap & VEQ_CAP_BRIGHTNESS) { + regs.beslumactl &= 0xFFFF; + regs.beslumactl |= (eq->brightness*255/2000)<<16; + } + if (eq->cap & VEQ_CAP_CONTRAST) { + regs.beslumactl &= 0xFFFF0000; + regs.beslumactl |= (128+eq->contrast*255/2000)&0xFFFF; + } + writel(regs.beslumactl,mga_mmio_base + BESLUMACTL); - luma = ((int)(prev_br * factor) << 16) + ((int)(prev_c * factor) & 0xFFFF); - - regs.beslumactl = luma+0x80; - - writel(regs.beslumactl,mga_mmio_base + BESLUMACTL); return(0); } int vixPlaybackGetEq( vidix_video_eq_t * eq) { - uint32_t luma; - float factor = 2000.0 / 256; - /* contrast and brightness control isn't supported on G200 - alex */ if (!is_g400) { @@ -1470,12 +1470,13 @@ return(ENOTSUP); } - regs.beslumactl = readl(mga_mmio_base + BESLUMACTL); - luma = regs.beslumactl-0x80; +// regs.beslumactl = readl(mga_mmio_base + BESLUMACTL); - eq->brightness = (signed short int)(luma >> 16) * factor; - eq->contrast = (signed short int)(luma & 0xFFFF) * factor; + eq->brightness = (signed short int)(regs.beslumactl >> 16) * 1000 / 128; + eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000; eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST; + + printf("MGA GET_EQ: br=%d c=%d \n",eq->brightness,eq->contrast); return(0); }