Hi Edgar, looks good! I also cleaned up a little and now it looks like below. These links are also updated: This patch is against 2.2.1 intel driver: http://linux.pengin.de/intel_xv_attr.diff I tested successful with my i965 and gnome video player. (patched Ubuntu 8:10 package: http://linux.pengin.de/xserver-xorg-video-intel_2.2.1-1ubun.deb) Cheers, Thomas Fritzsche ==================== diff -urN xserver-xorg-video-intel-2.2.1_orig/src/i830_video.c xserver-xorg-video-intel-2.2.1/src/i830_video.c --- xserver-xorg-video-intel-2.2.1_orig/src/i830_video.c 2008-02-21 06:41:25.000000000 +0900 +++ xserver-xorg-video-intel-2.2.1/src/i830_video.c 2008-05-11 15:48:44.000000000 +0900 @@ -623,8 +623,11 @@ overlay->SWIDTH = 0; overlay->SWIDTHSW = 0; overlay->SHEIGHT = 0; - overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); - overlay->OCLRC1 = pPriv->saturation; + overlay->OCLRC0 = ((pPriv->contrast <= 128 ? pPriv->contrast / 2 : + 64 + ((pPriv->contrast - 128) * 191 ) / 127) << 18) + | (pPriv->brightness & 0xff); + overlay->OCLRC1 = pPriv->saturation <= 512 ? pPriv->saturation / 4 : + 128 + ((pPriv->saturation - 512) * 895) / 511; #if 0 overlay->AWINPOS = 0; overlay->AWINSZ = 0; @@ -834,8 +837,8 @@ pPriv->colorKey = pI830->colorKey & ((1 << pScrn->depth) - 1); pPriv->videoStatus = 0; pPriv->brightness = 0; - pPriv->contrast = 64; - pPriv->saturation = 128; + pPriv->contrast = 128; + pPriv->saturation = 512; pPriv->current_crtc = NULL; pPriv->desired_crtc = NULL; pPriv->buf = NULL; @@ -1046,21 +1049,23 @@ if ((value < -128) || (value > 127)) return BadValue; pPriv->brightness = value; - overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + overlay->OCLRC0 = (overlay->OCLRC0 & 0xffffff00) | (pPriv->brightness & 0xff); OVERLAY_DEBUG("BRIGHTNESS\n"); i830_overlay_continue (pScrn, FALSE); } else if (attribute == xvContrast) { if ((value < 0) || (value > 255)) return BadValue; pPriv->contrast = value; - overlay->OCLRC0 = (pPriv->contrast << 18) | (pPriv->brightness & 0xff); + overlay->OCLRC0 = ( (pPriv->contrast <= 128 ? pPriv->contrast / 2 : + 64 + ((pPriv->contrast - 128) * 191 ) / 127) << 18) | (overlay->OCLRC0 & 0xff); OVERLAY_DEBUG("CONTRAST\n"); i830_overlay_continue (pScrn, FALSE); } else if (attribute == xvSaturation) { if ((value < 0) || (value > 1023)) return BadValue; pPriv->saturation = value; - overlay->OCLRC1 = pPriv->saturation; + overlay->OCLRC1 = pPriv->saturation <= 512 ? pPriv->saturation / 4 : + 128 + ((pPriv->saturation - 512) * 895) / 511; i830_overlay_continue (pScrn, FALSE); } else if (attribute == xvPipe) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); On Sat, May 10, 2008 at 7:29 PM, Edgar Toernig <froese@xxxxxx> wrote: > Thomas Fritzsche wrote: >> >> + if (pPriv->contrast <= 128) contrast = (int) (pPriv->contrast / 2); >> + else contrast = (int) (64 + (pPriv->contrast -127) * (192/127)); >> + if (contrast > 255) contrast = 255; > >> + if (pPriv->saturation <= 512) saturation = (int) (pPriv->saturation / 4 ); >> + else saturation = (int) (128 + (pPriv->saturation-512) * (895/512)); >> + if ( saturation > 1023 ) saturation = 1023; > > Expressions like (192/127) are evalutated to 1. Is that really what > you want? The constants itself look a little bit off, too. > > What about: > > else contrast = 64 + (pPriv->contrast - 128) * 191 / 127; > > else saturation = 128 + (pPriv->saturation - 512) * 895 / 511; > > instead? > > Ciao, ET. > > _______________________________________________ > xorg mailing list > xorg@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/xorg > _______________________________________________ xorg mailing list xorg@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/xorg