[PATCH v3 2/4] drm: Add drm_rect_calc_{hscale, vscale}() utility functions

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 16 07:49:58 PDT 2013


On Tue, Apr 16, 2013 at 05:14:14PM +0300, Ville Syrjälä wrote:
> 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.

Hmm, ofc you are right.  I guess I'm just not that comfortable with the
concept of relaxed scaling. Dare I ask you to split patch 4 so that you
can convince me with a solid changelog?

s/calculcated/calculated.
-Chris
-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list