]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/i915: Provide a device level .mode_valid() hook
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Nov 2017 18:32:58 +0000 (20:32 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 29 Jan 2018 19:55:07 +0000 (21:55 +0200)
We never support certain mode flags etc. Reject those early on in the
mode_config.mode_valid() hook. That allows us to remove some duplicated
checks from the connector .mode_valid() hooks, and it guarantees that
we never see those flags even from user mode as the
mode_config.mode_valid() hooks gets executed for those as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114183258.16976-11-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_crt.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dsi.c
drivers/gpu/drm/i915/intel_dvo.c
drivers/gpu/drm/i915/intel_fbc.c
drivers/gpu/drm/i915/intel_hdmi.c
drivers/gpu/drm/i915/intel_sdvo.c

index 9f31aea51dfff27846c92a050e4d4277a0112983..1cd4a7c22bd56a37e96f05b648676bb1e05bf2e5 100644 (file)
@@ -304,9 +304,6 @@ intel_crt_mode_valid(struct drm_connector *connector,
        int max_dotclk = dev_priv->max_dotclk_freq;
        int max_clock;
 
-       if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-               return MODE_NO_DBLESCAN;
-
        if (mode->clock < 25000)
                return MODE_CLOCK_LOW;
 
index eb2322175624afbb6f09f2b0ee12c20b90033a57..9803da5fd6b34bbcbf9e1330370b16507c70aad9 100644 (file)
@@ -14082,10 +14082,37 @@ static void intel_atomic_state_free(struct drm_atomic_state *state)
        kfree(state);
 }
 
+static enum drm_mode_status
+intel_mode_valid(struct drm_device *dev,
+                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_CSYNC |
+                          DRM_MODE_FLAG_NCSYNC |
+                          DRM_MODE_FLAG_PCSYNC))
+               return MODE_HSYNC;
+
+       if (mode->flags & (DRM_MODE_FLAG_BCAST |
+                          DRM_MODE_FLAG_PIXMUX |
+                          DRM_MODE_FLAG_CLKDIV2))
+               return MODE_BAD;
+
+       return MODE_OK;
+}
+
 static const struct drm_mode_config_funcs intel_mode_funcs = {
        .fb_create = intel_user_framebuffer_create,
        .get_format_info = intel_get_format_info,
        .output_poll_changed = intel_fbdev_output_poll_changed,
+       .mode_valid = intel_mode_valid,
        .atomic_check = intel_atomic_check,
        .atomic_commit = intel_atomic_commit,
        .atomic_state_alloc = intel_atomic_state_alloc,
index f67d321376e406660c2a2e733502725ca6452975..51a1d6868b1eac8f69d5db8b9b496fbf38cc4295 100644 (file)
@@ -1266,11 +1266,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
 
        DRM_DEBUG_KMS("\n");
 
-       if (mode->flags & DRM_MODE_FLAG_DBLSCAN) {
-               DRM_DEBUG_KMS("MODE_NO_DBLESCAN\n");
-               return MODE_NO_DBLESCAN;
-       }
-
        if (fixed_mode) {
                if (mode->hdisplay > fixed_mode->hdisplay)
                        return MODE_PANEL;
index 754baa00bea925031d98b3865ece51e709405524..59c066ca14e5f576ce9104410b715d4e6c9d4d05 100644 (file)
@@ -219,9 +219,6 @@ intel_dvo_mode_valid(struct drm_connector *connector,
        int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
        int target_clock = mode->clock;
 
-       if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-               return MODE_NO_DBLESCAN;
-
        /* XXX: Validate clock range */
 
        if (fixed_mode) {
index f88c1b5dae4c16699ac9a7dbbb5ffbdef09e20b3..eee1b02c827e824001df56ddce70fe9d6e798563 100644 (file)
@@ -794,8 +794,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
                return false;
        }
 
-       if ((cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) ||
-           (cache->crtc.mode_flags & DRM_MODE_FLAG_DBLSCAN)) {
+       if (cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) {
                fbc->no_fbc_reason = "incompatible mode";
                return false;
        }
index bced7b954d93d855496bb20ebdbdd5131e5855c2..8a9a925410e5686401e69347fada0dde01adbfa1 100644 (file)
@@ -1314,9 +1314,6 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
        bool force_dvi =
                READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == HDMI_AUDIO_OFF_DVI;
 
-       if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-               return MODE_NO_DBLESCAN;
-
        clock = mode->clock;
 
        if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
index 2b8764897d68636e05636c77a582937be79896b7..0bf97ed5fface97b4dc85a1ffca51e8dd1ec08a0 100644 (file)
@@ -1607,9 +1607,6 @@ intel_sdvo_mode_valid(struct drm_connector *connector,
        struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
        int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
 
-       if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
-               return MODE_NO_DBLESCAN;
-
        if (intel_sdvo->pixel_clock_min > mode->clock)
                return MODE_CLOCK_LOW;