dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libdrm] intel: Add a getter for the intel_context ctx_id
@ 2016-11-17 13:00 Robert Bragg
  2016-11-21 16:23 ` [PATCH libdrm v2] " Robert Bragg
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Bragg @ 2016-11-17 13:00 UTC (permalink / raw)
  To: dri-devel

I forgot that my recently sent out i915-perf i-g-t tests depend on this utility
api (not just my Mesa / GL_INTEL_performance_query patches).

Not all tests in i-g-t use libdrm to create contexts, but the i915-perf tests
use render_copy (drm_intel_context based) while testing single context
filtering and so want to pluck out the u32 ctx_id for passing to i915-perf.

I made a last moment tweak to the utility to return an error value separate
from a uint32_t output ctx_id pointer, so there will need to be a corresponding
tweak of the perf.c tests I sent out.

Regards,
- Robert

--- >8 ---

Exposing the u32 context ID makes it possible to define new drm kernel
interfaces based on the same IDs that e.g. execbuf uses to identify a
gem context, that aren't themselves abstracted by libdrm but need to be
used by libdrm/drm_intel_context based clients such as (parts of) i-g-t
or Mesa.

For example this can be used to configure an i915-perf stream to collect
metrics for a specific context.

Signed-off: Robert Bragg <robert@sixbynine.org>
---
 intel/intel_bufmgr.h     |  2 ++
 intel/intel_bufmgr_gem.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index ce4e70d..7530fa5 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -212,6 +212,8 @@ int drm_intel_bufmgr_gem_get_devid(drm_intel_bufmgr *bufmgr);
 int drm_intel_gem_bo_wait(drm_intel_bo *bo, int64_t timeout_ns);
 
 drm_intel_context *drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr);
+int drm_intel_gem_context_get_context_id(drm_intel_context *ctx,
+					 uint32_t *ctx_id);
 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);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 15c79b3..cefe4a7 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -3184,6 +3184,17 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
 	return context;
 }
 
+int
+drm_intel_gem_context_get_context_id(drm_intel_context *ctx, uint32_t *ctx_id)
+{
+	if (ctx == NULL)
+		return -EINVAL;
+
+	*ctx_id = ctx->ctx_id;
+
+	return 0;
+}
+
 void
 drm_intel_gem_context_destroy(drm_intel_context *ctx)
 {
-- 
2.10.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH libdrm v2] intel: Add a getter for the intel_context ctx_id
  2016-11-17 13:00 [PATCH libdrm] intel: Add a getter for the intel_context ctx_id Robert Bragg
@ 2016-11-21 16:23 ` Robert Bragg
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Bragg @ 2016-11-21 16:23 UTC (permalink / raw)
  To: dri-devel

Renamed to avoid the seemingly redundant 'context_' infix and note that it's
been reviewed by Matthew Auld.

--- >8 ---

Exposing the u32 context ID makes it possible to define new drm kernel
interfaces based on the same IDs that e.g. execbuf uses to identify a
gem context, that aren't themselves abstracted by libdrm but need to be
used by libdrm/drm_intel_context based clients such as (parts of) i-g-t
or Mesa.

For example this can be used to configure an i915-perf stream to collect
metrics for a specific context.

v2: s/drm_intel_gem_context_get_context_id/drm_intel_gem_context_get_id/

Signed-off: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
 intel/intel_bufmgr.h     |  2 ++
 intel/intel_bufmgr_gem.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index ce4e70d..85e4ff7 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -212,6 +212,8 @@ int drm_intel_bufmgr_gem_get_devid(drm_intel_bufmgr *bufmgr);
 int drm_intel_gem_bo_wait(drm_intel_bo *bo, int64_t timeout_ns);
 
 drm_intel_context *drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr);
+int drm_intel_gem_context_get_id(drm_intel_context *ctx,
+                                 uint32_t *ctx_id);
 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);
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 15c79b3..5fc022a 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -3184,6 +3184,17 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
 	return context;
 }
 
+int
+drm_intel_gem_context_get_id(drm_intel_context *ctx, uint32_t *ctx_id)
+{
+	if (ctx == NULL)
+		return -EINVAL;
+
+	*ctx_id = ctx->ctx_id;
+
+	return 0;
+}
+
 void
 drm_intel_gem_context_destroy(drm_intel_context *ctx)
 {
-- 
2.10.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-21 16:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-17 13:00 [PATCH libdrm] intel: Add a getter for the intel_context ctx_id Robert Bragg
2016-11-21 16:23 ` [PATCH libdrm v2] " Robert Bragg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).