From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH i-g-t 09/17] lib/ioctl: Document ctx param functions
Date: Tue, 10 Feb 2015 19:05:52 +0100 [thread overview]
Message-ID: <1423591560-9471-9-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1423591560-9471-1-git-send-email-daniel.vetter@ffwll.ch>
And move them so that they're grouped with the other context wrappers.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
lib/ioctl_wrappers.c | 79 +++++++++++++++++++++++++++++++++++-----------------
lib/ioctl_wrappers.h | 22 +++++++--------
2 files changed, 63 insertions(+), 38 deletions(-)
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index e86b3c2bfa46..288ab8d7e0e2 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -663,6 +663,59 @@ void gem_context_destroy(int fd, uint32_t ctx_id)
}
/**
+ * gem_context_get_param:
+ * @fd: open i915 drm file descriptor
+ * @p: i915 hw context parameter
+ *
+ * This is a wraps the CONTEXT_GET_PARAM ioctl, which is used to free a hardware
+ * context. Not that similarly to gem_set_caching() this wrapper calls
+ * igt_require() internally to correctly skip on kernels and platforms where hw
+ * context parameter support is not available.
+ */
+void gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
+{
+#define LOCAL_I915_GEM_CONTEXT_GETPARAM 0x34
+#define LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_GETPARAM, struct local_i915_gem_context_param)
+ do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p);
+}
+
+/**
+ * gem_context_set_param:
+ * @fd: open i915 drm file descriptor
+ * @p: i915 hw context parameter
+ *
+ * This is a wraps the CONTEXT_SET_PARAM ioctl, which is used to free a hardware
+ * context. Not that similarly to gem_set_caching() this wrapper calls
+ * igt_require() internally to correctly skip on kernels and platforms where hw
+ * context parameter support is not available.
+ */
+void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
+{
+#define LOCAL_I915_GEM_CONTEXT_SETPARAM 0x35
+#define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
+ do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p);
+}
+
+/**
+ * gem_require_caching:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether hw context parameter support for @param
+ * is available. Automatically skips through igt_require() if not.
+ */
+void gem_context_require_param(int fd, uint64_t param)
+{
+ struct local_i915_gem_context_param p;
+
+ p.context = 0;
+ p.param = param;
+ p.value = 0;
+ p.size = 0;
+
+ igt_require(drmIoctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
+}
+
+/**
* gem_sw_finish:
* @fd: open i915 drm file descriptor
* @handle: gem buffer object handle
@@ -1089,29 +1142,3 @@ off_t prime_get_size(int dma_buf_fd)
return ret;
}
-
-void gem_context_get_param(int fd, struct local_i915_gem_context_param *p)
-{
-#define LOCAL_I915_GEM_CONTEXT_GETPARAM 0x34
-#define LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_GETPARAM, struct local_i915_gem_context_param)
- do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, p);
-}
-
-void gem_context_set_param(int fd, struct local_i915_gem_context_param *p)
-{
-#define LOCAL_I915_GEM_CONTEXT_SETPARAM 0x35
-#define LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + LOCAL_I915_GEM_CONTEXT_SETPARAM, struct local_i915_gem_context_param)
- do_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_SETPARAM, p);
-}
-
-void gem_context_require_param(int fd, uint64_t param)
-{
- struct local_i915_gem_context_param p;
-
- p.context = 0;
- p.param = param;
- p.value = 0;
- p.size = 0;
-
- igt_require(drmIoctl(fd, LOCAL_I915_GEM_CONTEXT_GETPARAM, &p) == 0);
-}
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index ad10bd03d370..ea9f5598e7e3 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -97,6 +97,16 @@ int gem_madvise(int fd, uint32_t handle, int state);
uint32_t gem_context_create(int fd);
void gem_context_destroy(int fd, uint32_t ctx_id);
int __gem_context_destroy(int fd, uint32_t ctx_id);
+struct local_i915_gem_context_param {
+ uint32_t context;
+ uint32_t size;
+ uint64_t param;
+#define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1
+ uint64_t value;
+};
+void gem_context_require_param(int fd, uint64_t param);
+void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
+void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
void gem_sw_finish(int fd, uint32_t handle);
@@ -125,16 +135,4 @@ int prime_handle_to_fd(int fd, uint32_t handle);
uint32_t prime_fd_to_handle(int fd, int dma_buf_fd);
off_t prime_get_size(int dma_buf_fd);
-struct local_i915_gem_context_param {
- uint32_t context;
- uint32_t size;
- uint64_t param;
-#define LOCAL_CONTEXT_PARAM_BAN_PERIOD 0x1
- uint64_t value;
-};
-
-void gem_context_require_param(int fd, uint64_t param);
-void gem_context_get_param(int fd, struct local_i915_gem_context_param *p);
-void gem_context_set_param(int fd, struct local_i915_gem_context_param *p);
-
#endif /* IOCTL_WRAPPERS_H */
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-02-10 18:04 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-10 18:05 [PATCH i-g-t 01/17] lib/gt: api polish for igt_can_hang_ring Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 02/17] lib/ioctl: api polish for gem_context_has_param Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 03/17] lib/ioctl: gem_ prefix for igt_require_mmap_wc Daniel Vetter
2015-02-10 21:58 ` Chris Wilson
2015-02-11 8:37 ` Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 04/17] igt/ioctls: doc for gem_mmap Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 05/17] lib/ioctls: make gem_context_set/get_param infallible Daniel Vetter
2015-02-10 21:54 ` Chris Wilson
2015-02-11 8:42 ` Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 06/17] lib/ioctl: Add gem_context_destroy helpers Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 07/17] tests/gem_ctx_*: Use helpers Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 08/17] tests/gem_reset_stat: Use new ctx helpers Daniel Vetter
2015-02-10 18:05 ` Daniel Vetter [this message]
2015-02-10 18:05 ` [PATCH i-g-t 10/17] tests: Add gem_ctx_param_basic Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 11/17] tests: Add invalid pad tests for ctx create/destroy Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 12/17] tests/gem_ppgtt: Start rcs before bcs for context tests Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 13/17] tests: Align subtest with naming convention Daniel Vetter
2015-02-10 21:53 ` Chris Wilson
2015-02-11 8:44 ` Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 14/17] lib/igt_aux: s/swap/igt_swap/ Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 15/17] tests/gem_wait: Adjust makefile Daniel Vetter
2015-02-10 18:05 ` [PATCH i-g-t 16/17] doc: Consolidate naming conventions into docbook Daniel Vetter
2015-02-10 18:06 ` [PATCH i-g-t 17/17] lib/igt_gt: Document and consolidate Daniel Vetter
2015-02-10 21:36 ` [PATCH i-g-t 01/17] lib/gt: api polish for igt_can_hang_ring Chris Wilson
2015-02-10 21:56 ` Daniel Vetter
2015-02-10 21:59 ` [PATCH i-g-t] lib/chipset: Cache devid Daniel Vetter
2015-02-10 22:28 ` Chris Wilson
2015-02-10 22:37 ` Daniel Vetter
2015-02-10 22:39 ` Daniel Vetter
2015-02-10 22:45 ` Daniel Vetter
2015-02-10 22:50 ` Chris Wilson
2015-02-11 8:49 ` Daniel Vetter
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=1423591560-9471-9-git-send-email-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=daniel.vetter@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