Commit e995ca0b authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Provide a device level .mode_valid() hook

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171114183258.16976-11-ville.syrjala@linux.intel.comReviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 75a655e0
...@@ -304,9 +304,6 @@ intel_crt_mode_valid(struct drm_connector *connector, ...@@ -304,9 +304,6 @@ intel_crt_mode_valid(struct drm_connector *connector,
int max_dotclk = dev_priv->max_dotclk_freq; int max_dotclk = dev_priv->max_dotclk_freq;
int max_clock; int max_clock;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN;
if (mode->clock < 25000) if (mode->clock < 25000)
return MODE_CLOCK_LOW; return MODE_CLOCK_LOW;
......
...@@ -14082,10 +14082,37 @@ static void intel_atomic_state_free(struct drm_atomic_state *state) ...@@ -14082,10 +14082,37 @@ static void intel_atomic_state_free(struct drm_atomic_state *state)
kfree(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 = { static const struct drm_mode_config_funcs intel_mode_funcs = {
.fb_create = intel_user_framebuffer_create, .fb_create = intel_user_framebuffer_create,
.get_format_info = intel_get_format_info, .get_format_info = intel_get_format_info,
.output_poll_changed = intel_fbdev_output_poll_changed, .output_poll_changed = intel_fbdev_output_poll_changed,
.mode_valid = intel_mode_valid,
.atomic_check = intel_atomic_check, .atomic_check = intel_atomic_check,
.atomic_commit = intel_atomic_commit, .atomic_commit = intel_atomic_commit,
.atomic_state_alloc = intel_atomic_state_alloc, .atomic_state_alloc = intel_atomic_state_alloc,
......
...@@ -1266,11 +1266,6 @@ intel_dsi_mode_valid(struct drm_connector *connector, ...@@ -1266,11 +1266,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
DRM_DEBUG_KMS("\n"); 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 (fixed_mode) {
if (mode->hdisplay > fixed_mode->hdisplay) if (mode->hdisplay > fixed_mode->hdisplay)
return MODE_PANEL; return MODE_PANEL;
......
...@@ -219,9 +219,6 @@ intel_dvo_mode_valid(struct drm_connector *connector, ...@@ -219,9 +219,6 @@ intel_dvo_mode_valid(struct drm_connector *connector,
int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; int max_dotclk = to_i915(connector->dev)->max_dotclk_freq;
int target_clock = mode->clock; int target_clock = mode->clock;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN;
/* XXX: Validate clock range */ /* XXX: Validate clock range */
if (fixed_mode) { if (fixed_mode) {
......
...@@ -794,8 +794,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc) ...@@ -794,8 +794,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
return false; return false;
} }
if ((cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) || if (cache->crtc.mode_flags & DRM_MODE_FLAG_INTERLACE) {
(cache->crtc.mode_flags & DRM_MODE_FLAG_DBLSCAN)) {
fbc->no_fbc_reason = "incompatible mode"; fbc->no_fbc_reason = "incompatible mode";
return false; return false;
} }
......
...@@ -1314,9 +1314,6 @@ intel_hdmi_mode_valid(struct drm_connector *connector, ...@@ -1314,9 +1314,6 @@ intel_hdmi_mode_valid(struct drm_connector *connector,
bool force_dvi = bool force_dvi =
READ_ONCE(to_intel_digital_connector_state(connector->state)->force_audio) == HDMI_AUDIO_OFF_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; clock = mode->clock;
if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING)
......
...@@ -1607,9 +1607,6 @@ intel_sdvo_mode_valid(struct drm_connector *connector, ...@@ -1607,9 +1607,6 @@ intel_sdvo_mode_valid(struct drm_connector *connector,
struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector); struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
int max_dotclk = to_i915(connector->dev)->max_dotclk_freq; 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) if (intel_sdvo->pixel_clock_min > mode->clock)
return MODE_CLOCK_LOW; return MODE_CLOCK_LOW;
......
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