From 411a7cfe67c39c9b79217b63664e4ed0f7a2e8ed Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 19 Sep 2019 12:45:06 +0300 Subject: [PATCH] gl-renderer: display_create needs surface type In case the base EGLConfig is needed, gl_renderer_display_create() needs to know it should use EGL_WINDOW_BIT or EGL_PBUFFER_BIT. The PBUFFER case is added for when the headless backend will grow GL-renderer support. Signed-off-by: Pekka Paalanen --- libweston/backend-drm/drm.c | 1 + libweston/backend-wayland/wayland.c | 1 + libweston/backend-x11/x11.c | 1 + libweston/renderer-gl/gl-renderer.c | 7 +++---- libweston/renderer-gl/gl-renderer.h | 3 +++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index f6fb827a..b21a5ed7 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -747,6 +747,7 @@ drm_backend_create_gl_renderer(struct drm_backend *b) if (gl_renderer->display_create(b->compositor, EGL_PLATFORM_GBM_KHR, (void *)b->gbm, + EGL_WINDOW_BIT, format, n_formats) < 0) { return -1; diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c index 5592becc..42af0c80 100644 --- a/libweston/backend-wayland/wayland.c +++ b/libweston/backend-wayland/wayland.c @@ -2773,6 +2773,7 @@ wayland_backend_create(struct weston_compositor *compositor, if (gl_renderer->display_create(compositor, EGL_PLATFORM_WAYLAND_KHR, b->parent.wl_display, + EGL_WINDOW_BIT, wayland_formats, ARRAY_LENGTH(wayland_formats)) < 0) { weston_log("Failed to initialize the GL renderer; " diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c index 4ed3f511..5fda0568 100644 --- a/libweston/backend-x11/x11.c +++ b/libweston/backend-x11/x11.c @@ -1813,6 +1813,7 @@ init_gl_renderer(struct x11_backend *b) ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR, (void *) b->dpy, + EGL_WINDOW_BIT, x11_formats, ARRAY_LENGTH(x11_formats)); diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 142cb5bb..fba08304 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -3354,6 +3354,7 @@ static int gl_renderer_display_create(struct weston_compositor *ec, EGLenum platform, void *native_display, + EGLint egl_surface_type, const uint32_t *drm_formats, unsigned drm_formats_count) { @@ -3427,13 +3428,11 @@ gl_renderer_display_create(struct weston_compositor *ec, goto fail_with_error; if (!gr->has_configless_context) { - EGLint surface_type = EGL_WINDOW_BIT; - if (!gr->has_surfaceless_context) - surface_type |= EGL_PBUFFER_BIT; + egl_surface_type |= EGL_PBUFFER_BIT; gr->egl_config = gl_renderer_get_egl_config(gr, - surface_type, + egl_surface_type, drm_formats, drm_formats_count); if (gr->egl_config == EGL_NO_CONFIG_KHR) { diff --git a/libweston/renderer-gl/gl-renderer.h b/libweston/renderer-gl/gl-renderer.h index 8a26ac66..a9187be8 100644 --- a/libweston/renderer-gl/gl-renderer.h +++ b/libweston/renderer-gl/gl-renderer.h @@ -46,6 +46,8 @@ typedef void *EGLConfig; typedef intptr_t EGLNativeDisplayType; typedef intptr_t EGLNativeWindowType; #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_WINDOW_BIT 0x0004 #endif /* ENABLE_EGL */ @@ -60,6 +62,7 @@ struct gl_renderer_interface { int (*display_create)(struct weston_compositor *ec, EGLenum platform, void *native_display, + EGLint egl_surface_type, const uint32_t *drm_formats, unsigned drm_formats_count);