compositor: Set EGL_PLATFORM env variable for each backend.

I may have missed something, but - since the Wayland compositor
already picks a platform backend, opens a connection and initializes the
backend specific display data structure it doesn't make sense
to let egl pick a platform. If it picks a different one the
display specific data structure will most likely not match.
Thus determine the platform in the Wayland rendering backend by setting
the EGL_PLATFORM env variable.
For the client any other platform than 'wayland' doesn't seem to make
sense.
I'm not sure if I've got the the platform ofr openfwd right.

Signed-off-by: Egbert Eich <eich@freedesktop.org>
dev
Egbert Eich 14 years ago committed by Kristian Høgsberg
parent b79216e7a0
commit e7b8d9055e
  1. 1
      clients/window.c
  2. 1
      compositor/compositor-drm.c
  3. 1
      compositor/compositor-openwfd.c
  4. 1
      compositor/compositor-wayland.c
  5. 1
      compositor/compositor-x11.c

@ -1757,6 +1757,7 @@ init_egl(struct display *d)
EGL_NONE EGL_NONE
}; };
setenv("EGL_PLATFORM", "wayland", 1);
d->dpy = eglGetDisplay(d->display); d->dpy = eglGetDisplay(d->display);
if (!eglInitialize(d->dpy, &major, &minor)) { if (!eglInitialize(d->dpy, &major, &minor)) {
fprintf(stderr, "failed to initialize display\n"); fprintf(stderr, "failed to initialize display\n");

@ -269,6 +269,7 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
return -1; return -1;
} }
setenv("EGL_PLATFORM", "drm", 1);
ec->drm.fd = fd; ec->drm.fd = fd;
ec->base.display = eglGetDisplay(FD_TO_EGL_NATIVE_DPY(ec->drm.fd)); ec->base.display = eglGetDisplay(FD_TO_EGL_NATIVE_DPY(ec->drm.fd));
if (ec->base.display == NULL) { if (ec->base.display == NULL) {

@ -118,6 +118,7 @@ init_egl(struct wfd_compositor *ec)
return -1; return -1;
ec->wfd_fd = fd; ec->wfd_fd = fd;
setenv("EGL_PLATFORM", "drm", 1);
ec->base.display = eglGetDisplay(FD_TO_EGL_NATIVE_DPY(ec->wfd_fd)); ec->base.display = eglGetDisplay(FD_TO_EGL_NATIVE_DPY(ec->wfd_fd));
if (ec->base.display == NULL) { if (ec->base.display == NULL) {
fprintf(stderr, "failed to create display\n"); fprintf(stderr, "failed to create display\n");

@ -111,6 +111,7 @@ wayland_compositor_init_egl(struct wayland_compositor *c)
EGL_NONE EGL_NONE
}; };
setenv("EGL_PLATFORM", "wayland", 1);
c->base.display = eglGetDisplay(c->parent.display); c->base.display = eglGetDisplay(c->parent.display);
if (c->base.display == NULL) { if (c->base.display == NULL) {
fprintf(stderr, "failed to create display\n"); fprintf(stderr, "failed to create display\n");

@ -113,6 +113,7 @@ x11_compositor_init_egl(struct x11_compositor *c)
EGL_NONE EGL_NONE
}; };
setenv("EGL_PLATFORM", "x11", 1);
c->base.display = eglGetDisplay(c->dpy); c->base.display = eglGetDisplay(c->dpy);
if (c->base.display == NULL) { if (c->base.display == NULL) {
fprintf(stderr, "failed to create display\n"); fprintf(stderr, "failed to create display\n");

Loading…
Cancel
Save