[PATCH weston 2/2] Rename weston_compositor EGLDisplay member to egl_display

Daniel Stone daniel at fooishbar.org
Mon Jun 18 11:39:57 PDT 2012


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 <daniel at fooishbar.org>
---
 src/compositor-android.c |   51 +++++++++++++++++++-----------------
 src/compositor-drm.c     |   64 ++++++++++++++++++++++++++--------------------
 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, 139 insertions(+), 123 deletions(-)

diff --git a/src/compositor-android.c b/src/compositor-android.c
index bc47b2d..26fc9ba 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 6ffff1f..49a97f4 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;
@@ -1639,10 +1647,10 @@ drm_destroy(struct weston_compositor *ec)
 	weston_compositor_shutdown(ec);
 
 	/* Work around crash in egl_dri2.c's dri2_make_current() */
-	if (ec->display) {
-		eglMakeCurrent(ec->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
+	if (ec->egl_display) {
+		eglMakeCurrent(ec->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
 			       EGL_NO_CONTEXT);
-		eglTerminate(ec->display);
+		eglTerminate(ec->egl_display);
 		eglReleaseThread();
 	}
 
diff --git a/src/compositor-openwfd.c b/src/compositor-openwfd.c
index e4debc1..dfbeb23 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 b1971a9..5864071 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);
 
@@ -840,18 +842,18 @@ wayland_compositor_create(struct wl_display *display,
 
 	weston_compositor_pre_init(&c->base);
 
-	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)
@@ -873,7 +875,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 d32af90..92b18e8 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 cdb6d01..25f3a5b 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -693,7 +693,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);
@@ -770,8 +770,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);
 
@@ -2991,7 +2991,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");
@@ -3024,7 +3024,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;
@@ -3033,7 +3033,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);
 
 	weston_spring_init(&ec->fade.spring, 30.0, 1.0, 1.0);
 	ec->fade.animation.frame = fade_frame;
@@ -3312,7 +3312,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 4f1d045..daea290 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;
-- 
1.7.10



More information about the wayland-devel mailing list