From 230d490ecade2a7151a31973c13abaafdaba826f Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Tue, 21 Jun 2022 11:40:07 -0500 Subject: 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. --- video/out/x11_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'video/out') 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); } -- cgit v1.2.3