diff options
-rw-r--r-- | drivers/gpu/drm/drm_atomic.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_mode_config.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 45 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 3 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 1 | ||||
-rw-r--r-- | include/drm/drm_mode_config.h | 1 |
7 files changed, 29 insertions, 34 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index f0e3e96ebf7b..3568a354c2d3 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -522,6 +522,9 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, } else if (property == config->prop_pipe_src_h) { state->src_h = val; state->pipescaler_changed = true; + } else if (property == config->prop_fitting_mode) { + state->fitting_mode = val; + state->pipescaler_changed = true; } else if (crtc->funcs->atomic_set_property) return crtc->funcs->atomic_set_property(crtc, state, property, val); else @@ -570,6 +573,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = state->src_w; else if (property == config->prop_pipe_src_h) *val = state->src_h; + else if (property == config->prop_fitting_mode) + *val = state->fitting_mode; else if (crtc->funcs->atomic_get_property) return crtc->funcs->atomic_get_property(crtc, state, property, val); else diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 989691264b6a..766641709e66 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -340,6 +340,8 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, config->prop_pipe_src_w, 0); drm_object_attach_property(&crtc->base, config->prop_pipe_src_h, 0); + drm_object_attach_property(&crtc->base, + config->prop_fitting_mode, 0); } return 0; diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index c9a33d456803..5b512fc6b718 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -348,6 +348,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.prop_pipe_src_h = prop; + prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC, + "SCALER_MODE", 0, INT_MAX); + if (!prop) + return -ENOMEM; + dev->mode_config.prop_fitting_mode = prop; + return 0; } diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5d80a9415e53..ef783a98c007 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -10929,48 +10929,25 @@ static bool check_single_encoder_cloning(struct drm_atomic_state *state, static int skylake_pfiter_calculate(struct drm_crtc *crtc, struct drm_crtc_state *crtc_state) { - struct drm_device *dev = crtc->dev; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc_state *pipe_config = to_intel_crtc_state(crtc_state); bool mode_changed = needs_modeset(crtc_state); - struct intel_connector *intel_connector; int ret = 0; - struct drm_display_mode *adjusted_mode = - &intel_crtc->config->base.adjusted_mode; - - for_each_intel_connector(dev, intel_connector) { - if (!(intel_connector) || !(intel_connector->encoder) || - (intel_connector->encoder->base.crtc != crtc)) - continue; - if (((pipe_config->pipe_src_w != - intel_crtc->config->pipe_src_w) || - (pipe_config->pipe_src_h != - intel_crtc->config->pipe_src_h)) && (!mode_changed)) + if (((pipe_config->pipe_scaling_mode != + intel_crtc->config->pipe_scaling_mode) || + (pipe_config->pipe_src_w != intel_crtc->config->pipe_src_w) || + (pipe_config->pipe_src_h != intel_crtc->config->pipe_src_h)) && + (!mode_changed)) { pipe_config->update_pipe = true; + } - if ((pipe_config->pipe_scaling_mode != - intel_connector->panel.fitting_mode) && - (!mode_changed)) { - if ((adjusted_mode->hdisplay != - pipe_config->pipe_src_w) || - (adjusted_mode->vdisplay != - pipe_config->pipe_src_h)) { - pipe_config->pipe_scaling_mode = - intel_connector->panel.fitting_mode; - pipe_config->update_pipe = true; - } - } - - if ((mode_changed) || (pipe_config->update_pipe)) { - ret = skl_update_scaler_crtc(pipe_config); - if (ret) - break; + if ((mode_changed) || (pipe_config->update_pipe)) { + ret = skl_update_scaler_crtc(pipe_config); + if (!ret) intel_pch_panel_fitting(intel_crtc, pipe_config, - intel_connector->panel.fitting_mode); - break; - } + pipe_config->pipe_scaling_mode); } return ret; } @@ -12533,6 +12510,8 @@ static int intel_atomic_check(struct drm_device *dev, } pipe_config->pipe_src_w = crtc_state->src_w; pipe_config->pipe_src_h = crtc_state->src_h; + pipe_config->pipe_scaling_mode = + crtc_state->fitting_mode; crtc_state->pipescaler_changed = false; } diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 780eaca58885..a3b0a99b89bf 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -106,6 +106,7 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc, int fitting_mode) { const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; + struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev); int x = 0, y = 0, width = 0, height = 0; bool downscale = false; @@ -115,7 +116,7 @@ intel_pch_panel_fitting(struct intel_crtc *intel_crtc, goto done; /* Downscale pfiter */ - if (IS_GEN9(intel_crtc->base.dev) && + if (IS_GEN9(dev_priv) && (adjusted_mode->hdisplay < pipe_config->pipe_src_w || adjusted_mode->vdisplay < pipe_config->pipe_src_h)) downscale = true; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d26184f2f05a..bf5e679a8729 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -217,6 +217,7 @@ struct drm_crtc_state { bool pipescaler_changed; u32 src_w, src_h; + u32 fitting_mode; }; /** diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index a7857dd93164..6ef878944f79 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -539,6 +539,7 @@ struct drm_mode_config { /* pipe scaler properties */ struct drm_property *prop_pipe_src_w; struct drm_property *prop_pipe_src_h; + struct drm_property *prop_fitting_mode; /** * @dvi_i_subconnector_property: Optional DVI-I property to |