forked from Minki/linux
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: 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>
This commit is contained in:
parent
75a655e0a2
commit
e995ca0b81
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user