From 362b672111e1e71e2a4b58f3e542f1a08a4ae584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 18 Jun 2012 15:13:51 -0400 Subject: [PATCH] Rename weston_compositor EGLDisplay member to egl_display EGLDisplay is helpfully typedeffed as void *, which means that you won't get conflicting-pointer-type warnings if you accidentally confuse it with weston_compositor::wl_display. Rename it to make it more clear which display you're dealing with, and also rename compositor-wayland's parent.display member to parent.wl_display. Signed-off-by: Daniel Stone --- src/compositor-android.c | 51 +++++++++++++++++---------------- src/compositor-drm.c | 62 +++++++++++++++++++++++----------------- src/compositor-openwfd.c | 23 ++++++++------- src/compositor-wayland.c | 60 +++++++++++++++++++------------------- src/compositor-x11.c | 44 ++++++++++++++-------------- src/compositor.c | 14 ++++----- src/compositor.h | 6 ++-- 7 files changed, 138 insertions(+), 122 deletions(-) diff --git a/src/compositor-android.c b/src/compositor-android.c index 06c85170..9797d391 100644 --- a/src/compositor-android.c +++ b/src/compositor-android.c @@ -108,8 +108,8 @@ android_output_make_current(struct android_output *output) 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; @@ -149,7 +149,7 @@ android_output_repaint(struct weston_output *base, pixman_region32_t *damage) 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"); @@ -267,9 +267,9 @@ android_egl_choose_config(struct android_compositor *compositor, * 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; @@ -277,26 +277,27 @@ android_egl_choose_config(struct android_compositor *compositor, 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; @@ -324,14 +325,14 @@ android_init_egl(struct android_compositor *compositor, 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(); @@ -351,20 +352,22 @@ android_init_egl(struct android_compositor *compositor, 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(); @@ -380,11 +383,11 @@ android_init_egl(struct android_compositor *compositor, 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(); } diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 45ef6ef7..1bb89294 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -249,7 +249,8 @@ drm_output_prepare_scanout_surface(struct drm_output *output) 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); @@ -290,8 +291,9 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage) 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; } @@ -301,7 +303,7 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage) 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"); @@ -550,8 +552,9 @@ drm_output_prepare_overlay_surface(struct weston_output *output_base, 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; @@ -809,7 +812,7 @@ drm_output_destroy(struct weston_output *output_base) 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); @@ -912,8 +915,8 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo } 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) { @@ -949,7 +952,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo } 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; @@ -961,7 +964,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo return 0; err: - eglDestroySurface(ec->base.display, egl_surface); + eglDestroySurface(ec->base.egl_display, egl_surface); gbm_surface_destroy(surface); return -1; } @@ -1022,13 +1025,13 @@ init_egl(struct drm_compositor *ec, struct udev_device *device) 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; } @@ -1038,15 +1041,16 @@ init_egl(struct drm_compositor *ec, struct udev_device *device) 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; } @@ -1060,15 +1064,17 @@ init_egl(struct drm_compositor *ec, struct udev_device *device) } 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; } @@ -1318,8 +1324,10 @@ create_output_for_connector(struct drm_compositor *ec, } 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; @@ -1634,9 +1642,9 @@ drm_destroy(struct weston_compositor *ec) 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); diff --git a/src/compositor-openwfd.c b/src/compositor-openwfd.c index aac80642..d6616f5a 100644 --- a/src/compositor-openwfd.c +++ b/src/compositor-openwfd.c @@ -135,18 +135,18 @@ init_egl(struct wfd_compositor *ec) 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; @@ -157,15 +157,16 @@ init_egl(struct wfd_compositor *ec) 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; } @@ -204,7 +205,7 @@ wfd_output_destroy(struct weston_output *output_base) 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]); } @@ -362,7 +363,7 @@ create_output_for_port(struct wfd_compositor *ec, 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); diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index fc1917d7..50a6f6d1 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -51,7 +51,7 @@ struct wayland_compositor { 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; @@ -265,13 +265,13 @@ wayland_compositor_init_egl(struct wayland_compositor *c) 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; } @@ -280,15 +280,16 @@ wayland_compositor_init_egl(struct wayland_compositor *c) 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; } @@ -300,10 +301,10 @@ wayland_compositor_init_egl(struct wayland_compositor *c) } 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; } @@ -334,8 +335,9 @@ wayland_output_repaint(struct weston_output *output_base, 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; } @@ -347,7 +349,7 @@ wayland_output_repaint(struct weston_output *output_base, 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); @@ -360,7 +362,7 @@ wayland_output_destroy(struct weston_output *output_base) 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); @@ -413,15 +415,15 @@ wayland_compositor_create_output(struct wayland_compositor *c, } 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; @@ -447,7 +449,7 @@ wayland_compositor_create_output(struct wayland_compositor *c, 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: @@ -726,7 +728,7 @@ display_add_seat(struct wayland_compositor *c, uint32_t id) 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); @@ -787,9 +789,9 @@ wayland_compositor_handle_event(int fd, uint32_t mask, void *data) 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; } @@ -808,7 +810,7 @@ wayland_input_create(struct wayland_compositor *c) 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); @@ -838,18 +840,18 @@ wayland_compositor_create(struct wl_display *display, 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) @@ -871,7 +873,7 @@ wayland_compositor_create(struct wl_display *display, 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); diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 44a48b03..61a5464a 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -194,13 +194,13 @@ x11_compositor_init_egl(struct x11_compositor *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; } @@ -209,29 +209,30 @@ x11_compositor_init_egl(struct x11_compositor *c) 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; } @@ -242,11 +243,11 @@ x11_compositor_init_egl(struct x11_compositor *c) 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(); } @@ -259,8 +260,9 @@ x11_output_repaint(struct weston_output *output_base, (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; } @@ -270,7 +272,7 @@ x11_output_repaint(struct weston_output *output_base, 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); } @@ -299,7 +301,7 @@ x11_output_destroy(struct weston_output *output_base) 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); @@ -497,14 +499,14 @@ x11_compositor_create_output(struct x11_compositor *c, int x, int y, 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; } diff --git a/src/compositor.c b/src/compositor.c index ccca60d4..053dfd13 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -668,7 +668,7 @@ destroy_surface(struct wl_resource *resource) 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); @@ -745,8 +745,8 @@ weston_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer) 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); @@ -2984,7 +2984,7 @@ weston_compositor_init(struct weston_compositor *ec, 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"); @@ -3017,7 +3017,7 @@ weston_compositor_init(struct weston_compositor *ec, 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; @@ -3026,7 +3026,7 @@ weston_compositor_init(struct weston_compositor *ec, 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); @@ -3310,7 +3310,7 @@ int main(int argc, char *argv[]) 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]); diff --git a/src/compositor.h b/src/compositor.h index df100d5d..b57fc2ee 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -273,9 +273,9 @@ struct weston_compositor { 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;