Commit 61f1c1d4 authored by Chad Versace's avatar Chad Versace

xegl: Convert to use new egl module

Lines of code changed: +118 / -508
Files removed: 6
Signed-off-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent c1a43520
......@@ -118,11 +118,8 @@ endif()
if(waffle_has_x11_egl)
list(APPEND waffle_sources
xegl/xegl_config.c
xegl/xegl_context.c
xegl/xegl_display.c
xegl/xegl_platform.c
xegl/xegl_priv_egl.c
xegl/xegl_window.c
)
endif()
......
......@@ -155,7 +155,8 @@ choose_real_config(struct wegl_display *dpy,
}
struct wcore_config*
wegl_config_choose(struct wcore_display *wc_dpy,
wegl_config_choose(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
const struct wcore_config_attrs *attrs)
{
struct wegl_display *dpy = wegl_display(wc_dpy);
......
......@@ -56,7 +56,8 @@ DEFINE_CONTAINER_CAST_FUNC(wegl_config,
wcore)
struct wcore_config*
wegl_config_choose(struct wcore_display *wc_dpy,
wegl_config_choose(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
const struct wcore_config_attrs *attrs);
bool
......
......@@ -68,7 +68,8 @@ wegl_emit_error(const char *egl_func_call)
}
bool
wegl_make_current(struct wcore_display *wc_dpy,
wegl_make_current(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
struct wcore_window *wc_window,
struct wcore_context *wc_ctx)
{
......@@ -86,3 +87,9 @@ wegl_make_current(struct wcore_display *wc_dpy,
return ok;
}
void*
wegl_get_proc_address(struct wcore_platform *wc_self, const char *name)
{
return eglGetProcAddress(name);
}
......@@ -41,6 +41,10 @@ void
wegl_emit_error(const char *egl_func_call);
bool
wegl_make_current(struct wcore_display *wc_dpy,
wegl_make_current(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
struct wcore_window *wc_window,
struct wcore_context *wc_ctx);
void*
wegl_get_proc_address(struct wcore_platform *wc_self, const char *name);
// Copyright 2012 Intel Corporation
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <string.h>
#include "waffle/core/wcore_config_attrs.h"
#include "waffle/core/wcore_error.h"
#include "xegl_config.h"
#include "xegl_display.h"
#include "xegl_platform.h"
#include "xegl_priv_egl.h"
bool
xegl_config_destroy(struct wcore_config *wc_self)
{
struct xegl_config *self = xegl_config(wc_self);
bool ok = true;
if (!self)
return ok;
ok &= wcore_config_teardown(wc_self);
free(self);
return ok;
}
struct wcore_config*
xegl_config_choose(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
const struct wcore_config_attrs *attrs)
{
struct xegl_config *self;
struct xegl_display *dpy = xegl_display(wc_dpy);
bool ok = true;
self = wcore_calloc(sizeof(*self));
if (self == NULL)
return NULL;
ok = wcore_config_init(&self->wcore, wc_dpy);
if (!ok)
goto error;
ok = egl_get_render_buffer_attrib(attrs, &self->egl_render_buffer);
if (!ok)
goto error;
self->egl = egl_choose_config(wc_plat, dpy->egl, attrs);
if (!self->egl)
goto error;
ok = eglGetConfigAttrib(dpy->egl,
self->egl,
EGL_NATIVE_VISUAL_ID,
(EGLint*) &self->xcb_visual_id);
if (!ok) {
egl_get_error("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID)");
goto error;
}
self->waffle_context_api = attrs->context_api;
return &self->wcore;
error:
xegl_config_destroy(&self->wcore);
return NULL;
}
union waffle_native_config*
xegl_config_get_native(struct wcore_config *wc_self)
{
struct xegl_config *self = xegl_config(wc_self);
struct xegl_display *dpy = xegl_display(wc_self->display);
union waffle_native_config *n_config;
WCORE_CREATE_NATIVE_UNION(n_config, x11_egl);
if (!n_config)
return NULL;
xegl_display_fill_native(dpy, &n_config->x11_egl->display);
n_config->x11_egl->egl_config = self->egl;
return n_config;
}
// Copyright 2012 Intel Corporation
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <EGL/egl.h>
#include <xcb/xcb.h>
#include "waffle/core/wcore_config.h"
#include "waffle/core/wcore_util.h"
struct wcore_config_attrs;
struct wcore_platform;
struct xegl_config {
struct wcore_config wcore;
EGLConfig egl;
xcb_visualid_t xcb_visual_id;
/// The value of @c EGL_RENDER_BUFFER that will be set in the attrib_list
/// of eglCreateWindowSurface().
EGLint egl_render_buffer;
/// The API given to xegl_config_choose(). This is later used to
/// select the value of the EGL_RENDERABLE attribute.
int32_t waffle_context_api;
};
DEFINE_CONTAINER_CAST_FUNC(xegl_config,
struct xegl_config,
struct wcore_config,
wcore)
struct wcore_config*
xegl_config_choose(struct wcore_platform *wc_plat,
struct wcore_display *wc_dpy,
const struct wcore_config_attrs *attrs);
bool
xegl_config_destroy(struct wcore_config *wc_self);
union waffle_native_config*
xegl_config_get_native(struct wcore_config *wc_self);
// Copyright 2012 Intel Corporation
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include "waffle/core/wcore_config.h"
#include "waffle/core/wcore_error.h"
#include "xegl_config.h"
#include "xegl_context.h"
#include "xegl_display.h"
#include "xegl_priv_egl.h"
bool
xegl_context_destroy(struct wcore_context *wc_self)
{
struct xegl_context *self = xegl_context(wc_self);
bool ok = true;
if (!self)
return ok;
if (self->egl)
ok &= egl_destroy_context(xegl_display(wc_self->display)->egl,
self->egl);
ok &= wcore_context_teardown(wc_self);
free(self);
return ok;
}
struct wcore_context*
xegl_context_create(struct wcore_platform *wc_plat,
struct wcore_config *wc_config,
struct wcore_context *wc_share_ctx)
{
struct xegl_context *self;
struct xegl_config *config = xegl_config(wc_config);
struct xegl_context *share_ctx = xegl_context(wc_share_ctx);
struct xegl_display *dpy = xegl_display(wc_config->display);
bool ok = true;
self = wcore_calloc(sizeof(*self));
if (self == NULL)
return NULL;
ok = wcore_context_init(&self->wcore, wc_config);
if (!ok)
goto error;
self->egl = egl_create_context(dpy->egl,
config->egl,
share_ctx
? share_ctx->egl
: NULL,
config->waffle_context_api);
if (!self->egl)
goto error;
return &self->wcore;
error:
xegl_context_destroy(&self->wcore);
return NULL;
}
union waffle_native_context*
xegl_context_get_native(struct wcore_context *wc_self)
{
struct xegl_context *self = xegl_context(wc_self);
struct xegl_display *dpy = xegl_display(wc_self->display);
union waffle_native_context *n_ctx;
WCORE_CREATE_NATIVE_UNION(n_ctx, x11_egl);
if (!n_ctx)
return NULL;
xegl_display_fill_native(dpy, &n_ctx->x11_egl->display);
n_ctx->x11_egl->egl_context = self->egl;
return n_ctx;
}
// Copyright 2012 Intel Corporation
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <stdbool.h>
#include <EGL/egl.h>
#include "waffle/core/wcore_context.h"
#include "waffle/core/wcore_util.h"
struct wcore_config;
struct wcore_platform;
struct xegl_context {
struct wcore_context wcore;
EGLContext egl;
};
DEFINE_CONTAINER_CAST_FUNC(xegl_context,
struct xegl_context,
struct wcore_context,
wcore)
struct wcore_context*
xegl_context_create(struct wcore_platform *wc_plat,
struct wcore_config *wc_config,
struct wcore_context *wc_share_ctx);
bool
xegl_context_destroy(struct wcore_context *wc_self);
union waffle_native_context*
xegl_context_get_native(struct wcore_context *wc_self);
......@@ -30,7 +30,6 @@
#include "xegl_display.h"
#include "xegl_platform.h"
#include "xegl_priv_egl.h"
bool
xegl_display_destroy(struct wcore_display *wc_self)
......@@ -41,11 +40,8 @@ xegl_display_destroy(struct wcore_display *wc_self)
if (!self)
return ok;
if (self->egl)
ok &= egl_terminate(self->egl);
ok &= wegl_display_teardown(&self->wegl);
ok &= x11_display_teardown(&self->x11);
ok &= wcore_display_teardown(&self->wcore);
free(self);
return ok;
}
......@@ -62,38 +58,27 @@ xegl_display_connect(
if (self == NULL)
return NULL;
ok = wcore_display_init(&self->wcore, wc_plat);
if (!ok)
goto error;
ok = x11_display_init(&self->x11, name);
if (!ok)
goto error;
self->egl = xegl_egl_initialize(self->x11.xlib);
if (!self->egl)
ok = wegl_display_init(&self->wegl, wc_plat, (intptr_t) self->x11.xlib);
if (!ok)
goto error;
return &self->wcore;
return &self->wegl.wcore;
error:
xegl_display_destroy(&self->wcore);
xegl_display_destroy(&self->wegl.wcore);
return NULL;
}
bool
xegl_display_supports_context_api(struct wcore_display *wc_self,
int32_t waffle_context_api)
{
return egl_supports_context_api(wc_self->platform, waffle_context_api);
}
void
xegl_display_fill_native(struct xegl_display *self,
struct waffle_x11_egl_display *n_dpy)
{
n_dpy->xlib_display = self->x11.xlib;
n_dpy->egl_display = self->egl;
n_dpy->egl_display = self->wegl.egl;
}
union waffle_native_display*
......
......@@ -28,26 +28,29 @@
#include <stdbool.h>
#include <stdint.h>
#include <EGL/egl.h>
#include <X11/Xlib-xcb.h>
#include "waffle/core/wcore_display.h"
#include "waffle/core/wcore_util.h"
#include "waffle_x11_egl.h"
#include "waffle/egl/wegl_display.h"
#include "waffle/x11/x11_display.h"
struct wcore_platform;
struct xegl_display {
struct wcore_display wcore;
struct x11_display x11;
EGLDisplay egl;
struct wegl_display wegl;
};
DEFINE_CONTAINER_CAST_FUNC(xegl_display,
struct xegl_display,
struct wcore_display,
wcore)
static inline struct xegl_display*
xegl_display(struct wcore_display *wc_self)
{
if (wc_self) {
struct wegl_display *wegl_self = container_of(wc_self, struct wegl_display, wcore);
return container_of(wegl_self, struct xegl_display, wegl);
}
else {
return NULL;
}
}
struct wcore_display*
xegl_display_connect(struct wcore_platform *wc_plat,
......@@ -56,10 +59,6 @@ xegl_display_connect(struct wcore_platform *wc_plat,
bool
xegl_display_destroy(struct wcore_display *wc_self);
bool
xegl_display_supports_context_api(struct wcore_display *wc_self,
int32_t waffle_context_api);
void
xegl_display_fill_native(struct xegl_display *self,
struct waffle_x11_egl_display *n_dpy);
......
......@@ -29,12 +29,12 @@
#include "waffle/core/wcore_error.h"
#include "waffle/linux/linux_platform.h"
#include "waffle/egl/wegl_config.h"
#include "waffle/egl/wegl_context.h"
#include "waffle/egl/wegl_util.h"
#include "xegl_config.h"
#include "xegl_context.h"
#include "xegl_display.h"
#include "xegl_platform.h"
#include "xegl_priv_egl.h"
#include "xegl_window.h"
static const struct wcore_platform_vtbl xegl_platform_vtbl;
......@@ -86,24 +86,6 @@ error:
return NULL;
}
static bool
xegl_platform_make_current(struct wcore_platform *wc_self,
struct wcore_display *wc_dpy,
struct wcore_window *wc_window,
struct wcore_context *wc_ctx)
{
return egl_make_current(xegl_display(wc_dpy)->egl,
wc_window ? xegl_window(wc_window)->egl : NULL,
wc_ctx ? xegl_context(wc_ctx)->egl : NULL);
}
static void*
xegl_platform_get_proc_address(struct wcore_platform *wc_self,
const char *name)
{
return eglGetProcAddress(name);
}
static bool
xegl_platform_dl_can_open(struct wcore_platform *wc_self,
int32_t waffle_dl)
......@@ -122,30 +104,64 @@ xegl_platform_dl_sym(struct wcore_platform *wc_self,
name);
}
static union waffle_native_config*
xegl_config_get_native(struct wcore_config *wc_config)
{
struct xegl_display *dpy = xegl_display(wc_config->display);
struct wegl_config *config = wegl_config(wc_config);
union waffle_native_config *n_config;
WCORE_CREATE_NATIVE_UNION(n_config, x11_egl);
if (!n_config)
return NULL;
xegl_display_fill_native(dpy, &n_config->x11_egl->display);
n_config->x11_egl->egl_config = config->egl;
return n_config;
}
static union waffle_native_context*
xegl_context_get_native(struct wcore_context *wc_ctx)
{
struct xegl_display *dpy = xegl_display(wc_ctx->display);
struct wegl_context *ctx = wegl_context(wc_ctx);
union waffle_native_context *n_ctx;
WCORE_CREATE_NATIVE_UNION(n_ctx, x11_egl);
if (!n_ctx)
return NULL;
xegl_display_fill_native(dpy, &n_ctx->x11_egl->display);
n_ctx->x11_egl->egl_context = ctx->egl;
return n_ctx;
}
static const struct wcore_platform_vtbl xegl_platform_vtbl = {
.destroy = xegl_platform_destroy,
.make_current = xegl_platform_make_current,
.get_proc_address = xegl_platform_get_proc_address,
.make_current = wegl_make_current,
.get_proc_address = wegl_get_proc_address,
.dl_can_open = xegl_platform_dl_can_open,
.dl_sym = xegl_platform_dl_sym,
.display = {
.connect = xegl_display_connect,
.destroy = xegl_display_destroy,
.supports_context_api = xegl_display_supports_context_api,
.supports_context_api = wegl_display_supports_context_api,
.get_native = xegl_display_get_native,
},
.config = {
.choose = xegl_config_choose,
.destroy = xegl_config_destroy,
.choose = wegl_config_choose,
.destroy = wegl_config_destroy,
.get_native = xegl_config_get_native,
},
.context = {
.create = xegl_context_create,
.destroy = xegl_context_destroy,
.create = wegl_context_create,
.destroy = wegl_context_destroy,
.get_native = xegl_context_get_native,
},
......@@ -153,7 +169,7 @@ static const struct wcore_platform_vtbl xegl_platform_vtbl = {
.create = xegl_window_create,
.destroy = xegl_window_destroy,
.show = xegl_window_show,
.swap_buffers = xegl_window_swap_buffers,
.swap_buffers = wegl_window_swap_buffers,
.get_native = xegl_window_get_native,
},
};
// Copyright 2012 Intel Corporation
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "xegl_priv_egl.h"
#include "waffle/egl/egl_native_template.c"
// Copyright 2012 Intel Corporation
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#define NATIVE_EGL(basename) xegl_egl_##basename
#include "waffle/egl/egl.h"
......@@ -26,30 +26,26 @@
#include <stdlib.h>
#include <string.h>
#include <xcb/xcb.h>
#include "waffle/core/wcore_error.h"
#include "waffle/egl/wegl_config.h"
#include "waffle/egl/wegl_util.h"
#include "xegl_config.h"
#include "xegl_display.h"
#include "xegl_priv_egl.h"
#include "xegl_window.h"
bool
xegl_window_destroy(struct wcore_window *wc_self)
{
struct xegl_window *self = xegl_window(wc_self);
struct xegl_display *dpy;
bool ok = true;
if (!self)
return ok;
dpy = xegl_display(wc_self->display);
if (self->egl)
ok &= egl_destroy_surface(dpy->egl, self->egl);
ok &= wegl_window_teardown(&self->wegl);
ok &= x11_window_teardown(&self->x11);
ok &= wcore_window_teardown(&self->wcore);
free(self);
return ok;
}
......@@ -61,37 +57,42 @@ xegl_window_create(struct wcore_platform *wc_plat,
int height)
{
struct xegl_window *self;
struct xegl_config *config = xegl_config