Commit 6b589db4 authored by Chad Versace's avatar Chad Versace

xegl: Implement get_native functions

Signed-off-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent c8692053
......@@ -93,6 +93,24 @@ error:
return NULL;
}
static 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);
struct waffle_x11_egl_config *n_config;
n_config = wcore_malloc(sizeof(*n_config));
if (n_config == NULL)
return NULL;
xegl_display_fill_native(dpy, &n_config->display);
n_config->egl_config = self->egl;
return (union waffle_native_config*) n_config;
}
static const struct wcore_config_vtbl xegl_config_wcore_vtbl = {
.destroy = xegl_config_destroy,
.get_native = xegl_config_get_native,
};
......@@ -89,6 +89,24 @@ error:
return NULL;
}
static 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);
struct waffle_x11_egl_context *n_ctx;
n_ctx = wcore_malloc(sizeof(*n_ctx));
if (n_ctx == NULL)
return NULL;
xegl_display_fill_native(dpy, &n_ctx->display);
n_ctx->egl_context = self->egl;
return (union waffle_native_context*) n_ctx;
}
static const struct wcore_context_vtbl xegl_context_wcore_vtbl = {
.destroy = xegl_context_destroy,
.get_native = xegl_context_get_native,
};
......@@ -91,7 +91,31 @@ xegl_display_supports_context_api(struct wcore_display *wc_self,
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;
}
static union waffle_native_display*
xegl_display_get_native(struct wcore_display *wc_self)
{
struct xegl_display *self = xegl_display(wc_self);
struct waffle_x11_egl_display *n_dpy;
n_dpy = wcore_malloc(sizeof(*n_dpy));
if (n_dpy == NULL)
return NULL;
xegl_display_fill_native(self, n_dpy);
return (union waffle_native_display*) n_dpy;
}
static const struct wcore_display_vtbl xegl_display_wcore_vtbl = {
.destroy = xegl_display_destroy,
.get_native = xegl_display_get_native,
.supports_context_api = xegl_display_supports_context_api,
};
......@@ -33,6 +33,7 @@
#include <waffle/core/wcore_display.h>
#include <waffle/core/wcore_util.h>
#include <waffle/native/waffle_x11_egl.h>
#include <waffle/x11/x11_display.h>
struct wcore_platform;
......@@ -51,3 +52,7 @@ DEFINE_CONTAINER_CAST_FUNC(xegl_display,
struct wcore_display*
xegl_display_connect(struct wcore_platform *wc_plat,
const char *name);
void
xegl_display_fill_native(struct xegl_display *self,
struct waffle_x11_egl_display *n_dpy);
......@@ -113,8 +113,27 @@ xegl_window_swap_buffers(struct wcore_window *wc_self)
return egl_swap_buffers(dpy->egl, self->egl);
}
static union waffle_native_window*
xegl_window_get_native(struct wcore_window *wc_self)
{
struct xegl_window *self = xegl_window(wc_self);
struct xegl_display *dpy = xegl_display(wc_self->display);
struct waffle_x11_egl_window *n_window;
n_window = wcore_malloc(sizeof(*n_window));
if (n_window == NULL)
return NULL;
xegl_display_fill_native(dpy, &n_window->display);
n_window->xlib_window = self->x11.xcb;
n_window->egl_surface = self->egl;
return (union waffle_native_window*) n_window;
}
static const struct wcore_window_vtbl xegl_window_wcore_vtbl = {
.destroy = xegl_window_destroy,
.get_native = xegl_window_get_native,
.show = xegl_window_show,
.swap_buffers = xegl_window_swap_buffers,
};
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