diff mbox

[1/7] drm/plane-helper: Test for plane disable earlier

Message ID 1418154823-10819-2-git-send-email-matthew.d.roper@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Matt Roper Dec. 9, 2014, 7:53 p.m. UTC
drm_plane_helper_check_update() currently uses crtc before testing whether
we're disabling the plane (fb == NULL).  Move the fb test before the first crtc
usage so that crtc == NULL doesn't have to be handled by the caller.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 drivers/gpu/drm/drm_plane_helper.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Comments

Daniel Vetter Dec. 10, 2014, 10:05 a.m. UTC | #1
On Tue, Dec 09, 2014 at 11:53:37AM -0800, Matt Roper wrote:
> drm_plane_helper_check_update() currently uses crtc before testing whether
> we're disabling the plane (fb == NULL).  Move the fb test before the first crtc
> usage so that crtc == NULL doesn't have to be handled by the caller.
> 
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

Makes sense, but can you please resubmit with dri-devel cced?

Thanks, Daniel

> ---
>  drivers/gpu/drm/drm_plane_helper.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index ae61fb2..f24c4cf 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -142,6 +142,17 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  {
>  	int hscale, vscale;
>  
> +	if (!fb) {
> +		*visible = false;
> +		return 0;
> +	}
> +
> +	/* crtc should only be NULL when disabling (i.e., !fb) */
> +	if (WARN_ON(!crtc)) {
> +		*visible = false;
> +		return 0;
> +	}
> +
>  	if (!crtc->enabled && !can_update_disabled) {
>  		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
>  		return -EINVAL;
> @@ -155,11 +166,6 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
>  		return -ERANGE;
>  	}
>  
> -	if (!fb) {
> -		*visible = false;
> -		return 0;
> -	}
> -
>  	*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
>  	if (!*visible)
>  		/*
> -- 
> 1.8.5.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index ae61fb2..f24c4cf 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -142,6 +142,17 @@  int drm_plane_helper_check_update(struct drm_plane *plane,
 {
 	int hscale, vscale;
 
+	if (!fb) {
+		*visible = false;
+		return 0;
+	}
+
+	/* crtc should only be NULL when disabling (i.e., !fb) */
+	if (WARN_ON(!crtc)) {
+		*visible = false;
+		return 0;
+	}
+
 	if (!crtc->enabled && !can_update_disabled) {
 		DRM_DEBUG_KMS("Cannot update plane of a disabled CRTC.\n");
 		return -EINVAL;
@@ -155,11 +166,6 @@  int drm_plane_helper_check_update(struct drm_plane *plane,
 		return -ERANGE;
 	}
 
-	if (!fb) {
-		*visible = false;
-		return 0;
-	}
-
 	*visible = drm_rect_clip_scaled(src, dest, clip, hscale, vscale);
 	if (!*visible)
 		/*