aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2018-01-11 10:19:23 +0100
committerThomas Hellstrom <[email protected]>2018-01-12 09:17:35 +0100
commit897c54d522ab960a879b763a15e489f630c491ee (patch)
tree36d0cba708d2e7e4055c722d5fbe7d332a03a697 /src
parente63adf8b1ea56c9c2d0794f563bced765fb8300a (diff)
loader/dri3: Avoid freeing renderbuffers in use
Upon reception of an event that lowered the number of active back buffers, the code would immediately try to free all back buffers with an id equal to or higher than the new number of active back buffers. However, that could lead to an active or to-be-active back buffer being freed, since the old number of back buffers was used when obtaining an idle back buffer for use. This lead to crashes when lowering the number of active back buffers by transitioning from page-flipping to non-page-flipping presents. Fix this by computing the number of active back buffers only when trying to obtain a new back buffer. Fixes: 15e208c4cc ("loader/dri3: Don't accidently free buffer holding new back content") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104214 Cc: "17.3" <[email protected]> Tested-by: Andriy.Khulap <[email protected]> Tested-by: Vadym Shovkoplias <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/loader/loader_dri3_helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index cc890bc923d..8f8efcb6463 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -205,7 +205,6 @@ void
loader_dri3_set_swap_interval(struct loader_dri3_drawable *draw, int interval)
{
draw->swap_interval = interval;
- dri3_update_num_back(draw);
}
/** dri3_free_render_buffer
@@ -377,7 +376,6 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
draw->flipping = false;
break;
}
- dri3_update_num_back(draw);
if (draw->vtable->show_fps)
draw->vtable->show_fps(draw, ce->ust);
@@ -402,7 +400,8 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
buf->busy = 0;
if (buf && draw->num_back <= b && b < LOADER_DRI3_MAX_BACK &&
- draw->cur_blit_source != b) {
+ draw->cur_blit_source != b &&
+ !buf->busy) {
dri3_free_render_buffer(draw, buf);
draw->buffers[b] = NULL;
}
@@ -537,6 +536,7 @@ 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;