diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2013-04-24 19:52:35 +0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-05-01 00:19:39 +0400 |
commit | 4954c4282f6b945f1dd5716f92b594a07fa4ffe3 (patch) | |
tree | 3c72d5bd093e1c066cd1ef8c0f9608231ad4d44f /include/drm/drm_rect.h | |
parent | 3512f976d252bd5d07d04e9e157f0cd210c959a0 (diff) | |
download | linux-4954c4282f6b945f1dd5716f92b594a07fa4ffe3.tar.xz |
drm: Add drm_rect_calc_{hscale, vscale}() utility functions
These functions calculate the scaling factor based on the source and
destination rectangles.
There are two version of the functions, the strict ones that will
return an error if the min/max scaling factor is exceeded, and the
relaxed versions that will adjust the src/dst rectangles in order to
keep the scaling factor withing the limits.
v2: Return error instead of adjusting regions, refactor common parts
into one function, and split into strict and relaxed versions.
v3: Renamed drm_region to drm_rect, add "_rect_" to the function
names.
v4: Fix "calculcate" typos
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm/drm_rect.h')
-rw-r--r-- | include/drm/drm_rect.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h index 2b7278c1bc42..de24f16a3c4f 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); #endif |