From 52535d7684ecbc417bebd0a94639387c0f244d1f Mon Sep 17 00:00:00 2001 From: Stanislav Vorobiov Date: Wed, 21 Aug 2013 17:10:22 +0400 Subject: YaGL: Added bo_import support to GBM Change-Id: I46f68c4f6ae290094167bb7f4077b82f056c5080 --- EGL/CMakeLists.txt | 12 +--- EGL/wayland-drm.c | 201 ---------------------------------------------------- EGL/wayland-drm.h | 33 --------- EGL/wayland-drm.xml | 155 ---------------------------------------- 4 files changed, 1 insertion(+), 400 deletions(-) delete mode 100644 EGL/wayland-drm.c delete mode 100644 EGL/wayland-drm.h delete mode 100644 EGL/wayland-drm.xml (limited to 'EGL') 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 -#include "wayland-drm-server-protocol.h" -#include "yagl_malloc.h" -#include "vigs.h" -#include -#include - -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 @@ - - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3