[PATCH:xbacklight] Use current output configuration

Nils Schneider nils at nilsschneider.net
Wed Nov 4 09:03:25 PST 2015


Do not trigger re-enumerating output devices when changing or querying
the backlight.

Re-enumerating output devices may stall Xorg at least on Intel GPUs when
EDID is unresponsive or contains bogus data (due to retries). When
working with the backlight it is safe to assume that a monitor capable
of setting its backlight is currently connected.

Signed-off-by: Nils Schneider <nils at nilsschneider.net>
---
 xbacklight.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xbacklight.c b/xbacklight.c
index f4a8b12..278043f 100644
--- a/xbacklight.c
+++ b/xbacklight.c
@@ -265,18 +265,18 @@ main (int argc, char **argv)
 	xcb_window_t root = screen->root;
 	xcb_randr_output_t *outputs;
 
-	xcb_randr_get_screen_resources_cookie_t resources_cookie;
-	xcb_randr_get_screen_resources_reply_t *resources_reply;
+	xcb_randr_get_screen_resources_current_cookie_t resources_cookie;
+	xcb_randr_get_screen_resources_current_reply_t *resources_reply;
 
-	resources_cookie = xcb_randr_get_screen_resources (conn, root);
-	resources_reply = xcb_randr_get_screen_resources_reply (conn, resources_cookie, &error);
+	resources_cookie = xcb_randr_get_screen_resources_current (conn, root);
+	resources_reply = xcb_randr_get_screen_resources_current_reply (conn, resources_cookie, &error);
 	if (error != NULL || resources_reply == NULL) {
 	    int ec = error ? error->error_code : -1;
 	    fprintf (stderr, "RANDR Get Screen Resources returned error %d\n", ec);
 	    continue;
 	}
 
-	outputs = xcb_randr_get_screen_resources_outputs (resources_reply);
+	outputs = xcb_randr_get_screen_resources_current_outputs (resources_reply);
 	for (int o = 0; o < resources_reply->num_outputs; o++)
 	{
 	    xcb_randr_output_t output = outputs[o];
-- 
2.6.2



More information about the xorg-devel mailing list