All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 2/9] lib/i915: Expose I915_CONTEXT_PARAM_PERSISTENCE
Date: Thu, 24 Oct 2019 11:54:42 +0100	[thread overview]
Message-ID: <20191024105449.31948-2-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <20191024105449.31948-1-chris@chris-wilson.co.uk>

Expose a new context parameters to opting out of persistent behaviour.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
---
 lib/i915/gem_context.c | 37 +++++++++++++++++++++++++++++++++++++
 lib/i915/gem_context.h |  8 ++++++++
 2 files changed, 45 insertions(+)

diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 83c5df961..1fae5191f 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -272,6 +272,43 @@ void gem_context_set_priority(int fd, uint32_t ctx_id, int prio)
 	igt_assert_eq(__gem_context_set_priority(fd, ctx_id, prio), 0);
 }
 
+/**
+ * __gem_context_set_persistence:
+ * @i915: open i915 drm file descriptor
+ * @ctx: i915 context id
+ * @state: desired persistence
+ *
+ * Declare whether this context is allowed to persist after closing until
+ * its requests are complete (persistent=true) or if it should be
+ * immediately reaped on closing and its requests cancelled
+ * (persistent=false).
+ *
+ * Returns: An integer equal to zero for success and negative for failure
+ */
+int __gem_context_set_persistence(int i915, uint32_t ctx, bool state)
+{
+	struct drm_i915_gem_context_param p = {
+		.ctx_id = ctx,
+		.param = I915_CONTEXT_PARAM_PERSISTENCE,
+		.value = state,
+	};
+
+	return __gem_context_set_param(i915, &p);
+}
+
+/**
+ * __gem_context_set_persistence:
+ * @i915: open i915 drm file descriptor
+ * @ctx: i915 context id
+ * @state: desired persistence
+ *
+ * Like __gem_context_set_persistence(), except we assert on failure.
+ */
+void gem_context_set_persistence(int i915, uint32_t ctx, bool state)
+{
+	igt_assert_eq(__gem_context_set_persistence(i915, ctx, state), 0);
+}
+
 int
 __gem_context_clone(int i915,
 		    uint32_t src, unsigned int share,
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index 8043c3401..c0d4c9615 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -24,6 +24,11 @@
 #ifndef GEM_CONTEXT_H
 #define GEM_CONTEXT_H
 
+#include <stdbool.h>
+#include <stdint.h>
+
+struct drm_i915_gem_context_param;
+
 uint32_t gem_context_create(int fd);
 int __gem_context_create(int fd, uint32_t *ctx_id);
 void gem_context_destroy(int fd, uint32_t ctx_id);
@@ -58,6 +63,9 @@ int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p);
 int __gem_context_set_priority(int fd, uint32_t ctx, int prio);
 void gem_context_set_priority(int fd, uint32_t ctx, int prio);
 
+int __gem_context_set_persistence(int i915, uint32_t ctx, bool state);
+void gem_context_set_persistence(int i915, uint32_t ctx, bool state);
+
 bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine);
 
 #endif /* GEM_CONTEXT_H */
-- 
2.24.0.rc0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 2/9] lib/i915: Expose I915_CONTEXT_PARAM_PERSISTENCE
Date: Thu, 24 Oct 2019 11:54:42 +0100	[thread overview]
Message-ID: <20191024105449.31948-2-chris@chris-wilson.co.uk> (raw)
Message-ID: <20191024105442.HJbpJmjUip6xt3j9BINP_M1ORI-piCt7qnV966Rudw8@z> (raw)
In-Reply-To: <20191024105449.31948-1-chris@chris-wilson.co.uk>

Expose a new context parameters to opting out of persistent behaviour.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Andi Shyti <andi.shyti@intel.com>
---
 lib/i915/gem_context.c | 37 +++++++++++++++++++++++++++++++++++++
 lib/i915/gem_context.h |  8 ++++++++
 2 files changed, 45 insertions(+)

