diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2018-07-14 12:17:45 +0200 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2019-05-17 13:16:32 +0200 |
commit | 7f07ce0f04e25cd41a85ee780dbe85b40c9e3482 (patch) | |
tree | 7000e784b0e5066dc04c44b6e234001923fb4e36 /drivers/gpu/drm/armada | |
parent | drm/armada: add drm_atomic_helper_shutdown() call in tear-down (diff) | |
download | linux-7f07ce0f04e25cd41a85ee780dbe85b40c9e3482.tar.xz linux-7f07ce0f04e25cd41a85ee780dbe85b40c9e3482.zip |
drm/armada: add CRTC mode validation
Add CRTC mode validation to reject modes that the CRTC does not support.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/armada')
-rw-r--r-- | drivers/gpu/drm/armada/armada_crtc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index d802a6bc2d9f..edce74f60198 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -168,6 +168,25 @@ static void armada_drm_update_gamma(struct drm_crtc *crtc) } } +static enum drm_mode_status armada_drm_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + if (mode->vscan > 1) + return MODE_NO_VSCAN; + + if (mode->flags & DRM_MODE_FLAG_DBLSCAN) + return MODE_NO_DBLESCAN; + + if (mode->flags & DRM_MODE_FLAG_HSKEW) + return MODE_H_ILLEGAL; + + if (mode->flags & (DRM_MODE_FLAG_BCAST | DRM_MODE_FLAG_PIXMUX | + DRM_MODE_FLAG_CLKDIV2)) + return MODE_BAD; + + return MODE_OK; +} + /* The mode_config.mutex will be held for this call */ static bool armada_drm_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adj) @@ -499,6 +518,7 @@ static void armada_drm_crtc_atomic_enable(struct drm_crtc *crtc, } static const struct drm_crtc_helper_funcs armada_crtc_helper_funcs = { + .mode_valid = armada_drm_crtc_mode_valid, .mode_fixup = armada_drm_crtc_mode_fixup, .mode_set_nofb = armada_drm_crtc_mode_set_nofb, .atomic_check = armada_drm_crtc_atomic_check, |