[cairo] Having trouble using Cairo, EGL, and Wayland together
Theo Veenker
theo.veenker at beexy.nl
Wed May 6 18:57:42 UTC 2020
On 04/05/2020 04:03, Philip White wrote:
> I have been having a lot of trouble getting a valid Cairo context for
> EGL on Wayland. I have a piece of software that I initially built
> using an image surface that was built on top of the wl_shm interface.
> Thus, all of the rendering for the application was happening on the
> CPU. I'd like to make it faster by using both Wayland and Cairo's EGL
> APIs instead of the software rendering ones.
>
> I am at a point where I have an egl_context that I can call
> eglMakeCurrent with, and I can bare OpenGL ES calls to draw things. I
> also have a function that renders directly to a cairo_surface_t. Thus,
> all I really need to do is create a cairo_surface_t from the EGL
> context. I have attempted to do that through the following.
>
> eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context);
>
> egl_device = cairo_egl_device_create(egl_device, egl_context);
> surface = cairo_gl_surface_create_for_egl(egl_device, egl_surface,
> width, height);
Is the cairo status of the created surface OK?
> render_frame(surface);
>
> eglSwapInterval(egl_display, 0);
> eglSwapBuffers(egl_display, egl_surface);
Maybe use cairo_gl_surface_swapbuffers() here? Don't really know if it
would make a difference.
>
> This is of course stripped down, but these are the important bits. If
> I replace the middle three lines with a call to glClear, then there
> are no errors. However, as it stands, I receive an EGL_BAD_CONTEXT
> error at eglSwapInterval, and EGL_BAD_DISPLAY at eglSwapBuffers. Thus,
> something about the cairo function calls has ruined the state of
> things. What am I doing wrong, and how can I fix it?
>
> In my internet searching, I actually found a similar question to this
> in the archive of this mailing list, but it was never answered.
>
> Thanks,
> Philip
>
--
Theo Veenker | Beexy - Behavioral Experiment Software
+31(0)524-541531 | +31(0)6-42525777 mobile
theo.veenker at beexy.nl | www.beexy.nl
More information about the cairo
mailing list