On Tue, 2022-03-15 at 15:27 +0200, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Pre-determine the frontbuffer_bits for the each pipe during > intel_drrs_enable(). Will become useful for bigjoiner use cases > soon. Reviewed-by: José Roberto de Souza <jose.souza@xxxxxxxxx> > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_display_types.h | 1 + > drivers/gpu/drm/i915/display/intel_drrs.c | 11 ++++++++++- > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > index d84e82f3eab9..c94eb7d5191d 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > @@ -1302,6 +1302,7 @@ struct intel_crtc { > struct mutex mutex; > struct delayed_work work; > enum drrs_refresh_rate refresh_rate; > + unsigned int frontbuffer_bits; > unsigned int busy_frontbuffer_bits; > enum transcoder cpu_transcoder; > struct intel_link_m_n m_n, m2_n2; > diff --git a/drivers/gpu/drm/i915/display/intel_drrs.c b/drivers/gpu/drm/i915/display/intel_drrs.c > index e9d622fe66b3..91aab77c495c 100644 > --- a/drivers/gpu/drm/i915/display/intel_drrs.c > +++ b/drivers/gpu/drm/i915/display/intel_drrs.c > @@ -168,6 +168,13 @@ static void intel_drrs_set_state(struct intel_crtc *crtc, > crtc->drrs.refresh_rate = refresh_rate; > } > > +static unsigned int intel_drrs_frontbuffer_bits(const struct intel_crtc_state *crtc_state) > +{ > + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); > + > + return INTEL_FRONTBUFFER_ALL_MASK(crtc->pipe); > +} > + > /** > * intel_drrs_enable - init drrs struct if supported > * @crtc_state: A pointer to the active crtc state. > @@ -190,6 +197,7 @@ void intel_drrs_enable(const struct intel_crtc_state *crtc_state) > crtc->drrs.cpu_transcoder = crtc_state->cpu_transcoder; > crtc->drrs.m_n = crtc_state->dp_m_n; > crtc->drrs.m2_n2 = crtc_state->dp_m2_n2; > + crtc->drrs.frontbuffer_bits = intel_drrs_frontbuffer_bits(crtc_state); > crtc->drrs.busy_frontbuffer_bits = 0; > > mutex_unlock(&crtc->drrs.mutex); > @@ -216,6 +224,7 @@ void intel_drrs_disable(const struct intel_crtc_state *old_crtc_state) > intel_drrs_set_state(crtc, DRRS_REFRESH_RATE_HIGH); > > crtc->drrs.cpu_transcoder = INVALID_TRANSCODER; > + crtc->drrs.frontbuffer_bits = 0; > crtc->drrs.busy_frontbuffer_bits = 0; > > mutex_unlock(&crtc->drrs.mutex); > @@ -278,7 +287,7 @@ static void intel_drrs_frontbuffer_update(struct drm_i915_private *dev_priv, > continue; > } > > - frontbuffer_bits = all_frontbuffer_bits & INTEL_FRONTBUFFER_ALL_MASK(crtc->pipe); > + frontbuffer_bits = all_frontbuffer_bits & crtc->drrs.frontbuffer_bits; > if (invalidate) > crtc->drrs.busy_frontbuffer_bits |= frontbuffer_bits; > else