diff options
author | Kristian Høgsberg <[email protected]> | 2012-07-19 08:48:45 -0400 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2012-07-19 14:03:17 -0400 |
commit | e1b45a3c06ec19a2b9f1e0d3f8732aaad2d932da (patch) | |
tree | 904fcc0fe399871d2e2a3adff12d7751c24ce11f /src/gallium/state_trackers | |
parent | d43f4181e1633d2677a8d828abd4ffc1a7c1e493 (diff) |
gallium-egl: Implement eglQueryWaylandBufferWL
Support this query for gallium EGL too.
Signed-off-by: Kristian Høgsberg <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/egl/common/egl_g3d_api.c | 32 |
1 files changed, 31 insertions, 1 deletions
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 <wayland-drm.h> +#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; |