mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
egl: Support NV_context_priority_realtime
This extension extends EGL_IMG_context_priority with a new EGL_CONTEXT_PRIORITY_REALTIME_NV attribute. Effectively, Gallium drivers would need to implement PIPE_CONTEXT_REALTIME_PRIORITY flag in context_create and expose PIPE_CONTEXT_PRIORITY_REALTIME on PIPE_CAP_CONTEXT_PRIORITY_MASK to enable this extension. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30989>
This commit is contained in:
parent
d12950539c
commit
43db7e5323
9 changed files with 50 additions and 6 deletions
|
|
@ -674,6 +674,18 @@ dri2_setup_screen(_EGLDisplay *disp)
|
|||
disp->Extensions.IMG_context_priority =
|
||||
dri_get_screen_param(dri2_dpy->dri_screen_render_gpu, PIPE_CAP_CONTEXT_PRIORITY_MASK);
|
||||
|
||||
/**
|
||||
* FIXME: Some drivers currently misreport what context priorities the user
|
||||
* can use and fail context creation. This cause issues on Android where the
|
||||
* display process would try to use realtime priority. This is also a spec
|
||||
* violation for IMG_context_priority.
|
||||
*/
|
||||
#ifndef HAVE_ANDROID_PLATFORM
|
||||
disp->Extensions.NV_context_priority_realtime =
|
||||
disp->Extensions.IMG_context_priority &
|
||||
(1 << __EGL_CONTEXT_PRIORITY_REALTIME_BIT);
|
||||
#endif
|
||||
|
||||
disp->Extensions.EXT_pixel_format_float = EGL_TRUE;
|
||||
|
||||
if (pscreen->is_format_supported(pscreen, PIPE_FORMAT_B8G8R8A8_SRGB,
|
||||
|
|
@ -1145,6 +1157,9 @@ dri2_fill_context_attribs(struct dri2_egl_context *dri2_ctx,
|
|||
unsigned val;
|
||||
|
||||
switch (dri2_ctx->base.ContextPriority) {
|
||||
case EGL_CONTEXT_PRIORITY_REALTIME_NV:
|
||||
val = __DRI_CTX_PRIORITY_REALTIME;
|
||||
break;
|
||||
case EGL_CONTEXT_PRIORITY_HIGH_IMG:
|
||||
val = __DRI_CTX_PRIORITY_HIGH;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -361,6 +361,9 @@ haiku_initialize_impl(_EGLDisplay *disp, void *platformDisplay)
|
|||
disp->Extensions.IMG_context_priority =
|
||||
hgl_dpy->disp->fscreen->screen->get_param(hgl_dpy->disp->fscreen->screen,
|
||||
PIPE_CAP_CONTEXT_PRIORITY_MASK);
|
||||
disp->Extensions.NV_context_priority_realtime =
|
||||
disp->Extensions.IMG_context_priority &
|
||||
(1 << __EGL_CONTEXT_PRIORITY_REALTIME_BIT);
|
||||
|
||||
disp->Extensions.EXT_pixel_format_float = EGL_TRUE;
|
||||
|
||||
|
|
|
|||
|
|
@ -271,6 +271,9 @@ wgl_initialize_impl(_EGLDisplay *disp, HDC hdc)
|
|||
/* Report back to EGL the bitmask of priorities supported */
|
||||
disp->Extensions.IMG_context_priority = wgl_dpy->screen->get_param(
|
||||
wgl_dpy->screen, PIPE_CAP_CONTEXT_PRIORITY_MASK);
|
||||
disp->Extensions.NV_context_priority_realtime =
|
||||
disp->Extensions.IMG_context_priority &
|
||||
(1 << __EGL_CONTEXT_PRIORITY_REALTIME_BIT);
|
||||
|
||||
disp->Extensions.EXT_pixel_format_float = EGL_TRUE;
|
||||
|
||||
|
|
|
|||
|
|
@ -606,6 +606,7 @@ _eglCreateExtensionsString(_EGLDisplay *disp)
|
|||
_EGL_CHECK_EXTENSION(NOK_swap_region);
|
||||
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
|
||||
|
||||
_EGL_CHECK_EXTENSION(NV_context_priority_realtime);
|
||||
_EGL_CHECK_EXTENSION(NV_post_sub_buffer);
|
||||
|
||||
_EGL_CHECK_EXTENSION(WL_bind_wayland_display);
|
||||
|
|
|
|||
|
|
@ -413,6 +413,12 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *disp,
|
|||
int bit;
|
||||
|
||||
switch (val) {
|
||||
case EGL_CONTEXT_PRIORITY_REALTIME_NV:
|
||||
if (disp->Extensions.NV_context_priority_realtime)
|
||||
bit = __EGL_CONTEXT_PRIORITY_REALTIME_BIT;
|
||||
else
|
||||
bit = -1;
|
||||
break;
|
||||
case EGL_CONTEXT_PRIORITY_HIGH_IMG:
|
||||
bit = __EGL_CONTEXT_PRIORITY_HIGH_BIT;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -117,9 +117,10 @@ struct _egl_extensions {
|
|||
EGLBoolean EXT_swap_buffers_with_damage;
|
||||
|
||||
unsigned int IMG_context_priority;
|
||||
#define __EGL_CONTEXT_PRIORITY_LOW_BIT 0
|
||||
#define __EGL_CONTEXT_PRIORITY_MEDIUM_BIT 1
|
||||
#define __EGL_CONTEXT_PRIORITY_HIGH_BIT 2
|
||||
#define __EGL_CONTEXT_PRIORITY_LOW_BIT 0
|
||||
#define __EGL_CONTEXT_PRIORITY_MEDIUM_BIT 1
|
||||
#define __EGL_CONTEXT_PRIORITY_HIGH_BIT 2
|
||||
#define __EGL_CONTEXT_PRIORITY_REALTIME_BIT 3
|
||||
|
||||
EGLBoolean KHR_cl_event2;
|
||||
EGLBoolean KHR_config_attribs;
|
||||
|
|
@ -153,6 +154,7 @@ struct _egl_extensions {
|
|||
EGLBoolean NOK_texture_from_pixmap;
|
||||
|
||||
EGLBoolean NV_post_sub_buffer;
|
||||
EGLBoolean NV_context_priority_realtime;
|
||||
|
||||
EGLBoolean WL_bind_wayland_display;
|
||||
EGLBoolean WL_create_wayland_buffer_from_image;
|
||||
|
|
|
|||
|
|
@ -136,6 +136,9 @@ dri_create_context(struct dri_screen *screen,
|
|||
case __DRI_CTX_PRIORITY_HIGH:
|
||||
attribs.context_flags |= PIPE_CONTEXT_HIGH_PRIORITY;
|
||||
break;
|
||||
case __DRI_CTX_PRIORITY_REALTIME:
|
||||
attribs.context_flags |= PIPE_CONTEXT_REALTIME_PRIORITY;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1076,6 +1076,7 @@ struct __DRIdri2LoaderExtensionRec {
|
|||
#define __DRI_CTX_PRIORITY_LOW 0
|
||||
#define __DRI_CTX_PRIORITY_MEDIUM 1
|
||||
#define __DRI_CTX_PRIORITY_HIGH 2
|
||||
#define __DRI_CTX_PRIORITY_REALTIME 3
|
||||
|
||||
#define __DRI_CTX_ATTRIB_RELEASE_BEHAVIOR 5
|
||||
#define __DRI_CTX_RELEASE_BEHAVIOR_NONE 0
|
||||
|
|
|
|||
|
|
@ -413,6 +413,15 @@ enum pipe_flush_flags
|
|||
*/
|
||||
#define PIPE_CONTEXT_MEDIA_ONLY (1 << 9)
|
||||
|
||||
/**
|
||||
* Create a realtime priority context.
|
||||
*
|
||||
* The context must run at the highest possible priority and be capable of
|
||||
* preempting the current executing context when commands are flushed
|
||||
* by such a realtime context.
|
||||
*/
|
||||
#define PIPE_CONTEXT_REALTIME_PRIORITY (1 << 10)
|
||||
|
||||
/**
|
||||
* Flags for pipe_context::memory_barrier.
|
||||
*/
|
||||
|
|
@ -998,9 +1007,10 @@ enum pipe_texture_transfer_mode {
|
|||
*
|
||||
* Note that these match __EGL_CONTEXT_PRIORITY_*_BIT.
|
||||
*/
|
||||
#define PIPE_CONTEXT_PRIORITY_LOW (1 << 0)
|
||||
#define PIPE_CONTEXT_PRIORITY_MEDIUM (1 << 1)
|
||||
#define PIPE_CONTEXT_PRIORITY_HIGH (1 << 2)
|
||||
#define PIPE_CONTEXT_PRIORITY_LOW (1 << 0)
|
||||
#define PIPE_CONTEXT_PRIORITY_MEDIUM (1 << 1)
|
||||
#define PIPE_CONTEXT_PRIORITY_HIGH (1 << 2)
|
||||
#define PIPE_CONTEXT_PRIORITY_REALTIME (1 << 3)
|
||||
|
||||
enum pipe_quirk_texture_border_color_swizzle {
|
||||
PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 = (1 << 0),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue