diff options
author | Neil Roberts <[email protected]> | 2013-10-28 15:07:03 +0000 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2013-12-04 17:04:57 -0800 |
commit | 5cddb1ce3c9890435374ae3e03fc4a5b57dee314 (patch) | |
tree | 97be439739da18c825b2941f846edb0709f280bd /src/egl/main/eglapi.c | |
parent | bce64c6c83122b1f4a684cc7890c7a61d2f9ffd7 (diff) |
wayland: Add an extension to create wl_buffers from EGLImages
This adds an extension called EGL_WL_create_wayland_buffer_from_image
which adds the following single function:
struct wl_buffer *
eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImageKHR image);
The function creates a wl_buffer which shares its contents with the given
EGLImage. The expected use case for this is in a nested Wayland compositor
which is using subsurfaces to present buffers from its clients. Using this
extension it can attach the client buffers directly to the subsurface without
having to blit the contents into an intermediate buffer. The compositing can
then be done in the parent compositor.
The extension is only implemented in the Wayland EGL platform because of
course it wouldn't make sense anywhere else.
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r-- | src/egl/main/eglapi.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 66f96de4140..9ac2ef44698 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -973,6 +973,9 @@ eglGetProcAddress(const char *procname) { "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL }, { "eglQueryWaylandBufferWL", (_EGLProc) eglQueryWaylandBufferWL }, #endif +#ifdef EGL_WL_create_wayland_buffer_from_image + { "eglCreateWaylandBufferFromImageWL", (_EGLProc) eglCreateWaylandBufferFromImageWL }, +#endif { "eglPostSubBufferNV", (_EGLProc) eglPostSubBufferNV }, #ifdef EGL_EXT_swap_buffers_with_damage { "eglSwapBuffersWithDamageEXT", (_EGLProc) eglSwapBuffersWithDamageEXT }, @@ -1601,6 +1604,28 @@ eglQueryWaylandBufferWL(EGLDisplay dpy, struct wl_resource *buffer, } #endif +#ifdef EGL_WL_create_wayland_buffer_from_image +struct wl_buffer * EGLAPIENTRY +eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImageKHR image) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLImage *img; + _EGLDriver *drv; + struct wl_buffer *ret; + + _EGL_CHECK_DISPLAY(disp, NULL, drv); + assert(disp->Extensions.WL_create_wayland_buffer_from_image); + + img = _eglLookupImage(image, disp); + + if (!img) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, NULL); + + ret = drv->API.CreateWaylandBufferFromImageWL(drv, disp, img); + + RETURN_EGL_EVAL(disp, ret); +} +#endif EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, |