derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=329e9c0b4beb2a1f29e9e75bd516f3faccef3abc

commit 329e9c0b4beb2a1f29e9e75bd516f3faccef3abc
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Wed Mar 7 15:08:46 2018 -0600

    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
---
 src/modules/evas/engines/gl_drm/evas_engine.c |  4 ++++
 src/modules/evas/engines/gl_drm/evas_engine.h |  1 +
 src/modules/evas/engines/gl_drm/evas_outbuf.c | 16 +++++++++++-----
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c 
b/src/modules/evas/engines/gl_drm/evas_engine.c
index 9bfd562a37..2dd6bb1fb4 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -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;
 }
 
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.h 
b/src/modules/evas/engines/gl_drm/evas_engine.h
index 3d3acf3de6..8b1f68035b 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.h
+++ b/src/modules/evas/engines/gl_drm/evas_engine.h
@@ -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
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c 
b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index b1235355cc..3dae82a617 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -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;

-- 


Reply via email to