[PATCH 14/22] drm/i915/display: add intel_bo_get/set_frontbuffer() and use them
Jani Nikula
jani.nikula at intel.com
Tue Sep 17 16:13:53 UTC 2024
Add the struct drm_gem_object based interfaces.
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
drivers/gpu/drm/i915/display/intel_bo.c | 12 ++++++++++++
drivers/gpu/drm/i915/display/intel_bo.h | 4 ++++
drivers/gpu/drm/i915/display/intel_frontbuffer.c | 7 ++++---
drivers/gpu/drm/xe/display/intel_bo.c | 11 +++++++++++
4 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_bo.c b/drivers/gpu/drm/i915/display/intel_bo.c
index 5643835cdfec..3881b9ad08ee 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.c
+++ b/drivers/gpu/drm/i915/display/intel_bo.c
@@ -3,6 +3,7 @@
#include "gem/i915_gem_mman.h"
#include "gem/i915_gem_object.h"
+#include "gem/i915_gem_object_frontbuffer.h"
#include "intel_bo.h"
bool intel_bo_is_tiled(struct drm_gem_object *obj)
@@ -39,3 +40,14 @@ int intel_bo_read_from_page(struct drm_gem_object *obj, u64 offset, void *dst, i
{
return i915_gem_object_read_from_page(to_intel_bo(obj), offset, dst, size);
}
+
+struct intel_frontbuffer *intel_bo_get_frontbuffer(struct drm_gem_object *obj)
+{
+ return i915_gem_object_get_frontbuffer(to_intel_bo(obj));
+}
+
+struct intel_frontbuffer *intel_bo_set_frontbuffer(struct drm_gem_object *obj,
+ struct intel_frontbuffer *front)
+{
+ return i915_gem_object_set_frontbuffer(to_intel_bo(obj), front);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_bo.h b/drivers/gpu/drm/i915/display/intel_bo.h
index 2aab8e25b471..df0bd8c871a5 100644
--- a/drivers/gpu/drm/i915/display/intel_bo.h
+++ b/drivers/gpu/drm/i915/display/intel_bo.h
@@ -17,4 +17,8 @@ void intel_bo_flush_if_display(struct drm_gem_object *obj);
int intel_bo_fb_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
int intel_bo_read_from_page(struct drm_gem_object *obj, u64 offset, void *dst, int size);
+struct intel_frontbuffer *intel_bo_get_frontbuffer(struct drm_gem_object *obj);
+struct intel_frontbuffer *intel_bo_set_frontbuffer(struct drm_gem_object *obj,
+ struct intel_frontbuffer *front);
+
#endif /* __INTEL_BO__ */
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.c b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
index e56d596485c3..1be72901efb0 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.c
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.c
@@ -59,6 +59,7 @@
#include "gem/i915_gem_object_types.h"
#include "i915_active.h"
#include "i915_drv.h"
+#include "intel_bo.h"
#include "intel_display_trace.h"
#include "intel_display_types.h"
#include "intel_dp.h"
@@ -266,7 +267,7 @@ static void frontbuffer_release(struct kref *ref)
i915_ggtt_clear_scanout(obj);
- ret = i915_gem_object_set_frontbuffer(obj, NULL);
+ ret = intel_bo_set_frontbuffer(intel_bo_to_drm_bo(obj), NULL);
drm_WARN_ON(&intel_bo_to_i915(obj)->drm, ret);
spin_unlock(&intel_bo_to_i915(obj)->display.fb_tracking.lock);
@@ -280,7 +281,7 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj)
struct drm_i915_private *i915 = intel_bo_to_i915(obj);
struct intel_frontbuffer *front, *cur;
- front = i915_gem_object_get_frontbuffer(obj);
+ front = intel_bo_get_frontbuffer(intel_bo_to_drm_bo(obj));
if (front)
return front;
@@ -298,7 +299,7 @@ intel_frontbuffer_get(struct drm_i915_gem_object *obj)
INIT_WORK(&front->flush_work, intel_frontbuffer_flush_work);
spin_lock(&i915->display.fb_tracking.lock);
- cur = i915_gem_object_set_frontbuffer(obj, front);
+ cur = intel_bo_set_frontbuffer(intel_bo_to_drm_bo(obj), front);
spin_unlock(&i915->display.fb_tracking.lock);
if (cur != front)
kfree(front);
diff --git a/drivers/gpu/drm/xe/display/intel_bo.c b/drivers/gpu/drm/xe/display/intel_bo.c
index c93bc77ad535..d4007b00b121 100644
--- a/drivers/gpu/drm/xe/display/intel_bo.c
+++ b/drivers/gpu/drm/xe/display/intel_bo.c
@@ -66,3 +66,14 @@ int intel_bo_read_from_page(struct drm_gem_object *obj, u64 offset, void *dst, i
xe_bo_unlock(bo);
return ret;
}
+
+struct intel_frontbuffer *intel_bo_get_frontbuffer(struct drm_gem_object *obj)
+{
+ return NULL;
+}
+
+struct intel_frontbuffer *intel_bo_set_frontbuffer(struct drm_gem_object *obj,
+ struct intel_frontbuffer *front)
+{
+ return front;
+}
--
2.39.2
More information about the Intel-gfx
mailing list