From: David Weinehall <david.weinehall@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] intel: Add get/set context parameter helpers
Date: Tue, 30 Jun 2015 15:24:52 +0300 [thread overview]
Message-ID: <1435667093-14563-2-git-send-email-david.weinehall@linux.intel.com> (raw)
In-Reply-To: <1435667093-14563-1-git-send-email-david.weinehall@linux.intel.com>
Add helper functions to set/get GEM context parameters.
Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
---
intel/intel_bufmgr.h | 4 ++++
intel/intel_bufmgr_gem.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+)
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index 285919e4c40d..b9af2361735d 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -203,6 +203,10 @@ 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);
void drm_intel_gem_context_destroy(drm_intel_context *ctx);
+int drm_intel_gem_context_get_param(drm_intel_context *ctx,
+ uint64_t param, uint64_t *value);
+int drm_intel_gem_context_set_param(drm_intel_context *ctx,
+ uint64_t param, uint64_t value);
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 60c06fccfb20..2ac00cb3be3e 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -3326,6 +3326,63 @@ drm_intel_gem_context_destroy(drm_intel_context *ctx)
}
int
+drm_intel_gem_context_get_param(drm_intel_context *ctx,
+ uint64_t param, uint64_t *value)
+{
+ drm_intel_bufmgr_gem *bufmgr_gem;
+ struct drm_i915_gem_context_param ctx_param;
+ int ret;
+
+ if (ctx == NULL)
+ return -EINVAL;
+
+ memclear(ctx_param);
+
+ bufmgr_gem = (drm_intel_bufmgr_gem *)ctx->bufmgr;
+
+ ctx_param.ctx_id = ctx->ctx_id;
+ ctx_param.param = param;
+
+ ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM,
+ ¶m);
+ if (ret != 0)
+ fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM failed: %s\n",
+ strerror(errno));
+ else
+ *value = ctx_param.value;
+
+ return ret;
+}
+
+int
+drm_intel_gem_context_set_param(drm_intel_context *ctx,
+ uint64_t param, uint64_t value)
+{
+ drm_intel_bufmgr_gem *bufmgr_gem;
+ struct drm_i915_gem_context_param ctx_param;
+ int ret;
+
+ if (ctx == NULL)
+ return -EINVAL;
+
+ memclear(ctx_param);
+
+ bufmgr_gem = (drm_intel_bufmgr_gem *)ctx->bufmgr;
+
+ ctx_param.ctx_id = ctx->ctx_id;
+ ctx_param.param = param;
+ ctx_param.value = value;
+
+ ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM,
+ ¶m);
+ if (ret != 0)
+ fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM failed: %s\n",
+ strerror(errno));
+
+ return ret;
+}
+
+int
drm_intel_get_reset_stats(drm_intel_context *ctx,
uint32_t *reset_count,
uint32_t *active,
--
2.1.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-06-30 12:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 12:24 [PATCH 0/2] I915 GEM context updates David Weinehall
2015-06-30 12:24 ` David Weinehall [this message]
2015-06-30 12:24 ` [PATCH 2/2] Add the I915_CONTEXT_PARAM_NO_ZEROMAP parameter David Weinehall
2015-06-30 12:49 ` [PATCH 0/2] I915 GEM context updates Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435667093-14563-2-git-send-email-david.weinehall@linux.intel.com \
--to=david.weinehall@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox