aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c23
-rw-r--r--src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h3
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_drm.c23
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_shm.c15
4 files changed, 44 insertions, 20 deletions
diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
index bc2cee4c386..50b6efd6102 100644
--- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
@@ -15,17 +15,32 @@
void *
egl_g3d_wl_drm_helper_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)
{
struct native_display *ndpy = user_data;
struct pipe_resource templ;
struct winsys_handle wsh;
- enum pipe_format format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ enum pipe_format pf;
+
+ switch (format) {
+ case WL_DRM_FORMAT_ARGB32:
+ case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
+ pf = PIPE_FORMAT_B8G8R8A8_UNORM;
+ break;
+ case WL_DRM_FORMAT_XRGB32:
+ pf = PIPE_FORMAT_B8G8R8X8_UNORM;
+ break;
+ default:
+ pf = PIPE_FORMAT_NONE;
+ break;
+ }
+
+ if (pf == PIPE_FORMAT_NONE)
+ return NULL;
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
- templ.format = format;
+ templ.format = pf;
templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
templ.width0 = width;
templ.height0 = height;
diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h
index 71cb6c52b26..6085875f098 100644
--- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h
+++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.h
@@ -31,8 +31,7 @@
void *
egl_g3d_wl_drm_helper_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
egl_g3d_wl_drm_helper_unreference_buffer(void *user_data, void *buffer);
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index 7a5b33affd8..05c32f47734 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -97,7 +97,7 @@ wayland_create_drm_buffer(struct wayland_display *display,
struct pipe_resource *resource;
struct winsys_handle wsh;
uint width, height;
- struct wl_visual *visual;
+ uint32_t format;
resource = resource_surface_get_single_resource(surface->rsurf, attachment);
resource_surface_get_size(surface->rsurf, &width, &height);
@@ -107,19 +107,21 @@ wayland_create_drm_buffer(struct wayland_display *display,
pipe_resource_reference(&resource, NULL);
- switch (surface->type) {
- case WL_WINDOW_SURFACE:
- visual = surface->win->visual;
+ switch (surface->color_format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ /* assume premultiplied */
+ format = WL_DRM_FORMAT_PREMULTIPLIED_ARGB32;
break;
- case WL_PIXMAP_SURFACE:
- visual = surface->pix->visual;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ format = WL_DRM_FORMAT_XRGB32;
break;
default:
return NULL;
+ break;
}
return wl_drm_create_buffer(drmdpy->wl_drm, wsh.handle,
- width, height, wsh.stride, visual);
+ width, height, wsh.stride, format);
}
static void
@@ -144,6 +146,12 @@ drm_handle_device(void *data, struct wl_drm *drm, const char *device)
}
static void
+drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
+{
+ /* TODO */
+}
+
+static void
drm_handle_authenticated(void *data, struct wl_drm *drm)
{
struct wayland_drm_display *drmdpy = data;
@@ -153,6 +161,7 @@ drm_handle_authenticated(void *data, struct wl_drm *drm)
static const struct wl_drm_listener drm_listener = {
drm_handle_device,
+ drm_handle_format,
drm_handle_authenticated
};
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index 018fbe8e0ef..598df9fe2ce 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -84,7 +84,7 @@ wayland_create_shm_buffer(struct wayland_display *display,
struct pipe_resource *resource;
struct winsys_handle wsh;
uint width, height;
- struct wl_visual *visual;
+ uint32_t format;
resource = resource_surface_get_single_resource(surface->rsurf, attachment);
resource_surface_get_size(surface->rsurf, &width, &height);
@@ -93,20 +93,21 @@ wayland_create_shm_buffer(struct wayland_display *display,
pipe_resource_reference(&resource, NULL);
- switch (surface->type) {
- case WL_WINDOW_SURFACE:
- visual = surface->win->visual;
+ switch (surface->color_format) {
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ format = WL_SHM_FORMAT_PREMULTIPLIED_ARGB32;
break;
- case WL_PIXMAP_SURFACE:
- visual = surface->pix->visual;
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ format = WL_SHM_FORMAT_XRGB32;
break;
default:
return NULL;
+ break;
}
return wl_shm_create_buffer(shmdpy->wl_shm, wsh.fd,
width, height,
- wsh.stride, visual);
+ wsh.stride, format);
}
static boolean