[packages/Mesa] fix dri3 crash on switching between GL apps

jajcus jajcus at pld-linux.org
Wed Jan 17 13:18:11 CET 2018


commit 303ae5d630118bed0bfdbe02c5f93fcb06811a23
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Jan 17 13:17:38 2018 +0100

    fix dri3 crash on switching between GL apps
    
    Release: 2

 Mesa.spec            |  4 +++-
 dri3_crash_fix.patch | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletion(-)
---
diff --git a/Mesa.spec b/Mesa.spec
index a503316..05dad2d 100644
--- a/Mesa.spec
+++ b/Mesa.spec
@@ -60,13 +60,14 @@ Summary:	Free OpenGL implementation
 Summary(pl.UTF-8):	Wolnodostępna implementacja standardu OpenGL
 Name:		Mesa
 Version:	17.3.1
-Release:	1
+Release:	2
 License:	MIT (core) and others - see license.html file
 Group:		X11/Libraries
 Source0:	ftp://ftp.freedesktop.org/pub/mesa/mesa-%{version}.tar.xz
 # Source0-md5:	b4b021279ea21e1eb8a1369afa6f19a0
 Patch0:		%{name}-link.patch
 Patch1:		glvnd-fix-gl-dot-pc.patch
+Patch2:		dri3_crash_fix.patch
 URL:		http://www.mesa3d.org/
 BuildRequires:	autoconf >= 2.60
 BuildRequires:	automake
@@ -1267,6 +1268,7 @@ radv - eksperymentalny sterownik Vulkan dla GPU firmy AMD.
 %if %{with glvnd}
 %patch1 -p1
 %endif
+%patch2 -p1
 
 %build
 %{__libtoolize}
diff --git a/dri3_crash_fix.patch b/dri3_crash_fix.patch
new file mode 100644
index 0000000..618a466
--- /dev/null
+++ b/dri3_crash_fix.patch
@@ -0,0 +1,64 @@
+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>
+Tested-by: Andriy.Khulap <andriy.khulap at globallogic.com>
+Tested-by: Vadym Shovkoplias <vadym.shovkoplias at globallogic.com>
+Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
+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..8f8efcb 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;
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/Mesa.git/commitdiff/303ae5d630118bed0bfdbe02c5f93fcb06811a23



More information about the pld-cvs-commit mailing list