diff options
Diffstat (limited to 'src/egl/wayland')
-rw-r--r-- | src/egl/wayland/wayland-drm/protocol/wayland-drm.xml | 14 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.c | 34 | ||||
-rw-r--r-- | src/egl/wayland/wayland-drm/wayland-drm.h | 3 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl-priv.h | 2 | ||||
-rw-r--r-- | src/egl/wayland/wayland-egl/wayland-egl.c | 8 |
5 files changed, 37 insertions, 24 deletions
diff --git a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml index cde943060ca..f63bebdcaf5 100644 --- a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml +++ b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml @@ -32,10 +32,16 @@ <interface name="wl_drm" version="1"> <enum name="error"> <entry name="authenticate_fail" value="0"/> - <entry name="invalid_visual" value="1"/> + <entry name="invalid_format" value="1"/> <entry name="invalid_name" value="2"/> </enum> + <enum name="format"> + <entry name="argb32" value="0"/> + <entry name="premultiplied_argb32" value="1"/> + <entry name="xrgb32" value="2"/> + </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 @@ -52,7 +58,7 @@ <arg name="width" type="int"/> <arg name="height" type="int"/> <arg name="stride" type="uint"/> - <arg name="visual" type="object" interface="wl_visual"/> + <arg name="format" type="uint"/> </request> <!-- Notification of the path of the drm device which is used by @@ -64,6 +70,10 @@ <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> diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c index 3f51c89703f..372faf70806 100644 --- a/src/egl/wayland/wayland-drm/wayland-drm.c +++ b/src/egl/wayland/wayland-drm/wayland-drm.c @@ -48,7 +48,8 @@ struct wl_drm { struct wl_drm_buffer { struct wl_buffer buffer; struct wl_drm *drm; - + uint32_t format; + void *driver_buffer; }; @@ -83,11 +84,22 @@ const static struct wl_buffer_interface drm_buffer_interface = { 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, struct wl_resource *visual_resource) + uint32_t stride, uint32_t format) { struct wl_drm *drm = resource->data; struct wl_drm_buffer *buffer; - struct wl_visual *visual = visual_resource->data; + + switch (format) { + case WL_DRM_FORMAT_ARGB32: + case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32: + case WL_DRM_FORMAT_XRGB32: + break; + default: + wl_resource_post_error(resource, + WL_DRM_ERROR_INVALID_FORMAT, + "invalid format"); + return; + } buffer = calloc(1, sizeof *buffer); if (buffer == NULL) { @@ -98,20 +110,12 @@ drm_create_buffer(struct wl_client *client, struct wl_resource *resource, buffer->drm = drm; buffer->buffer.width = width; buffer->buffer.height = height; - buffer->buffer.visual = visual; - - if (!visual || visual_resource->object.interface != &wl_visual_interface) { - wl_resource_post_error(resource, - WL_DRM_ERROR_INVALID_VISUAL, - "invalid visual"); - free(buffer); - return; - } + buffer->format = format; buffer->driver_buffer = drm->callbacks->reference_buffer(drm->user_data, name, width, height, - stride, visual); + stride, format); if (buffer->driver_buffer == NULL) { wl_resource_post_error(resource, @@ -160,6 +164,10 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id) resource = wl_client_add_object(client, &wl_drm_interface, &drm_interface, id, data); wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name); + wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_ARGB32); + wl_resource_post_event(resource, WL_DRM_FORMAT, + WL_DRM_FORMAT_PREMULTIPLIED_ARGB32); + wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_XRGB32); } struct wl_drm * diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h index 4324b591425..c9a90cad1ba 100644 --- a/src/egl/wayland/wayland-drm/wayland-drm.h +++ b/src/egl/wayland/wayland-drm/wayland-drm.h @@ -5,6 +5,7 @@ #include "eglimage.h" #include <wayland-server.h> +#include "wayland-drm-server-protocol.h" struct wl_drm; @@ -13,7 +14,7 @@ struct wayland_drm_callbacks { void *(*reference_buffer)(void *user_data, uint32_t name, int32_t width, int32_t height, - uint32_t stride, struct wl_visual *visual); + uint32_t stride, uint32_t format); void (*release_buffer)(void *user_data, void *buffer); }; diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h index 179f5cf199b..accd2ddca84 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h +++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h @@ -16,7 +16,6 @@ extern "C" { struct wl_egl_window { struct wl_surface *surface; - struct wl_visual *visual; int width; int height; @@ -28,7 +27,6 @@ struct wl_egl_window { }; struct wl_egl_pixmap { - struct wl_visual *visual; struct wl_buffer *buffer; int width; diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c index c8f73ea8a3a..e950b4a644b 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl.c +++ b/src/egl/wayland/wayland-egl/wayland-egl.c @@ -17,8 +17,7 @@ wl_egl_window_resize(struct wl_egl_window *egl_window, WL_EGL_EXPORT struct wl_egl_window * wl_egl_window_create(struct wl_surface *surface, - int width, int height, - struct wl_visual *visual) + int width, int height) { struct wl_egl_window *egl_window; @@ -27,7 +26,6 @@ wl_egl_window_create(struct wl_surface *surface, 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; @@ -52,8 +50,7 @@ wl_egl_window_get_attached_size(struct wl_egl_window *egl_window, } WL_EGL_EXPORT struct wl_egl_pixmap * -wl_egl_pixmap_create(int width, int height, - struct wl_visual *visual, uint32_t flags) +wl_egl_pixmap_create(int width, int height, uint32_t flags) { struct wl_egl_pixmap *egl_pixmap; @@ -63,7 +60,6 @@ wl_egl_pixmap_create(int width, int height, egl_pixmap->width = width; egl_pixmap->height = height; - egl_pixmap->visual = visual; egl_pixmap->destroy = NULL; egl_pixmap->buffer = NULL; |