<div dir="ltr"><div>I think we should do it differently because this interface will be mostly unused by open source userspace in its current form.</div><div><br></div><div>Let's set the workload hint in drm_amdgpu_ctx_in::flags, and that will be immutable for the lifetime of the context. No other interface is needed.<br></div><div><br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 26, 2022 at 5:41 PM Shashank Sharma <<a href="mailto:shashank.sharma@amd.com">shashank.sharma@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Allow the user to specify a workload hint to the kernel.<br>
We can use these to tweak the dpm heuristics to better match<br>
the workload for improved performance.<br>
<br>
V3: Create only set() workload UAPI (Christian)<br>
<br>
Signed-off-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com" target="_blank">alexander.deucher@amd.com</a>><br>
Signed-off-by: Shashank Sharma <<a href="mailto:shashank.sharma@amd.com" target="_blank">shashank.sharma@amd.com</a>><br>
---<br>
include/uapi/drm/amdgpu_drm.h | 17 +++++++++++++++++<br>
1 file changed, 17 insertions(+)<br>
<br>
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h<br>
index c2c9c674a223..23d354242699 100644<br>
--- a/include/uapi/drm/amdgpu_drm.h<br>
+++ b/include/uapi/drm/amdgpu_drm.h<br>
@@ -212,6 +212,7 @@ union drm_amdgpu_bo_list {<br>
#define AMDGPU_CTX_OP_QUERY_STATE2 4<br>
#define AMDGPU_CTX_OP_GET_STABLE_PSTATE 5<br>
#define AMDGPU_CTX_OP_SET_STABLE_PSTATE 6<br>
+#define AMDGPU_CTX_OP_SET_WORKLOAD_PROFILE 7<br>
<br>
/* GPU reset status */<br>
#define AMDGPU_CTX_NO_RESET 0<br>
@@ -252,6 +253,17 @@ union drm_amdgpu_bo_list {<br>
#define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK 3<br>
#define AMDGPU_CTX_STABLE_PSTATE_PEAK 4<br>
<br>
+/* GPU workload hints, flag bits 8-15 */<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_SHIFT 8<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_MASK (0xff << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_NONE (0 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_3D (1 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_VIDEO (2 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_VR (3 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_COMPUTE (4 << AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+#define AMDGPU_CTX_WORKLOAD_HINT_MAX AMDGPU_CTX_WORKLOAD_HINT_COMPUTE<br>
+#define AMDGPU_CTX_WORKLOAD_INDEX(n) (n >> AMDGPU_CTX_WORKLOAD_HINT_SHIFT)<br>
+<br>
struct drm_amdgpu_ctx_in {<br>
/** AMDGPU_CTX_OP_* */<br>
__u32 op;<br>
@@ -281,6 +293,11 @@ union drm_amdgpu_ctx_out {<br>
__u32 flags;<br>
__u32 _pad;<br>
} pstate;<br>
+<br>
+ struct {<br>
+ __u32 flags;<br>
+ __u32 _pad;<br>
+ } workload;<br>
};<br>
<br>
union drm_amdgpu_ctx {<br>
-- <br>
2.34.1<br>
<br>
</blockquote></div>