From 7daf8d54c17c6dae0c949aa37cbc6bb5604a4b2e Mon Sep 17 00:00:00 2001 From: Matt Roper Date: Thu, 29 May 2014 08:06:52 -0700 Subject: drm/plane-helper: Add drm_plane_helper_check_update() (v3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull the parameter checking from drm_primary_helper_update() out into its own function; drivers that provide their own setplane() implementations rather than using the helper may still want to share this parameter checking logic. A few of the checks here were also updated based on suggestions by Ville Syrjälä. v3: - s/primary_helper/plane_helper/ --- this checking logic may be useful for other types of planes as well. - Fix visibility check (need to dereference visibility pointer) v2: - Pass src/dest/clip rects and min/max scaling down to helper to avoid duplication of effort between helper and drivers (suggested by Ville). - Allow caller to specify whether the primary plane should be updatable while the crtc is disabled. Cc: dri-devel@lists.freedesktop.org Reviewed-by: Chon Ming Lee Signed-off-by: Matt Roper Acked-by: Dave Airlie [danvet: Include header properly and fixup declaration mismatch to make this compile.] Signed-off-by: Daniel Vetter --- include/drm/drm_plane_helper.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include') diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index c5e7ab9503c8..52e6870534b2 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h @@ -24,6 +24,17 @@ #ifndef DRM_PLANE_HELPER_H #define DRM_PLANE_HELPER_H +#include + +/* + * Drivers that don't allow primary plane scaling may pass this macro in place + * of the min/max scale parameters of the update checker function. + * + * Due to src being in 16.16 fixed point and dest being in integer pixels, + * 1<<16 represents no scaling. + */ +#define DRM_PLANE_HELPER_NO_SCALING (1<<16) + /** * DOC: plane helpers * @@ -31,6 +42,17 @@ * planes. */ +extern int drm_plane_helper_check_update(struct drm_plane *plane, + struct drm_crtc *crtc, + struct drm_framebuffer *fb, + struct drm_rect *src, + struct drm_rect *dest, + const struct drm_rect *clip, + int min_scale, + int max_scale, + bool can_position, + bool can_update_disabled, + bool *visible); extern int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, -- cgit v1.2.3