On Tue, Apr 16, 2013 at 01:47:22PM +0300, ville.syrjala@linux.intel.com wrote:
From: Ville Syrjälä ville.syrjala@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@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 &&
disable_primary = true;(crtc_x == 0) && (crtc_y == 0) && (crtc_w == primary_w) && (crtc_h == primary_h))
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