dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] I915 GEM context updates
@ 2015-06-30 12:24 David Weinehall
  2015-06-30 12:24 ` [PATCH 1/2] intel: Add get/set context parameter helpers David Weinehall
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Weinehall @ 2015-06-30 12:24 UTC (permalink / raw)
  To: dri-devel

This patch contains a few minor updates related to
I915 GEM context.

David Weinehall (2):
  intel: Add get/set context parameter helpers
  Add the I915_CONTEXT_PARAM_NO_ZEROMAP parameter

 include/drm/i915_drm.h   |  1 +
 intel/intel_bufmgr.h     |  4 ++++
 intel/intel_bufmgr_gem.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+)

-- 
2.1.4

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

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

* [PATCH 1/2] intel: Add get/set context parameter helpers
  2015-06-30 12:24 [PATCH 0/2] I915 GEM context updates David Weinehall
@ 2015-06-30 12:24 ` David Weinehall
  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
  2 siblings, 0 replies; 4+ messages in thread
From: David Weinehall @ 2015-06-30 12:24 UTC (permalink / raw)
  To: dri-devel

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,
+		       &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,
+		       &param);
+	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

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

* [PATCH 2/2] Add the I915_CONTEXT_PARAM_NO_ZEROMAP parameter
  2015-06-30 12:24 [PATCH 0/2] I915 GEM context updates David Weinehall
  2015-06-30 12:24 ` [PATCH 1/2] intel: Add get/set context parameter helpers David Weinehall
@ 2015-06-30 12:24 ` David Weinehall
  2015-06-30 12:49 ` [PATCH 0/2] I915 GEM context updates Chris Wilson
  2 siblings, 0 replies; 4+ messages in thread
From: David Weinehall @ 2015-06-30 12:24 UTC (permalink / raw)
  To: dri-devel

A new parameter was recently added to the i915 GEM contexts.
Add its define to i915_drm.h.

Signed-off-by: David Weinehall <david.weinehall@linux.intel.com>
---
 include/drm/i915_drm.h | 1 +
 1 file changed, 1 insertion(+)

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;
 };
 
-- 
2.1.4

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

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

* Re: [PATCH 0/2] I915 GEM context updates
  2015-06-30 12:24 [PATCH 0/2] I915 GEM context updates David Weinehall
  2015-06-30 12:24 ` [PATCH 1/2] intel: Add get/set context parameter helpers David Weinehall
  2015-06-30 12:24 ` [PATCH 2/2] Add the I915_CONTEXT_PARAM_NO_ZEROMAP parameter David Weinehall
@ 2015-06-30 12:49 ` Chris Wilson
  2 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2015-06-30 12:49 UTC (permalink / raw)
  To: David Weinehall; +Cc: Daniel Vetter, dri-devel

On Tue, Jun 30, 2015 at 03:24:51PM +0300, David Weinehall wrote:
> This patch contains a few minor updates related to
> I915 GEM context.

As a kernel API, this is absolutely awful. Can we please correct it before
it is released?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2015-06-30 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-30 12:24 [PATCH 0/2] I915 GEM context updates David Weinehall
2015-06-30 12:24 ` [PATCH 1/2] intel: Add get/set context parameter helpers David Weinehall
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox