mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
radeonsi: Add support for EGL_IMG_context_priority
This allows creating high priority contexts when using radeonsi. It's primarily intended for apps whose rendering commands must be processed as soon as possible, e.g. wayland compositors. Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16594>
This commit is contained in:
parent
f4de4453cf
commit
e20718e8fa
2 changed files with 23 additions and 1 deletions
|
|
@ -254,6 +254,13 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
|||
case PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF:
|
||||
return 0;
|
||||
|
||||
case PIPE_CAP_CONTEXT_PRIORITY_MASK:
|
||||
if (!(sscreen->info.is_amdgpu && sscreen->info.drm_minor >= 22))
|
||||
return 0;
|
||||
return PIPE_CONTEXT_PRIORITY_LOW |
|
||||
PIPE_CONTEXT_PRIORITY_MEDIUM |
|
||||
PIPE_CONTEXT_PRIORITY_HIGH;
|
||||
|
||||
case PIPE_CAP_FENCE_SIGNAL:
|
||||
return sscreen->info.has_syncobj;
|
||||
|
||||
|
|
|
|||
|
|
@ -501,10 +501,25 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, unsign
|
|||
}
|
||||
}
|
||||
|
||||
priority = RADEON_CTX_PRIORITY_MEDIUM;
|
||||
if (flags & PIPE_CONTEXT_HIGH_PRIORITY) {
|
||||
priority = RADEON_CTX_PRIORITY_HIGH;
|
||||
} else if (flags & PIPE_CONTEXT_LOW_PRIORITY) {
|
||||
priority = RADEON_CTX_PRIORITY_LOW;
|
||||
} else {
|
||||
priority = RADEON_CTX_PRIORITY_MEDIUM;
|
||||
}
|
||||
|
||||
/* Initialize the context handle and the command stream. */
|
||||
sctx->ctx = sctx->ws->ctx_create(sctx->ws, priority);
|
||||
if (!sctx->ctx && priority != RADEON_CTX_PRIORITY_MEDIUM) {
|
||||
/* 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.
|
||||
*/
|
||||
priority = RADEON_CTX_PRIORITY_MEDIUM;
|
||||
sctx->ctx = sctx->ws->ctx_create(sctx->ws, priority);
|
||||
}
|
||||
if (!sctx->ctx) {
|
||||
fprintf(stderr, "radeonsi: can't create radeon_winsys_ctx\n");
|
||||
goto fail;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue