[PATCH v3 4/4] drm/i915: Implement proper clipping for video sprites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 16, 2013 at 01:47:22PM +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrj?l? <ville.syrjala at linux.intel.com>
> 
> 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 relaxed drm_region functions.
> That means that the src/dst regions are reduced in size in order to keep
> the scaling factor within the limits.
> 
> 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.
> 
> Signed-off-by: Ville Syrj?l? <ville.syrjala at linux.intel.com>

Skipping to the end, use of drm_rect looks good.

The one ugly that stood out is:

>  	/*
>  	 * If the sprite is completely covering the primary plane,
>  	 * we can disable the primary and save power.
>  	 */
> -	if ((crtc_x == 0) && (crtc_y == 0) &&
> +	if (visible &&
> +	    (crtc_x == 0) && (crtc_y == 0) &&
>  	    (crtc_w == primary_w) && (crtc_h == primary_h))
>  		disable_primary = true;

which would be
  disable_primary = drm_rect_equals(&dst, &clip);
  BUG_ON(disable_primary && !visible);
with a little bit of massaging of crtc/dst.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux