Commit c50a115b authored by Jose Abreu's avatar Jose Abreu Committed by Daniel Vetter

drm: vc4: Use crtc->mode_valid() and encoder->mode_valid() callbacks

Now that we have a callback to check if crtc and encoder supports a
given mode we can use it in vc4 so that we restrict the number of
probed modes to the ones we can actually display.

Also, remove the mode_fixup() calls as these are no longer needed
because mode_valid() will be called before.
Signed-off-by: default avatarJose Abreu <joabreu@synopsys.com>
Cc: Carlos Palminha <palminha@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>
Cc: David Airlie <airlied@linux.ie>
Reviewed-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
Compile-tested and Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/5bea792f91074688c88a2dab8b0a90eec6e98fdf.1495720737.git.joabreu@synopsys.com
parent bb2eaba6
...@@ -546,18 +546,17 @@ static void vc4_crtc_enable(struct drm_crtc *crtc) ...@@ -546,18 +546,17 @@ static void vc4_crtc_enable(struct drm_crtc *crtc)
drm_crtc_vblank_on(crtc); drm_crtc_vblank_on(crtc);
} }
static bool vc4_crtc_mode_fixup(struct drm_crtc *crtc, static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode, const struct drm_display_mode *mode)
struct drm_display_mode *adjusted_mode)
{ {
/* Do not allow doublescan modes from user space */ /* Do not allow doublescan modes from user space */
if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) { if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
DRM_DEBUG_KMS("[CRTC:%d] Doublescan mode rejected.\n", DRM_DEBUG_KMS("[CRTC:%d] Doublescan mode rejected.\n",
crtc->base.id); crtc->base.id);
return false; return MODE_NO_DBLESCAN;
} }
return true; return MODE_OK;
} }
static int vc4_crtc_atomic_check(struct drm_crtc *crtc, static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
...@@ -867,7 +866,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = { ...@@ -867,7 +866,7 @@ static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = {
.mode_set_nofb = vc4_crtc_mode_set_nofb, .mode_set_nofb = vc4_crtc_mode_set_nofb,
.disable = vc4_crtc_disable, .disable = vc4_crtc_disable,
.enable = vc4_crtc_enable, .enable = vc4_crtc_enable,
.mode_fixup = vc4_crtc_mode_fixup, .mode_valid = vc4_crtc_mode_valid,
.atomic_check = vc4_crtc_atomic_check, .atomic_check = vc4_crtc_atomic_check,
.atomic_flush = vc4_crtc_atomic_flush, .atomic_flush = vc4_crtc_atomic_flush,
}; };
......
...@@ -224,20 +224,19 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) ...@@ -224,20 +224,19 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder)
DRM_ERROR("Failed to set clock rate: %d\n", ret); DRM_ERROR("Failed to set clock rate: %d\n", ret);
} }
static bool vc4_dpi_encoder_mode_fixup(struct drm_encoder *encoder, static enum drm_mode_status vc4_dpi_encoder_mode_valid(struct drm_encoder *encoder,
const struct drm_display_mode *mode, const struct drm_display_mode *mode)
struct drm_display_mode *adjusted_mode)
{ {
if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) if (mode->flags & DRM_MODE_FLAG_INTERLACE)
return false; return MODE_NO_INTERLACE;
return true; return MODE_OK;
} }
static const struct drm_encoder_helper_funcs vc4_dpi_encoder_helper_funcs = { static const struct drm_encoder_helper_funcs vc4_dpi_encoder_helper_funcs = {
.disable = vc4_dpi_encoder_disable, .disable = vc4_dpi_encoder_disable,
.enable = vc4_dpi_encoder_enable, .enable = vc4_dpi_encoder_enable,
.mode_fixup = vc4_dpi_encoder_mode_fixup, .mode_valid = vc4_dpi_encoder_mode_valid,
}; };
static const struct of_device_id vc4_dpi_dt_match[] = { static const struct of_device_id vc4_dpi_dt_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment