summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/display/intel_frontbuffer.h
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2022-08-24 16:15:56 +0300
committerJani Nikula <jani.nikula@intel.com>2022-08-29 13:37:05 +0300
commitdf22d67e5f3d91ce6f0b0f64ccc14d016c89d956 (patch)
tree7f677fce09d049ceb251418c44bf2b48a3342258 /drivers/gpu/drm/i915/display/intel_frontbuffer.h
parent44eba1b85119a8f2d44a47bb3e8c5c608a05eba4 (diff)
drm/i915: move INTEL_FRONTBUFFER_* macros to intel_frontbuffer.h
The macros clearly don't belong in i915_drv.h. Move to intel_frontbuffer.h. Also split the BUILD_BUG_ON()s to intel_frontbuffer_track() to avoid depending on some other macros in the header. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/c899fd1ef2220564a876cd88c03e53c4c7b0168b.1661346845.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/display/intel_frontbuffer.h')
-rw-r--r--drivers/gpu/drm/i915/display/intel_frontbuffer.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_frontbuffer.h b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
index ff0c37b079aa..3c474ed937fb 100644
--- a/drivers/gpu/drm/i915/display/intel_frontbuffer.h
+++ b/drivers/gpu/drm/i915/display/intel_frontbuffer.h
@@ -25,6 +25,7 @@
#define __INTEL_FRONTBUFFER_H__
#include <linux/atomic.h>
+#include <linux/bits.h>
#include <linux/kref.h>
#include "gem/i915_gem_object_types.h"
@@ -48,6 +49,23 @@ struct intel_frontbuffer {
struct rcu_head rcu;
};
+/*
+ * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is
+ * considered to be the frontbuffer for the given plane interface-wise. This
+ * doesn't mean that the hw necessarily already scans it out, but that any
+ * rendering (by the cpu or gpu) will land in the frontbuffer eventually.
+ *
+ * We have one bit per pipe and per scanout plane type.
+ */
+#define INTEL_FRONTBUFFER_BITS_PER_PIPE 8
+#define INTEL_FRONTBUFFER(pipe, plane_id) \
+ BIT((plane_id) + INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe));
+#define INTEL_FRONTBUFFER_OVERLAY(pipe) \
+ BIT(INTEL_FRONTBUFFER_BITS_PER_PIPE - 1 + INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))
+#define INTEL_FRONTBUFFER_ALL_MASK(pipe) \
+ GENMASK(INTEL_FRONTBUFFER_BITS_PER_PIPE * ((pipe) + 1) - 1, \
+ INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))
+
void intel_frontbuffer_flip_prepare(struct drm_i915_private *i915,
unsigned frontbuffer_bits);
void intel_frontbuffer_flip_complete(struct drm_i915_private *i915,