• Ville Syrjälä's avatar
    drm/i915: Implement proper clipping for video sprites · 1731693a
    Ville Syrjälä authored
    Properly clip the source when the destination gets clipped
    by the pipe dimensions.
    
    Sadly the video sprite hardware is rather limited so it can't do proper
    sub-pixel postitioning. Resort to truncating the source coordinates to
    (macro)pixel boundary.
    
    The scaling checks are done using the strict drm_region functions.
    Which means that an error is returned when the min/max scaling
    ratios are exceeded.
    
    Also do some additional checking against various hardware limits.
    
    v2: Truncate src coords instead of rounding to avoid increasing src
        viewport size, and adapt to changes in drm_calc_{h,v}scale().
    v3: Adapt to drm_region->drm_rect rename. Fix misaligned crtc_w for
        packed YUV formats when scaling isn't supported.
    v4: Use stricter scaling checks, use drm_rect_equals()
    v5: If sprite is below min size, make it invisible instead returning
        an error.
        Use WARN_ON() instead if BUG_ON(), and add one to sanity check the
        src viewport size.
    v6: Add comments to remind about src and dst coordinate types
    Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    1731693a
intel_sprite.c 28.6 KB