diff mbox

drm: check that planes types are correct while initializing CRTC

Message ID 1426590329-27983-1-git-send-email-benjamin.gaignard@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Benjamin Gaignard March 17, 2015, 11:05 a.m. UTC
Be warned if primary or cursor planes haven't the correct type

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
---
 drivers/gpu/drm/drm_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Daniel Vetter March 17, 2015, 1:03 p.m. UTC | #1
On Tue, Mar 17, 2015 at 12:05:29PM +0100, Benjamin Gaignard wrote:
> Be warned if primary or cursor planes haven't the correct type
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

Yeah that's a useful self-check to make sure universal plane conversions
are done correctly. Merged to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_crtc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 5785336..111849c4 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -659,6 +659,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
>  	struct drm_mode_config *config = &dev->mode_config;
>  	int ret;
>  
> +	WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY);
> +	WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
> +
>  	crtc->dev = dev;
>  	crtc->funcs = funcs;
>  	crtc->invert_dimensions = false;
> -- 
> 1.9.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 5785336..111849c4 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -659,6 +659,9 @@  int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
 	struct drm_mode_config *config = &dev->mode_config;
 	int ret;
 
+	WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY);
+	WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
+
 	crtc->dev = dev;
 	crtc->funcs = funcs;
 	crtc->invert_dimensions = false;