diff --git a/lib/i915/gem_context.c b/lib/i915/gem_context.c
index 83c5df961..1fae5191f 100644
--- a/lib/i915/gem_context.c
+++ b/lib/i915/gem_context.c
@@ -272,6 +272,43 @@ void gem_context_set_priority(int fd, uint32_t ctx_id, int prio)
 	igt_assert_eq(__gem_context_set_priority(fd, ctx_id, prio), 0);
 }
 
+/**
+ * __gem_context_set_persistence:
+ * @i915: open i915 drm file descriptor
+ * @ctx: i915 context id
+ * @state: desired persistence
+ *
+ * Declare whether this context is allowed to persist after closing until
+ * its requests are complete (persistent=true) or if it should be
+ * immediately reaped on closing and its requests cancelled
+ * (persistent=false).
+ *
+ * Returns: An integer equal to zero for success and negative for failure
+ */
+int __gem_context_set_persistence(int i915, uint32_t ctx, bool state)
+{
+	struct drm_i915_gem_context_param p = {
+		.ctx_id = ctx,
+		.param = I915_CONTEXT_PARAM_PERSISTENCE,
+		.value = state,
+	};
+
+	return __gem_context_set_param(i915, &p);
+}
+
+/**
+ * __gem_context_set_persistence:
+ * @i915: open i915 drm file descriptor
+ * @ctx: i915 context id
+ * @state: desired persistence
+ *
+ * Like __gem_context_set_persistence(), except we assert on failure.
+ */
+void gem_context_set_persistence(int i915, uint32_t ctx, bool state)
+{
+	igt_assert_eq(__gem_context_set_persistence(i915, ctx, state), 0);
+}
+
 int
 __gem_context_clone(int i915,
 		    uint32_t src, unsigned int share,
diff --git a/lib/i915/gem_context.h b/lib/i915/gem_context.h
index 8043c3401..c0d4c9615 100644
--- a/lib/i915/gem_context.h
+++ b/lib/i915/gem_context.h
@@ -24,6 +24,11 @@
 #ifndef GEM_CONTEXT_H
 #define GEM_CONTEXT_H
 
+#include <stdbool.h>
+#include <stdint.h>
+
+struct drm_i915_gem_context_param;
+
 uint32_t gem_context_create(int fd);
 int __gem_context_create(int fd, uint32_t *ctx_id);
 void gem_context_destroy(int fd, uint32_t ctx_id);
@@ -58,6 +63,9 @@ int __gem_context_get_param(int fd, struct drm_i915_gem_context_param *p);
 int __gem_context_set_priority(int fd, uint32_t ctx, int prio);
 void gem_context_set_priority(int fd, uint32_t ctx, int prio);
 
+int __gem_context_set_persistence(int i915, uint32_t ctx, bool state);
+void gem_context_set_persistence(int i915, uint32_t ctx, bool state);
+
 bool gem_context_has_engine(int fd, uint32_t ctx, uint64_t engine);
 
 #endif /* GEM_CONTEXT_H */
-- 
2.24.0.rc0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-10-24 10:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 10:54 [PATCH i-g-t 1/9] i915_drm.h sync Chris Wilson
2019-10-24 10:54 ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` Chris Wilson [this message]
2019-10-24 10:54   ` [Intel-gfx] [PATCH i-g-t 2/9] lib/i915: Expose I915_CONTEXT_PARAM_PERSISTENCE Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 3/9] Add i915/gem_ctx_persistence Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 4/9] i915: Start putting the mmio_base to wider use Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 5/9] i915/gem_ctx_isolation: Check engine relative registers Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 6/9] i915: Exercise preemption timeout controls in sysfs Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 7/9] i915: Exercise sysfs heartbeat controls Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 8/9] i915: Exercise timeslice sysfs property Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 10:54 ` [PATCH i-g-t 9/9] i915: Exercise I915_CONTEXT_PARAM_RINGSIZE Chris Wilson
2019-10-24 10:54   ` [Intel-gfx] " Chris Wilson
2019-10-24 12:45 ` ✗ GitLab.Pipeline: warning for series starting with [1/9] i915_drm.h sync Patchwork
2019-10-24 12:45   ` [Intel-gfx] " Patchwork

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=20191024105449.31948-2-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.