EGLBoolean ret;
static int errored;
- ret = eglMakeCurrent(compositor->base.display, output->egl_surface,
- output->egl_surface, compositor->base.context);
+ ret = eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
+ output->egl_surface, compositor->base.egl_context);
if (ret == EGL_FALSE) {
if (errored)
return -1;
weston_output_do_read_pixels(&output->base);
- ret = eglSwapBuffers(compositor->base.display, output->egl_surface);
+ ret = eglSwapBuffers(compositor->base.egl_display, output->egl_surface);
if (ret == EGL_FALSE && !errored) {
errored = 1;
weston_log("Failed in eglSwapBuffers.\n");
* surfaceflinger/DisplayHardware/DisplayHardware.cpp
*/
- compositor->base.config = NULL;
+ compositor->base.egl_config = NULL;
- ret = eglGetConfigs(compositor->base.display, NULL, 0, &count);
+ ret = eglGetConfigs(compositor->base.egl_display, NULL, 0, &count);
if (ret == EGL_FALSE || count < 1)
return -1;
if (!configs)
return -1;
- ret = eglChooseConfig(compositor->base.display, attribs, configs,
+ ret = eglChooseConfig(compositor->base.egl_display, attribs, configs,
count, &matched);
if (ret == EGL_FALSE || matched < 1)
goto out;
for (i = 0; i < matched; ++i) {
EGLint id;
- ret = eglGetConfigAttrib(compositor->base.display, configs[i],
- EGL_NATIVE_VISUAL_ID, &id);
+ ret = eglGetConfigAttrib(compositor->base.egl_display,
+ configs[i], EGL_NATIVE_VISUAL_ID,
+ &id);
if (ret == EGL_FALSE)
continue;
if (id > 0 && fb->format == id) {
- compositor->base.config = configs[i];
+ compositor->base.egl_config = configs[i];
break;
}
}
out:
free(configs);
- if (!compositor->base.config)
+ if (!compositor->base.egl_config)
return -1;
return 0;
EGL_NONE
};
- compositor->base.display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (compositor->base.display == EGL_NO_DISPLAY) {
+ compositor->base.egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (compositor->base.egl_display == EGL_NO_DISPLAY) {
weston_log("Failed to create EGL display.\n");
print_egl_error_state();
return -1;
}
- ret = eglInitialize(compositor->base.display, &eglmajor, &eglminor);
+ ret = eglInitialize(compositor->base.egl_display, &eglmajor, &eglminor);
if (!ret) {
weston_log("Failed to initialise EGL.\n");
print_egl_error_state();
return -1;
}
- compositor->base.context = eglCreateContext(compositor->base.display,
- compositor->base.config,
- EGL_NO_CONTEXT,
- context_attrs);
- if (compositor->base.context == EGL_NO_CONTEXT) {
+ compositor->base.egl_context =
+ eglCreateContext(compositor->base.egl_display,
+ compositor->base.egl_config,
+ EGL_NO_CONTEXT,
+ context_attrs);
+ if (compositor->base.egl_context == EGL_NO_CONTEXT) {
weston_log("Failed to create a GL ES 2 context.\n");
print_egl_error_state();
return -1;
}
- output->egl_surface = eglCreateWindowSurface(compositor->base.display,
- compositor->base.config,
- output->fb->native_window,
- NULL);
+ output->egl_surface =
+ eglCreateWindowSurface(compositor->base.egl_display,
+ compositor->base.egl_config,
+ output->fb->native_window,
+ NULL);
if (output->egl_surface == EGL_NO_SURFACE) {
weston_log("Failed to create FB EGLSurface.\n");
print_egl_error_state();
static void
android_fini_egl(struct android_compositor *compositor)
{
- eglMakeCurrent(compositor->base.display,
+ eglMakeCurrent(compositor->base.egl_display,
EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
- eglTerminate(compositor->base.display);
+ eglTerminate(compositor->base.egl_display);
eglReleaseThread();
}
return -1;
bo = gbm_bo_create_from_egl_image(c->gbm,
- c->base.display, es->image,
+ c->base.egl_display,
+ es->image,
es->geometry.width,
es->geometry.height,
GBM_BO_USE_SCANOUT);
struct weston_surface *surface;
struct gbm_bo *bo;
- if (!eglMakeCurrent(compositor->base.display, output->egl_surface,
- output->egl_surface, compositor->base.context)) {
+ if (!eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
+ output->egl_surface,
+ compositor->base.egl_context)) {
weston_log("failed to make current\n");
return;
}
weston_output_do_read_pixels(&output->base);
- eglSwapBuffers(compositor->base.display, output->egl_surface);
+ eglSwapBuffers(compositor->base.egl_display, output->egl_surface);
bo = gbm_surface_lock_front_buffer(output->surface);
if (!bo) {
weston_log("failed to lock front buffer: %m\n");
if (!found)
return -1;
- bo = gbm_bo_create_from_egl_image(c->gbm, c->base.display, es->image,
- es->geometry.width, es->geometry.height,
+ bo = gbm_bo_create_from_egl_image(c->gbm, c->base.egl_display,
+ es->image, es->geometry.width,
+ es->geometry.height,
GBM_BO_USE_SCANOUT);
format = gbm_bo_get_format(bo);
handle = gbm_bo_get_handle(bo).s32;
c->crtc_allocator &= ~(1 << output->crtc_id);
c->connector_allocator &= ~(1 << output->connector_id);
- eglDestroySurface(c->base.display, output->egl_surface);
+ eglDestroySurface(c->base.egl_display, output->egl_surface);
gbm_surface_destroy(output->surface);
weston_output_destroy(&output->base);
}
egl_surface =
- eglCreateWindowSurface(ec->base.display,
- ec->base.config,
+ eglCreateWindowSurface(ec->base.egl_display,
+ ec->base.egl_config,
surface, NULL);
if (egl_surface == EGL_NO_SURFACE) {
}
output->next = NULL;
- eglDestroySurface(ec->base.display, output->egl_surface);
+ eglDestroySurface(ec->base.egl_display, output->egl_surface);
gbm_surface_destroy(output->surface);
output->egl_surface = egl_surface;
output->surface = surface;
return 0;
err:
- eglDestroySurface(ec->base.display, egl_surface);
+ eglDestroySurface(ec->base.egl_display, egl_surface);
gbm_surface_destroy(surface);
return -1;
}
ec->drm.fd = fd;
ec->gbm = gbm_create_device(ec->drm.fd);
- ec->base.display = eglGetDisplay(ec->gbm);
- if (ec->base.display == NULL) {
+ ec->base.egl_display = eglGetDisplay(ec->gbm);
+ if (ec->base.egl_display == NULL) {
weston_log("failed to create display\n");
return -1;
}
- if (!eglInitialize(ec->base.display, &major, &minor)) {
+ if (!eglInitialize(ec->base.egl_display, &major, &minor)) {
weston_log("failed to initialize display\n");
return -1;
}
return -1;
}
- if (!eglChooseConfig(ec->base.display, config_attribs,
- &ec->base.config, 1, &n) || n != 1) {
+ if (!eglChooseConfig(ec->base.egl_display, config_attribs,
+ &ec->base.egl_config, 1, &n) || n != 1) {
weston_log("failed to choose config: %d\n", n);
return -1;
}
- ec->base.context = eglCreateContext(ec->base.display, ec->base.config,
- EGL_NO_CONTEXT, context_attribs);
- if (ec->base.context == NULL) {
+ ec->base.egl_context =
+ eglCreateContext(ec->base.egl_display, ec->base.egl_config,
+ EGL_NO_CONTEXT, context_attribs);
+ if (ec->base.egl_context == NULL) {
weston_log("failed to create context\n");
return -1;
}
}
ec->dummy_egl_surface =
- eglCreateWindowSurface(ec->base.display, ec->base.config,
- ec->dummy_surface, NULL);
+ eglCreateWindowSurface(ec->base.egl_display,
+ ec->base.egl_config,
+ ec->dummy_surface,
+ NULL);
if (ec->dummy_egl_surface == EGL_NO_SURFACE) {
weston_log("failed to create egl surface\n");
return -1;
}
- if (!eglMakeCurrent(ec->base.display, ec->dummy_egl_surface,
- ec->dummy_egl_surface, ec->base.context)) {
+ if (!eglMakeCurrent(ec->base.egl_display, ec->dummy_egl_surface,
+ ec->dummy_egl_surface, ec->base.egl_context)) {
weston_log("failed to make context current\n");
return -1;
}
}
output->egl_surface =
- eglCreateWindowSurface(ec->base.display, ec->base.config,
- output->surface, NULL);
+ eglCreateWindowSurface(ec->base.egl_display,
+ ec->base.egl_config,
+ output->surface,
+ NULL);
if (output->egl_surface == EGL_NO_SURFACE) {
weston_log("failed to create egl surface\n");
goto err_surface;
weston_compositor_shutdown(ec);
/* Work around crash in egl_dri2.c's dri2_make_current() */
- eglMakeCurrent(ec->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
+ eglMakeCurrent(ec->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
- eglTerminate(ec->display);
+ eglTerminate(ec->egl_display);
eglReleaseThread();
gbm_device_destroy(d->gbm);
ec->wfd_fd = fd;
ec->gbm = gbm_create_device(ec->wfd_fd);
- ec->base.display = eglGetDisplay(ec->gbm);
- if (ec->base.display == NULL) {
+ ec->base.egl_display = eglGetDisplay(ec->gbm);
+ if (ec->base.egl_display == NULL) {
weston_log("failed to create display\n");
return -1;
}
- if (!eglInitialize(ec->base.display, &major, &minor)) {
+ if (!eglInitialize(ec->base.egl_display, &major, &minor)) {
weston_log("failed to initialize display\n");
return -1;
}
- extensions = eglQueryString(ec->base.display, EGL_EXTENSIONS);
+ extensions = eglQueryString(ec->base.egl_display, EGL_EXTENSIONS);
if (!strstr(extensions, "EGL_KHR_surfaceless_gles2")) {
weston_log("EGL_KHR_surfaceless_gles2 not available\n");
return -1;
return -1;
}
- ec->base.context = eglCreateContext(ec->base.display, NULL,
- EGL_NO_CONTEXT, context_attribs);
- if (ec->base.context == NULL) {
+ ec->base.egl_context =
+ eglCreateContext(ec->base.egl_display, NULL,
+ EGL_NO_CONTEXT, context_attribs);
+ if (ec->base.egl_context == NULL) {
weston_log("failed to create context\n");
return -1;
}
- if (!eglMakeCurrent(ec->base.display, EGL_NO_SURFACE,
- EGL_NO_SURFACE, ec->base.context)) {
+ if (!eglMakeCurrent(ec->base.egl_display, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, ec->base.egl_context)) {
weston_log("failed to make context current\n");
return -1;
}
glDeleteRenderbuffers(2, output->rbo);
for (i = 0; i < 2; i++) {
- ec->base.destroy_image(ec->base.display, output->image[i]);
+ ec->base.destroy_image(ec->base.egl_display, output->image[i]);
gbm_bo_destroy(output->bo[i]);
wfdDestroySource(ec->dev, output->source[i]);
}
output->base.current->height,
GBM_BO_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
- output->image[i] = ec->base.create_image(ec->base.display,
+ output->image[i] = ec->base.create_image(ec->base.egl_display,
NULL,
EGL_NATIVE_PIXMAP_KHR,
output->bo[i], NULL);
EGLSurface dummy_egl_surface;
struct {
- struct wl_display *display;
+ struct wl_display *wl_display;
struct wl_compositor *compositor;
struct wl_shell *shell;
struct wl_output *output;
EGL_NONE
};
- c->base.display = eglGetDisplay(c->parent.display);
- if (c->base.display == NULL) {
+ c->base.egl_display = eglGetDisplay(c->parent.wl_display);
+ if (c->base.egl_display == NULL) {
weston_log("failed to create display\n");
return -1;
}
- if (!eglInitialize(c->base.display, &major, &minor)) {
+ if (!eglInitialize(c->base.egl_display, &major, &minor)) {
weston_log("failed to initialize display\n");
return -1;
}
weston_log("failed to bind EGL_OPENGL_ES_API\n");
return -1;
}
- if (!eglChooseConfig(c->base.display, config_attribs,
- &c->base.config, 1, &n) || n == 0) {
+ if (!eglChooseConfig(c->base.egl_display, config_attribs,
+ &c->base.egl_config, 1, &n) || n == 0) {
weston_log("failed to choose config: %d\n", n);
return -1;
}
- c->base.context = eglCreateContext(c->base.display, c->base.config,
- EGL_NO_CONTEXT, context_attribs);
- if (c->base.context == NULL) {
+ c->base.egl_context =
+ eglCreateContext(c->base.egl_display, c->base.egl_config,
+ EGL_NO_CONTEXT, context_attribs);
+ if (c->base.egl_context == NULL) {
weston_log("failed to create context\n");
return -1;
}
}
c->dummy_egl_surface =
- eglCreatePixmapSurface(c->base.display, c->base.config,
+ eglCreatePixmapSurface(c->base.egl_display, c->base.egl_config,
c->dummy_pixmap, NULL);
- if (!eglMakeCurrent(c->base.display, c->dummy_egl_surface,
- c->dummy_egl_surface, c->base.context)) {
+ if (!eglMakeCurrent(c->base.egl_display, c->dummy_egl_surface,
+ c->dummy_egl_surface, c->base.egl_context)) {
weston_log("failed to make context current\n");
return -1;
}
struct wl_callback *callback;
struct weston_surface *surface;
- if (!eglMakeCurrent(compositor->base.display, output->egl_surface,
- output->egl_surface, compositor->base.context)) {
+ if (!eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
+ output->egl_surface,
+ compositor->base.egl_context)) {
weston_log("failed to make current\n");
return;
}
weston_output_do_read_pixels(&output->base);
- eglSwapBuffers(compositor->base.display, output->egl_surface);
+ eglSwapBuffers(compositor->base.egl_display, output->egl_surface);
callback = wl_surface_frame(output->parent.surface);
wl_callback_add_listener(callback, &frame_listener, output);
struct wayland_output *output = (struct wayland_output *) output_base;
struct weston_compositor *ec = output->base.compositor;
- eglDestroySurface(ec->display, output->egl_surface);
+ eglDestroySurface(ec->egl_display, output->egl_surface);
wl_egl_window_destroy(output->parent.egl_window);
free(output);
}
output->egl_surface =
- eglCreateWindowSurface(c->base.display, c->base.config,
+ eglCreateWindowSurface(c->base.egl_display, c->base.egl_config,
output->parent.egl_window, NULL);
if (!output->egl_surface) {
weston_log("failed to create window surface\n");
goto cleanup_window;
}
- if (!eglMakeCurrent(c->base.display, output->egl_surface,
- output->egl_surface, c->base.context)) {
+ if (!eglMakeCurrent(c->base.egl_display, output->egl_surface,
+ output->egl_surface, c->base.egl_context)) {
weston_log("failed to make surface current\n");
goto cleanup_surface;
return -1;
return 0;
cleanup_surface:
- eglDestroySurface(c->base.display, output->egl_surface);
+ eglDestroySurface(c->base.egl_display, output->egl_surface);
cleanup_window:
wl_egl_window_destroy(output->parent.egl_window);
cleanup_output:
memset(input, 0, sizeof *input);
input->compositor = c;
- input->seat = wl_display_bind(c->parent.display, id,
+ input->seat = wl_display_bind(c->parent.wl_display, id,
&wl_seat_interface);
wl_list_insert(c->input_list.prev, &input->link);
struct wayland_compositor *c = data;
if (mask & WL_EVENT_READABLE)
- wl_display_iterate(c->parent.display, WL_DISPLAY_READABLE);
+ wl_display_iterate(c->parent.wl_display, WL_DISPLAY_READABLE);
if (mask & WL_EVENT_WRITABLE)
- wl_display_iterate(c->parent.display, WL_DISPLAY_WRITABLE);
+ wl_display_iterate(c->parent.wl_display, WL_DISPLAY_WRITABLE);
return 1;
}
c->base.seat = seat;
- wl_display_add_global_listener(c->parent.display,
+ wl_display_add_global_listener(c->parent.wl_display,
display_handle_global_input,
c);
memset(c, 0, sizeof *c);
- c->parent.display = wl_display_connect(display_name);
+ c->parent.wl_display = wl_display_connect(display_name);
- if (c->parent.display == NULL) {
+ if (c->parent.wl_display == NULL) {
weston_log("failed to create display: %m\n");
return NULL;
}
wl_list_init(&c->input_list);
- wl_display_add_global_listener(c->parent.display,
+ wl_display_add_global_listener(c->parent.wl_display,
display_handle_global, c);
- wl_display_iterate(c->parent.display, WL_DISPLAY_READABLE);
+ wl_display_iterate(c->parent.wl_display, WL_DISPLAY_READABLE);
c->base.wl_display = display;
if (wayland_compositor_init_egl(c) < 0)
loop = wl_display_get_event_loop(c->base.wl_display);
- fd = wl_display_get_fd(c->parent.display, update_event_mask, c);
+ fd = wl_display_get_fd(c->parent.wl_display, update_event_mask, c);
c->parent.wl_source =
wl_event_loop_add_fd(loop, fd, c->parent.event_mask,
wayland_compositor_handle_event, c);
EGL_NONE
};
- c->base.display = eglGetDisplay(c->dpy);
- if (c->base.display == NULL) {
+ c->base.egl_display = eglGetDisplay(c->dpy);
+ if (c->base.egl_display == NULL) {
weston_log("failed to create display\n");
return -1;
}
- if (!eglInitialize(c->base.display, &major, &minor)) {
+ if (!eglInitialize(c->base.egl_display, &major, &minor)) {
weston_log("failed to initialize display\n");
return -1;
}
weston_log("failed to bind EGL_OPENGL_ES_API\n");
return -1;
}
- if (!eglChooseConfig(c->base.display, config_attribs,
- &c->base.config, 1, &n) || n == 0) {
+ if (!eglChooseConfig(c->base.egl_display, config_attribs,
+ &c->base.egl_config, 1, &n) || n == 0) {
weston_log("failed to choose config: %d\n", n);
return -1;
}
- c->base.context = eglCreateContext(c->base.display, c->base.config,
- EGL_NO_CONTEXT, context_attribs);
- if (c->base.context == NULL) {
+ c->base.egl_context =
+ eglCreateContext(c->base.egl_display, c->base.egl_config,
+ EGL_NO_CONTEXT, context_attribs);
+ if (c->base.egl_context == NULL) {
weston_log("failed to create context\n");
return -1;
}
- c->dummy_pbuffer = eglCreatePbufferSurface(c->base.display,
- c->base.config,
+ c->dummy_pbuffer = eglCreatePbufferSurface(c->base.egl_display,
+ c->base.egl_config,
pbuffer_attribs);
if (c->dummy_pbuffer == NULL) {
weston_log("failed to create dummy pbuffer\n");
return -1;
}
- if (!eglMakeCurrent(c->base.display, c->dummy_pbuffer,
- c->dummy_pbuffer, c->base.context)) {
+ if (!eglMakeCurrent(c->base.egl_display, c->dummy_pbuffer,
+ c->dummy_pbuffer, c->base.egl_context)) {
weston_log("failed to make context current\n");
return -1;
}
static void
x11_compositor_fini_egl(struct x11_compositor *compositor)
{
- eglMakeCurrent(compositor->base.display,
+ eglMakeCurrent(compositor->base.egl_display,
EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
- eglTerminate(compositor->base.display);
+ eglTerminate(compositor->base.egl_display);
eglReleaseThread();
}
(struct x11_compositor *)output->base.compositor;
struct weston_surface *surface;
- if (!eglMakeCurrent(compositor->base.display, output->egl_surface,
- output->egl_surface, compositor->base.context)) {
+ if (!eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
+ output->egl_surface,
+ compositor->base.egl_context)) {
weston_log("failed to make current\n");
return;
}
weston_output_do_read_pixels(&output->base);
- eglSwapBuffers(compositor->base.display, output->egl_surface);
+ eglSwapBuffers(compositor->base.egl_display, output->egl_surface);
wl_event_source_timer_update(output->finish_frame_timer, 10);
}
wl_list_remove(&output->base.link);
wl_event_source_remove(output->finish_frame_timer);
- eglDestroySurface(compositor->base.display, output->egl_surface);
+ eglDestroySurface(compositor->base.egl_display, output->egl_surface);
xcb_destroy_window(compositor->conn, output->window);
c->atom.net_wm_state_fullscreen);
output->egl_surface =
- eglCreateWindowSurface(c->base.display, c->base.config,
+ eglCreateWindowSurface(c->base.egl_display, c->base.egl_config,
output->window, NULL);
if (!output->egl_surface) {
weston_log("failed to create window surface\n");
return -1;
}
- if (!eglMakeCurrent(c->base.display, output->egl_surface,
- output->egl_surface, c->base.context)) {
+ if (!eglMakeCurrent(c->base.egl_display, output->egl_surface,
+ output->egl_surface, c->base.egl_context)) {
weston_log("failed to make surface current\n");
return -1;
}
wl_list_remove(&surface->buffer_destroy_listener.link);
if (surface->image != EGL_NO_IMAGE_KHR)
- compositor->destroy_image(compositor->display,
+ compositor->destroy_image(compositor->egl_display,
surface->image);
pixman_region32_fini(&surface->transform.boundingbox);
es->blend = 1;
} else {
if (es->image != EGL_NO_IMAGE_KHR)
- ec->destroy_image(ec->display, es->image);
- es->image = ec->create_image(ec->display, NULL,
+ ec->destroy_image(ec->egl_display, es->image);
+ es->image = ec->create_image(ec->egl_display, NULL,
EGL_WAYLAND_BUFFER_WL,
buffer, NULL);
wl_display_init_shm(display);
- log_egl_gl_info(ec->display);
+ log_egl_gl_info(ec->egl_display);
ec->image_target_texture_2d =
(void *) eglGetProcAddress("glEGLImageTargetTexture2DOES");
ec->has_unpack_subimage = 1;
extensions =
- (const char *) eglQueryString(ec->display, EGL_EXTENSIONS);
+ (const char *) eglQueryString(ec->egl_display, EGL_EXTENSIONS);
if (!extensions) {
weston_log("Retrieving EGL extension string failed.\n");
return -1;
if (strstr(extensions, "EGL_WL_bind_wayland_display"))
ec->has_bind_display = 1;
if (ec->has_bind_display)
- ec->bind_display(ec->display, ec->wl_display);
+ ec->bind_display(ec->egl_display, ec->wl_display);
wl_list_init(&ec->surface_list);
wl_list_init(&ec->layer_list);
wl_signal_emit(&ec->destroy_signal, ec);
if (ec->has_bind_display)
- ec->unbind_display(ec->display, display);
+ ec->unbind_display(ec->egl_display, display);
for (i = ARRAY_LENGTH(signals); i;)
wl_event_source_remove(signals[--i]);
struct wl_shm *shm;
struct wl_signal destroy_signal;
- EGLDisplay display;
- EGLContext context;
- EGLConfig config;
+ EGLDisplay egl_display;
+ EGLContext egl_context;
+ EGLConfig egl_config;
GLuint fbo;
struct weston_shader texture_shader;
struct weston_shader solid_shader;