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 <daniel@fooishbar.org>
This commit is contained in:
+27
-24
@@ -108,8 +108,8 @@ android_output_make_current(struct android_output *output)
|
|||||||
EGLBoolean ret;
|
EGLBoolean ret;
|
||||||
static int errored;
|
static int errored;
|
||||||
|
|
||||||
ret = eglMakeCurrent(compositor->base.display, output->egl_surface,
|
ret = eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
|
||||||
output->egl_surface, compositor->base.context);
|
output->egl_surface, compositor->base.egl_context);
|
||||||
if (ret == EGL_FALSE) {
|
if (ret == EGL_FALSE) {
|
||||||
if (errored)
|
if (errored)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -149,7 +149,7 @@ android_output_repaint(struct weston_output *base, pixman_region32_t *damage)
|
|||||||
|
|
||||||
weston_output_do_read_pixels(&output->base);
|
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) {
|
if (ret == EGL_FALSE && !errored) {
|
||||||
errored = 1;
|
errored = 1;
|
||||||
weston_log("Failed in eglSwapBuffers.\n");
|
weston_log("Failed in eglSwapBuffers.\n");
|
||||||
@@ -267,9 +267,9 @@ android_egl_choose_config(struct android_compositor *compositor,
|
|||||||
* surfaceflinger/DisplayHardware/DisplayHardware.cpp
|
* 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)
|
if (ret == EGL_FALSE || count < 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -277,26 +277,27 @@ android_egl_choose_config(struct android_compositor *compositor,
|
|||||||
if (!configs)
|
if (!configs)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = eglChooseConfig(compositor->base.display, attribs, configs,
|
ret = eglChooseConfig(compositor->base.egl_display, attribs, configs,
|
||||||
count, &matched);
|
count, &matched);
|
||||||
if (ret == EGL_FALSE || matched < 1)
|
if (ret == EGL_FALSE || matched < 1)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (i = 0; i < matched; ++i) {
|
for (i = 0; i < matched; ++i) {
|
||||||
EGLint id;
|
EGLint id;
|
||||||
ret = eglGetConfigAttrib(compositor->base.display, configs[i],
|
ret = eglGetConfigAttrib(compositor->base.egl_display,
|
||||||
EGL_NATIVE_VISUAL_ID, &id);
|
configs[i], EGL_NATIVE_VISUAL_ID,
|
||||||
|
&id);
|
||||||
if (ret == EGL_FALSE)
|
if (ret == EGL_FALSE)
|
||||||
continue;
|
continue;
|
||||||
if (id > 0 && fb->format == id) {
|
if (id > 0 && fb->format == id) {
|
||||||
compositor->base.config = configs[i];
|
compositor->base.egl_config = configs[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(configs);
|
free(configs);
|
||||||
if (!compositor->base.config)
|
if (!compositor->base.egl_config)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -324,14 +325,14 @@ android_init_egl(struct android_compositor *compositor,
|
|||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
compositor->base.display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
compositor->base.egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
if (compositor->base.display == EGL_NO_DISPLAY) {
|
if (compositor->base.egl_display == EGL_NO_DISPLAY) {
|
||||||
weston_log("Failed to create EGL display.\n");
|
weston_log("Failed to create EGL display.\n");
|
||||||
print_egl_error_state();
|
print_egl_error_state();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = eglInitialize(compositor->base.display, &eglmajor, &eglminor);
|
ret = eglInitialize(compositor->base.egl_display, &eglmajor, &eglminor);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
weston_log("Failed to initialise EGL.\n");
|
weston_log("Failed to initialise EGL.\n");
|
||||||
print_egl_error_state();
|
print_egl_error_state();
|
||||||
@@ -351,20 +352,22 @@ android_init_egl(struct android_compositor *compositor,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
compositor->base.context = eglCreateContext(compositor->base.display,
|
compositor->base.egl_context =
|
||||||
compositor->base.config,
|
eglCreateContext(compositor->base.egl_display,
|
||||||
EGL_NO_CONTEXT,
|
compositor->base.egl_config,
|
||||||
context_attrs);
|
EGL_NO_CONTEXT,
|
||||||
if (compositor->base.context == EGL_NO_CONTEXT) {
|
context_attrs);
|
||||||
|
if (compositor->base.egl_context == EGL_NO_CONTEXT) {
|
||||||
weston_log("Failed to create a GL ES 2 context.\n");
|
weston_log("Failed to create a GL ES 2 context.\n");
|
||||||
print_egl_error_state();
|
print_egl_error_state();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->egl_surface = eglCreateWindowSurface(compositor->base.display,
|
output->egl_surface =
|
||||||
compositor->base.config,
|
eglCreateWindowSurface(compositor->base.egl_display,
|
||||||
output->fb->native_window,
|
compositor->base.egl_config,
|
||||||
NULL);
|
output->fb->native_window,
|
||||||
|
NULL);
|
||||||
if (output->egl_surface == EGL_NO_SURFACE) {
|
if (output->egl_surface == EGL_NO_SURFACE) {
|
||||||
weston_log("Failed to create FB EGLSurface.\n");
|
weston_log("Failed to create FB EGLSurface.\n");
|
||||||
print_egl_error_state();
|
print_egl_error_state();
|
||||||
@@ -380,11 +383,11 @@ android_init_egl(struct android_compositor *compositor,
|
|||||||
static void
|
static void
|
||||||
android_fini_egl(struct android_compositor *compositor)
|
android_fini_egl(struct android_compositor *compositor)
|
||||||
{
|
{
|
||||||
eglMakeCurrent(compositor->base.display,
|
eglMakeCurrent(compositor->base.egl_display,
|
||||||
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
EGL_NO_CONTEXT);
|
EGL_NO_CONTEXT);
|
||||||
|
|
||||||
eglTerminate(compositor->base.display);
|
eglTerminate(compositor->base.egl_display);
|
||||||
eglReleaseThread();
|
eglReleaseThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+35
-27
@@ -249,7 +249,8 @@ drm_output_prepare_scanout_surface(struct drm_output *output)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
bo = gbm_bo_create_from_egl_image(c->gbm,
|
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.width,
|
||||||
es->geometry.height,
|
es->geometry.height,
|
||||||
GBM_BO_USE_SCANOUT);
|
GBM_BO_USE_SCANOUT);
|
||||||
@@ -290,8 +291,9 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage)
|
|||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct gbm_bo *bo;
|
struct gbm_bo *bo;
|
||||||
|
|
||||||
if (!eglMakeCurrent(compositor->base.display, output->egl_surface,
|
if (!eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
|
||||||
output->egl_surface, compositor->base.context)) {
|
output->egl_surface,
|
||||||
|
compositor->base.egl_context)) {
|
||||||
weston_log("failed to make current\n");
|
weston_log("failed to make current\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -301,7 +303,7 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage)
|
|||||||
|
|
||||||
weston_output_do_read_pixels(&output->base);
|
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);
|
bo = gbm_surface_lock_front_buffer(output->surface);
|
||||||
if (!bo) {
|
if (!bo) {
|
||||||
weston_log("failed to lock front buffer: %m\n");
|
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)
|
if (!found)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
bo = gbm_bo_create_from_egl_image(c->gbm, c->base.display, es->image,
|
bo = gbm_bo_create_from_egl_image(c->gbm, c->base.egl_display,
|
||||||
es->geometry.width, es->geometry.height,
|
es->image, es->geometry.width,
|
||||||
|
es->geometry.height,
|
||||||
GBM_BO_USE_SCANOUT);
|
GBM_BO_USE_SCANOUT);
|
||||||
format = gbm_bo_get_format(bo);
|
format = gbm_bo_get_format(bo);
|
||||||
handle = gbm_bo_get_handle(bo).s32;
|
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->crtc_allocator &= ~(1 << output->crtc_id);
|
||||||
c->connector_allocator &= ~(1 << output->connector_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);
|
gbm_surface_destroy(output->surface);
|
||||||
|
|
||||||
weston_output_destroy(&output->base);
|
weston_output_destroy(&output->base);
|
||||||
@@ -912,8 +915,8 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
|
|||||||
}
|
}
|
||||||
|
|
||||||
egl_surface =
|
egl_surface =
|
||||||
eglCreateWindowSurface(ec->base.display,
|
eglCreateWindowSurface(ec->base.egl_display,
|
||||||
ec->base.config,
|
ec->base.egl_config,
|
||||||
surface, NULL);
|
surface, NULL);
|
||||||
|
|
||||||
if (egl_surface == EGL_NO_SURFACE) {
|
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;
|
output->next = NULL;
|
||||||
|
|
||||||
eglDestroySurface(ec->base.display, output->egl_surface);
|
eglDestroySurface(ec->base.egl_display, output->egl_surface);
|
||||||
gbm_surface_destroy(output->surface);
|
gbm_surface_destroy(output->surface);
|
||||||
output->egl_surface = egl_surface;
|
output->egl_surface = egl_surface;
|
||||||
output->surface = surface;
|
output->surface = surface;
|
||||||
@@ -961,7 +964,7 @@ drm_output_switch_mode(struct weston_output *output_base, struct weston_mode *mo
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
eglDestroySurface(ec->base.display, egl_surface);
|
eglDestroySurface(ec->base.egl_display, egl_surface);
|
||||||
gbm_surface_destroy(surface);
|
gbm_surface_destroy(surface);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1022,13 +1025,13 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
|
|||||||
|
|
||||||
ec->drm.fd = fd;
|
ec->drm.fd = fd;
|
||||||
ec->gbm = gbm_create_device(ec->drm.fd);
|
ec->gbm = gbm_create_device(ec->drm.fd);
|
||||||
ec->base.display = eglGetDisplay(ec->gbm);
|
ec->base.egl_display = eglGetDisplay(ec->gbm);
|
||||||
if (ec->base.display == NULL) {
|
if (ec->base.egl_display == NULL) {
|
||||||
weston_log("failed to create display\n");
|
weston_log("failed to create display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglInitialize(ec->base.display, &major, &minor)) {
|
if (!eglInitialize(ec->base.egl_display, &major, &minor)) {
|
||||||
weston_log("failed to initialize display\n");
|
weston_log("failed to initialize display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1038,15 +1041,16 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglChooseConfig(ec->base.display, config_attribs,
|
if (!eglChooseConfig(ec->base.egl_display, config_attribs,
|
||||||
&ec->base.config, 1, &n) || n != 1) {
|
&ec->base.egl_config, 1, &n) || n != 1) {
|
||||||
weston_log("failed to choose config: %d\n", n);
|
weston_log("failed to choose config: %d\n", n);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ec->base.context = eglCreateContext(ec->base.display, ec->base.config,
|
ec->base.egl_context =
|
||||||
EGL_NO_CONTEXT, context_attribs);
|
eglCreateContext(ec->base.egl_display, ec->base.egl_config,
|
||||||
if (ec->base.context == NULL) {
|
EGL_NO_CONTEXT, context_attribs);
|
||||||
|
if (ec->base.egl_context == NULL) {
|
||||||
weston_log("failed to create context\n");
|
weston_log("failed to create context\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1060,15 +1064,17 @@ init_egl(struct drm_compositor *ec, struct udev_device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ec->dummy_egl_surface =
|
ec->dummy_egl_surface =
|
||||||
eglCreateWindowSurface(ec->base.display, ec->base.config,
|
eglCreateWindowSurface(ec->base.egl_display,
|
||||||
ec->dummy_surface, NULL);
|
ec->base.egl_config,
|
||||||
|
ec->dummy_surface,
|
||||||
|
NULL);
|
||||||
if (ec->dummy_egl_surface == EGL_NO_SURFACE) {
|
if (ec->dummy_egl_surface == EGL_NO_SURFACE) {
|
||||||
weston_log("failed to create egl surface\n");
|
weston_log("failed to create egl surface\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglMakeCurrent(ec->base.display, ec->dummy_egl_surface,
|
if (!eglMakeCurrent(ec->base.egl_display, ec->dummy_egl_surface,
|
||||||
ec->dummy_egl_surface, ec->base.context)) {
|
ec->dummy_egl_surface, ec->base.egl_context)) {
|
||||||
weston_log("failed to make context current\n");
|
weston_log("failed to make context current\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1318,8 +1324,10 @@ create_output_for_connector(struct drm_compositor *ec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
output->egl_surface =
|
output->egl_surface =
|
||||||
eglCreateWindowSurface(ec->base.display, ec->base.config,
|
eglCreateWindowSurface(ec->base.egl_display,
|
||||||
output->surface, NULL);
|
ec->base.egl_config,
|
||||||
|
output->surface,
|
||||||
|
NULL);
|
||||||
if (output->egl_surface == EGL_NO_SURFACE) {
|
if (output->egl_surface == EGL_NO_SURFACE) {
|
||||||
weston_log("failed to create egl surface\n");
|
weston_log("failed to create egl surface\n");
|
||||||
goto err_surface;
|
goto err_surface;
|
||||||
@@ -1634,9 +1642,9 @@ drm_destroy(struct weston_compositor *ec)
|
|||||||
weston_compositor_shutdown(ec);
|
weston_compositor_shutdown(ec);
|
||||||
|
|
||||||
/* Work around crash in egl_dri2.c's dri2_make_current() */
|
/* 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);
|
EGL_NO_CONTEXT);
|
||||||
eglTerminate(ec->display);
|
eglTerminate(ec->egl_display);
|
||||||
eglReleaseThread();
|
eglReleaseThread();
|
||||||
|
|
||||||
gbm_device_destroy(d->gbm);
|
gbm_device_destroy(d->gbm);
|
||||||
|
|||||||
+12
-11
@@ -135,18 +135,18 @@ init_egl(struct wfd_compositor *ec)
|
|||||||
|
|
||||||
ec->wfd_fd = fd;
|
ec->wfd_fd = fd;
|
||||||
ec->gbm = gbm_create_device(ec->wfd_fd);
|
ec->gbm = gbm_create_device(ec->wfd_fd);
|
||||||
ec->base.display = eglGetDisplay(ec->gbm);
|
ec->base.egl_display = eglGetDisplay(ec->gbm);
|
||||||
if (ec->base.display == NULL) {
|
if (ec->base.egl_display == NULL) {
|
||||||
weston_log("failed to create display\n");
|
weston_log("failed to create display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglInitialize(ec->base.display, &major, &minor)) {
|
if (!eglInitialize(ec->base.egl_display, &major, &minor)) {
|
||||||
weston_log("failed to initialize display\n");
|
weston_log("failed to initialize display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions = eglQueryString(ec->base.display, EGL_EXTENSIONS);
|
extensions = eglQueryString(ec->base.egl_display, EGL_EXTENSIONS);
|
||||||
if (!strstr(extensions, "EGL_KHR_surfaceless_gles2")) {
|
if (!strstr(extensions, "EGL_KHR_surfaceless_gles2")) {
|
||||||
weston_log("EGL_KHR_surfaceless_gles2 not available\n");
|
weston_log("EGL_KHR_surfaceless_gles2 not available\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -157,15 +157,16 @@ init_egl(struct wfd_compositor *ec)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ec->base.context = eglCreateContext(ec->base.display, NULL,
|
ec->base.egl_context =
|
||||||
EGL_NO_CONTEXT, context_attribs);
|
eglCreateContext(ec->base.egl_display, NULL,
|
||||||
if (ec->base.context == NULL) {
|
EGL_NO_CONTEXT, context_attribs);
|
||||||
|
if (ec->base.egl_context == NULL) {
|
||||||
weston_log("failed to create context\n");
|
weston_log("failed to create context\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglMakeCurrent(ec->base.display, EGL_NO_SURFACE,
|
if (!eglMakeCurrent(ec->base.egl_display, EGL_NO_SURFACE,
|
||||||
EGL_NO_SURFACE, ec->base.context)) {
|
EGL_NO_SURFACE, ec->base.egl_context)) {
|
||||||
weston_log("failed to make context current\n");
|
weston_log("failed to make context current\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -204,7 +205,7 @@ wfd_output_destroy(struct weston_output *output_base)
|
|||||||
glDeleteRenderbuffers(2, output->rbo);
|
glDeleteRenderbuffers(2, output->rbo);
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
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]);
|
gbm_bo_destroy(output->bo[i]);
|
||||||
wfdDestroySource(ec->dev, output->source[i]);
|
wfdDestroySource(ec->dev, output->source[i]);
|
||||||
}
|
}
|
||||||
@@ -362,7 +363,7 @@ create_output_for_port(struct wfd_compositor *ec,
|
|||||||
output->base.current->height,
|
output->base.current->height,
|
||||||
GBM_BO_FORMAT_XRGB8888,
|
GBM_BO_FORMAT_XRGB8888,
|
||||||
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
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,
|
NULL,
|
||||||
EGL_NATIVE_PIXMAP_KHR,
|
EGL_NATIVE_PIXMAP_KHR,
|
||||||
output->bo[i], NULL);
|
output->bo[i], NULL);
|
||||||
|
|||||||
+31
-29
@@ -51,7 +51,7 @@ struct wayland_compositor {
|
|||||||
EGLSurface dummy_egl_surface;
|
EGLSurface dummy_egl_surface;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_display *display;
|
struct wl_display *wl_display;
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct wl_shell *shell;
|
struct wl_shell *shell;
|
||||||
struct wl_output *output;
|
struct wl_output *output;
|
||||||
@@ -265,13 +265,13 @@ wayland_compositor_init_egl(struct wayland_compositor *c)
|
|||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
c->base.display = eglGetDisplay(c->parent.display);
|
c->base.egl_display = eglGetDisplay(c->parent.wl_display);
|
||||||
if (c->base.display == NULL) {
|
if (c->base.egl_display == NULL) {
|
||||||
weston_log("failed to create display\n");
|
weston_log("failed to create display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglInitialize(c->base.display, &major, &minor)) {
|
if (!eglInitialize(c->base.egl_display, &major, &minor)) {
|
||||||
weston_log("failed to initialize display\n");
|
weston_log("failed to initialize display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -280,15 +280,16 @@ wayland_compositor_init_egl(struct wayland_compositor *c)
|
|||||||
weston_log("failed to bind EGL_OPENGL_ES_API\n");
|
weston_log("failed to bind EGL_OPENGL_ES_API\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!eglChooseConfig(c->base.display, config_attribs,
|
if (!eglChooseConfig(c->base.egl_display, config_attribs,
|
||||||
&c->base.config, 1, &n) || n == 0) {
|
&c->base.egl_config, 1, &n) || n == 0) {
|
||||||
weston_log("failed to choose config: %d\n", n);
|
weston_log("failed to choose config: %d\n", n);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->base.context = eglCreateContext(c->base.display, c->base.config,
|
c->base.egl_context =
|
||||||
EGL_NO_CONTEXT, context_attribs);
|
eglCreateContext(c->base.egl_display, c->base.egl_config,
|
||||||
if (c->base.context == NULL) {
|
EGL_NO_CONTEXT, context_attribs);
|
||||||
|
if (c->base.egl_context == NULL) {
|
||||||
weston_log("failed to create context\n");
|
weston_log("failed to create context\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -300,10 +301,10 @@ wayland_compositor_init_egl(struct wayland_compositor *c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
c->dummy_egl_surface =
|
c->dummy_egl_surface =
|
||||||
eglCreatePixmapSurface(c->base.display, c->base.config,
|
eglCreatePixmapSurface(c->base.egl_display, c->base.egl_config,
|
||||||
c->dummy_pixmap, NULL);
|
c->dummy_pixmap, NULL);
|
||||||
if (!eglMakeCurrent(c->base.display, c->dummy_egl_surface,
|
if (!eglMakeCurrent(c->base.egl_display, c->dummy_egl_surface,
|
||||||
c->dummy_egl_surface, c->base.context)) {
|
c->dummy_egl_surface, c->base.egl_context)) {
|
||||||
weston_log("failed to make context current\n");
|
weston_log("failed to make context current\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -334,8 +335,9 @@ wayland_output_repaint(struct weston_output *output_base,
|
|||||||
struct wl_callback *callback;
|
struct wl_callback *callback;
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
if (!eglMakeCurrent(compositor->base.display, output->egl_surface,
|
if (!eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
|
||||||
output->egl_surface, compositor->base.context)) {
|
output->egl_surface,
|
||||||
|
compositor->base.egl_context)) {
|
||||||
weston_log("failed to make current\n");
|
weston_log("failed to make current\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -347,7 +349,7 @@ wayland_output_repaint(struct weston_output *output_base,
|
|||||||
|
|
||||||
weston_output_do_read_pixels(&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);
|
callback = wl_surface_frame(output->parent.surface);
|
||||||
wl_callback_add_listener(callback, &frame_listener, output);
|
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 wayland_output *output = (struct wayland_output *) output_base;
|
||||||
struct weston_compositor *ec = output->base.compositor;
|
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);
|
wl_egl_window_destroy(output->parent.egl_window);
|
||||||
free(output);
|
free(output);
|
||||||
|
|
||||||
@@ -413,15 +415,15 @@ wayland_compositor_create_output(struct wayland_compositor *c,
|
|||||||
}
|
}
|
||||||
|
|
||||||
output->egl_surface =
|
output->egl_surface =
|
||||||
eglCreateWindowSurface(c->base.display, c->base.config,
|
eglCreateWindowSurface(c->base.egl_display, c->base.egl_config,
|
||||||
output->parent.egl_window, NULL);
|
output->parent.egl_window, NULL);
|
||||||
if (!output->egl_surface) {
|
if (!output->egl_surface) {
|
||||||
weston_log("failed to create window surface\n");
|
weston_log("failed to create window surface\n");
|
||||||
goto cleanup_window;
|
goto cleanup_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglMakeCurrent(c->base.display, output->egl_surface,
|
if (!eglMakeCurrent(c->base.egl_display, output->egl_surface,
|
||||||
output->egl_surface, c->base.context)) {
|
output->egl_surface, c->base.egl_context)) {
|
||||||
weston_log("failed to make surface current\n");
|
weston_log("failed to make surface current\n");
|
||||||
goto cleanup_surface;
|
goto cleanup_surface;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -447,7 +449,7 @@ wayland_compositor_create_output(struct wayland_compositor *c,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
cleanup_surface:
|
cleanup_surface:
|
||||||
eglDestroySurface(c->base.display, output->egl_surface);
|
eglDestroySurface(c->base.egl_display, output->egl_surface);
|
||||||
cleanup_window:
|
cleanup_window:
|
||||||
wl_egl_window_destroy(output->parent.egl_window);
|
wl_egl_window_destroy(output->parent.egl_window);
|
||||||
cleanup_output:
|
cleanup_output:
|
||||||
@@ -726,7 +728,7 @@ display_add_seat(struct wayland_compositor *c, uint32_t id)
|
|||||||
memset(input, 0, sizeof *input);
|
memset(input, 0, sizeof *input);
|
||||||
|
|
||||||
input->compositor = c;
|
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_seat_interface);
|
||||||
wl_list_insert(c->input_list.prev, &input->link);
|
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;
|
struct wayland_compositor *c = data;
|
||||||
|
|
||||||
if (mask & WL_EVENT_READABLE)
|
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)
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -808,7 +810,7 @@ wayland_input_create(struct wayland_compositor *c)
|
|||||||
|
|
||||||
c->base.seat = seat;
|
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,
|
display_handle_global_input,
|
||||||
c);
|
c);
|
||||||
|
|
||||||
@@ -838,18 +840,18 @@ wayland_compositor_create(struct wl_display *display,
|
|||||||
|
|
||||||
memset(c, 0, sizeof *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");
|
weston_log("failed to create display: %m\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_init(&c->input_list);
|
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);
|
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;
|
c->base.wl_display = display;
|
||||||
if (wayland_compositor_init_egl(c) < 0)
|
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);
|
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 =
|
c->parent.wl_source =
|
||||||
wl_event_loop_add_fd(loop, fd, c->parent.event_mask,
|
wl_event_loop_add_fd(loop, fd, c->parent.event_mask,
|
||||||
wayland_compositor_handle_event, c);
|
wayland_compositor_handle_event, c);
|
||||||
|
|||||||
+23
-21
@@ -194,13 +194,13 @@ x11_compositor_init_egl(struct x11_compositor *c)
|
|||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
c->base.display = eglGetDisplay(c->dpy);
|
c->base.egl_display = eglGetDisplay(c->dpy);
|
||||||
if (c->base.display == NULL) {
|
if (c->base.egl_display == NULL) {
|
||||||
weston_log("failed to create display\n");
|
weston_log("failed to create display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglInitialize(c->base.display, &major, &minor)) {
|
if (!eglInitialize(c->base.egl_display, &major, &minor)) {
|
||||||
weston_log("failed to initialize display\n");
|
weston_log("failed to initialize display\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -209,29 +209,30 @@ x11_compositor_init_egl(struct x11_compositor *c)
|
|||||||
weston_log("failed to bind EGL_OPENGL_ES_API\n");
|
weston_log("failed to bind EGL_OPENGL_ES_API\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!eglChooseConfig(c->base.display, config_attribs,
|
if (!eglChooseConfig(c->base.egl_display, config_attribs,
|
||||||
&c->base.config, 1, &n) || n == 0) {
|
&c->base.egl_config, 1, &n) || n == 0) {
|
||||||
weston_log("failed to choose config: %d\n", n);
|
weston_log("failed to choose config: %d\n", n);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->base.context = eglCreateContext(c->base.display, c->base.config,
|
c->base.egl_context =
|
||||||
EGL_NO_CONTEXT, context_attribs);
|
eglCreateContext(c->base.egl_display, c->base.egl_config,
|
||||||
if (c->base.context == NULL) {
|
EGL_NO_CONTEXT, context_attribs);
|
||||||
|
if (c->base.egl_context == NULL) {
|
||||||
weston_log("failed to create context\n");
|
weston_log("failed to create context\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->dummy_pbuffer = eglCreatePbufferSurface(c->base.display,
|
c->dummy_pbuffer = eglCreatePbufferSurface(c->base.egl_display,
|
||||||
c->base.config,
|
c->base.egl_config,
|
||||||
pbuffer_attribs);
|
pbuffer_attribs);
|
||||||
if (c->dummy_pbuffer == NULL) {
|
if (c->dummy_pbuffer == NULL) {
|
||||||
weston_log("failed to create dummy pbuffer\n");
|
weston_log("failed to create dummy pbuffer\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eglMakeCurrent(c->base.display, c->dummy_pbuffer,
|
if (!eglMakeCurrent(c->base.egl_display, c->dummy_pbuffer,
|
||||||
c->dummy_pbuffer, c->base.context)) {
|
c->dummy_pbuffer, c->base.egl_context)) {
|
||||||
weston_log("failed to make context current\n");
|
weston_log("failed to make context current\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -242,11 +243,11 @@ x11_compositor_init_egl(struct x11_compositor *c)
|
|||||||
static void
|
static void
|
||||||
x11_compositor_fini_egl(struct x11_compositor *compositor)
|
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_SURFACE, EGL_NO_SURFACE,
|
||||||
EGL_NO_CONTEXT);
|
EGL_NO_CONTEXT);
|
||||||
|
|
||||||
eglTerminate(compositor->base.display);
|
eglTerminate(compositor->base.egl_display);
|
||||||
eglReleaseThread();
|
eglReleaseThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,8 +260,9 @@ x11_output_repaint(struct weston_output *output_base,
|
|||||||
(struct x11_compositor *)output->base.compositor;
|
(struct x11_compositor *)output->base.compositor;
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
|
|
||||||
if (!eglMakeCurrent(compositor->base.display, output->egl_surface,
|
if (!eglMakeCurrent(compositor->base.egl_display, output->egl_surface,
|
||||||
output->egl_surface, compositor->base.context)) {
|
output->egl_surface,
|
||||||
|
compositor->base.egl_context)) {
|
||||||
weston_log("failed to make current\n");
|
weston_log("failed to make current\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -270,7 +272,7 @@ x11_output_repaint(struct weston_output *output_base,
|
|||||||
|
|
||||||
weston_output_do_read_pixels(&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);
|
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_list_remove(&output->base.link);
|
||||||
wl_event_source_remove(output->finish_frame_timer);
|
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);
|
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);
|
c->atom.net_wm_state_fullscreen);
|
||||||
|
|
||||||
output->egl_surface =
|
output->egl_surface =
|
||||||
eglCreateWindowSurface(c->base.display, c->base.config,
|
eglCreateWindowSurface(c->base.egl_display, c->base.egl_config,
|
||||||
output->window, NULL);
|
output->window, NULL);
|
||||||
if (!output->egl_surface) {
|
if (!output->egl_surface) {
|
||||||
weston_log("failed to create window surface\n");
|
weston_log("failed to create window surface\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!eglMakeCurrent(c->base.display, output->egl_surface,
|
if (!eglMakeCurrent(c->base.egl_display, output->egl_surface,
|
||||||
output->egl_surface, c->base.context)) {
|
output->egl_surface, c->base.egl_context)) {
|
||||||
weston_log("failed to make surface current\n");
|
weston_log("failed to make surface current\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -668,7 +668,7 @@ destroy_surface(struct wl_resource *resource)
|
|||||||
wl_list_remove(&surface->buffer_destroy_listener.link);
|
wl_list_remove(&surface->buffer_destroy_listener.link);
|
||||||
|
|
||||||
if (surface->image != EGL_NO_IMAGE_KHR)
|
if (surface->image != EGL_NO_IMAGE_KHR)
|
||||||
compositor->destroy_image(compositor->display,
|
compositor->destroy_image(compositor->egl_display,
|
||||||
surface->image);
|
surface->image);
|
||||||
|
|
||||||
pixman_region32_fini(&surface->transform.boundingbox);
|
pixman_region32_fini(&surface->transform.boundingbox);
|
||||||
@@ -745,8 +745,8 @@ weston_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer)
|
|||||||
es->blend = 1;
|
es->blend = 1;
|
||||||
} else {
|
} else {
|
||||||
if (es->image != EGL_NO_IMAGE_KHR)
|
if (es->image != EGL_NO_IMAGE_KHR)
|
||||||
ec->destroy_image(ec->display, es->image);
|
ec->destroy_image(ec->egl_display, es->image);
|
||||||
es->image = ec->create_image(ec->display, NULL,
|
es->image = ec->create_image(ec->egl_display, NULL,
|
||||||
EGL_WAYLAND_BUFFER_WL,
|
EGL_WAYLAND_BUFFER_WL,
|
||||||
buffer, NULL);
|
buffer, NULL);
|
||||||
|
|
||||||
@@ -2984,7 +2984,7 @@ weston_compositor_init(struct weston_compositor *ec,
|
|||||||
|
|
||||||
wl_display_init_shm(display);
|
wl_display_init_shm(display);
|
||||||
|
|
||||||
log_egl_gl_info(ec->display);
|
log_egl_gl_info(ec->egl_display);
|
||||||
|
|
||||||
ec->image_target_texture_2d =
|
ec->image_target_texture_2d =
|
||||||
(void *) eglGetProcAddress("glEGLImageTargetTexture2DOES");
|
(void *) eglGetProcAddress("glEGLImageTargetTexture2DOES");
|
||||||
@@ -3017,7 +3017,7 @@ weston_compositor_init(struct weston_compositor *ec,
|
|||||||
ec->has_unpack_subimage = 1;
|
ec->has_unpack_subimage = 1;
|
||||||
|
|
||||||
extensions =
|
extensions =
|
||||||
(const char *) eglQueryString(ec->display, EGL_EXTENSIONS);
|
(const char *) eglQueryString(ec->egl_display, EGL_EXTENSIONS);
|
||||||
if (!extensions) {
|
if (!extensions) {
|
||||||
weston_log("Retrieving EGL extension string failed.\n");
|
weston_log("Retrieving EGL extension string failed.\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -3026,7 +3026,7 @@ weston_compositor_init(struct weston_compositor *ec,
|
|||||||
if (strstr(extensions, "EGL_WL_bind_wayland_display"))
|
if (strstr(extensions, "EGL_WL_bind_wayland_display"))
|
||||||
ec->has_bind_display = 1;
|
ec->has_bind_display = 1;
|
||||||
if (ec->has_bind_display)
|
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->surface_list);
|
||||||
wl_list_init(&ec->layer_list);
|
wl_list_init(&ec->layer_list);
|
||||||
@@ -3310,7 +3310,7 @@ int main(int argc, char *argv[])
|
|||||||
wl_signal_emit(&ec->destroy_signal, ec);
|
wl_signal_emit(&ec->destroy_signal, ec);
|
||||||
|
|
||||||
if (ec->has_bind_display)
|
if (ec->has_bind_display)
|
||||||
ec->unbind_display(ec->display, display);
|
ec->unbind_display(ec->egl_display, display);
|
||||||
|
|
||||||
for (i = ARRAY_LENGTH(signals); i;)
|
for (i = ARRAY_LENGTH(signals); i;)
|
||||||
wl_event_source_remove(signals[--i]);
|
wl_event_source_remove(signals[--i]);
|
||||||
|
|||||||
+3
-3
@@ -273,9 +273,9 @@ struct weston_compositor {
|
|||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
struct wl_signal destroy_signal;
|
struct wl_signal destroy_signal;
|
||||||
|
|
||||||
EGLDisplay display;
|
EGLDisplay egl_display;
|
||||||
EGLContext context;
|
EGLContext egl_context;
|
||||||
EGLConfig config;
|
EGLConfig egl_config;
|
||||||
GLuint fbo;
|
GLuint fbo;
|
||||||
struct weston_shader texture_shader;
|
struct weston_shader texture_shader;
|
||||||
struct weston_shader solid_shader;
|
struct weston_shader solid_shader;
|
||||||
|
|||||||
Reference in New Issue
Block a user