| Summary: | XRandR multiple screen code fails if there is no primary screen | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Edward Rudd <urkle> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | cedega.git, galtgendo, icculus, winterknight |
| Version: | HG 2.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | Xrandr keep searching for non-primary outputs on default screen | ||
|
Description
Edward Rudd
2015-11-20 20:47:06 UTC
Created attachment 2329 [details]
Xrandr keep searching for non-primary outputs on default screen
I have also run across this, in a slightly different circumstance, in hg 9943. Basically, X11_InitModes_XRandR logic will not find any outputs on the default screen, except for the primary output, if available. This can lead to funky behavior if the default screen has no primary output, but another screen does.
The culprit is this section here:
if ((looking_for_primary && (screen != default_screen)) ||
(!looking_for_primary && (screen == default_screen))) {
continue;
}
Why do you abort if you're not looking for primary outputs and the screen == default_screen? There are non-primary outputs on the default screen you want to find. The patch I propose just simplifies this line so that SDL will continue looking for outputs even if looking for non primary outputs on the default screen.
I also suggest simplifying the line on 424-425. You already aborted the loop on line 379 if looking_for_primary & screen != default_screen, so you don't have to check for that again. It makes the logic more complicated and easier to make mistakes.
*** Bug 3209 has been marked as a duplicate of this bug. *** (In reply to winterknight from comment #2) > Why do you abort if you're not looking for primary outputs and the screen == > default_screen? Because that loop is trying to find the primary output on the default screen first, so it'll be first in our list of SDL displays. So on the first time through the outer loop, we only run our code for the default screen. After that, we run it for every screen except the default. --ryan. (In reply to Ryan C. Gordon from comment #4) > (In reply to winterknight from comment #2) > > Why do you abort if you're not looking for primary outputs and the screen == > > default_screen? > > Because that loop is trying to find the primary output on the default screen > first, so it'll be first in our list of SDL displays. So on the first time > through the outer loop, we only run our code for the default screen. After > that, we run it for every screen except the default. Oh, wait, I get what you're saying. Yeah, that's a bug. --ryan. (In reply to Ryan C. Gordon from comment #5) > Oh, wait, I get what you're saying. Yeah, that's a bug. So, yes, your patch looks good, and should fix Edward's problem, too, so I've applied it to revision control as https://hg.libsdl.org/SDL/rev/df034dc2f547, thanks! --ryan. |