[Intel-gfx] [PATCH v3 2/4] drm: Add drm_rect_calc_{hscale, vscale}() utility functions
Ville Syrjälä
ville.syrjala at linux.intel.com
Tue Apr 16 16:14:14 CEST 2013
On Tue, Apr 16, 2013 at 02:42:34PM +0100, Chris Wilson wrote:
> On Tue, Apr 16, 2013 at 01:47:20PM +0300, ville.syrjala at linux.intel.com wrote:
> > diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> > index 2b7278c..de24f16 100644
> > --- a/include/drm/drm_rect.h
> > +++ b/include/drm/drm_rect.h
> > @@ -128,5 +128,17 @@ bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip);
> > bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
> > const struct drm_rect *clip,
> > int hscale, int vscale);
> > +int drm_rect_calc_hscale(const struct drm_rect *src,
> > + const struct drm_rect *dst,
> > + int min_hscale, int max_hscale);
> > +int drm_rect_calc_vscale(const struct drm_rect *src,
> > + const struct drm_rect *dst,
> > + int min_vscale, int max_vscale);
> > +int drm_rect_calc_hscale_relaxed(struct drm_rect *src,
> > + struct drm_rect *dst,
> > + int min_hscale, int max_hscale);
> > +int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
> > + struct drm_rect *dst,
> > + int min_vscale, int max_vscale);
>
> These struct drm_rect *src should be const so it is clear that dst is
> being manipulated.
Actually they can manipulate either src or dst, depending on whether
we're trying upscale or downscale too much. The idea being that we
can only decrease the size of either rect, never increase.
--
Ville Syrjälä
Intel OTC
More information about the Intel-gfx
mailing list