On Tue, Feb 15, 2022 at 08:32:01PM +0200, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Deduplicate the code to convert the full timings to > per-pipe timings for bigjoiner usage. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Makes sense to have a helper to do this: Reviewed-by: Manasi Navare <manasi.d.navare@xxxxxxxxx> Manasi > --- > drivers/gpu/drm/i915/display/intel_display.c | 41 +++++++++----------- > 1 file changed, 18 insertions(+), 23 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 70017526fa81..19417ff975c6 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -2724,6 +2724,21 @@ static void intel_crtc_compute_pixel_rate(struct intel_crtc_state *crtc_state) > ilk_pipe_pixel_rate(crtc_state); > } > > +static void intel_bigjoiner_adjust_timings(const struct intel_crtc_state *crtc_state, > + struct drm_display_mode *mode) > +{ > + if (!crtc_state->bigjoiner) > + return; > + > + mode->crtc_clock /= 2; > + mode->crtc_hdisplay /= 2; > + mode->crtc_hblank_start /= 2; > + mode->crtc_hblank_end /= 2; > + mode->crtc_hsync_start /= 2; > + mode->crtc_hsync_end /= 2; > + mode->crtc_htotal /= 2; > +} > + > static void intel_splitter_adjust_timings(const struct intel_crtc_state *crtc_state, > struct drm_display_mode *mode) > { > @@ -2756,19 +2771,7 @@ static void intel_crtc_readout_derived_state(struct intel_crtc_state *crtc_state > > drm_mode_copy(pipe_mode, adjusted_mode); > > - if (crtc_state->bigjoiner) { > - /* > - * transcoder is programmed to the full mode, > - * but pipe timings are half of the transcoder mode > - */ > - pipe_mode->crtc_hdisplay /= 2; > - pipe_mode->crtc_hblank_start /= 2; > - pipe_mode->crtc_hblank_end /= 2; > - pipe_mode->crtc_hsync_start /= 2; > - pipe_mode->crtc_hsync_end /= 2; > - pipe_mode->crtc_htotal /= 2; > - pipe_mode->crtc_clock /= 2; > - } > + intel_bigjoiner_adjust_timings(crtc_state, pipe_mode); > > if (crtc_state->splitter.enable) { > intel_splitter_adjust_timings(crtc_state, pipe_mode); > @@ -2804,17 +2807,9 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, > > drm_mode_copy(pipe_mode, &crtc_state->hw.adjusted_mode); > > - /* Adjust pipe_mode for bigjoiner, with half the horizontal mode */ > - if (crtc_state->bigjoiner) { > - pipe_mode->crtc_clock /= 2; > - pipe_mode->crtc_hdisplay /= 2; > - pipe_mode->crtc_hblank_start /= 2; > - pipe_mode->crtc_hblank_end /= 2; > - pipe_mode->crtc_hsync_start /= 2; > - pipe_mode->crtc_hsync_end /= 2; > - pipe_mode->crtc_htotal /= 2; > + intel_bigjoiner_adjust_timings(crtc_state, pipe_mode); > + if (crtc_state->bigjoiner) > crtc_state->pipe_src_w /= 2; > - } > > intel_splitter_adjust_timings(crtc_state, pipe_mode); > > -- > 2.34.1 >