Commit fab038d8 authored by chadversary's avatar chadversary

egl: Rename struct wegl_window -> wegl_surface

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.
Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.l.velikov@gmail.com>
parent d9cb4944
......@@ -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,
},
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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");
......
......@@ -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);
......@@ -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,
......
......@@ -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);
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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,
},
};
......@@ -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;
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment