[PATCH drm 3/6] drm: add fence context
Alex Goins
agoins at nvidia.com
Thu Oct 22 13:00:56 PDT 2015
From: agoins <agoins at nvidia.com>
Adds new struct drm_prime_fence_ctx as field of drm_prime_member, and
initializes it when member is created. Used for keeping track of context id
and seqno of fences to be generated by PRIME.
Signed-off-by: Alex Goins <agoins at nvidia.com>
---
drivers/gpu/drm/drm_prime.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index e2e86de..2956a65 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -28,6 +28,7 @@
#include <linux/export.h>
#include <linux/dma-buf.h>
+#include <linux/reservation.h>
#include <drm/drmP.h>
#include <drm/drm_gem.h>
@@ -60,8 +61,14 @@
* use the drm_gem_prime_{import,export} helpers.
*/
+struct drm_prime_fence_ctx {
+ uint32_t context;
+ uint32_t seqno;
+};
+
struct drm_prime_member {
struct list_head entry;
+ struct drm_prime_fence_ctx fctx;
struct dma_buf *dma_buf;
uint32_t handle;
};
@@ -83,6 +90,11 @@ static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv,
get_dma_buf(dma_buf);
member->dma_buf = dma_buf;
member->handle = handle;
+
+ /* Initialize fence context for PRIME flipping */
+ member->fctx.context = fence_context_alloc(1);
+ member->fctx.seqno = 0;
+
list_add(&member->entry, &prime_fpriv->head);
return 0;
}
--
1.9.1
More information about the dri-devel
mailing list