Today, the EGLSurface belonging to struct wegl_window (and, post-patch, struct wegl_surface) is always created with eglCreateWindowSurface. But future patches will extend it to allow the EGLSurface to be a pbuffer. Hence the rename, to reduce confusion. --- src/waffle/android/droid_platform.c | 2 +- src/waffle/android/droid_window.c | 2 +- src/waffle/android/droid_window.h | 4 ++-- src/waffle/egl/wegl_surface.c | 35 +++++++++++++++++------------------ src/waffle/egl/wegl_surface.h | 12 ++++++------ src/waffle/egl/wegl_util.c | 2 +- src/waffle/gbm/wgbm_window.c | 4 ++-- src/waffle/gbm/wgbm_window.h | 4 ++-- src/waffle/wayland/wayland_window.c | 4 ++-- src/waffle/wayland/wayland_window.h | 4 ++-- src/waffle/xegl/xegl_platform.c | 2 +- src/waffle/xegl/xegl_window.c | 2 +- src/waffle/xegl/xegl_window.h | 4 ++-- 13 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/src/waffle/android/droid_platform.c b/src/waffle/android/droid_platform.c index bbf2b14..eb1407f 100644 --- a/src/waffle/android/droid_platform.c +++ b/src/waffle/android/droid_platform.c @@ -133,7 +133,7 @@ static const struct wcore_platform_vtbl droid_platform_vtbl = { .create = droid_window_create, .destroy = droid_window_destroy, .show = droid_window_show, - .swap_buffers = wegl_window_swap_buffers, + .swap_buffers = wegl_surface_swap_buffers, .resize = droid_window_resize, .get_native = NULL, }, diff --git a/src/waffle/android/droid_window.c b/src/waffle/android/droid_window.c index 048a2bb..41def73 100644 --- a/src/waffle/android/droid_window.c +++ b/src/waffle/android/droid_window.c @@ -93,7 +93,7 @@ droid_window_destroy(struct wcore_window *wc_self) dpy = droid_display(self->wegl.wcore.display); - ok &= wegl_window_teardown(&self->wegl); + ok &= wegl_surface_teardown(&self->wegl); droid_destroy_surface(dpy->pSFContainer, self->pANWContainer); free(self); return ok; diff --git a/src/waffle/android/droid_window.h b/src/waffle/android/droid_window.h index 4067c98..5eb3ed7 100644 --- a/src/waffle/android/droid_window.h +++ b/src/waffle/android/droid_window.h @@ -34,14 +34,14 @@ struct wcore_platform; struct droid_window { /// Used by droid_surfaceflinger.cpp. struct droid_ANativeWindow_container *pANWContainer; - struct wegl_window wegl; + struct wegl_surface wegl; }; static inline struct droid_window* droid_window(struct wcore_window *wc_self) { if (wc_self) { - struct wegl_window *wegl_self = container_of(wc_self, struct wegl_window, wcore); + struct wegl_surface *wegl_self = container_of(wc_self, struct wegl_surface, wcore); return container_of(wegl_self, struct droid_window, wegl); } else { diff --git a/src/waffle/egl/wegl_surface.c b/src/waffle/egl/wegl_surface.c index 961c0bb..ccd0799 100644 --- a/src/waffle/egl/wegl_surface.c +++ b/src/waffle/egl/wegl_surface.c @@ -33,7 +33,7 @@ /// On Linux, according to eglplatform.h, EGLNativeDisplayType and intptr_t /// have the same size regardless of platform. bool -wegl_window_init(struct wegl_window *window, +wegl_window_init(struct wegl_surface *surf, struct wcore_config *wc_config, intptr_t native_window) { @@ -43,7 +43,7 @@ wegl_window_init(struct wegl_window *window, EGLint egl_render_buffer; bool ok; - ok = wcore_window_init(&window->wcore, wc_config); + ok = wcore_window_init(&surf->wcore, wc_config); if (!ok) goto fail; @@ -57,12 +57,11 @@ wegl_window_init(struct wegl_window *window, EGL_NONE, }; - window->egl = plat->eglCreateWindowSurface(dpy->egl, - config->egl, - (EGLNativeWindowType) - native_window, - attrib_list); - if (!window->egl) { + surf->egl = + plat->eglCreateWindowSurface(dpy->egl, config->egl, + (EGLNativeWindowType) native_window, + attrib_list); + if (!surf->egl) { wegl_emit_error(plat, "eglCreateWindowSurface"); goto fail; } @@ -70,37 +69,37 @@ wegl_window_init(struct wegl_window *window, return true; fail: - wegl_window_teardown(window); + wegl_surface_teardown(surf); return false; } bool -wegl_window_teardown(struct wegl_window *window) +wegl_surface_teardown(struct wegl_surface *surf) { - struct wegl_display *dpy = wegl_display(window->wcore.display); + struct wegl_display *dpy = wegl_display(surf->wcore.display); struct wegl_platform *plat = wegl_platform(dpy->wcore.platform); bool result = true; - if (window->egl) { - bool ok = plat->eglDestroySurface(dpy->egl, window->egl); + if (surf->egl) { + bool ok = plat->eglDestroySurface(dpy->egl, surf->egl); if (!ok) { wegl_emit_error(plat, "eglDestroySurface"); result = false; } } - result &= wcore_window_teardown(&window->wcore); + result &= wcore_window_teardown(&surf->wcore); return result; } bool -wegl_window_swap_buffers(struct wcore_window *wc_window) +wegl_surface_swap_buffers(struct wcore_window *wc_window) { - struct wegl_window *window = wegl_window(wc_window); - struct wegl_display *dpy = wegl_display(window->wcore.display); + struct wegl_surface *surf = wegl_surface(wc_window); + struct wegl_display *dpy = wegl_display(surf->wcore.display); struct wegl_platform *plat = wegl_platform(dpy->wcore.platform); - bool ok = plat->eglSwapBuffers(dpy->egl, window->egl); + bool ok = plat->eglSwapBuffers(dpy->egl, surf->egl); if (!ok) wegl_emit_error(plat, "eglSwapBuffers"); diff --git a/src/waffle/egl/wegl_surface.h b/src/waffle/egl/wegl_surface.h index 3dc0742..b107423 100644 --- a/src/waffle/egl/wegl_surface.h +++ b/src/waffle/egl/wegl_surface.h @@ -35,23 +35,23 @@ struct wegl_config; struct wegl_display; -struct wegl_window { +struct wegl_surface { struct wcore_window wcore; EGLSurface egl; }; -DEFINE_CONTAINER_CAST_FUNC(wegl_window, - struct wegl_window, +DEFINE_CONTAINER_CAST_FUNC(wegl_surface, + struct wegl_surface, struct wcore_window, wcore) bool -wegl_window_init(struct wegl_window *window, +wegl_window_init(struct wegl_surface *surf, struct wcore_config *wc_config, intptr_t native_window); bool -wegl_window_teardown(struct wegl_window *window); +wegl_surface_teardown(struct wegl_surface *surf); bool -wegl_window_swap_buffers(struct wcore_window *wc_window); +wegl_surface_swap_buffers(struct wcore_window *wc_window); diff --git a/src/waffle/egl/wegl_util.c b/src/waffle/egl/wegl_util.c index 6b4f90e..a148471 100644 --- a/src/waffle/egl/wegl_util.c +++ b/src/waffle/egl/wegl_util.c @@ -76,7 +76,7 @@ wegl_make_current(struct wcore_platform *wc_plat, struct wcore_context *wc_ctx) { struct wegl_platform *plat = wegl_platform(wc_plat); - EGLSurface surface = wc_window ? wegl_window(wc_window)->egl : NULL; + EGLSurface surface = wc_window ? wegl_surface(wc_window)->egl : NULL; bool ok; ok = plat->eglMakeCurrent(wegl_display(wc_dpy)->egl, diff --git a/src/waffle/gbm/wgbm_window.c b/src/waffle/gbm/wgbm_window.c index 313304b..34f2806 100644 --- a/src/waffle/gbm/wgbm_window.c +++ b/src/waffle/gbm/wgbm_window.c @@ -51,7 +51,7 @@ wgbm_window_destroy(struct wcore_window *wc_self) if (!self) return ok; - ok &= wegl_window_teardown(&self->wegl); + ok &= wegl_surface_teardown(&self->wegl); plat->gbm_surface_destroy(self->gbm_surface); free(self); return ok; @@ -123,7 +123,7 @@ wgbm_window_swap_buffers(struct wcore_window *wc_self) struct wcore_platform *wc_plat = wc_self->display->platform; struct wgbm_platform *plat = wgbm_platform(wegl_platform(wc_plat)); - if (!wegl_window_swap_buffers(wc_self)) + if (!wegl_surface_swap_buffers(wc_self)) return false; struct wgbm_window *self = wgbm_window(wc_self); diff --git a/src/waffle/gbm/wgbm_window.h b/src/waffle/gbm/wgbm_window.h index ed444b9..4839355 100644 --- a/src/waffle/gbm/wgbm_window.h +++ b/src/waffle/gbm/wgbm_window.h @@ -34,14 +34,14 @@ struct gbm_surface; struct wgbm_window { struct gbm_surface *gbm_surface; - struct wegl_window wegl; + struct wegl_surface wegl; }; static inline struct wgbm_window* wgbm_window(struct wcore_window *wc_self) { if (wc_self) { - struct wegl_window *wegl_self = container_of(wc_self, struct wegl_window, wcore); + struct wegl_surface *wegl_self = container_of(wc_self, struct wegl_surface, wcore); return container_of(wegl_self, struct wgbm_window, wegl); } else { diff --git a/src/waffle/wayland/wayland_window.c b/src/waffle/wayland/wayland_window.c index 2c4ebc8..89f7342 100644 --- a/src/waffle/wayland/wayland_window.c +++ b/src/waffle/wayland/wayland_window.c @@ -55,7 +55,7 @@ wayland_window_destroy(struct wcore_window *wc_self) if (!self) return ok; - ok &= wegl_window_teardown(&self->wegl); + ok &= wegl_surface_teardown(&self->wegl); if (self->wl_window) plat->wl_egl_window_destroy(self->wl_window); @@ -200,7 +200,7 @@ wayland_window_swap_buffers(struct wcore_window *wc_self) struct wayland_display *dpy = wayland_display(wc_self->display); bool ok; - ok = wegl_window_swap_buffers(wc_self); + ok = wegl_surface_swap_buffers(wc_self); if (!ok) return false; diff --git a/src/waffle/wayland/wayland_window.h b/src/waffle/wayland/wayland_window.h index 1893623..d63ae69 100644 --- a/src/waffle/wayland/wayland_window.h +++ b/src/waffle/wayland/wayland_window.h @@ -41,14 +41,14 @@ struct wayland_window { struct wl_shell_surface *wl_shell_surface; struct wl_egl_window *wl_window; - struct wegl_window wegl; + struct wegl_surface wegl; }; static inline struct wayland_window* wayland_window(struct wcore_window *wc_self) { if (wc_self) { - struct wegl_window *wegl_self = container_of(wc_self, struct wegl_window, wcore); + struct wegl_surface *wegl_self = container_of(wc_self, struct wegl_surface, wcore); return container_of(wegl_self, struct wayland_window, wegl); } else { diff --git a/src/waffle/xegl/xegl_platform.c b/src/waffle/xegl/xegl_platform.c index f39ab93..f207771 100644 --- a/src/waffle/xegl/xegl_platform.c +++ b/src/waffle/xegl/xegl_platform.c @@ -166,7 +166,7 @@ static const struct wcore_platform_vtbl xegl_platform_vtbl = { .destroy = xegl_window_destroy, .show = xegl_window_show, .resize = xegl_window_resize, - .swap_buffers = wegl_window_swap_buffers, + .swap_buffers = wegl_surface_swap_buffers, .get_native = xegl_window_get_native, }, }; diff --git a/src/waffle/xegl/xegl_window.c b/src/waffle/xegl/xegl_window.c index cd2be46..93949ca 100644 --- a/src/waffle/xegl/xegl_window.c +++ b/src/waffle/xegl/xegl_window.c @@ -47,7 +47,7 @@ xegl_window_destroy(struct wcore_window *wc_self) if (!self) return ok; - ok &= wegl_window_teardown(&self->wegl); + ok &= wegl_surface_teardown(&self->wegl); ok &= x11_window_teardown(&self->x11); free(self); return ok; diff --git a/src/waffle/xegl/xegl_window.h b/src/waffle/xegl/xegl_window.h index d994897..5528347 100644 --- a/src/waffle/xegl/xegl_window.h +++ b/src/waffle/xegl/xegl_window.h @@ -38,14 +38,14 @@ struct wcore_platform; struct xegl_window { struct x11_window x11; - struct wegl_window wegl; + struct wegl_surface wegl; }; static inline struct xegl_window* xegl_window(struct wcore_window *wc_self) { if (wc_self) { - struct wegl_window *wegl_self = container_of(wc_self, struct wegl_window, wcore); + struct wegl_surface *wegl_self = container_of(wc_self, struct wegl_surface, wcore); return container_of(wegl_self, struct xegl_window, wegl); } else { -- 2.10.0 _______________________________________________ waffle mailing list waffle@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/waffle