@@ -77,6 +77,16 @@ void intel_frontbuffer_bits_or(struct intel_frontbuffer *front, unsigned int bit
atomic_or(bits, &front->bits);
}
+bool intel_frontbuffer_get_unless_zero_raw(struct intel_frontbuffer *front)
+{
+ return kref_get_unless_zero(&front->ref);
+}
+
+void intel_frontbuffer_get_raw(struct intel_frontbuffer *front)
+{
+ kref_get(&front->ref);
+}
+
/**
* frontbuffer_flush - flush frontbuffer
* @i915: i915 device
@@ -79,6 +79,9 @@ void intel_frontbuffer_flip(struct drm_i915_private *i915,
void intel_frontbuffer_put(struct intel_frontbuffer *front);
+bool intel_frontbuffer_get_unless_zero_raw(struct intel_frontbuffer *front);
+void intel_frontbuffer_get_raw(struct intel_frontbuffer *front);
+
struct intel_frontbuffer *
intel_frontbuffer_get(struct drm_i915_gem_object *obj);
@@ -56,7 +56,7 @@ i915_gem_object_get_frontbuffer(const struct drm_i915_gem_object *obj)
if (!front)
break;
- if (unlikely(!kref_get_unless_zero(&front->ref)))
+ if (unlikely(!intel_frontbuffer_get_unless_zero_raw(front)))
continue;
if (likely(front == rcu_access_pointer(obj->frontbuffer)))
@@ -92,7 +92,7 @@ i915_gem_object_set_frontbuffer(struct drm_i915_gem_object *obj,
drm_gem_object_put(intel_bo_to_drm_bo(obj));
} else if (rcu_access_pointer(obj->frontbuffer)) {
cur = rcu_dereference_protected(obj->frontbuffer, true);
- kref_get(&cur->ref);
+ intel_frontbuffer_get_raw(cur);
} else {
drm_gem_object_get(intel_bo_to_drm_bo(obj));
rcu_assign_pointer(obj->frontbuffer, front);
Add _raw accessors for front->ref to avoid direct access from outside of intel_frontbuffer.c, in preparation for making struct intel_frontbuffer opaque. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/i915/display/intel_frontbuffer.c | 10 ++++++++++ drivers/gpu/drm/i915/display/intel_frontbuffer.h | 3 +++ drivers/gpu/drm/i915/gem/i915_gem_object_frontbuffer.h | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-)