egl image creation in case of atomic

Hosokawa, Kenji (ADITG/ESB) khosokawa at
Mon Sep 10 15:35:52 UTC 2018

> -----Original Message-----
> From: wayland-devel <wayland-devel-bounces at> On Behalf Of Hosokawa, Kenji (ADITG/ESB)
> Sent: Dienstag, 28. August 2018 14:32
> To: wayland-devel at
> Subject: egl image creation in case of atomic
> Hi,
> When eglSwapInterval is 0, clients may send buffers without waiting frame callbacks. Currently, egl image is created when a buffer is
> committed from client. But egl image is only needed, when gl-renderer is used to render the framebuffer. Creating an egl image in
> every commit causes additional CPU load in weston when clients are sending more buffers than display refresh rate. Furthermore,
> creating egl images are not needed at all, when the client buffer can be imported to a DRM plane. We would like to reduce CPU usage
> of weston in that case.
> In my investigation, egl image creation can produce higher CPU load in Weston. I tried to remove egl image creation with this simple
> ugly patch for weston.
> diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
> index 2c50d2d..bbb5846 100644
> --- a/libweston/gl-renderer.c
> +++ b/libweston/gl-renderer.c
> @@ -2260,6 +2260,8 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,
>         buffer->y_inverted =
>                 !(dmabuf->attributes.flags & ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT);
> +       return;
> +
>         for (i = 0; i < gs->num_images; i++)
>                 egl_image_unref(gs->images[i]);
>         gs->num_images = 0;
> Without the patch (original), total CPU usage of weston was 25%. With the patch, it was decreased to 10%.
> I used weston v4.0.92, weston-simple-egl with -o and -b options, rcar h3 target. It was measured with top command simply.
> My question is that can egl image creation be postponed until repaint output (gl_renderer_repaint_output)?


Do you have any ideas for my question? If it makes sense in principle, I will jump into the detail to achieve it.
If there are some problems which I don't know, I hope you'll let me know.

Best regards

Kenji Hosokawa
Engineering Software Base (ADITG/ESB)

> Best regards
> Kenji Hosokawa
> Engineering Software Base (ADITG/ESB)

More information about the wayland-devel mailing list