diff options
author | Michel Dänzer <[email protected]> | 2018-04-27 17:41:48 +0200 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2018-05-09 15:40:41 +0200 |
commit | 6f81e07ecb8c0793dc482307d5d96fd3df95b7d2 (patch) | |
tree | 46f575f04144dede779d525369ab9d97fecd0d6e | |
parent | 2cf64fdb4623cb145e51f615cf0baf85de23234d (diff) |
dri3: Only update number of back buffers in loader_dri3_get_buffers
And only free no longer needed back buffers there as well.
We want to stick to the same back buffer throughout a frame, otherwise
we can run into various issues.
Bugzilla: https://bugs.freedesktop.org/105906
Bugzilla: https://bugs.freedesktop.org/106399
Fixes: 3160cb86aa92 "egl/x11: Re-allocate buffers if format is suboptimal"
Reported-by: Sergii Romantsov <[email protected]>
Tested-by: Eero Tamminen <[email protected]>
Acked-by: Daniel Stone <[email protected]>
-rw-r--r-- | src/loader/loader_dri3_helper.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 23729f7ecb2..6db8303d26d 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -420,13 +420,6 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw, if (buf && buf->pixmap == ie->pixmap) buf->busy = 0; - - if (buf && draw->cur_blit_source != b && !buf->busy && - (buf->reallocate || - (draw->num_back <= b && b < LOADER_DRI3_MAX_BACK))) { - dri3_free_render_buffer(draw, buf); - draw->buffers[b] = NULL; - } } break; } @@ -559,7 +552,6 @@ dri3_find_back(struct loader_dri3_drawable *draw) /* Check whether we need to reuse the current back buffer as new back. * In that case, wait until it's not busy anymore. */ - dri3_update_num_back(draw); num_to_consider = draw->num_back; if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != -1) { num_to_consider = 1; @@ -1815,6 +1807,7 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable, { struct loader_dri3_drawable *draw = loaderPrivate; struct loader_dri3_buffer *front, *back; + int buf_id; buffers->image_mask = 0; buffers->front = NULL; @@ -1826,6 +1819,16 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable, if (!dri3_update_drawable(driDrawable, draw)) return false; + dri3_update_num_back(draw); + + /* Free no longer needed back buffers */ + for (buf_id = draw->num_back; buf_id < LOADER_DRI3_MAX_BACK; buf_id++) { + if (draw->cur_blit_source != buf_id && draw->buffers[buf_id]) { + dri3_free_render_buffer(draw, draw->buffers[buf_id]); + draw->buffers[buf_id] = NULL; + } + } + /* pixmaps always have front buffers. * Exchange swaps also mandate fake front buffers. */ |