[prefix=PATCH weston] gl-renderer.c: Pass visual ID for choosing egl configs for pbuffer

Madhurkiran Harikrishnan madhurkiran.harikrishnan at xilinx.com
Mon Mar 19 22:49:34 UTC 2018


The original implementation always chose first egl config for pbuffer
surface type, however the returned configs are implementation specific
and egl config may not always match between ctx and surface. Hence,
pass the visual_id to find the correct egl config.

Signed-off-by: Madhurkiran Harikrishnan <madhurkiran.harikrishnan at xilinx.com>
---
 libweston/gl-renderer.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index b67c8e2..c387367 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -3145,7 +3145,7 @@ output_handle_destroy(struct wl_listener *listener, void *data)
 }

 static int
-gl_renderer_create_pbuffer_surface(struct gl_renderer *gr) {
+gl_renderer_create_pbuffer_surface(struct gl_renderer *gr, const EGLint *visual_id, int n_ids) {
        EGLConfig pbuffer_config;

        static const EGLint pbuffer_config_attribs[] = {
@@ -3164,11 +3164,19 @@ gl_renderer_create_pbuffer_surface(struct gl_renderer *gr) {
                EGL_NONE
        };

-       if (egl_choose_config(gr, pbuffer_config_attribs, NULL, 0, &pbuffer_config) < 0) {
+       if (egl_choose_config(gr, pbuffer_config_attribs, visual_id, n_ids, &pbuffer_config) < 0) {
                weston_log("failed to choose EGL config for PbufferSurface\n");
                return -1;
        }

+       if (pbuffer_config != gr->egl_config &&
+           !gr->has_configless_context) {
+               weston_log("attempted to use a different EGL config for an "
+                          "output but EGL_KHR_no_config_context or "
+                          "EGL_MESA_configless_context is not supported\n");
+               return -1;
+       }
+
        gr->dummy_surface = eglCreatePbufferSurface(gr->egl_display,
                                                    pbuffer_config,
                                                    pbuffer_attribs);
@@ -3277,7 +3285,7 @@ gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform,
                weston_log("EGL_KHR_surfaceless_context unavailable. "
                           "Trying PbufferSurface\n");

-               if (gl_renderer_create_pbuffer_surface(gr) < 0)
+               if (gl_renderer_create_pbuffer_surface(gr, visual_id, n_ids) < 0)
                        goto fail_with_error;
        }

--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.


More information about the wayland-devel mailing list