summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vidix/drivers/mga_vid.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/vidix/drivers/mga_vid.c b/vidix/drivers/mga_vid.c
index eee5f10667..0c5ba8b72e 100644
--- a/vidix/drivers/mga_vid.c
+++ b/vidix/drivers/mga_vid.c
@@ -1435,11 +1435,6 @@ int vixSetGrKeys(const vidix_grkey_t *grkey)
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 @@ int vixPlaybackSetEq( const vidix_video_eq_t * eq)
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; }
-
- luma = ((int)(prev_br * factor) << 16) + ((int)(prev_c * factor) & 0xFFFF);
-
- regs.beslumactl = luma+0x80;
-
+ // 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);
+
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 @@ int vixPlaybackGetEq( vidix_video_eq_t * eq)
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);
}