[PATCH] drm/display: Call panel_fitting function from pipe_config
Nemesa Garg
nemesa.garg at intel.com
Tue Jun 25 09:43:14 UTC 2024
In panel fitter/pipe scaler scenario the pch_pfit configuration
currently takes place before we account for bigjoiner.
So once the calculation for bigjoiner is done, proper values
of width and height can be used for panel fitting.
Signed-off-by: Nemesa Garg <nemesa.garg at intel.com>
---
drivers/gpu/drm/i915/display/intel_display.c | 6 +++++
.../drm/i915/display/intel_display_types.h | 1 +
drivers/gpu/drm/i915/display/intel_dp.c | 8 +++---
drivers/gpu/drm/i915/display/intel_panel.c | 27 +++++++++++++------
4 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 7bc4f3de691e..02fba68c1093 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -4773,6 +4773,12 @@ intel_modeset_pipe_config(struct intel_atomic_state *state,
crtc->base.base.id, crtc->base.name,
base_bpp, crtc_state->pipe_bpp, crtc_state->dither);
+ if (crtc_state->pch_pfit.is_pch_required) {
+ ret = intel_panel_fitting(crtc_state, connector_state);
+ if (ret)
+ return ret;
+ }
+
return 0;
}
diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 8fe7942511f8..451ac451f539 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1246,6 +1246,7 @@ struct intel_crtc_state {
struct drm_rect dst;
bool enabled;
bool force_thru;
+ bool is_pch_required;
} pch_pfit;
/* FDI configuration, only valid if has_pch_encoder is set. */
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 3903f6ead6e6..74fa0b9062dc 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2952,11 +2952,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
return ret;
if ((intel_dp_is_edp(intel_dp) && fixed_mode) ||
- pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) {
- ret = intel_panel_fitting(pipe_config, conn_state);
- if (ret)
- return ret;
- }
+ pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) {
+ pipe_config->pch_pfit.is_pch_required = true;
+ }
pipe_config->limited_color_range =
intel_dp_limited_color_range(pipe_config, conn_state);
diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 71454ddef20f..d1110e91952c 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -410,13 +410,13 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
case DRM_MODE_SCALE_ASPECT:
/* Scale but preserve the aspect ratio */
{
- u32 scaled_width = adjusted_mode->crtc_hdisplay * pipe_src_h;
+ u32 scaled_width = adjusted_mode->crtc_hdisplay /2 * pipe_src_h;
u32 scaled_height = pipe_src_w * adjusted_mode->crtc_vdisplay;
if (scaled_width > scaled_height) { /* pillar */
width = scaled_height / pipe_src_h;
if (width & 1)
width++;
- x = (adjusted_mode->crtc_hdisplay - width + 1) / 2;
+ x = (adjusted_mode->crtc_hdisplay/2 - width + 1) / 2;
y = 0;
height = adjusted_mode->crtc_vdisplay;
} else if (scaled_width < scaled_height) { /* letter */
@@ -425,25 +425,36 @@ static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
height++;
y = (adjusted_mode->crtc_vdisplay - height + 1) / 2;
x = 0;
- width = adjusted_mode->crtc_hdisplay;
+ width = adjusted_mode->crtc_hdisplay/2;
} else {
x = y = 0;
- width = adjusted_mode->crtc_hdisplay;
+ width = adjusted_mode->crtc_hdisplay/2;
height = adjusted_mode->crtc_vdisplay;
}
}
break;
case DRM_MODE_SCALE_NONE:
+ if(crtc_state->joiner_pipes) {
+ WARN_ON(adjusted_mode->crtc_hdisplay/2 != pipe_src_w);
+ WARN_ON(adjusted_mode->crtc_vdisplay != pipe_src_h);
+ }
+ else {
WARN_ON(adjusted_mode->crtc_hdisplay != pipe_src_w);
WARN_ON(adjusted_mode->crtc_vdisplay != pipe_src_h);
+ }
fallthrough;
case DRM_MODE_SCALE_FULLSCREEN:
- x = y = 0;
- width = adjusted_mode->crtc_hdisplay;
- height = adjusted_mode->crtc_vdisplay;
+ if (crtc_state->joiner_pipes) {
+ x = y =0;
+ width = adjusted_mode->crtc_hdisplay/2;
+ height = adjusted_mode->crtc_vdisplay;
+ } else {
+ x = y = 0;
+ width = adjusted_mode->crtc_hdisplay;
+ height = adjusted_mode->crtc_vdisplay;
+ }
break;
-
default:
MISSING_CASE(conn_state->scaling_mode);
return -EINVAL;
--
2.25.1
More information about the Intel-gfx-trybot
mailing list