diff options
author | Robert Bragg <robert@sixbynine.org> | 2015-01-26 16:11:26 +0000 |
---|---|---|
committer | Robert Bragg <robert.bragg@intel.com> | 2016-11-21 16:33:55 +0000 |
commit | 770f6bc424f93ab92f2c2f651615d02240f7387a (patch) | |
tree | 695d6b98865dca7c79f41129da925a1e70cefd95 /intel | |
parent | befb6429f03072b128a55360c1cf57f7b4d47b67 (diff) |
intel: Add a getter for the intel_context ctx_id
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-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Diffstat (limited to 'intel')
-rw-r--r-- | intel/intel_bufmgr.h | 2 | ||||
-rw-r--r-- | intel/intel_bufmgr_gem.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h index ce4e70d5..85e4ff78 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 15c79b3f..5fc022a0 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) { |