summaryrefslogtreecommitdiff
path: root/EGL
diff options
context:
space:
mode:
authorStanislav Vorobiov <s.vorobiov@samsung.com>2013-08-21 17:10:22 +0400
committerStanislav Vorobiov <s.vorobiov@samsung.com>2013-08-21 17:10:22 +0400
commit52535d7684ecbc417bebd0a94639387c0f244d1f (patch)
tree3c296bc83302bde378ab27aeeb8b5ea809f1b782 /EGL
parent0144559318178e4e062616687bffc223890396dd (diff)
downloademulator-yagl-52535d7684ecbc417bebd0a94639387c0f244d1f.tar.gz
emulator-yagl-52535d7684ecbc417bebd0a94639387c0f244d1f.tar.bz2
emulator-yagl-52535d7684ecbc417bebd0a94639387c0f244d1f.zip
YaGL: Added bo_import support to GBM
Change-Id: I46f68c4f6ae290094167bb7f4077b82f056c5080
Diffstat (limited to 'EGL')
-rw-r--r--EGL/CMakeLists.txt12
-rw-r--r--EGL/wayland-drm.c201
-rw-r--r--EGL/wayland-drm.h33
-rw-r--r--EGL/wayland-drm.xml155
4 files changed, 1 insertions, 400 deletions
diff --git a/EGL/CMakeLists.txt b/EGL/CMakeLists.txt
index dc72574..ac6fb79 100644
--- a/EGL/CMakeLists.txt
+++ b/EGL/CMakeLists.txt
@@ -1,5 +1,3 @@
-include (WPCodegenTarget)
-
set(SOURCES
yagl_context.c
yagl_display.c
@@ -72,24 +70,16 @@ if (PLATFORM_WAYLAND)
wayland/yagl_wayland_platform.c
wayland/yagl_wayland_display.c
wayland/yagl_wayland_window.c
- ${CMAKE_CURRENT_BINARY_DIR}/wayland-drm-server-protocol.h
- ${CMAKE_CURRENT_BINARY_DIR}/wayland-drm-client-protocol.h
- ${CMAKE_CURRENT_BINARY_DIR}/wayland-drm-protocol.c
- wayland-drm.c
yagl_onscreen_image_wl_buffer.c
)
set(LIBRARIES ${LIBRARIES}
wayland-egl-yagl
+ wayland-drm
${WAYLAND_CLIENT_LIBRARIES}
- ${WAYLAND_SERVER_LIBRARIES}
)
add_definitions(-DYAGL_PLATFORM_WAYLAND)
- wp_codegen_target(wayland-drm
- ${CMAKE_CURRENT_SOURCE_DIR}/wayland-drm.xml
- ${CMAKE_CURRENT_BINARY_DIR})
endif ()
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(.)
add_library(EGL SHARED ${SOURCES})
diff --git a/EGL/wayland-drm.c b/EGL/wayland-drm.c
deleted file mode 100644
index 0f3462b..0000000
--- a/EGL/wayland-drm.c
+++ /dev/null
@@ -1,201 +0,0 @@
-#include "wayland-drm.h"
-#include <wayland-server.h>
-#include "wayland-drm-server-protocol.h"
-#include "yagl_malloc.h"
-#include "vigs.h"
-#include <string.h>
-#include <stdlib.h>
-
-struct wl_drm
-{
- struct wl_display *display;
- char *device_name;
- struct wayland_drm_callbacks *callbacks;
- void *user_data;
-};
-
-struct wl_drm_buffer
-{
- struct wl_resource resource;
-
- struct wl_drm *drm;
-
- struct vigs_drm_surface *drm_sfc;
-};
-
-static void buffer_destroy(struct wl_resource *resource)
-{
- struct wl_drm_buffer *buffer = resource->data;
-
- vigs_drm_gem_unref(&buffer->drm_sfc->gem);
-
- yagl_free(buffer);
-}
-
-static void drm_buffer_destroy(struct wl_client *client,
- struct wl_resource *resource)
-{
- wl_resource_destroy(resource);
-}
-
-static struct wl_buffer_interface drm_buffer_interface =
-{
- drm_buffer_destroy
-};
-
-static void drm_create_buffer(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id, uint32_t name,
- int32_t width, int32_t height,
- uint32_t stride, uint32_t format)
-{
- struct wl_drm *drm = resource->data;
- struct wl_drm_buffer *buffer;
-
- switch (format) {
- case WL_DRM_FORMAT_ARGB8888:
- case WL_DRM_FORMAT_XRGB8888:
- break;
- default:
- wl_resource_post_error(resource,
- WL_DRM_ERROR_INVALID_FORMAT,
- "invalid format");
- return;
- }
-
- buffer = yagl_malloc0(sizeof(*buffer));
-
- if (!buffer) {
- wl_resource_post_no_memory(resource);
- return;
- }
-
- buffer->drm_sfc = drm->callbacks->acquire_buffer(drm->user_data, name);
-
- if (!buffer->drm_sfc) {
- wl_resource_post_error(resource,
- WL_DRM_ERROR_INVALID_NAME,
- "invalid name");
- yagl_free(buffer);
- return;
- }
-
- buffer->drm = drm;
-
- buffer->resource.object.id = id;
- buffer->resource.object.interface = &wl_buffer_interface;
- buffer->resource.object.implementation = (void(**)(void))&drm_buffer_interface;
- buffer->resource.data = buffer;
-
- buffer->resource.destroy = buffer_destroy;
- buffer->resource.client = resource->client;
-
- wl_client_add_resource(resource->client, &buffer->resource);
-}
-
-static void drm_create_planar_buffer(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id, uint32_t name,
- int32_t width, int32_t height,
- uint32_t format,
- int32_t offset0, int32_t stride0,
- int32_t offset1, int32_t stride1,
- int32_t offset2, int32_t stride2)
-{
- wl_resource_post_error(resource,
- WL_DRM_ERROR_INVALID_FORMAT,
- "invalid format");
-}
-
-static void drm_authenticate(struct wl_client *client,
- struct wl_resource *resource,
- uint32_t id)
-{
- struct wl_drm *drm = resource->data;
-
- if (drm->callbacks->authenticate(drm->user_data, id) < 0) {
- wl_resource_post_error(resource,
- WL_DRM_ERROR_AUTHENTICATE_FAIL,
- "authenicate failed");
- } else {
- wl_drm_send_authenticated(resource);
- }
-}
-
-static struct wl_drm_interface drm_interface =
-{
- drm_authenticate,
- drm_create_buffer,
- drm_create_planar_buffer
-};
-
-static void bind_drm(struct wl_client *client,
- void *data,
- uint32_t version,
- uint32_t id)
-{
- struct wl_drm *drm = data;
- struct wl_resource *resource;
-
- resource = wl_resource_create(client,
- &wl_drm_interface,
- 1,
- id);
-
- if (!resource) {
- wl_client_post_no_memory(client);
- return;
- }
-
- wl_resource_set_implementation(resource, &drm_interface, data, NULL);
-
- wl_drm_send_device(resource, drm->device_name);
- wl_drm_send_format(resource, WL_DRM_FORMAT_ARGB8888);
- wl_drm_send_format(resource, WL_DRM_FORMAT_XRGB8888);
-}
-
-struct wl_drm *wayland_drm_create(struct wl_display *display,
- char *device_name,
- struct wayland_drm_callbacks *callbacks,
- void *user_data)
-{
- struct wl_drm *drm;
-
- drm = yagl_malloc0(sizeof(*drm));
-
- drm->display = display;
- drm->device_name = strdup(device_name);
- drm->callbacks = callbacks;
- drm->user_data = user_data;
-
- wl_global_create(display, &wl_drm_interface, 1, drm, bind_drm);
-
- return drm;
-}
-
-void wayland_drm_destroy(struct wl_drm *drm)
-{
- free(drm->device_name);
-
- yagl_free(drm);
-}
-
-struct wl_drm_buffer *wayland_drm_get_buffer(struct wl_resource *resource)
-{
- if (!resource) {
- return NULL;
- }
-
- if (wl_resource_instance_of(resource,
- &wl_buffer_interface,
- &drm_buffer_interface)) {
- return wl_resource_get_user_data(resource);
- } else {
- return NULL;
- }
-}
-
-struct vigs_drm_surface *wayland_drm_buffer_get_sfc(struct wl_drm_buffer *buffer)
-{
- return buffer->drm_sfc;
-}
diff --git a/EGL/wayland-drm.h b/EGL/wayland-drm.h
deleted file mode 100644
index 7c01d3c..0000000
--- a/EGL/wayland-drm.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _WAYLAND_DRM_H_
-#define _WAYLAND_DRM_H_
-
-#include "yagl_export.h"
-#include "yagl_types.h"
-
-struct wl_drm;
-struct wl_resource;
-struct wl_display;
-struct wl_drm_buffer;
-struct vigs_drm_surface;
-
-struct wayland_drm_callbacks
-{
- int (*authenticate)(void */*user_data*/,
- uint32_t /*id*/);
-
- struct vigs_drm_surface *(*acquire_buffer)(void */*user_data*/,
- uint32_t /*name*/);
-};
-
-struct wl_drm *wayland_drm_create(struct wl_display *display,
- char *device_name,
- struct wayland_drm_callbacks *callbacks,
- void *user_data);
-
-void wayland_drm_destroy(struct wl_drm *drm);
-
-struct wl_drm_buffer *wayland_drm_get_buffer(struct wl_resource *resource);
-
-struct vigs_drm_surface *wayland_drm_buffer_get_sfc(struct wl_drm_buffer *buffer);
-
-#endif
diff --git a/EGL/wayland-drm.xml b/EGL/wayland-drm.xml
deleted file mode 100644
index 265d4f8..0000000
--- a/EGL/wayland-drm.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="drm">
-
- <copyright>
- Copyright © 2008-2011 Kristian Høgsberg
- Copyright © 2010-2011 Intel Corporation
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that\n the above copyright notice appear in
- all copies and that both that copyright notice and this permission
- notice appear in supporting documentation, and that the name of
- the copyright holders not be used in advertising or publicity
- pertaining to distribution of the software without specific,
- written prior permission. The copyright holders make no
- representations about the suitability of this software for any
- purpose. It is provided "as is" without express or implied
- warranty.
-
- THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- THIS SOFTWARE.
- </copyright>
-
- <!-- drm support. This object is created by the server and published
- using the display's global event. -->
- <interface name="wl_drm" version="1">
- <enum name="error">
- <entry name="authenticate_fail" value="0"/>
- <entry name="invalid_format" value="1"/>
- <entry name="invalid_name" value="2"/>
- </enum>
-
- <enum name="format">
- <!-- The drm format codes match the #defines in drm_fourcc.h.
- The formats actually supported by the compositor will be
- reported by the format event. -->
- <entry name="c8" value="0x20203843"/>
- <entry name="rgb332" value="0x38424752"/>
- <entry name="bgr233" value="0x38524742"/>
- <entry name="xrgb4444" value="0x32315258"/>
- <entry name="xbgr4444" value="0x32314258"/>
- <entry name="rgbx4444" value="0x32315852"/>
- <entry name="bgrx4444" value="0x32315842"/>
- <entry name="argb4444" value="0x32315241"/>
- <entry name="abgr4444" value="0x32314241"/>
- <entry name="rgba4444" value="0x32314152"/>
- <entry name="bgra4444" value="0x32314142"/>
- <entry name="xrgb1555" value="0x35315258"/>
- <entry name="xbgr1555" value="0x35314258"/>
- <entry name="rgbx5551" value="0x35315852"/>
- <entry name="bgrx5551" value="0x35315842"/>
- <entry name="argb1555" value="0x35315241"/>
- <entry name="abgr1555" value="0x35314241"/>
- <entry name="rgba5551" value="0x35314152"/>
- <entry name="bgra5551" value="0x35314142"/>
- <entry name="rgb565" value="0x36314752"/>
- <entry name="bgr565" value="0x36314742"/>
- <entry name="rgb888" value="0x34324752"/>
- <entry name="bgr888" value="0x34324742"/>
- <entry name="xrgb8888" value="0x34325258"/>
- <entry name="xbgr8888" value="0x34324258"/>
- <entry name="rgbx8888" value="0x34325852"/>
- <entry name="bgrx8888" value="0x34325842"/>
- <entry name="argb8888" value="0x34325241"/>
- <entry name="abgr8888" value="0x34324241"/>
- <entry name="rgba8888" value="0x34324152"/>
- <entry name="bgra8888" value="0x34324142"/>
- <entry name="xrgb2101010" value="0x30335258"/>
- <entry name="xbgr2101010" value="0x30334258"/>
- <entry name="rgbx1010102" value="0x30335852"/>
- <entry name="bgrx1010102" value="0x30335842"/>
- <entry name="argb2101010" value="0x30335241"/>
- <entry name="abgr2101010" value="0x30334241"/>
- <entry name="rgba1010102" value="0x30334152"/>
- <entry name="bgra1010102" value="0x30334142"/>
- <entry name="yuyv" value="0x56595559"/>
- <entry name="yvyu" value="0x55595659"/>
- <entry name="uyvy" value="0x59565955"/>
- <entry name="vyuy" value="0x59555956"/>
- <entry name="ayuv" value="0x56555941"/>
- <entry name="nv12" value="0x3231564e"/>
- <entry name="nv21" value="0x3132564e"/>
- <entry name="nv16" value="0x3631564e"/>
- <entry name="nv61" value="0x3136564e"/>
- <entry name="yuv410" value="0x39565559"/>
- <entry name="yvu410" value="0x39555659"/>
- <entry name="yuv411" value="0x31315559"/>
- <entry name="yvu411" value="0x31315659"/>
- <entry name="yuv420" value="0x32315559"/>
- <entry name="yvu420" value="0x32315659"/>
- <entry name="yuv422" value="0x36315559"/>
- <entry name="yvu422" value="0x36315659"/>
- <entry name="yuv444" value="0x34325559"/>
- <entry name="yvu444" value="0x34325659"/>
- </enum>
-
- <!-- 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="wl_buffer"/>
- <arg name="name" type="uint"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="stride" type="uint"/>
- <arg name="format" 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_planar_buffer">
- <arg name="id" type="new_id" interface="wl_buffer"/>
- <arg name="name" type="uint"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="format" type="uint"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
- </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>
-
- <event name="format">
- <arg name="format" type="uint"/>
- </event>
-
- <!-- Raised if the authenticate request succeeded -->
- <event name="authenticated"/>
- </interface>
-
-</protocol>