• Ville Syrjälä's avatar
    drm/i915: Correctly handle limited range YCbCr data on VLV/CHV · 5deae919
    Ville Syrjälä authored
    Turns out the VLV/CHV fixed function sprite CSC expects full range
    data as input. We've been feeding it limited range data to it all
    along. To expand the data out to full range we'll use the color
    correction registers (brightness, contrast, and saturation).
    
    On CHV pipe B we were actually doing the right thing already because we
    progammed the custom CSC matrix to do expect limited range input. Now
    that well pre-expand the data out with the color correction unit, we
    need to change the CSC matrix to operate with full range input instead.
    
    This should make the sprite output of the other pipes match the sprite
    output of pipe B reasonably well. Looking at the resulting pipe CRCs,
    there can be a slight difference in the output, but as I don't know
    the formula used by the fixed function CSC of the other pipes, I don't
    think it's worth the effort to try to match the output exactly. It
    might not even be possible due to difference in internal precision etc.
    
    One slight caveat here is that the color correction registers are single
    bufferred, so we should really be updating them during vblank, but we
    still don't have a mechanism for that, so just toss in another FIXME.
    
    v2: Rebase
    v3: s/bri/brightness/ s/con/contrast/ (Shashank)
    v4: Clarify the constants and math (Shashank)
    
    Cc: Harry Wentland <harry.wentland@amd.com>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Daniel Stone <daniel@fooishbar.org>
    Cc: Russell King - ARM Linux <linux@armlinux.org.uk>
    Cc: Ilia Mirkin <imirkin@alum.mit.edu>
    Cc: Hans Verkuil <hverkuil@xs4all.nl>
    Cc: Shashank Sharma <shashank.sharma@intel.com>
    Cc: Uma Shankar <uma.shankar@intel.com>
    Cc: Jyri Sarha <jsarha@ti.com>
    Cc: "Tang, Jun" <jun.tang@intel.com>
    Reported-by: default avatar"Tang, Jun" <jun.tang@intel.com>
    Cc: stable@vger.kernel.org
    Fixes: 7f1f3851 ("drm/i915: sprite support for ValleyView v4")
    Reviewed-by: default avatarShashank Sharma <shashank.sharma@intel.com>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180214192327.3250-5-ville.syrjala@linux.intel.com
    5deae919
i915_reg.h 378 KB