gl_drm: use EGL_IMG_context_priority if available

This is a hint that we want a high priority context.  Since gl_drm is
likely a compositor or a full screen app, it makes sense that it try to
use this (but other engines probably shouldn't)

Based loosely on Chris Wilson's weston patch to do the same thing.
(weston commit b678befb6ed055e6c66466505d9195a3cebf8073)

As this extension appears to have been around for years, I haven't
added fallback defines for:
EGL_CONTEXT_PRIORITY_LEVEL_IMG  0x3100
EGL_CONTEXT_PRIORITY_HIGH_IMG   0x3101
This commit is contained in:
Derek Foreman 2018-03-07 15:08:46 -06:00
parent f8658d25fa
commit 329e9c0b4b
3 changed files with 16 additions and 5 deletions

View File

@ -29,6 +29,7 @@ struct scanout_handle
/* external variables */
int _evas_engine_gl_drm_log_dom = -1;
int _extn_have_buffer_age = 1;
int _extn_have_context_priority = 0;
/* local variables */
static Eina_Bool initted = EINA_FALSE;
@ -236,6 +237,9 @@ eng_gl_symbols(EGLDisplay edsp)
FINDSYM(glsym_eglQueryWaylandBufferWL, "eglQueryWaylandBufferWL",
glsym_func_uint);
if (strstr(exts, "EGL_IMG_context_priority"))
_extn_have_context_priority = 1;
done = EINA_TRUE;
}

View File

@ -28,6 +28,7 @@
extern int _evas_engine_gl_drm_log_dom;
extern int _extn_have_buffer_age;
extern int _extn_have_context_priority;
# ifdef ERR
# undef ERR

View File

@ -161,9 +161,9 @@ _evas_outbuf_init(void)
static Eina_Bool
_evas_outbuf_egl_setup(Outbuf *ob)
{
int ctx_attr[3];
int ctx_attr[5];
int cfg_attr[40];
int maj = 0, min = 0, n = 0, i = 0;
int maj = 0, min = 0, n = 0, i = 0, cn = 0;
EGLint ncfg = 0;
EGLConfig *cfgs;
const GLubyte *vendor, *renderer, *version, *glslversion;
@ -176,9 +176,15 @@ _evas_outbuf_egl_setup(Outbuf *ob)
}
/* setup gbm egl surface */
ctx_attr[0] = EGL_CONTEXT_CLIENT_VERSION;
ctx_attr[1] = 2;
ctx_attr[2] = EGL_NONE;
ctx_attr[cn++] = EGL_CONTEXT_CLIENT_VERSION;
ctx_attr[cn++] = 2;
if (_extn_have_context_priority)
{
ctx_attr[cn++] = EGL_CONTEXT_PRIORITY_LEVEL_IMG;
ctx_attr[cn++] = EGL_CONTEXT_PRIORITY_HIGH_IMG;
}
ctx_attr[cn++] = EGL_NONE;
cfg_attr[n++] = EGL_RENDERABLE_TYPE;
cfg_attr[n++] = EGL_OPENGL_ES2_BIT;