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 ec2a3fb171ab..ab176cb4e4bd 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -915,6 +915,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 @@ -939,10 +947,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(sizeof(*dsb), GFP_KERNEL); diff --git a/drivers/gpu/drm/i915/display/intel_dsb.h b/drivers/gpu/drm/i915/display/intel_dsb.h index 2f31f2c1d0c5..e97a44c72f7a 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.51.2
