diff options
Diffstat (limited to 'src/egl/wayland')
-rw-r--r-- | src/egl/wayland/Makefile | 30 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/.gitignore | 3 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/Makefile | 45 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/protocol/wayland-drm.xml | 38 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.c | 203 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.h | 26 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/Makefile | 71 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl-priv.h | 60 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl.c | 226 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl.pc.in | 12 |
10 files changed, 714 insertions, 0 deletions
diff --git a/src/egl/wayland/Makefile b/src/egl/wayland/Makefile new file mode 100644 index 0000000000..c38a1302f1 --- /dev/null +++ b/src/egl/wayland/Makefile @@ -0,0 +1,30 @@ +# src/egl/wayland/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + +SUBDIRS = wayland-drm wayland-egl + +default: subdirs + + +subdirs: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + +install: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1 ; \ + fi \ + done + +clean: + -@for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done diff --git a/src/egl/wayland/wayland-drm/.gitignore b/src/egl/wayland/wayland-drm/.gitignore new file mode 100644 index 0000000000..f4ed848476 --- /dev/null +++ b/src/egl/wayland/wayland-drm/.gitignore @@ -0,0 +1,3 @@ +wayland-drm-client-protocol.h +wayland-drm-server-protocol.h +wayland-drm-protocol.c diff --git a/src/egl/wayland/wayland-drm/Makefile b/src/egl/wayland/wayland-drm/Makefile new file mode 100644 index 0000000000..c232769697 --- /dev/null +++ b/src/egl/wayland/wayland-drm/Makefile @@ -0,0 +1,45 @@ +# src/egl/wayland/wayland-drm/Makefile + +TOP = ../../../.. +include $(TOP)/configs/current + +GEN_SOURCES = wayland-drm-protocol.c + +GEN_HEADERS = wayland-drm-client-protocol.h wayland-drm-server-protocol.h + +wayland_drm_SOURCES = wayland-drm.c $(GEN_SOURCES) +wayland_drm_OBJECTS = $(wayland_drm_SOURCES:.c=.o) + +wayland_drm_INCLUDES = \ + $(WAYLAND_CFLAGS) \ + -I$(TOP)/src/egl/main + +# Generate protocol sources +prefix=$(shell pkg-config --variable=prefix wayland-server) +exec_prefx=$(shell pkg-config --variable=exec_prefix wayland-server) +wayland_protocoldir = $(PWD)/protocol +wayland_scanner=$(exec_prefix)/bin/wayland-scanner + +default: depend libwayland-drm.a $(GEN_SOURCES) $(GEN_HEADERS) + +libwayland-drm.a: $(wayland_drm_OBJECTS) Makefile + $(MKLIB) -o wayland-drm -static $(wayland_drm_OBJECTS) + +depend: + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(wayland_drm_INCLUDES) $(wayland_drm_SOURCES) 2> /dev/null + +clean: + rm -rf libwayland-drm.a $(wayland_drm_OBJECTS) \ + $(GEN_SOURCES) $(GEN_HEADERS) + +install: + @echo -n "" + +$(wayland_drm_OBJECTS): %.o: %.c $(GEN_HEADERS) + $(CC) -c $(wayland_drm_INCLUDES) $(CFLAGS) $< -o $@ + +include $(prefix)/share/aclocal/wayland-scanner.mk + +sinclude depend diff --git a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml new file mode 100644 index 0000000000..46725d8517 --- /dev/null +++ b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<protocol name="drm"> + <!-- drm support. This object is created by the server and published + using the display's global event. --> + <interface name="drm" version="1"> + <!-- Call this request with the magic received from drmGetMagic(). + It will be passed on to the drmAuthMagic() or + DRIAuthConnection() call. This authentication must be + completed before create_buffer could be used. --> + <request name="authenticate"> + <arg name="id" type="uint"/> + </request> + + <!-- Create a wayland buffer for the named DRM buffer. The DRM + surface must have a name using the flink ioctl --> + <request name="create_buffer"> + <arg name="id" type="new_id" interface="buffer"/> + <arg name="name" type="uint"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="stride" type="uint"/> + <arg name="visual" type="object" interface="visual"/> + </request> + + <!-- Notification of the path of the drm device which is used by + the server. The client should use this device for creating + local buffers. Only buffers created from this device should + be be passed to the server using this drm object's + create_buffer request. --> + <event name="device"> + <arg name="name" type="string"/> + </event> + + <!-- Raised if the authenticate request succeeded --> + <event name="authenticated"/> + </interface> + +</protocol> diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c new file mode 100644 index 0000000000..6624fbe9d4 --- /dev/null +++ b/src/egl/wayland/wayland-drm/wayland-drm.c @@ -0,0 +1,203 @@ +/* + * Copyright © 2011 Kristian Høgsberg + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kristian Høgsberg <krh@bitplanet.net> + * Benjamin Franzke <benjaminfranzke@googlemail.com> + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stddef.h> + +#include <wayland-server.h> +#include "wayland-drm.h" +#include "wayland-drm-server-protocol.h" + +#include "egldisplay.h" +#include "egldriver.h" +#include "eglimage.h" +#include "egltypedefs.h" + +struct wl_drm { + struct wl_object object; + struct wl_display *display; + + _EGLDisplay *edisp; + + char *device_name; + authenticate_t authenticate; +}; + +static void +drm_buffer_damage(struct wl_buffer *buffer_base, + struct wl_surface *surface, + int32_t x, int32_t y, int32_t width, int32_t height) +{ +} + +static void +destroy_buffer(struct wl_resource *resource, struct wl_client *client) +{ + struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) resource; + _EGLDriver *drv = buffer->drm->edisp->Driver; + + drv->API.DestroyImageKHR(drv, buffer->drm->edisp, buffer->image); + free(buffer); +} + +static void +buffer_destroy(struct wl_client *client, struct wl_buffer *buffer) +{ + wl_resource_destroy(&buffer->resource, client); +} + +const static struct wl_buffer_interface buffer_interface = { + buffer_destroy +}; + +static void +drm_create_buffer(struct wl_client *client, struct wl_drm *drm, + uint32_t id, uint32_t name, int32_t width, int32_t height, + uint32_t stride, struct wl_visual *visual) +{ + struct wl_drm_buffer *buffer; + EGLint attribs[] = { + EGL_WIDTH, 0, + EGL_HEIGHT, 0, + EGL_DRM_BUFFER_STRIDE_MESA, 0, + EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, + EGL_NONE + }; + _EGLDriver *drv = drm->edisp->Driver; + + buffer = malloc(sizeof *buffer); + if (buffer == NULL) { + wl_client_post_no_memory(client); + return; + } + + buffer->drm = drm; + buffer->buffer.compositor = NULL; + buffer->buffer.width = width; + buffer->buffer.height = height; + buffer->buffer.visual = visual; + buffer->buffer.attach = NULL; + buffer->buffer.damage = drm_buffer_damage; + + if (visual->object.interface != &wl_visual_interface) { + /* FIXME: Define a real exception event instead of + * abusing this one */ + wl_client_post_event(client, + (struct wl_object *) drm->display, + WL_DISPLAY_INVALID_OBJECT, 0); + fprintf(stderr, "invalid visual in create_buffer\n"); + return; + } + + attribs[1] = width; + attribs[3] = height; + attribs[5] = stride / 4; + buffer->image = drv->API.CreateImageKHR(drv, drm->edisp, + EGL_NO_CONTEXT, + EGL_DRM_BUFFER_MESA, + (EGLClientBuffer) (intptr_t) name, + attribs); + + if (buffer->image == NULL) { + /* FIXME: Define a real exception event instead of + * abusing this one */ + wl_client_post_event(client, + (struct wl_object *) drm->display, + WL_DISPLAY_INVALID_OBJECT, 0); + fprintf(stderr, "failed to create image for name %d\n", name); + return; + } + + buffer->buffer.resource.object.id = id; + buffer->buffer.resource.object.interface = &wl_buffer_interface; + buffer->buffer.resource.object.implementation = (void (**)(void)) + &buffer_interface; + + buffer->buffer.resource.destroy = destroy_buffer; + + wl_client_add_resource(client, &buffer->buffer.resource); +} + +static void +drm_authenticate(struct wl_client *client, + struct wl_drm *drm, uint32_t id) +{ + if (drm->authenticate(drm->edisp, id) < 0) + wl_client_post_event(client, + (struct wl_object *) drm->display, + WL_DISPLAY_INVALID_OBJECT, 0); + else + wl_client_post_event(client, &drm->object, + WL_DRM_AUTHENTICATED); +} + +const static struct wl_drm_interface drm_interface = { + drm_authenticate, + drm_create_buffer +}; + +static void +post_drm_device(struct wl_client *client, struct wl_object *global) +{ + struct wl_drm *drm = (struct wl_drm *) global; + + wl_client_post_event(client, global, WL_DRM_DEVICE, drm->device_name); +} + +struct wl_drm * +wayland_drm_init(struct wl_display *display, _EGLDisplay *disp, + authenticate_t authenticate, char *device_name) +{ + struct wl_drm *drm; + + drm = malloc(sizeof *drm); + + drm->display = display; + drm->edisp = disp; + drm->authenticate = authenticate; + drm->device_name = strdup(device_name); + + drm->object.interface = &wl_drm_interface; + drm->object.implementation = (void (**)(void)) &drm_interface; + wl_display_add_object(display, &drm->object); + wl_display_add_global(display, &drm->object, post_drm_device); + + return drm; +} + +void +wayland_drm_destroy(struct wl_drm *drm) +{ + free(drm->device_name); + + /* FIXME: need wl_display_del_{object,global} */ + + free(drm); +} diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h new file mode 100644 index 0000000000..675a6a5ce4 --- /dev/null +++ b/src/egl/wayland/wayland-drm/wayland-drm.h @@ -0,0 +1,26 @@ +#ifndef WAYLAND_DRM_H +#define WAYLAND_DRM_H + +#include "egldisplay.h" +#include "eglimage.h" + +#include <wayland-server.h> + +struct wl_drm; + +typedef int (*authenticate_t) (_EGLDisplay *disp, uint32_t id); + +struct wl_drm_buffer { + struct wl_buffer buffer; + struct wl_drm *drm; + _EGLImage *image; +}; + +struct wl_drm * +wayland_drm_init(struct wl_display *display, _EGLDisplay *disp, + authenticate_t authenticate, char *device_name); + +void +wayland_drm_destroy(struct wl_drm *drm); + +#endif diff --git a/src/egl/wayland/wayland-egl/Makefile b/src/egl/wayland/wayland-egl/Makefile new file mode 100644 index 0000000000..b9d13dce5d --- /dev/null +++ b/src/egl/wayland/wayland-egl/Makefile @@ -0,0 +1,71 @@ +# src/egl/wayland/wayland-egl/Makefile + +TOP = ../../../.. +include $(TOP)/configs/current + +INCLUDE_DIRS = -I$(TOP)/include \ + -I$(TOP)/include/EGL \ + -I$(TOP)/src/egl/wayland/wayland-drm + + +HEADERS = wayland-egl-priv.h +SOURCES = wayland-egl.c + +OBJECTS = $(SOURCES:.c=.o) + +LOCAL_CFLAGS = $(LIBDRM_CFLAGS) \ + $(WAYLAND_CFLAGS) + +LOCAL_LIBS = + +.c.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@ + + +default: depend library + +# wayland-egl Library +library: $(TOP)/$(LIB_DIR)/$(WAYLAND_EGL_LIB_NAME) + +$(TOP)/$(LIB_DIR)/$(WAYLAND_EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS) + $(MKLIB) -o $(WAYLAND_EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \ + -L$(TOP)/$(LIB_DIR) $(WAYLAND_EGL_LIB_DEPS) \ + $(OBJECTS) $(LOCAL_LIBS) + +PKG_CONFIG_DIR = $(INSTALL_LIB_DIR)/pkgconfig + +gl_pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ + -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@WAYLAND_EGL_PC_REQ_PRIV@,$(WAYLAND_EGL_PC_REQ_PRIV),' \ + -e 's,@WAYLAND_EGL_PC_LIB_PRIV@,$(WAYLAND_EGL_PC_LIB_PRIV),' \ + -e 's,@WAYLAND_EGL_PC_CFLAGS@,$(WAYLAND_EGL_PC_CFLAGS),' \ + -e 's,@WAYLAND_EGL_LIB@,$(WAYLAND_EGL_LIB),' + +wayland-egl.pc: wayland-egl.pc.in + $(gl_pcedit) $< > $@ + +install: default wayland-egl.pc + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(WAYLAND_EGL_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(PKG_CONFIG_DIR) + $(INSTALL) -m 644 wayland-egl.pc $(DESTDIR)$(PKG_CONFIG_DIR) + +clean: + -rm -f *.o + -rm -f depend depend.bak + +depend: $(SOURCES) $(HEADERS) + @ echo "running $(MKDEP)" + @ rm -f depend + @ touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \ + $(SOURCES) $(HEADERS) > /dev/null 2>/dev/null + + +-include depend +# DO NOT DELETE diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h new file mode 100644 index 0000000000..38b21c25be --- /dev/null +++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h @@ -0,0 +1,60 @@ +#ifndef _WAYLAND_EGL_PRIV_H +#define _WAYLAND_EGL_PRIV_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* GCC visibility */ +#if defined(__GNUC__) && __GNUC__ >= 4 +#define WL_EGL_EXPORT __attribute__ ((visibility("default"))) +#else +#define WL_EGL_EXPORT +#endif + +#include <stdbool.h> +#include <wayland-client.h> + +struct wl_egl_display { + struct wl_display *display; + + struct wl_drm *drm; + int fd; + char *device_name; + bool authenticated; + + void (*glFlush)(void); +}; + +struct wl_egl_window { + struct wl_surface *surface; + struct wl_visual *visual; + + int width; + int height; + int dx; + int dy; + + int attached_width; + int attached_height; +}; + +struct wl_egl_pixmap { + struct wl_egl_display *display; + struct wl_visual *visual; + + int name; + int width; + int height; + int stride; + + void (*destroy) (struct wl_egl_pixmap *egl_pixmap); + + void *driver_private; +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c new file mode 100644 index 0000000000..2c84bec64a --- /dev/null +++ b/src/egl/wayland/wayland-egl/wayland-egl.c @@ -0,0 +1,226 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdbool.h> +#include <errno.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> + +#include <dlfcn.h> + +#include <wayland-client.h> +#include "wayland-egl.h" +#include "wayland-egl-priv.h" +#include "wayland-drm-client-protocol.h" +#include <xf86drm.h> + +static void +drm_handle_device(void *data, struct wl_drm *drm, const char *device) +{ + struct wl_egl_display *egl_display = data; + drm_magic_t magic; + + egl_display->device_name = strdup(device); + + egl_display->fd = open(egl_display->device_name, O_RDWR); + + if (egl_display->fd == -1) { + fprintf(stderr, "wayland-egl: could not open %s (%s)", + egl_display->device_name, strerror(errno)); + return; + } + drmGetMagic(egl_display->fd, &magic); + wl_drm_authenticate(egl_display->drm, magic); +} + +static void +drm_handle_authenticated(void *data, struct wl_drm *drm) +{ + struct wl_egl_display *egl_display = data; + + egl_display->authenticated = true; +} + +static const struct wl_drm_listener drm_listener = { + drm_handle_device, + drm_handle_authenticated +}; + +static void +wl_display_handle_global(struct wl_display *display, uint32_t id, + const char *interface, uint32_t version, void *data) +{ + struct wl_egl_display *egl_display = data; + + if (strcmp(interface, "drm") == 0) { + egl_display->drm = wl_drm_create(display, id); + wl_drm_add_listener(egl_display->drm, &drm_listener, + egl_display); + } +} + +/* stolen from egl_dri2:dri2_load() */ +static void * +get_flush_address() { + void *handle; + void *(*get_proc_address)(const char *procname); + + handle = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); + if (handle) { + get_proc_address = (void* (*)(const char *)) + dlsym(handle, "_glapi_get_proc_address"); + /* no need to keep a reference */ + dlclose(handle); + } + + /* + * If glapi is not available, loading DRI drivers will fail. Ideally, we + * should load one of libGL, libGLESv1_CM, or libGLESv2 and go on. But if + * the app has loaded another one of them with RTLD_LOCAL, there may be + * unexpected behaviors later because there will be two copies of glapi + * (with global variables of the same names!) in the memory. + */ + if (!get_proc_address) { + fprintf(stderr, "failed to find _glapi_get_proc_address"); + return NULL; + } + + return get_proc_address("glFlush"); +} + +WL_EGL_EXPORT struct wl_egl_display * +wl_egl_display_create(struct wl_display *display) +{ + struct wl_egl_display *egl_display; + + egl_display = malloc(sizeof *egl_display); + if (!egl_display) + return NULL; + + egl_display->display = display; + egl_display->drm = NULL; + egl_display->fd = -1; + egl_display->device_name = NULL; + egl_display->authenticated = false; + + egl_display->glFlush = (void (*)(void)) get_flush_address(); + + wl_display_add_global_listener(display, wl_display_handle_global, + egl_display); + + return egl_display; +} + +WL_EGL_EXPORT void +wl_egl_display_destroy(struct wl_egl_display *egl_display) +{ + + free(egl_display->device_name); + close(egl_display->fd); + + wl_drm_destroy(egl_display->drm); + + free(egl_display); +} + +WL_EGL_EXPORT void +wl_egl_window_resize(struct wl_egl_window *egl_window, + int width, int height, + int dx, int dy) +{ + egl_window->width = width; + egl_window->height = height; + egl_window->dx = dx; + egl_window->dy = dy; +} + +WL_EGL_EXPORT struct wl_egl_window * +wl_egl_window_create(struct wl_egl_display *egl_display, + struct wl_surface *surface, + int width, int height, + struct wl_visual *visual) +{ + struct wl_egl_window *egl_window; + + egl_window = malloc(sizeof *egl_window); + if (!egl_window) + return NULL; + + egl_window->surface = surface; + egl_window->visual = visual; + wl_egl_window_resize(egl_window, width, height, 0, 0); + egl_window->attached_width = 0; + egl_window->attached_height = 0; + + return egl_window; +} + +WL_EGL_EXPORT void +wl_egl_window_destroy(struct wl_egl_window *egl_window) +{ + free(egl_window); +} + +WL_EGL_EXPORT void +wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, + int *width, int *height) +{ + if (width) + *width = egl_window->attached_width; + if (height) + *height = egl_window->attached_height; +} + +WL_EGL_EXPORT struct wl_egl_pixmap * +wl_egl_pixmap_create(struct wl_egl_display *egl_display, + int width, int height, + struct wl_visual *visual, uint32_t flags) +{ + struct wl_egl_pixmap *egl_pixmap; + + egl_pixmap = malloc(sizeof *egl_pixmap); + if (egl_pixmap == NULL) + return NULL; + + egl_pixmap->display = egl_display; + egl_pixmap->width = width; + egl_pixmap->height = height; + egl_pixmap->visual = visual; + egl_pixmap->name = 0; + egl_pixmap->stride = 0; + + egl_pixmap->destroy = NULL; + + return egl_pixmap; +} + +WL_EGL_EXPORT void +wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap) +{ + if (egl_pixmap->destroy) + egl_pixmap->destroy(egl_pixmap); + free(egl_pixmap); +} + +WL_EGL_EXPORT struct wl_buffer * +wl_egl_pixmap_create_buffer(struct wl_egl_display *egl_display, + struct wl_egl_pixmap *egl_pixmap) +{ + if (egl_pixmap->name == 0) + return NULL; + + return wl_drm_create_buffer(egl_display->drm, egl_pixmap->name, + egl_pixmap->width, egl_pixmap->height, + egl_pixmap->stride, egl_pixmap->visual); +} + +WL_EGL_EXPORT void +wl_egl_pixmap_flush(struct wl_egl_display *egl_display, + struct wl_egl_pixmap *egl_pixmap) +{ + if (egl_display->glFlush) + egl_display->glFlush(); +} diff --git a/src/egl/wayland/wayland-egl/wayland-egl.pc.in b/src/egl/wayland/wayland-egl/wayland-egl.pc.in new file mode 100644 index 0000000000..3c2067c2a7 --- /dev/null +++ b/src/egl/wayland/wayland-egl/wayland-egl.pc.in @@ -0,0 +1,12 @@ +prefix=@INSTALL_DIR@ +exec_prefix=${prefix} +libdir=@INSTALL_LIB_DIR@ +includedir=@INSTALL_INC_DIR@ + +Name: wayland-egl +Description: Mesa wayland-egl library +Requires.private: @WAYLAND_EGL_PC_REQ_PRIV@ +Version: @VERSION@ +Libs: -L${libdir} -l@WAYLAND_EGL_LIB@ +Libs.private: @WAYLAND_EGL_PC_LIB_PRIV@ +Cflags: -I${includedir} @WAYLAND_EGL_PC_CFLAGS@ |