From ecdf50d38e488a7046776773aceb5ba1ac7f8701 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Fri, 20 Sep 2019 14:18:14 +0300 Subject: [PATCH] gl-renderer: add EGL surfaceless platform support This allows passing EGL_PLATFORM_SURFACELESS_MESA to gl_renderer_display_create(). It is not useful on its own, because the surfaceless platform has no window surfaces. This feature will be used by the headless backend. Signed-off-by: Pekka Paalanen --- libweston/renderer-gl/gl-renderer.c | 6 ++++++ shared/weston-egl-ext.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index fba08304..cc77a345 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -3303,6 +3303,8 @@ platform_to_extension(EGLenum platform) return "wayland"; case EGL_PLATFORM_X11_KHR: return "x11"; + case EGL_PLATFORM_SURFACELESS_MESA: + return "surfaceless"; default: assert(0 && "bad EGL platform enum"); } @@ -3369,6 +3371,10 @@ gl_renderer_display_create(struct weston_compositor *ec, return -1; } + /* Surfaceless is unusable without platform_base extension */ + if (supports == 0 && platform == EGL_PLATFORM_SURFACELESS_MESA) + return -1; + gr = zalloc(sizeof *gr); if (gr == NULL) return -1; diff --git a/shared/weston-egl-ext.h b/shared/weston-egl-ext.h index 0784ea2d..4a757c8b 100644 --- a/shared/weston-egl-ext.h +++ b/shared/weston-egl-ext.h @@ -176,6 +176,10 @@ typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLD #define EGL_PLATFORM_X11_KHR 0x31D5 #endif +#ifndef EGL_PLATFORM_SURFACELESS_MESA +#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD +#endif + #ifndef EGL_KHR_cl_event2 #define EGL_KHR_cl_event2 1 typedef void *EGLSyncKHR; @@ -210,6 +214,7 @@ typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, #define EGL_PLATFORM_GBM_KHR 0x31D7 #define EGL_PLATFORM_WAYLAND_KHR 0x31D8 #define EGL_PLATFORM_X11_KHR 0x31D5 +#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD #endif /* ENABLE_EGL */