diff options
author | Michel Dänzer <mdaenzer@redhat.com> | 2021-01-14 13:04:57 +0100 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2021-01-20 09:22:16 -0800 |
commit | be4b6186061f001688e0dbf8c06fa0d47c59f070 (patch) | |
tree | 346af59cd52beb46164a13b42635cb7853f4fd55 | |
parent | 7d2ccf574ce6e2756beaf14c7d46186725711280 (diff) |
wsi/x11: Use get_screen_resources_current in wsi_x11_detect_xwayland
get_screen_resources may trigger an active probe of display connections
in the X server, which may take significant time and/or result in log
file spam.
Fixes: b5268d532a01 "wsi/x11: Detect Xwayland"
Reported-by: Sylvain Bertrand <sylvain.bertrand@legeek.net>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8492>
(cherry picked from commit 23f2e7771053233df3d4c348ae46f838ccdda7ef)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/vulkan/wsi/wsi_common_x11.c | 19 |
2 files changed, 11 insertions, 10 deletions
diff --git a/.pick_status.json b/.pick_status.json index b0756c1311f..7ee2d46102c 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -454,7 +454,7 @@ "description": "wsi/x11: Use get_screen_resources_current in wsi_x11_detect_xwayland", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "b5268d532a019c81877343f8e5390ca215db6338" }, diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 124377dd6cb..165b366e2df 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -120,30 +120,31 @@ static bool wsi_x11_detect_xwayland(xcb_connection_t *conn) { xcb_randr_query_version_cookie_t ver_cookie = - xcb_randr_query_version_unchecked(conn, 1, 2); + xcb_randr_query_version_unchecked(conn, 1, 3); xcb_randr_query_version_reply_t *ver_reply = xcb_randr_query_version_reply(conn, ver_cookie, NULL); - bool has_randr_v1_2 = ver_reply && (ver_reply->major_version > 1 || - ver_reply->minor_version >= 2); + bool has_randr_v1_3 = ver_reply && (ver_reply->major_version > 1 || + ver_reply->minor_version >= 3); free(ver_reply); - if (!has_randr_v1_2) + if (!has_randr_v1_3) return false; const xcb_setup_t *setup = xcb_get_setup(conn); xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup); - xcb_randr_get_screen_resources_cookie_t gsr_cookie = - xcb_randr_get_screen_resources_unchecked(conn, iter.data->root); - xcb_randr_get_screen_resources_reply_t *gsr_reply = - xcb_randr_get_screen_resources_reply(conn, gsr_cookie, NULL); + xcb_randr_get_screen_resources_current_cookie_t gsr_cookie = + xcb_randr_get_screen_resources_current_unchecked(conn, iter.data->root); + xcb_randr_get_screen_resources_current_reply_t *gsr_reply = + xcb_randr_get_screen_resources_current_reply(conn, gsr_cookie, NULL); if (!gsr_reply || gsr_reply->num_outputs == 0) { free(gsr_reply); return false; } - xcb_randr_output_t *randr_outputs = xcb_randr_get_screen_resources_outputs(gsr_reply); + xcb_randr_output_t *randr_outputs = + xcb_randr_get_screen_resources_current_outputs(gsr_reply); xcb_randr_get_output_info_cookie_t goi_cookie = xcb_randr_get_output_info(conn, randr_outputs[0], gsr_reply->config_timestamp); free(gsr_reply); |