drm/i915: Fix skl+ non-scaled pfit modes

Fix skl_update_scaler_crtc() to deal with different scaling
modes correctly. The current implementation assumes
DRM_MODE_SCALE_FULLSCREEN. Fortunately we don't expose any
border properties currently so the code does actually end
up doing the right thing (assigning a scaler for pfit).
The code does need to be fixed before any borders are
exposed.

Also we have redundant calls to skl_update_scaler_crtc() in
dp/hdmi .compute_config() which can be nuked. They were anyway
called before we had even computed the pfit state so were
basically nonsense. The real call we need to keep is in
intel_crtc_atomic_check().

v2: Deal witrh skl_update_scaler_crtc() in intel_dp_ycbcr420_config()

Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200422161917.17389-1-ville.syrjala@linux.intel.com
This commit is contained in:
Ville Syrjälä 2020-04-22 19:19:12 +03:00
parent 50689771c8
commit c5a01ec757
4 changed files with 19 additions and 46 deletions

View File

@ -6089,30 +6089,28 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
return 0; return 0;
} }
/** static int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state)
* skl_update_scaler_crtc - Stages update to scaler state for a given crtc.
*
* @state: crtc's scaler state
*
* Return
* 0 - scaler_usage updated successfully
* error - requested scaling cannot be supported or other error condition
*/
int skl_update_scaler_crtc(struct intel_crtc_state *state)
{ {
const struct drm_display_mode *adjusted_mode = &state->hw.adjusted_mode; const struct drm_display_mode *adjusted_mode =
bool need_scaler = false; &crtc_state->hw.adjusted_mode;
int width, height;
if (state->output_format == INTEL_OUTPUT_FORMAT_YCBCR420 || if (crtc_state->pch_pfit.enabled) {
state->pch_pfit.enabled) u32 pfit_size = crtc_state->pch_pfit.size;
need_scaler = true;
return skl_update_scaler(state, !state->hw.active, SKL_CRTC_INDEX, width = pfit_size >> 16;
&state->scaler_state.scaler_id, height = pfit_size & 0xffff;
state->pipe_src_w, state->pipe_src_h, } else {
adjusted_mode->crtc_hdisplay, width = adjusted_mode->crtc_hdisplay;
adjusted_mode->crtc_vdisplay, NULL, 0, height = adjusted_mode->crtc_vdisplay;
need_scaler); }
return skl_update_scaler(crtc_state, !crtc_state->hw.active,
SKL_CRTC_INDEX,
&crtc_state->scaler_state.scaler_id,
crtc_state->pipe_src_w, crtc_state->pipe_src_h,
width, height, NULL, 0,
crtc_state->pch_pfit.enabled);
} }
/** /**

View File

@ -591,7 +591,6 @@ void intel_crtc_arm_fifo_underrun(struct intel_crtc *crtc,
struct intel_crtc_state *crtc_state); struct intel_crtc_state *crtc_state);
u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_center); u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_center);
int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state); void skl_scaler_disable(const struct intel_crtc_state *old_crtc_state);
void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state); void ilk_pfit_disable(const struct intel_crtc_state *old_crtc_state);
u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,

View File

@ -2342,12 +2342,10 @@ intel_dp_ycbcr420_config(struct intel_dp *intel_dp,
struct drm_connector *connector, struct drm_connector *connector,
struct intel_crtc_state *crtc_state) struct intel_crtc_state *crtc_state)
{ {
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
const struct drm_display_info *info = &connector->display_info; const struct drm_display_info *info = &connector->display_info;
const struct drm_display_mode *adjusted_mode = const struct drm_display_mode *adjusted_mode =
&crtc_state->hw.adjusted_mode; &crtc_state->hw.adjusted_mode;
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
int ret;
if (!drm_mode_is_420_only(info, adjusted_mode) || if (!drm_mode_is_420_only(info, adjusted_mode) ||
!intel_dp_get_colorimetry_status(intel_dp) || !intel_dp_get_colorimetry_status(intel_dp) ||
@ -2356,14 +2354,6 @@ intel_dp_ycbcr420_config(struct intel_dp *intel_dp,
crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
/* YCBCR 420 output conversion needs a scaler */
ret = skl_update_scaler_crtc(crtc_state);
if (ret) {
drm_dbg_kms(&i915->drm,
"Scaler allocation for output failed\n");
return ret;
}
intel_pch_panel_fitting(crtc, crtc_state, DRM_MODE_SCALE_FULLSCREEN); intel_pch_panel_fitting(crtc, crtc_state, DRM_MODE_SCALE_FULLSCREEN);
return 0; return 0;
@ -2563,7 +2553,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
else else
ret = intel_dp_ycbcr420_config(intel_dp, &intel_connector->base, ret = intel_dp_ycbcr420_config(intel_dp, &intel_connector->base,
pipe_config); pipe_config);
if (ret) if (ret)
return ret; return ret;
@ -2579,12 +2568,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
intel_fixed_panel_mode(intel_connector->panel.fixed_mode, intel_fixed_panel_mode(intel_connector->panel.fixed_mode,
adjusted_mode); adjusted_mode);
if (INTEL_GEN(dev_priv) >= 9) {
ret = skl_update_scaler_crtc(pipe_config);
if (ret)
return ret;
}
if (HAS_GMCH(dev_priv)) if (HAS_GMCH(dev_priv))
intel_gmch_panel_fitting(intel_crtc, pipe_config, intel_gmch_panel_fitting(intel_crtc, pipe_config,
conn_state->scaling_mode); conn_state->scaling_mode);

View File

@ -2336,13 +2336,6 @@ intel_hdmi_ycbcr420_config(struct drm_connector *connector,
config->output_format = INTEL_OUTPUT_FORMAT_YCBCR420; config->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
/* YCBCR 420 output conversion needs a scaler */
if (skl_update_scaler_crtc(config)) {
drm_dbg_kms(&i915->drm,
"Scaler allocation for output failed\n");
return false;
}
intel_pch_panel_fitting(intel_crtc, config, intel_pch_panel_fitting(intel_crtc, config,
DRM_MODE_SCALE_FULLSCREEN); DRM_MODE_SCALE_FULLSCREEN);