<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:"MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@MS Mincho";
        panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.shorttext
        {mso-style-name:short_text;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<span class="shorttext"><o:p></o:p></span></span></p>
<p class="MsoNormal"><span lang="EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">index 2c50d2d..bbb5846 100644<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">--- a/libweston/gl-renderer.c<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">+++ b/libweston/gl-renderer.c<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">@@ -2260,6 +2260,8 @@ gl_renderer_attach_dmabuf(struct weston_surface *surface,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">        buffer->y_inverted =<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                !(dmabuf->attributes.flags & ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">+       return;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">+<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">        for (i = 0; i < gs->num_images; i++)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">                </span>egl_image_unref(gs->images[i]);<o:p></o:p></p>
<p class="MsoNormal">        gs->num_images = 0;<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">Without the patch (original), total CPU usage of weston was 25%. With the patch, it was decreased to 10%.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I used weston v4.0.92, weston-simple-egl with –o and –b options, rcar h3 target. It was measured with top command simply.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My question is that can egl image creation be postponed until repaint output (gl_renderer_repaint_output)?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif">Best regards</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Times New Roman",serif"><br>
</span><span lang="EN-US" style="font-size:8.0pt;font-family:"Arial",sans-serif"><br>
</span><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif">Kenji Hosokawa</span></b><span lang="EN-US" style="font-size:8.0pt;font-family:"Times New Roman",serif"><br>
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif">Engineering Software Base (ADITG/ESB)</span><span lang="EN-US"><o:p></o:p></span></p>
</div>
</body>
</html>