From: Ville Syrjälä <[email protected]> Extract the "do we have a DSB and should be use it?" check into a helper. This mirrors intel_flipq_supported() and should help unify the logic around selecting the codepath which will be used to perform the commit (mmio vs. DSB. vs. flip queue).
Signed-off-by: Ville Syrjälä <[email protected]> --- drivers/gpu/drm/i915/display/intel_dsb.c | 13 +++++++++---- drivers/gpu/drm/i915/display/intel_dsb.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index d9a270362a82..8e01e1eed291 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -1025,6 +1025,14 @@ void intel_dsb_wait(struct intel_dsb *dsb) dsb_error_int_status(display) | DSB_PROG_INT_STATUS); } +bool intel_dsb_supported(struct intel_display *display) +{ + if (!display->params.enable_dsb) + return false; + + return HAS_DSB(display); +} + /** * intel_dsb_prepare() - Allocate, pin and map the DSB command buffer. * @state: the atomic state @@ -1049,10 +1057,7 @@ struct intel_dsb *intel_dsb_prepare(struct intel_atomic_state *state, struct intel_dsb *dsb; unsigned int size; - if (!HAS_DSB(display)) - return NULL; - - if (!display->params.enable_dsb) + if (!intel_dsb_supported(display)) return NULL; dsb = kzalloc_obj(*dsb); diff --git a/drivers/gpu/drm/i915/display/intel_dsb.h b/drivers/gpu/drm/i915/display/intel_dsb.h index 3dcca9ed5371..87d9c90da08f 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.h +++ b/drivers/gpu/drm/i915/display/intel_dsb.h @@ -26,6 +26,7 @@ enum intel_dsb_id { I915_MAX_DSBS, }; +bool intel_dsb_supported(struct intel_display *display); unsigned int intel_dsb_size(struct intel_dsb *dsb); unsigned int intel_dsb_head(struct intel_dsb *dsb); struct intel_dsb *intel_dsb_prepare(struct intel_atomic_state *state, -- 2.54.0
