Mesa (master): egl/dri2: check if the EGL API is valid before adding it to ClientAPIs

Emil Velikov evelikov at kemper.freedesktop.org
Tue Aug 30 13:55:33 UTC 2016


Module: Mesa
Branch: master
Commit: 03eaa6c5969d3eb87112d96a0e33b4eb46bf9f5a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=03eaa6c5969d3eb87112d96a0e33b4eb46bf9f5a

Author: Emil Velikov <emil.velikov at collabora.com>
Date:   Thu Aug 25 12:15:13 2016 +0100

egl/dri2: check if the EGL API is valid before adding it to ClientAPIs

In the rather unlikely case that the API is considered invalid, don't
add it to the (supported) ClientAPIs bitmask.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Tomasz Figa <tfiga at chromium.org>

---
Strictly speaking we only need this in the Android case for OpenGL.
Adding it everywhere doesn't hurt us since the compiler will const
propagate and optimise/remove these.

---

 src/egl/drivers/dri2/egl_dri2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e854903..19f54de 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -593,13 +593,13 @@ dri2_setup_screen(_EGLDisplay *disp)
    }
 
    disp->ClientAPIs = 0;
-   if (api_mask & (1 <<__DRI_API_OPENGL))
+   if ((api_mask & (1 <<__DRI_API_OPENGL)) && _eglIsApiValid(EGL_OPENGL_API))
       disp->ClientAPIs |= EGL_OPENGL_BIT;
-   if (api_mask & (1 <<__DRI_API_GLES))
+   if ((api_mask & (1 << __DRI_API_GLES)) && _eglIsApiValid(EGL_OPENGL_ES_API))
       disp->ClientAPIs |= EGL_OPENGL_ES_BIT;
-   if (api_mask & (1 << __DRI_API_GLES2))
+   if ((api_mask & (1 << __DRI_API_GLES2)) && _eglIsApiValid(EGL_OPENGL_ES_API))
       disp->ClientAPIs |= EGL_OPENGL_ES2_BIT;
-   if (api_mask & (1 << __DRI_API_GLES3))
+   if ((api_mask & (1 << __DRI_API_GLES3)) && _eglIsApiValid(EGL_OPENGL_ES_API))
       disp->ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR;
 
    assert(dri2_dpy->image_driver || dri2_dpy->dri2 || dri2_dpy->swrast);




More information about the mesa-commit mailing list