[Mesa-users] Mesa 17 Wayland EGL changes

Cédric Legrand legrand.cedric.01 at gmail.com
Tue Feb 14 12:41:04 UTC 2017


2017-02-14 13:13 GMT+01:00 Pekka Paalanen <ppaalanen at gmail.com>:

> On Tue, 14 Feb 2017 12:58:33 +0100
> Cédric Legrand <legrand.cedric.01 at gmail.com> wrote:
>
> > 2017-02-13 15:40 GMT+01:00 Pekka Paalanen <ppaalanen at gmail.com>:
> >
>
> > I'm still unable to get hardware acceleration with the
> > EGL_WL_bind_wayland_display extension working (question 3). I'm pretty
> sure
> > I missed a little stupid detail, but I can't get what exactly. If someone
> > could at least point me to a typical workflow, this may help me.
>
> Maybe follow what Weston does with it?
>
> https://cgit.freedesktop.org/wayland/weston/tree/libweston/
> gl-renderer.c?id=1.99.92#n1997
>
> gl_renderer_attach() -> gl_renderer_attach_egl()
>
> You do handle different wl_buffer types (wl_shm, EGL, ...) accordingly,
> right?
>
>
> Thanks,
> pq
>

Yep, this is what I'm doing. To be precise, here is my total workflow:
- After the server EGL display initialization, i call
eglBindWaylandDisplayWL. I just saw that, unlike weston, I'm binding the
wl_display after the context and surface creation. Weston does it right
after eglChooseConfig. Does it matter?
- When the surface gets mapped, I create a texture for it with
glGenTextures.
- On the wl_surface.attach event, I assign the buffer's wl_resource to the
surface.
- On the wl_surface.commit event, I set the buffer texture (detailed below).
- Once the surface is drawn, I send the wl_buffer.release and the
wl_callback.done events.

The texture filling with EGL buffer:
- I get the buffer size with eglQueryWaylandBufferWL
- I create an image with eglCreateImageKHR
- I bind the surface texture with glBindTexture
- I assign the buffer with glEGLImageTargetTexture2DOES, giving it the
image.

Some notes:
- I know that I don't check the format, on my system I get ARGB8888, so I'm
always using the GL_TEXTURE_2D atm.
- I also know that I miss some cleaning, I just want to make it work atm.
- wl_shm buffers work well, the only difference with an EGL buffer is the
texture filling. All the other steps use exactly the same code.
- I'm rendering to a X11 window. I don't need anything special at window
creation, do I?

Thanks,
Cédric Legrand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-users/attachments/20170214/c9ac180f/attachment.html>


More information about the mesa-users mailing list