[Mesa-dev] [PATCH] loader/dri3: Avoid freeing renderbuffers in use
Andriy Khulap
andriy.khulap at globallogic.com
Thu Jan 11 10:58:01 UTC 2018
Tested-by: Andriy.Khulap <andriy.khulap at globallogic.com>
Fixes Bug 104301 (https://bugs.freedesktop.org/show_bug.cgi?id=104301) on
Intel(R) HD Graphics 530 (Skylake GT2) (0x191b)
Ubuntu 16.04 Kernel 4.4.0
Mesa 17.4.0-devel (git-4f1e500)
mpv 0.14.0-git-e1993d5
*Andriy Khulap | Software Engineer*
Mobile: +38-067-607-27-80 Skype: a.khulap
www.globallogic.com
http://www.globallogic.com/email_disclaimer.txt
On Thu, Jan 11, 2018 at 11:53 AM, Thomas Hellstrom <thellstrom at vmware.com>
wrote:
> 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" <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Thomas Hellstrom <thellstrom at vmware.com>
> ---
> src/loader/loader_dri3_helper.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_
> helper.c
> index cc890bc..c01b0ac 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 == 0) {
> 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;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180111/72fa8816/attachment-0001.html>
More information about the mesa-dev
mailing list