From: Andres Rodriguez <andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: emil.l.velikov-Re5JQEeQqe8@public.gmane.org,
Andres Rodriguez
<andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 3/3] amdgpu: implement context priority for amdgpu_cs_ctx_create2 v3
Date: Wed, 4 Jan 2017 19:29:35 -0500 [thread overview]
Message-ID: <20170105002935.5796-4-andresx7@gmail.com> (raw)
In-Reply-To: <20170105002935.5796-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Add a new context creation function that allows specifying the context
priority.
A high priority context has the potential of starving lower priority
contexts. The current kernel driver implementation only allows only the
root user to allocate high priority contexts.
v2: corresponding changes for kernel patch v2
v3: Swap enum values of _NORMAL/_HIGH for backwards compatibility
Fixed 'make check' symbol error
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
---
amdgpu/amdgpu-symbol-check | 1 +
amdgpu/amdgpu.h | 17 +++++++++++++++--
amdgpu/amdgpu_cs.c | 17 +++++++++++++----
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
index 87f4fd2..f3772ac 100755
--- a/amdgpu/amdgpu-symbol-check
+++ b/amdgpu/amdgpu-symbol-check
@@ -26,6 +26,7 @@ amdgpu_bo_wait_for_idle
amdgpu_create_bo_from_user_mem
amdgpu_cs_create_semaphore
amdgpu_cs_ctx_create
+amdgpu_cs_ctx_create2
amdgpu_cs_ctx_free
amdgpu_cs_destroy_semaphore
amdgpu_cs_query_fence_status
diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
index 7b26a04..eef7a62 100644
--- a/amdgpu/amdgpu.h
+++ b/amdgpu/amdgpu.h
@@ -794,8 +794,9 @@ int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
* context will always be executed in order (first come, first serve).
*
*
- * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
- * \param context - \c [out] GPU Context handle
+ * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
+ * \param priority - \c [in] Context creation flags. See AMDGPU_CTX_PRIORITY_*
+ * \param context - \c [out] GPU Context handle
*
* \return 0 on success\n
* <0 - Negative POSIX Error code
@@ -803,6 +804,18 @@ int amdgpu_bo_list_update(amdgpu_bo_list_handle handle,
* \sa amdgpu_cs_ctx_free()
*
*/
+int amdgpu_cs_ctx_create2(amdgpu_device_handle dev,
+ uint32_t priority,
+ amdgpu_context_handle *context);
+/**
+ * Create GPU execution Context
+ *
+ * Refer to amdgpu_cs_ctx_create2 for full documentation. This call
+ * is missing the priority parameter.
+ *
+ * \sa amdgpu_cs_ctx_create2()
+ *
+*/
int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
amdgpu_context_handle *context);
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index fb5b3a8..ce0656e 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -46,13 +46,14 @@ static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem);
/**
* Create command submission context
*
- * \param dev - \c [in] amdgpu device handle
- * \param context - \c [out] amdgpu context handle
+ * \param dev - \c [in] Device handle. See #amdgpu_device_initialize()
+ * \param priority - \c [in] Context creation flags. See AMDGPU_CTX_PRIORITY_*
+ * \param context - \c [out] GPU Context handle
*
* \return 0 on success otherwise POSIX Error code
*/
-int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
- amdgpu_context_handle *context)
+int amdgpu_cs_ctx_create2(amdgpu_device_handle dev, uint32_t priority,
+ amdgpu_context_handle *context)
{
struct amdgpu_context *gpu_context;
union drm_amdgpu_ctx args;
@@ -77,6 +78,8 @@ int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
/* Create the context */
memset(&args, 0, sizeof(args));
args.in.op = AMDGPU_CTX_OP_ALLOC_CTX;
+ args.in.priority = priority;
+
r = drmCommandWriteRead(dev->fd, DRM_AMDGPU_CTX, &args, sizeof(args));
if (r)
goto error;
@@ -96,6 +99,12 @@ error:
return r;
}
+int amdgpu_cs_ctx_create(amdgpu_device_handle dev,
+ amdgpu_context_handle *context)
+{
+ return amdgpu_cs_ctx_create2(dev, AMDGPU_CTX_PRIORITY_NORMAL, context);
+}
+
/**
* Release command submission context
*
--
2.9.3
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2017-01-05 0:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 0:29 [PATCH v3] libdrm changes for high priority contexts Andres Rodriguez
[not found] ` <20170105002935.5796-1-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-05 0:29 ` [PATCH 1/3] headers: Sync {amdgpu,radeon}_drm.h with the kernel Andres Rodriguez
[not found] ` <20170105002935.5796-2-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-09 16:23 ` Emil Velikov
[not found] ` <CACvgo50x_z1XrM-V2jvYf3e3zp4muy0Wyxpimk_5zM9hof28PQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-09 17:01 ` Andres Rodriguez
[not found] ` <d5029218-6760-ef97-3dd6-632ad51dc966-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-09 18:00 ` Deucher, Alexander
[not found] ` <BN6PR12MB165210337024334D288C5F42F7640-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-01-09 18:07 ` Andres Rodriguez
2017-01-05 0:29 ` [PATCH 2/3] headers: add new context priority parameter to amdgpu_drm.h Andres Rodriguez
[not found] ` <20170105002935.5796-3-andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-09 16:28 ` Emil Velikov
[not found] ` <CACvgo53xrtLkCVj4xcZ7BzrsFWXJMBLMqNFkgYau3Gro-3KDjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-09 17:04 ` Andres Rodriguez
2017-01-05 0:29 ` Andres Rodriguez [this message]
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=20170105002935.5796-4-andresx7@gmail.com \
--to=andresx7-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=emil.l.velikov-Re5JQEeQqe8@public.gmane.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