summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c33
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.c19
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.h18
3 files changed, 33 insertions, 37 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e2dee798d60..bb30e699fe4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1220,43 +1220,40 @@ dri2_export_drm_image_mesa(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img,
#ifdef HAVE_WAYLAND_PLATFORM
-static void *
+static void
dri2_wl_reference_buffer(void *user_data, uint32_t name,
- int32_t width, int32_t height,
- uint32_t stride, uint32_t format)
+ struct wl_drm_buffer *buffer)
{
_EGLDisplay *disp = user_data;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
- __DRIimage *image;
- int dri_format;
- switch (format) {
+ switch (buffer->format) {
case WL_DRM_FORMAT_ARGB8888:
- dri_format =__DRI_IMAGE_FORMAT_ARGB8888;
+ buffer->driver_format =__DRI_IMAGE_FORMAT_ARGB8888;
break;
case WL_DRM_FORMAT_XRGB8888:
- dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
+ buffer->driver_format = __DRI_IMAGE_FORMAT_XRGB8888;
break;
default:
- return NULL;
+ return;
}
- image = dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
- width, height,
- dri_format, name, stride / 4,
- NULL);
-
- return image;
+ buffer->driver_buffer =
+ dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
+ buffer->buffer.width,
+ buffer->buffer.height,
+ buffer->driver_format, name,
+ buffer->stride0 / 4,
+ NULL);
}
static void
-dri2_wl_release_buffer(void *user_data, void *buffer)
+dri2_wl_release_buffer(void *user_data, struct wl_drm_buffer *buffer)
{
_EGLDisplay *disp = user_data;
- __DRIimage *image = buffer;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
- dri2_dpy->image->destroyImage(image);
+ dri2_dpy->image->destroyImage(buffer->driver_buffer);
}
static struct wayland_drm_callbacks wl_drm_callbacks = {
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 5f831b3487f..af176b72d12 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -56,22 +56,13 @@ struct wl_drm {
struct wayland_drm_callbacks *callbacks;
};
-struct wl_drm_buffer {
- struct wl_buffer buffer;
- struct wl_drm *drm;
- uint32_t format;
-
- void *driver_buffer;
-};
-
static void
destroy_buffer(struct wl_resource *resource)
{
struct wl_drm_buffer *buffer = resource->data;
struct wl_drm *drm = buffer->drm;
- drm->callbacks->release_buffer(drm->user_data,
- buffer->driver_buffer);
+ drm->callbacks->release_buffer(drm->user_data, buffer);
free(buffer);
}
@@ -129,12 +120,10 @@ drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
buffer->buffer.width = width;
buffer->buffer.height = height;
buffer->format = format;
+ buffer->offset0 = 0;
+ buffer->stride0 = stride;
- buffer->driver_buffer =
- drm->callbacks->reference_buffer(drm->user_data, name,
- width, height,
- stride, format);
-
+ drm->callbacks->reference_buffer(drm->user_data, name, buffer);
if (buffer->driver_buffer == NULL) {
wl_resource_post_error(resource,
WL_DRM_ERROR_INVALID_NAME,
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.h b/src/egl/wayland/wayland-drm/wayland-drm.h
index bec50a5539f..f3df7eeaddd 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.h
+++ b/src/egl/wayland/wayland-drm/wayland-drm.h
@@ -9,14 +9,24 @@
struct wl_drm;
+struct wl_drm_buffer {
+ struct wl_buffer buffer;
+ struct wl_drm *drm;
+ uint32_t format;
+ uint32_t driver_format;
+ int32_t offset0;
+ int32_t stride0;
+
+ void *driver_buffer;
+};
+
struct wayland_drm_callbacks {
int (*authenticate)(void *user_data, uint32_t id);
- void *(*reference_buffer)(void *user_data, uint32_t name,
- int32_t width, int32_t height,
- uint32_t stride, uint32_t format);
+ void (*reference_buffer)(void *user_data, uint32_t name,
+ struct wl_drm_buffer *buffer);
- void (*release_buffer)(void *user_data, void *buffer);
+ void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer);
};
struct wl_drm *