<div dir="ltr">Hello,<div>with my simple tests it works, but have some remarks (but don't have much experience with dri3):</div><div><br></div><div>1. It looks little dangerous to move logic of destroying buffers and seems in your version we are loosing some logic with 'busy' and '<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">num_back'</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">2. And also looks like buffers just will not be destroyed on time for some cases.</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">3. From my opinion it will be safer to use in function 'dri3_get_buffer' <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">call<span> </span></span>(<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">with my patch</span>):</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"> 'dri3_fence_await(draw->conn, NULL, buffer)' instead of 'dri3_fence_await(draw->conn, draw, buffer)'</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 27, 2018 at 6:56 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">From: Michel Dänzer <<a href="mailto:michel.daenzer@amd.com">michel.daenzer@amd.com</a>><br>
<br>
And only free no longer needed back buffers there as well.<br>
<br>
We want to stick to the same back buffer throughout a frame, otherwise<br>
we can run into various issues.<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/105906" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>105906</a><br>
Fixes: 3160cb86aa92 "egl/x11: Re-allocate buffers if format is suboptimal"<br>
Signed-off-by: Michel Dänzer <<a href="mailto:michel.daenzer@amd.com">michel.daenzer@amd.com</a>><br>
---<br>
<br>
Sergii, Eero, here's an alternative fix which I think is cleaner, can<br>
you test it?<br>
<br>
src/loader/loader_dri3_helper.<wbr>c | 19 +++++++++++--------<br>
1 file changed, 11 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/loader/loader_dri3_<wbr>helper.c b/src/loader/loader_dri3_<wbr>helper.c<br>
index 23729f7ecb2..6db8303d26d 100644<br>
--- a/src/loader/loader_dri3_<wbr>helper.c<br>
+++ b/src/loader/loader_dri3_<wbr>helper.c<br>
@@ -420,13 +420,6 @@ dri3_handle_present_event(<wbr>struct loader_dri3_drawable *draw,<br>
<br>
if (buf && buf->pixmap == ie->pixmap)<br>
buf->busy = 0;<br>
-<br>
- if (buf && draw->cur_blit_source != b && !buf->busy &&<br>
- (buf->reallocate ||<br>
- (draw->num_back <= b && b < LOADER_DRI3_MAX_BACK))) {<br>
- dri3_free_render_buffer(draw, buf);<br>
- draw->buffers[b] = NULL;<br>
- }<br>
}<br>
break;<br>
}<br>
@@ -559,7 +552,6 @@ dri3_find_back(struct loader_dri3_drawable *draw)<br>
/* Check whether we need to reuse the current back buffer as new back.<br>
* In that case, wait until it's not busy anymore.<br>
*/<br>
- dri3_update_num_back(draw);<br>
num_to_consider = draw->num_back;<br>
if (!loader_dri3_have_image_blit(<wbr>draw) && draw->cur_blit_source != -1) {<br>
num_to_consider = 1;<br>
@@ -1815,6 +1807,7 @@ loader_dri3_get_buffers(__<wbr>DRIdrawable *driDrawable,<br>
{<br>
struct loader_dri3_drawable *draw = loaderPrivate;<br>
struct loader_dri3_buffer *front, *back;<br>
+ int buf_id;<br>
<br>
buffers->image_mask = 0;<br>
buffers->front = NULL;<br>
@@ -1826,6 +1819,16 @@ loader_dri3_get_buffers(__<wbr>DRIdrawable *driDrawable,<br>
if (!dri3_update_drawable(<wbr>driDrawable, draw))<br>
return false;<br>
<br>
+ dri3_update_num_back(draw);<br>
+<br>
+ /* Free no longer needed back buffers */<br>
+ for (buf_id = draw->num_back; buf_id < LOADER_DRI3_MAX_BACK; buf_id++) {<br>
+ if (draw->cur_blit_source != buf_id && draw->buffers[buf_id]) {<br>
+ dri3_free_render_buffer(draw, draw->buffers[buf_id]);<br>
+ draw->buffers[buf_id] = NULL;<br>
+ }<br>
+ }<br>
+<br>
/* pixmaps always have front buffers.<br>
* Exchange swaps also mandate fake front buffers.<br>
*/<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.17.0<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">Sergii Romantsov<br></div><div dir="ltr"><div style="margin:0px;padding:0px;color:rgb(23,43,77);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">GlobalLogic Inc.<br><a href="http://www.globallogic.com/" rel="nofollow" style="color:rgb(0,82,204)" target="_blank">www.globallogic.com</a><br></div></div></div></div></div></div>
</div>