[Intel-gfx] [PATCH v3 4/4] drm/i915: Implement proper clipping for video sprites
Ville Syrjälä
ville.syrjala at linux.intel.com
Tue Apr 16 16:20:15 CEST 2013
On Tue, Apr 16, 2013 at 02:37:24PM +0100, Chris Wilson wrote:
> 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.
Yeah, looks nicer. I'll add drm_rect_equals() to our repertoire.
--
Ville Syrjälä
Intel OTC
More information about the Intel-gfx
mailing list