[Intel-gfx] [PATCH 1/2] intel: Add accessor to get HW context ID from a drm_intel_context

Ian Romanick idr at freedesktop.org
Mon Nov 11 18:48:26 CET 2013


From: Ian Romanick <ian.d.romanick at intel.com>

The drm_intel_context structure is, wisely, opaque.  However, libdrm
users may want to know the hardware context ID associated with the
structure.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Ben Widawsky <ben at bwidawsk.net>
---
 intel/intel_bufmgr.h     | 1 +
 intel/intel_bufmgr_gem.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 15f818e..7b28a70 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -194,6 +194,7 @@ drm_intel_context *drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr);
 void drm_intel_gem_context_destroy(drm_intel_context *ctx);
 int drm_intel_gem_bo_context_exec(drm_intel_bo *bo, drm_intel_context *ctx,
 				  int used, unsigned int flags);
+unsigned int drm_intel_gem_context_get_hw_context_id(const drm_intel_context *);
 
 int drm_intel_bo_gem_export_to_prime(drm_intel_bo *bo, int *prime_fd);
 drm_intel_bo *drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr,
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 029ca5d..5b64a7f 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -3020,6 +3020,12 @@ drm_intel_gem_context_destroy(drm_intel_context *ctx)
 	free(ctx);
 }
 
+unsigned int
+drm_intel_gem_context_get_hw_context_id(const drm_intel_context *ctx)
+{
+	return ctx->ctx_id;
+}
+
 int
 drm_intel_reg_read(drm_intel_bufmgr *bufmgr,
 		   uint32_t offset,
-- 
1.8.1.4




More information about the Intel-gfx mailing list