Commit 773bd825 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Extract intel_dp_output_format()

Refactor the output_format calculation into a helper so that
we can reuse it for mode validation as well.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917214335.3569-1-ville.syrjala@linux.intel.comReviewed-by: default avatarVandita Kulkarni <vandita.kulkarni@intel.com>
parent bff88b1c
...@@ -592,6 +592,22 @@ static u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, ...@@ -592,6 +592,22 @@ static u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp,
return 0; return 0;
} }
static enum intel_output_format
intel_dp_output_format(struct drm_connector *connector,
const struct drm_display_mode *mode)
{
struct intel_dp *intel_dp = intel_attached_dp(to_intel_connector(connector));
const struct drm_display_info *info = &connector->display_info;
if (!drm_mode_is_420_only(info, mode))
return INTEL_OUTPUT_FORMAT_RGB;
if (intel_dp->dfp.ycbcr_444_to_420)
return INTEL_OUTPUT_FORMAT_YCBCR444;
else
return INTEL_OUTPUT_FORMAT_YCBCR420;
}
static bool intel_dp_hdisplay_bad(struct drm_i915_private *dev_priv, static bool intel_dp_hdisplay_bad(struct drm_i915_private *dev_priv,
int hdisplay) int hdisplay)
{ {
...@@ -2430,27 +2446,20 @@ intel_dp_compute_link_config(struct intel_encoder *encoder, ...@@ -2430,27 +2446,20 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
} }
static int static int
intel_dp_ycbcr420_config(struct intel_dp *intel_dp, intel_dp_ycbcr420_config(struct intel_crtc_state *crtc_state,
struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state) const struct drm_connector_state *conn_state)
{ {
struct drm_connector *connector = conn_state->connector; struct drm_connector *connector = conn_state->connector;
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;
if (!connector->ycbcr_420_allowed) if (!connector->ycbcr_420_allowed)
return 0; return 0;
if (!drm_mode_is_420_only(info, adjusted_mode)) crtc_state->output_format = intel_dp_output_format(connector, adjusted_mode);
return 0;
if (intel_dp->dfp.ycbcr_444_to_420) { if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_YCBCR420)
crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR444;
return 0; return 0;
}
crtc_state->output_format = INTEL_OUTPUT_FORMAT_YCBCR420;
return intel_pch_panel_fitting(crtc_state, conn_state); return intel_pch_panel_fitting(crtc_state, conn_state);
} }
...@@ -2710,8 +2719,7 @@ intel_dp_compute_config(struct intel_encoder *encoder, ...@@ -2710,8 +2719,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
if (lspcon->active) if (lspcon->active)
lspcon_ycbcr420_config(&intel_connector->base, pipe_config); lspcon_ycbcr420_config(&intel_connector->base, pipe_config);
else else
ret = intel_dp_ycbcr420_config(intel_dp, pipe_config, ret = intel_dp_ycbcr420_config(pipe_config, conn_state);
conn_state);
if (ret) if (ret)
return ret; return ret;
......
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