<div dir="ltr"><div><span class="gmail-im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">Hello, Michel</span></div><div><span class="gmail-im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></span></div><span class="gmail-im" style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">On 2018-04-10 09:44 AM, Sergii Romantsov wrote:<br>> Commit 3160cb86aa92 adds optimization with flag 'reallocate'.<br>> Processing of flag causes buffers freeing while pointer<br>> is still hold in caller stack and than again used to be freed.<br>><span> </span><br>> Fixes: 3160cb86aa92 "egl/x11: Re-allocate buffers if format is suboptimal"<br>><span> </span><br>> v2:<br>>  used flag 'busy' instead of introducing new one.<br>><span> </span><br>> Bugzilla:<span> </span><a href="https://bugs.freedesktop.org/show_bug.cgi?id=105906" rel="noreferrer" target="_blank" style="color:rgb(17,85,204)">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=105906</a><br>> Signed-off-by: Sergii Romantsov <<a href="mailto:sergii.romantsov@globallogic.com" style="color:rgb(17,85,204)">sergii.romantsov@globallogic.<wbr>com</a>><br>> Tested-by: Andriy Khulap <<a href="mailto:andriy.khulap@globallogic.com" style="color:rgb(17,85,204)">andriy.khulap@globallogic.com</a><wbr>><br>> ---<br>>  src/loader/loader_dri3_helper.<wbr>c | 5 ++++-<br>>  1 file changed, 4 insertions(+), 1 deletion(-)<br>><span> </span><br>> diff --git a/src/loader/loader_dri3_<wbr>helper.c b/src/loader/loader_dri3_<wbr>helper.c<br>> index fe17df1..a934db1 100644<br>> --- a/src/loader/loader_dri3_<wbr>helper.c<br>> +++ b/src/loader/loader_dri3_<wbr>helper.c<br>> @@ -1688,6 +1688,7 @@ dri3_get_buffer(__DRIdrawable *driDrawable,<br>>             (buffer_type == loader_dri3_buffer_front && draw->have_fake_front))<br>>            && buffer) {<br>> <span> </span><br>> +         buffer->busy = true;<br>>           /* Fill the new buffer with data from an old buffer */<br>>           dri3_fence_await(draw->conn, draw, buffer);<br>>           if (!loader_dri3_blit_image(draw,<br><br></span><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hello, Michel,</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I've updated patch according to your remarks: <a href="https://lists.freedesktop.org/archives/mesa-dev/2018-April/193331.html">https://lists.freedesktop.org/archives/mesa-dev/2018-April/193331.html</a></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">And about question</span></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;font-size:12.8px;float:none;display:inline">This seems a bit of a hack. Will this always be cleared again, in<br></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;font-size:12.8px;float:none;display:inline">particular if it's the fake front buffer?</span><br class="gmail-Apple-interchange-newline"></blockquote>There are seems no needs in clearing due the next step is unconditional freeing of that buffer by call 'dri3_free_render_buffer(draw, buffer)'.</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 26, 2018 at 7:43 PM, Michel Dänzer <span dir="ltr"><<a href="mailto:michel@daenzer.net" target="_blank">michel@daenzer.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 2018-04-10 09:44 AM, Sergii Romantsov wrote:<br>
> Commit 3160cb86aa92 adds optimization with flag 'reallocate'.<br>
> Processing of flag causes buffers freeing while pointer<br>
> is still hold in caller stack and than again used to be freed.<br>
> <br>
> Fixes: 3160cb86aa92 "egl/x11: Re-allocate buffers if format is suboptimal"<br>
> <br>
> v2:<br>
>  used flag 'busy' instead of introducing new one.<br>
> <br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=105906" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=105906</a><br>
> Signed-off-by: Sergii Romantsov <<a href="mailto:sergii.romantsov@globallogic.com">sergii.romantsov@globallogic.<wbr>com</a>><br>
> Tested-by: Andriy Khulap <<a href="mailto:andriy.khulap@globallogic.com">andriy.khulap@globallogic.com</a><wbr>><br>
> ---<br>
>  src/loader/loader_dri3_helper.<wbr>c | 5 ++++-<br>
>  1 file changed, 4 insertions(+), 1 deletion(-)<br>
> <br>
> diff --git a/src/loader/loader_dri3_<wbr>helper.c b/src/loader/loader_dri3_<wbr>helper.c<br>
> index fe17df1..a934db1 100644<br>
> --- a/src/loader/loader_dri3_<wbr>helper.c<br>
> +++ b/src/loader/loader_dri3_<wbr>helper.c<br>
> @@ -1688,6 +1688,7 @@ dri3_get_buffer(__DRIdrawable *driDrawable,<br>
>             (buffer_type == loader_dri3_buffer_front && draw->have_fake_front))<br>
>            && buffer) {<br>
>  <br>
> +         buffer->busy = true;<br>
>           /* Fill the new buffer with data from an old buffer */<br>
>           dri3_fence_await(draw->conn, draw, buffer);<br>
>           if (!loader_dri3_blit_image(draw,<br>
<br>
</span>This seems a bit of a hack. Will this always be cleared again, in<br>
particular if it's the fake front buffer?<br>
<span class=""><br>
<br>
> @@ -1731,6 +1732,7 @@ dri3_get_buffer(__DRIdrawable *driDrawable,<br>
>        draw->buffers[buf_id] = buffer;<br>
>     }<br>
>     dri3_fence_await(draw->conn, draw, buffer);<br>
> +   buffer = draw->buffers[buf_id];<br>
<br>
</span>This should be something like<br>
<br>
   if (buffer_type == loader_dri3_buffer_back) {<br>
      buf_id = dri3_find_back(draw);<br>
<br>
      if (buf_id < 0)<br>
         return NULL;<br>
<span class="">   }<br>
   buffer = draw->buffers[buf_id];<br>
<br>
</span>to get the now-current back buffer.<br>
<span class=""><br>
<br>
> @@ -1744,7 +1746,8 @@ dri3_get_buffer(__DRIdrawable *driDrawable,<br>
>     if (buffer_type == loader_dri3_buffer_back &&<br>
>         draw->cur_blit_source != -1 &&<br>
>         draw->buffers[draw->cur_blit_<wbr>source] &&<br>
> -       buffer != draw->buffers[draw->cur_blit_<wbr>source]) {<br>
> +       buffer != draw->buffers[draw->cur_blit_<wbr>source] &&<br>
> +       buffer != NULL) {<br>
>  <br>
>        struct loader_dri3_buffer *source = draw->buffers[draw->cur_blit_<wbr>source];<br>
>  <br>
> <br>
<br>
</span>With the above, this NULL guard isn't needed.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Earthling Michel Dänzer               |               <a href="http://www.amd.com" rel="noreferrer" target="_blank">http://www.amd.com</a><br>
Libre software enthusiast             |             Mesa and X developer<br>
</font></span></blockquote></div><br></div>