Add helpers for ->bits in preparation for making struct intel_frontbuffer opaque. Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- drivers/gpu/drm/i915/display/intel_fb.c | 2 +- drivers/gpu/drm/i915/display/intel_frontbuffer.c | 10 ++++++++++ drivers/gpu/drm/i915/display/intel_frontbuffer.h | 3 +++ drivers/gpu/drm/i915/display/intel_plane_initial.c | 2 +- drivers/gpu/drm/xe/display/xe_plane_initial.c | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fb.c b/drivers/gpu/drm/i915/display/intel_fb.c index 8069abf91c5e..a49b5a1589a6 100644 --- a/drivers/gpu/drm/i915/display/intel_fb.c +++ b/drivers/gpu/drm/i915/display/intel_fb.c @@ -1965,7 +1965,7 @@ static int intel_user_framebuffer_dirty(struct drm_framebuffer *fb, struct frontbuffer_fence_cb *cb; int ret = 0; - if (!atomic_read(&front->bits)) + if (!intel_frontbuffer_bits(front)) return 0; if (dma_resv_test_signaled(intel_bo_to_drm_bo(obj)->resv, dma_resv_usage_rw(false))) diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c index 7964eaa6a60a..effb13e8a6bb 100644 --- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c +++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c @@ -67,6 +67,16 @@ #include "intel_psr.h" #include "intel_tdf.h" +unsigned int intel_frontbuffer_bits(struct intel_frontbuffer *front) +{ + return atomic_read(&front->bits); +} + +void intel_frontbuffer_bits_or(struct intel_frontbuffer *front, unsigned int bits) +{ + atomic_or(bits, &front->bits); +} + /** * frontbuffer_flush - flush frontbuffer * @i915: i915 device diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.h b/drivers/gpu/drm/i915/display/intel_frontbuffer.h index f4a3495300de..827b0129da71 100644 --- a/drivers/gpu/drm/i915/display/intel_frontbuffer.h +++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.h @@ -67,6 +67,9 @@ struct intel_frontbuffer { GENMASK(INTEL_FRONTBUFFER_BITS_PER_PIPE * ((pipe) + 1) - 1, \ INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)) +unsigned int intel_frontbuffer_bits(struct intel_frontbuffer *front); +void intel_frontbuffer_bits_or(struct intel_frontbuffer *front, unsigned int bits); + void intel_frontbuffer_flip_prepare(struct drm_i915_private *i915, unsigned frontbuffer_bits); void intel_frontbuffer_flip_complete(struct drm_i915_private *i915, diff --git a/drivers/gpu/drm/i915/display/intel_plane_initial.c b/drivers/gpu/drm/i915/display/intel_plane_initial.c index ada1792df5b3..7cc9863ffce8 100644 --- a/drivers/gpu/drm/i915/display/intel_plane_initial.c +++ b/drivers/gpu/drm/i915/display/intel_plane_initial.c @@ -391,7 +391,7 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc, plane_state->uapi.crtc = &crtc->base; intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc); - atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); + intel_frontbuffer_bits_or(to_intel_frontbuffer(fb), plane->frontbuffer_bit); } static void plane_config_fini(struct intel_initial_plane_config *plane_config) diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c index e135b20962d9..a838459c49ae 100644 --- a/drivers/gpu/drm/xe/display/xe_plane_initial.c +++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c @@ -232,7 +232,7 @@ intel_find_initial_plane_obj(struct intel_crtc *crtc, plane_state->uapi.crtc = &crtc->base; intel_plane_copy_uapi_to_hw_state(plane_state, plane_state, crtc); - atomic_or(plane->frontbuffer_bit, &to_intel_frontbuffer(fb)->bits); + intel_frontbuffer_bits_or(to_intel_frontbuffer(fb), plane->frontbuffer_bit); plane_config->vma = vma; -- 2.39.2