mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 16:40:30 +01:00
winsys/amdgpu: fall back to a normal priority without root in the winsys
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34983>
This commit is contained in:
parent
2ef6aa5934
commit
0dc5d649ea
2 changed files with 9 additions and 10 deletions
|
|
@ -550,15 +550,6 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
|
|||
|
||||
/* Initialize the context handle and the command stream. */
|
||||
sctx->ctx = sctx->ws->ctx_create(sctx->ws, sctx->context_flags);
|
||||
if (!sctx->ctx && sctx->context_flags & PIPE_CONTEXT_HIGH_PRIORITY) {
|
||||
/* Context priority should be treated as a hint. If context creation
|
||||
* fails with the requested priority, for example because the caller
|
||||
* lacks CAP_SYS_NICE capability or other system resource constraints,
|
||||
* fallback to normal priority.
|
||||
*/
|
||||
sctx->context_flags &= ~PIPE_CONTEXT_HIGH_PRIORITY;
|
||||
sctx->ctx = sctx->ws->ctx_create(sctx->ws, sctx->context_flags);
|
||||
}
|
||||
if (!sctx->ctx) {
|
||||
fprintf(stderr, "radeonsi: can't create radeon_winsys_ctx\n");
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -268,7 +268,15 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *rws, un
|
|||
|
||||
dev = ctx->aws->dev;
|
||||
|
||||
r = ac_drm_cs_ctx_create2(dev, amdgpu_priority, &ctx->ctx_handle);
|
||||
while (1) {
|
||||
r = ac_drm_cs_ctx_create2(dev, amdgpu_priority, &ctx->ctx_handle);
|
||||
if (r == -EACCES && amdgpu_priority == AMDGPU_CTX_PRIORITY_HIGH) {
|
||||
/* Try again with a lower priority. */
|
||||
amdgpu_priority = AMDGPU_CTX_PRIORITY_NORMAL;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (r) {
|
||||
fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create2 failed. (%i)\n", r);
|
||||
goto error_create;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue