diff options
author | Marek Olšák <marek.olsak@amd.com> | 2023-04-13 11:01:51 -0400 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2023-05-11 12:53:29 -0400 |
commit | 98e1db501173303e58ef6a1def94ab7a2d84afc1 (patch) | |
tree | 65944b520fba0db4e309bd8250c5ac400f8003f0 | |
parent | 7784d571661e3c1019f98ece7947dbf791405f8a (diff) |
amdgpu: add an environment variable that overrides the context priority
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
-rw-r--r-- | amdgpu/amdgpu_cs.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 638fd7d6..0eceb388 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -56,10 +56,22 @@ drm_public int amdgpu_cs_ctx_create2(amdgpu_device_handle dev, union drm_amdgpu_ctx args; int i, j, k; int r; + char *override_priority; if (!dev || !context) return -EINVAL; + override_priority = getenv("AMD_PRIORITY"); + if (override_priority) { + /* The priority is a signed integer. The variable type is + * wrong. If parsing fails, priority is unchanged. + */ + if (sscanf(override_priority, "%i", &priority) == 1) { + printf("amdgpu: context priority changed to %i\n", + priority); + } + } + gpu_context = calloc(1, sizeof(struct amdgpu_context)); if (!gpu_context) return -ENOMEM; |