From e1b45a3c06ec19a2b9f1e0d3f8732aaad2d932da Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 19 Jul 2012 08:48:45 -0400 Subject: gallium-egl: Implement eglQueryWaylandBufferWL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support this query for gallium EGL too. Signed-off-by: Kristian Høgsberg --- .../state_trackers/egl/common/egl_g3d_api.c | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/gallium/state_trackers/egl') diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c index 58e772f944e..f2e86de3147 100644 --- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c +++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c @@ -39,6 +39,10 @@ #include "egl_g3d_st.h" #include "native.h" +#ifdef EGL_WL_bind_wayland_display +#include +#endif + /** * Return the state tracker for the given context. */ @@ -873,6 +877,32 @@ egl_g3d_unbind_wayland_display_wl(_EGLDriver *drv, _EGLDisplay *dpy, return gdpy->native->wayland_bufmgr->unbind_display(gdpy->native, wl_dpy); } +static EGLBoolean +egl_g3d_query_wayland_buffer_wl(_EGLDriver *drv, _EGLDisplay *dpy, + struct wl_buffer *_buffer, + EGLint attribute, EGLint *value) +{ + struct wl_drm_buffer *buffer = (struct wl_drm_buffer *) _buffer; + struct pipe_resource *resource = buffer->driver_buffer; + + if (!wayland_buffer_is_drm(&buffer->buffer)) + return EGL_FALSE; + + if (attribute == EGL_WAYLAND_BUFFER_COMPONENTS_WL) { + switch (resource->format) { + case PIPE_FORMAT_B8G8R8A8_UNORM: + *value = EGL_WAYLAND_BUFFER_RGBA_WL; + return EGL_TRUE; + case PIPE_FORMAT_B8G8R8X8_UNORM: + *value = EGL_WAYLAND_BUFFER_RGB_WL; + return EGL_TRUE; + default: + return EGL_FALSE; + } + } + + return EGL_FALSE; +} #endif /* EGL_WL_bind_wayland_display */ void @@ -907,7 +937,7 @@ egl_g3d_init_driver_api(_EGLDriver *drv) #ifdef EGL_WL_bind_wayland_display drv->API.BindWaylandDisplayWL = egl_g3d_bind_wayland_display_wl; drv->API.UnbindWaylandDisplayWL = egl_g3d_unbind_wayland_display_wl; - + drv->API.QueryWaylandBufferWL = egl_g3d_query_wayland_buffer_wl; #endif drv->API.CreateSyncKHR = egl_g3d_create_sync; -- cgit v1.2.3