gl-renderer: fix pbuffer surface creation
authorTomek Bury <tomek.bury@broadcom.com>
Thu, 4 Jun 2020 13:59:55 +0000 (14:59 +0100)
committerTomek Bury <tomek.bury@broadcom.com>
Thu, 11 Jun 2020 09:52:22 +0000 (10:52 +0100)
When there's neither configless nor surfaceless EGL extension
(i.e. not a Mesa driver), Weston falls back to a dummy pbuffer surface.

Weston attempts to find for that surface an EGL config but uses a NULL
array of pixel formats. This fails with the following messages:

 EGL_KHR_surfaceless_context unavailable. Trying PbufferSurface
 Found an EGLConfig matching { pbf;  } but it is not usable because
    neither EGL_KHR_no_config_context nor EGL_MESA_configless_context
    are supported by EGL.
 failed to choose EGL config for PbufferSurface
 EGL error state: EGL_SUCCESS (0x3000)
 Failed to initialise the GL renderer;

Signed-off-by: Tomek Bury <tomek.bury@broadcom.com>
libweston/renderer-gl/gl-renderer.c

index 505d0559c70d5966ccf213557251aa16dca7ccfe..937ebe865b414c975cbfd5b8a31f05e01a604eb6 100644 (file)
@@ -3448,8 +3448,12 @@ gl_renderer_create_pbuffer_surface(struct gl_renderer *gr) {
                EGL_NONE
        };
 
-       pbuffer_config = gl_renderer_get_egl_config(gr, EGL_PBUFFER_BIT,
-                                                   NULL, 0);
+       pbuffer_config = gr->egl_config;
+       if (pbuffer_config == EGL_NO_CONFIG_KHR) {
+               pbuffer_config =
+                       gl_renderer_get_egl_config(gr, EGL_PBUFFER_BIT,
+                                                  NULL, 0);
+       }
        if (pbuffer_config == EGL_NO_CONFIG_KHR) {
                weston_log("failed to choose EGL config for PbufferSurface\n");
                return -1;