From: David Weinehall <david.weinehall@linux.intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: [PATCH 02/03] libdrm: export context_{get, set}param and I915_CONTEXT_PARAM_NO_ZEROMAP
Date: Wed, 20 May 2015 17:01:41 +0300 [thread overview]
Message-ID: <20150520140141.GC13974@boom> (raw)
In-Reply-To: <20150520135419.GA13974@boom>
Provide helper functions for the context_{get,set}param ioctls,
as well as the I915_CONTEXT_PARAM_NO_ZEROMAP parameter.
Signed-off-by: David Weinehall <david.weinehall@intel.com>
---
configure.ac | 2 -
include/drm/i915_drm.h | 1
intel/intel_bufmgr.h | 4 +++
intel/intel_bufmgr_gem.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 78a0010d851f..e48fb7e87c52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
AC_PREREQ([2.63])
AC_INIT([libdrm],
- [2.4.61],
+ [2.4.62],
[https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
[libdrm])
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index ded43b1cb117..a658d1cc367a 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -1101,6 +1101,7 @@ struct drm_i915_gem_context_param {
__u32 size;
__u64 param;
#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1
+#define I915_CONTEXT_PARAM_NO_ZEROMAP 0x2
__u64 value;
};
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..53378df2ecdf 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,
+ &ctx_param);
+ 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,
+ &ctx_param);
+ if (ret != 0)
+ fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM failed: %s (%d); %d\n",
+ strerror(errno), errno, ret);
+
+ return ret;
+}
+
+int
drm_intel_get_reset_stats(drm_intel_context *ctx,
uint32_t *reset_count,
uint32_t *active,
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-05-20 14:03 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 13:54 [PATCH 00/03] Preventing zero GPU virtual address allocation David Weinehall
2015-05-20 14:00 ` [PATCH 01/03] drm/i915: add a context parameter to {en, dis}able zero address mapping David Weinehall
2015-05-28 14:39 ` Chris Wilson
2015-05-28 15:52 ` Daniel Vetter
2015-05-28 16:56 ` Chris Wilson
2015-05-29 8:18 ` David Weinehall
2015-05-20 14:01 ` David Weinehall [this message]
2015-05-20 14:02 ` [PATCH 03/03] beignet: set I915_CONTEXT_PARAM_NO_ZEROMAP when initializing context David Weinehall
2015-05-20 14:09 ` [PATCH 00/03] Preventing zero GPU virtual address allocation Chris Wilson
2015-05-20 14:14 ` Chris Wilson
2015-05-20 16:00 ` Daniel Vetter
2015-05-20 16:10 ` Chris Wilson
2015-05-21 8:08 ` David Weinehall
2015-05-21 8:43 ` Chris Wilson
2015-05-21 9:38 ` David Weinehall
2015-05-21 9:59 ` Chris Wilson
2015-05-21 9:44 ` Daniel Vetter
2015-05-21 9:50 ` Chris Wilson
2015-05-27 9:17 ` David Weinehall
2015-06-05 14:13 ` Dave Gordon
2015-05-21 7:59 ` David Weinehall
2015-05-27 7:54 ` Zou, Nanhai
2015-05-27 11:29 ` Daniel Vetter
2015-05-21 9:44 ` [PATCH i-g-t 4/3] tests/gem_ctx_param_basic: Expand ctx_param tests David Weinehall
2015-05-27 11:32 ` Daniel Vetter
2015-05-28 12:20 ` David Weinehall
2015-05-28 14:53 ` David Weinehall
2015-05-29 7:52 ` Daniel Vetter
2015-08-06 21:30 ` Daniel Vetter
2015-08-06 21:30 ` Daniel Vetter
2015-08-06 21:33 ` Jesse Barnes
2015-08-10 14:15 ` David Weinehall
2015-08-13 23:12 ` Jesse Barnes
2015-08-10 14:17 ` David Weinehall
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=20150520140141.GC13974@boom \
--to=david.weinehall@linux.intel.com \
--cc=intel-gfx@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