summaryrefslogtreecommitdiffstats
path: root/src/egl/wayland/wayland-drm/wayland-drm.c
diff options
context:
space:
mode:
authorRobert Bragg <[email protected]>2012-01-10 22:16:26 +0000
committerKristian Høgsberg <[email protected]>2012-01-11 12:16:47 -0500
commit670f182a1f0401f34b1fb7ead50644589737f0d2 (patch)
tree5160c24346db79d47699271e374ddba55be3add5 /src/egl/wayland/wayland-drm/wayland-drm.c
parent765ed3a6a9317607311bac1dcb0edee13ebcee16 (diff)
egl_dri2/wayland: handle creating xrgb8888 images
When creating an EGLImage from a struct wl_buffer * this ensures that we create an XRGB8888 image if the wayland buffer doesn't have an alpha channel. To determine if a wl_buffer has a valid alpha channel this patch adds an internal wayland_drm_buffer_has_alpha() function. It's important to get the internal format for an EGLImage right so that if a GL texture is later created from the image then the GL driver will know if it should sample the alpha from the texture or flatten it to a constant of 1.0. This avoids needing fragment program workarounds in wayland compositors to manually ignore the alpha component of textures created from wayland buffers. krh: Edited to use wl_buffer_get_format() instead of wl_buffer_has_alpha(). Reviewed-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/egl/wayland/wayland-drm/wayland-drm.c')
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 82ca6aa9017..43f91691046 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -205,6 +205,14 @@ wayland_buffer_is_drm(struct wl_buffer *buffer)
(void (**)(void)) &drm_buffer_interface;
}
+uint32_t
+wayland_drm_buffer_get_format(struct wl_buffer *buffer_base)
+{
+ struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) buffer_base;
+
+ return buffer->format;
+}
+
void *
wayland_drm_buffer_get_buffer(struct wl_buffer *buffer_base)
{