[Mesa-dev] [PATCH 14/15] egl/wayland: Add Wayland dmabuf support for RGB10 winsys buffers.
Mario Kleiner
mario.kleiner.de at gmail.com
Fri Oct 6 16:11:44 UTC 2017
Successfully tested under Weston 3.0.
Photometer confirms 10 rgb bits from rendering to display.
Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
---
src/egl/drivers/dri2/egl_dri2.c | 3 +++
src/egl/drivers/dri2/egl_dri2.h | 2 ++
src/egl/drivers/dri2/platform_wayland.c | 16 +++++++++++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0db80a0..edbb9f7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -997,6 +997,9 @@ dri2_display_destroy(_EGLDisplay *disp)
wl_event_queue_destroy(dri2_dpy->wl_queue);
if (dri2_dpy->wl_dpy_wrapper)
wl_proxy_wrapper_destroy(dri2_dpy->wl_dpy_wrapper);
+
+ u_vector_finish(&dri2_dpy->wl_modifiers.argb2101010);
+ u_vector_finish(&dri2_dpy->wl_modifiers.xrgb2101010);
u_vector_finish(&dri2_dpy->wl_modifiers.argb8888);
u_vector_finish(&dri2_dpy->wl_modifiers.xrgb8888);
u_vector_finish(&dri2_dpy->wl_modifiers.rgb565);
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index e3bdbb5..330d457 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -218,6 +218,8 @@ struct dri2_egl_display
struct wl_event_queue *wl_queue;
struct zwp_linux_dmabuf_v1 *wl_dmabuf;
struct {
+ struct u_vector xrgb2101010;
+ struct u_vector argb2101010;
struct u_vector xrgb8888;
struct u_vector argb8888;
struct u_vector rgb565;
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index d3df141..08b7084 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -355,9 +355,13 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
switch (dri2_surf->format) {
case WL_DRM_FORMAT_ARGB2101010:
dri_image_format = __DRI_IMAGE_FORMAT_ARGB2101010;
+ modifiers = u_vector_tail(&dri2_dpy->wl_modifiers.argb2101010);
+ num_modifiers = u_vector_length(&dri2_dpy->wl_modifiers.argb2101010);
break;
case WL_DRM_FORMAT_XRGB2101010:
dri_image_format = __DRI_IMAGE_FORMAT_XRGB2101010;
+ modifiers = u_vector_tail(&dri2_dpy->wl_modifiers.xrgb2101010);
+ num_modifiers = u_vector_length(&dri2_dpy->wl_modifiers.xrgb2101010);
break;
case WL_DRM_FORMAT_ARGB8888:
dri_image_format = __DRI_IMAGE_FORMAT_ARGB8888;
@@ -1116,6 +1120,14 @@ dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
return;
switch (format) {
+ case WL_DRM_FORMAT_ARGB2101010:
+ mod = u_vector_add(&dri2_dpy->wl_modifiers.argb2101010);
+ dri2_dpy->formats |= HAS_ARGB2101010;
+ break;
+ case WL_DRM_FORMAT_XRGB2101010:
+ mod = u_vector_add(&dri2_dpy->wl_modifiers.xrgb2101010);
+ dri2_dpy->formats |= HAS_XRGB2101010;
+ break;
case WL_DRM_FORMAT_ARGB8888:
mod = u_vector_add(&dri2_dpy->wl_modifiers.argb8888);
dri2_dpy->formats |= HAS_ARGB8888;
@@ -1287,7 +1299,9 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay *disp)
dri2_dpy->wl_dpy = disp->PlatformDisplay;
}
- if (!u_vector_init(&dri2_dpy->wl_modifiers.xrgb8888, sizeof(uint64_t), 32) ||
+ if (!u_vector_init(&dri2_dpy->wl_modifiers.xrgb2101010, sizeof(uint64_t), 32) ||
+ !u_vector_init(&dri2_dpy->wl_modifiers.argb2101010, sizeof(uint64_t), 32) ||
+ !u_vector_init(&dri2_dpy->wl_modifiers.xrgb8888, sizeof(uint64_t), 32) ||
!u_vector_init(&dri2_dpy->wl_modifiers.argb8888, sizeof(uint64_t), 32) ||
!u_vector_init(&dri2_dpy->wl_modifiers.rgb565, sizeof(uint64_t), 32)) {
goto cleanup;
--
2.7.4
More information about the mesa-dev
mailing list