Switch to a more specific nvidia binary blob work-around

We once had the problem that with the nvidia blob, the X11 server told us that
"yes, I do support RandR; there is just a single big screen" even though there
were multiple screens and they could be queried for via Xinerama. To work around
this, we started to ignore RandR if it only provided information about a single
screen.

Our long-term goal is to stop restarting on RandR screen changes. Thus, even if
only a single screen is defined during startup, we should still use RandR later
when another screen is added. This means that we cannot just ignore RandR if it
only mentions a single screen.

This commit copies what GTK+ does: If there is an output named "default", then
some compatibility layer is assumed and we ignore RandR.

I have no way to test if this really does the right thing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-15 20:05:03 +02:00
parent ebe86e32d7
commit cba8655ca8
1 changed files with 16 additions and 8 deletions

View File

@ -277,14 +277,6 @@ screen_scan_randr_crtcs(lua_State *L, screen_array_t *screens)
xcb_randr_get_screen_resources_cookie_t screen_res_c = xcb_randr_get_screen_resources(globalconf.connection, globalconf.screen->root); xcb_randr_get_screen_resources_cookie_t screen_res_c = xcb_randr_get_screen_resources(globalconf.connection, globalconf.screen->root);
xcb_randr_get_screen_resources_reply_t *screen_res_r = xcb_randr_get_screen_resources_reply(globalconf.connection, screen_res_c, NULL); xcb_randr_get_screen_resources_reply_t *screen_res_r = xcb_randr_get_screen_resources_reply(globalconf.connection, screen_res_c, NULL);
/* Only use the data from XRandR if there is more than one screen
* defined. This should work around the broken nvidia driver. */
if (screen_res_r->num_crtcs <= 1)
{
p_delete(&screen_res_r);
return;
}
/* We go through CRTC, and build a screen for each one. */ /* We go through CRTC, and build a screen for each one. */
xcb_randr_crtc_t *randr_crtcs = xcb_randr_get_screen_resources_crtcs(screen_res_r); xcb_randr_crtc_t *randr_crtcs = xcb_randr_get_screen_resources_crtcs(screen_res_r);
@ -328,6 +320,22 @@ screen_scan_randr_crtcs(lua_State *L, screen_array_t *screens)
p_delete(&output_info_r); p_delete(&output_info_r);
if (A_STREQ(name, "default"))
{
/* non RandR 1.2+ X driver don't return any usable multihead
* data. I'm looking at you, nvidia binary blob!
*/
warn("Ignoring RandR, only a compatibility layer is present.");
/* Get rid of the screens that we already created */
foreach(screen, *screens)
luaA_object_unref(L, *screen);
screen_array_wipe(screens);
screen_array_init(screens);
return;
}
} }
p_delete(&crtc_info_r); p_delete(&crtc_info_r);