From 9b2e4cd5a8cac007aa702ce5f822e78e54707a07 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20R=C3=B8dal?= Date: Tue, 2 Oct 2012 09:30:18 +0200 Subject: [PATCH] Small xcb startup performance optimization. Prefetch all the extensions, to avoid having to do blocking calls later. Change-Id: I1527dbf03d76372ec88bc0d5d9f7af18a4cc2a26 Reviewed-by: Lars Knoll Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index bb5f301..3261bd1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -60,6 +60,8 @@ #include #include +#include +#include #include #ifdef XCB_USE_XLIB @@ -308,7 +310,19 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char connect(dispatcher, SIGNAL(awake()), this, SLOT(processXcbEvents())); #endif - xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id); + xcb_extension_t *extensions[] = { + &xcb_shm_id, &xcb_xfixes_id, &xcb_randr_id, &xcb_shape_id, &xcb_sync_id, +#ifdef XCB_USE_RENDER + &xcb_render_id, +#endif +#ifdef XCB_HAS_XCB_GLX + &xcb_glx_id, +#endif + 0 + }; + + for (xcb_extension_t **ext_it = extensions; *ext_it; ++ext_it) + xcb_prefetch_extension_data (m_connection, *ext_it); m_setup = xcb_get_setup(xcb_connection()); -- 2.7.4