From f384e296b8c2face6902258de71101d5f6a5a333 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 11 Sep 2015 15:32:14 +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 | 9 +- 2 files changed, 90 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 0b55962..91d0e3f 100644 --- a/mesa.spec +++ b/mesa.spec @@ -55,7 +55,7 @@ Summary: Mesa graphics libraries Name: mesa Version: 10.6.3 -Release: 2.%{git}%{?dist} +Release: 3.%{git}%{?dist} License: MIT Group: System Environment/Libraries URL: http://www.mesa3d.org @@ -85,6 +85,9 @@ Patch99: 0001-opencl-use-versioned-.so-in-mesa.icd.patch # http://bugs.freedesktop.org/show_bug.cgi?id=86281 Patch100: i965_Remove_early_release_of_DRI2_miptree.patch +# upstream fix for msaa issues on nv3x/nv4x +Patch101: 0001-nv30-Disable-msaa-unless-requested-from-the-env-by-N.patch + # To have sha info in glxinfo BuildRequires: git @@ -375,6 +378,7 @@ grep -q ^/ src/gallium/auxiliary/vl/vl_decoder.c && exit 1 %patch99 -p1 -b .icd %endif %patch100 -p1 -b .i965_Remove_early_release_of_DRI2_miptree +%patch101 -p1 %if 0%{with_private_llvm} @@ -721,6 +725,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Fri Sep 11 2015 Hans de Goede - 10.6.3-3.20150729 +- Add a patch from upstream master to disable msaa on nv3x/nv4x (#1008089) + * Thu Sep 10 2015 Rex Dieter 10.6.3-2.20150729 - Add brw_meta_fast_clear crash workaround patch (#1259443, fdo#86281)