summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-06-21 11:40:07 -0500
committerDudemanguy <random342@airmail.cc>2022-06-21 18:05:35 +0000
commit230d490ecade2a7151a31973c13abaafdaba826f (patch)
tree2733c0e9e2f5cf9d7d665332d9ea3780ce5774b2
parentb29878e3a19fa944b9ef044b9cef776ab3c89af7 (diff)
downloadmpv-230d490ecade2a7151a31973c13abaafdaba826f.tar.bz2
mpv-230d490ecade2a7151a31973c13abaafdaba826f.tar.xz
x11: correct provider detection logic
The old logic always reset the x11->has_mesa/has_nvidia values on every loop through the provider. This meant that it would always just match whatever the last provider happened to be. So in the case of a dual GPU system, if nvidia was the very first provider and the integrated intel/amd card was the second (in practice, this is probably mostly the other way around), then mpv would set has_mesa to true and has_nvidia to false and thus try to use presentation. This is not the intended behavior. Just rework this by also checking x11->has_mesa/has_nvidia in the loop so a true value from the previous iteration is preserved.
-rw-r--r--video/out/x11_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index e3479ea00c..4ceb7ba3d1 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -422,8 +422,8 @@ static void xrandr_read(struct vo_x11_state *x11)
int intel = bstr_find0(provider_name, "intel");
int nvidia = bstr_find0(provider_name, "nvidia");
int radeon = bstr_find0(provider_name, "radeon");
- x11->has_mesa = amd >= 0 || intel >= 0 || radeon >= 0;
- x11->has_nvidia = nvidia >= 0;
+ x11->has_mesa = x11->has_mesa || amd >= 0 || intel >= 0 || radeon >= 0;
+ x11->has_nvidia = x11->has_nvidia || nvidia >= 0;
}
XRRFreeProviderResources(pr);
}