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 <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2019-09-20 14:18:14 +03:00 committed by Pekka Paalanen
parent 53b7fd70b8
commit ecdf50d38e
2 changed files with 11 additions and 0 deletions

View File

@ -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;

View File

@ -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 */