From 699ee52770c7db785fa4ed83488c1ff5c9af5456 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 11 Sep 2015 15:38:20 +0200 Subject: [PATCH] Add a patch from upstream master to disable msaa on nv3x/nv4x (#1008089) --- ...a-unless-requested-from-the-env-by-N.patch | 82 +++++++++++++++++++ mesa.spec | 10 ++- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 0001-nv30-Disable-msaa-unless-requested-from-the-env-by-N.patch diff --git a/0001-nv30-Disable-msaa-unless-requested-from-the-env-by-N.patch b/0001-nv30-Disable-msaa-unless-requested-from-the-env-by-N.patch new file mode 100644 index 0000000..fb90548 --- /dev/null +++ b/0001-nv30-Disable-msaa-unless-requested-from-the-env-by-N.patch @@ -0,0 +1,82 @@ +From 3e9df0e3af7a8a84147ae48f588e9c435bf65b98 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 9 Sep 2015 15:52:09 +0200 +Subject: [PATCH mesa] nv30: Disable msaa unless requested from the env by + NV30_MAX_MSAA + +Some modern apps try to use msaa without keeping in mind the +restrictions on videomem of older cards. Resulting in dmesg saying: + + [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate + [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list + [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12 + +Because we are running out of video memory, after which the program +using the msaa visual freezes, and eventually the entire system freezes. + +To work around this we do not allow msaa visauls by default and allow +the user to override this via NV30_MAX_MSAA. + +Signed-off-by: Hans de Goede +[imirkin: move env var lookup to screen so that it's only done once] +Signed-off-by: Ilia Mirkin +Cc: "10.6 11.0" +--- + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 20 +++++++++++++++++++- + src/gallium/drivers/nouveau/nv30/nv30_screen.h | 2 ++ + 2 files changed, 21 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c +index 7aad26b..efa3a59 100644 +--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c ++++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c +@@ -310,8 +310,9 @@ nv30_screen_is_format_supported(struct p + unsigned sample_count, + unsigned bindings) + { +- if (sample_count > 4) ++ if (sample_count > nv30_screen(pscreen)->max_sample_count) + return FALSE; ++ + if (!(0x00000017 & (1 << sample_count))) + return FALSE; + +@@ -441,6 +442,23 @@ nv30_screen_create(struct nouveau_device + return NULL; + } + ++ /* ++ * Some modern apps try to use msaa without keeping in mind the ++ * restrictions on videomem of older cards. Resulting in dmesg saying: ++ * [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate ++ * [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list ++ * [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12 ++ * ++ * Because we are running out of video memory, after which the program ++ * using the msaa visual freezes, and eventually the entire system freezes. ++ * ++ * To work around this we do not allow msaa visauls by default and allow ++ * the user to override this via NV30_MAX_MSAA. ++ */ ++ screen->max_sample_count = debug_get_num_option("NV30_MAX_MSAA", 0); ++ if (screen->max_sample_count > 4) ++ screen->max_sample_count = 4; ++ + pscreen = &screen->base.base; + pscreen->destroy = nv30_screen_destroy; + pscreen->get_param = nv30_screen_get_param; +diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.h b/src/gallium/drivers/nouveau/nv30/nv30_screen.h +index 7b17b88..df11233 100644 +--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.h ++++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.h +@@ -38,6 +38,8 @@ struct nv30_screen { + /*XXX: nvfx state */ + struct nouveau_heap *vp_exec_heap; + struct nouveau_heap *vp_data_heap; ++ ++ unsigned max_sample_count; + }; + + static INLINE struct nv30_screen * +-- +2.4.3 diff --git a/mesa.spec b/mesa.spec index ef80aa1..1f75237 100644 --- a/mesa.spec +++ b/mesa.spec @@ -52,7 +52,7 @@ Summary: Mesa graphics libraries Name: mesa Version: 10.4.7 -Release: 1.%{git}%{?dist} +Release: 2.%{git}%{?dist} License: MIT Group: System Environment/Libraries URL: http://www.mesa3d.org @@ -78,6 +78,9 @@ Patch30: mesa-10.3-bigendian-assert.patch # https://bugs.freedesktop.org/show_bug.cgi?id=73512 Patch99: 0001-opencl-use-versioned-.so-in-mesa.icd.patch +# upstream fix for msaa issues on nv3x/nv4x +Patch100: 0001-nv30-Disable-msaa-unless-requested-from-the-env-by-N.patch + BuildRequires: pkgconfig autoconf automake libtool %if %{with_hardware} BuildRequires: kernel-headers @@ -364,6 +367,8 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1 %patch99 -p1 -b .icd %endif +%patch100 -p1 + %if 0%{with_private_llvm} sed -i 's/llvm-config/mesa-private-llvm-config-%{__isa_bits}/g' configure.ac sed -i 's/`$LLVM_CONFIG --version`/&-mesa/' configure.ac @@ -704,6 +709,9 @@ rm -rf $RPM_BUILD_ROOT # Generate changelog using: # git log old_commit_sha..new_commit_sha --format="- %H: %s (%an)" %changelog +* Fri Sep 11 2015 Hans de Goede - 10.4.7-2.20150323 +- Add a patch from upstream master to disable msaa on nv3x/nv4x (#1008089) + * Mon Mar 23 2015 Igor Gnatenko - 10.4.7-1.20150323 - 10.4.7