On Mon, Nov 20, 2017 at 09:01:07AM +0100, Daniel Vetter wrote: > On Tue, Nov 14, 2017 at 08:32:58PM +0200, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > > > 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@xxxxxxxxxxxxxxx> > > --- > > drivers/gpu/drm/i915/intel_crt.c | 3 --- > > drivers/gpu/drm/i915/intel_display.c | 27 +++++++++++++++++++++++++++ > > drivers/gpu/drm/i915/intel_dsi.c | 5 ----- > > drivers/gpu/drm/i915/intel_dvo.c | 3 --- > > drivers/gpu/drm/i915/intel_fbc.c | 3 +-- > > drivers/gpu/drm/i915/intel_hdmi.c | 3 --- > > drivers/gpu/drm/i915/intel_sdvo.c | 3 --- > > 7 files changed, 28 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c > > index 9f31aea51dff..1cd4a7c22bd5 100644 > > --- a/drivers/gpu/drm/i915/intel_crt.c > > +++ b/drivers/gpu/drm/i915/intel_crt.c > > @@ -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; > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > > index ed6a4a8d9273..fec76147d8e5 100644 > > --- a/drivers/gpu/drm/i915/intel_display.c > > +++ b/drivers/gpu/drm/i915/intel_display.c > > @@ -14151,10 +14151,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; > > +} > > Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx> And I'm kinda leaning towards moving the rejection of the old crud into the core, but that's a different thing. -Daniel > > > + > > 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, > > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c > > index f09474b0c4d3..c9b5a956c30a 100644 > > --- a/drivers/gpu/drm/i915/intel_dsi.c > > +++ b/drivers/gpu/drm/i915/intel_dsi.c > > @@ -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; > > diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c > > index 754baa00bea9..59c066ca14e5 100644 > > --- a/drivers/gpu/drm/i915/intel_dvo.c > > +++ b/drivers/gpu/drm/i915/intel_dvo.c > > @@ -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) { > > diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c > > index 1a0f5e0c8d10..f0e74477c678 100644 > > --- a/drivers/gpu/drm/i915/intel_fbc.c > > +++ b/drivers/gpu/drm/i915/intel_fbc.c > > @@ -789,8 +789,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; > > } > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > > index 2d95db64cdf2..7ce3d14153b4 100644 > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > @@ -1311,9 +1311,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) > > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c > > index 2b8764897d68..0bf97ed5ffac 100644 > > --- a/drivers/gpu/drm/i915/intel_sdvo.c > > +++ b/drivers/gpu/drm/i915/intel_sdvo.c > > @@ -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; > > > > -- > > 2.13.6 > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@xxxxxxxxxxxxxxxxxxxxx > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx