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 <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 5 years ago committed by Pekka Paalanen
parent 24756a8965
commit 411a7cfe67
  1. 1
      libweston/backend-drm/drm.c
  2. 1
      libweston/backend-wayland/wayland.c
  3. 1
      libweston/backend-x11/x11.c
  4. 7
      libweston/renderer-gl/gl-renderer.c
  5. 3
      libweston/renderer-gl/gl-renderer.h

@ -747,6 +747,7 @@ drm_backend_create_gl_renderer(struct drm_backend *b)
if (gl_renderer->display_create(b->compositor, if (gl_renderer->display_create(b->compositor,
EGL_PLATFORM_GBM_KHR, EGL_PLATFORM_GBM_KHR,
(void *)b->gbm, (void *)b->gbm,
EGL_WINDOW_BIT,
format, format,
n_formats) < 0) { n_formats) < 0) {
return -1; return -1;

@ -2773,6 +2773,7 @@ wayland_backend_create(struct weston_compositor *compositor,
if (gl_renderer->display_create(compositor, if (gl_renderer->display_create(compositor,
EGL_PLATFORM_WAYLAND_KHR, EGL_PLATFORM_WAYLAND_KHR,
b->parent.wl_display, b->parent.wl_display,
EGL_WINDOW_BIT,
wayland_formats, wayland_formats,
ARRAY_LENGTH(wayland_formats)) < 0) { ARRAY_LENGTH(wayland_formats)) < 0) {
weston_log("Failed to initialize the GL renderer; " weston_log("Failed to initialize the GL renderer; "

@ -1813,6 +1813,7 @@ init_gl_renderer(struct x11_backend *b)
ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR, ret = gl_renderer->display_create(b->compositor, EGL_PLATFORM_X11_KHR,
(void *) b->dpy, (void *) b->dpy,
EGL_WINDOW_BIT,
x11_formats, x11_formats,
ARRAY_LENGTH(x11_formats)); ARRAY_LENGTH(x11_formats));

@ -3354,6 +3354,7 @@ static int
gl_renderer_display_create(struct weston_compositor *ec, gl_renderer_display_create(struct weston_compositor *ec,
EGLenum platform, EGLenum platform,
void *native_display, void *native_display,
EGLint egl_surface_type,
const uint32_t *drm_formats, const uint32_t *drm_formats,
unsigned drm_formats_count) unsigned drm_formats_count)
{ {
@ -3427,13 +3428,11 @@ gl_renderer_display_create(struct weston_compositor *ec,
goto fail_with_error; goto fail_with_error;
if (!gr->has_configless_context) { if (!gr->has_configless_context) {
EGLint surface_type = EGL_WINDOW_BIT;
if (!gr->has_surfaceless_context) 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, gr->egl_config = gl_renderer_get_egl_config(gr,
surface_type, egl_surface_type,
drm_formats, drm_formats,
drm_formats_count); drm_formats_count);
if (gr->egl_config == EGL_NO_CONFIG_KHR) { if (gr->egl_config == EGL_NO_CONFIG_KHR) {

@ -46,6 +46,8 @@ typedef void *EGLConfig;
typedef intptr_t EGLNativeDisplayType; typedef intptr_t EGLNativeDisplayType;
typedef intptr_t EGLNativeWindowType; typedef intptr_t EGLNativeWindowType;
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0) #define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
#define EGL_PBUFFER_BIT 0x0001
#define EGL_WINDOW_BIT 0x0004
#endif /* ENABLE_EGL */ #endif /* ENABLE_EGL */
@ -60,6 +62,7 @@ struct gl_renderer_interface {
int (*display_create)(struct weston_compositor *ec, int (*display_create)(struct weston_compositor *ec,
EGLenum platform, EGLenum platform,
void *native_display, void *native_display,
EGLint egl_surface_type,
const uint32_t *drm_formats, const uint32_t *drm_formats,
unsigned drm_formats_count); unsigned drm_formats_count);

Loading…
Cancel
Save