summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.h
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@redhat.com>2015-02-23 20:27:37 +0100
committerShawn Rutledge <shawn.rutledge@digia.com>2015-03-11 07:15:28 +0000
commit3b30a8215e98f6164a1650ce7c7e2a42a3d8746f (patch)
tree9d2795005b22534bca74cd06d294edf474cd1c3b /src/plugins/platforms/xcb/qxcbconnection.h
parentd3f6249de30ade8e75fe01bd61f5e7416790c032 (diff)
Improve handling of XRandR events in XCB backend
Querying X server for data can be very expensive, especially when there are multiple processes querying it at the same time (which is exactly what happens when screen configuration changes and all Qt applications receive XRandR change notifications). This patch is aiming to reduce the number of queries to X server as much as possible by making use of detailed information available in the RRCrtcChangeNotify and RROutputChangeNotify events. Firstly, the backend now does not rebuild all QXcbScreens on any change (which involved the very expensive xcb_randr_get_screen_resources() call), but only builds the full set of QXcbScreens once in initializeScreens(), and then just incrementally updates it. Secondly, it avoids querying X server for all screens geometry as much as possible, and only does so when CRTC/Output change notification for a particular screen is delivered. As a result, handling of all XRandR events on screen change is reduced from tens of seconds to less then a seconds and applications are better responsive after that, because we don't block the event loop for long. The X server is also more responsive after the screen change, since we are not overloading it with requests. Change-Id: I9b8308341cada71dfc9590030909b1e68a335a1f Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.h')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index a3c8c0b95e..de454b5eae 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -35,6 +35,7 @@
#define QXCBCONNECTION_H
#include <xcb/xcb.h>
+#include <xcb/randr.h>
#include "qxcbexport.h"
#include <QHash>
@@ -492,9 +493,15 @@ private:
void initializeXShape();
void initializeXKB();
void handleClientMessageEvent(const xcb_client_message_event_t *event);
- QXcbScreen* findOrCreateScreen(QList<QXcbScreen *>& newScreens, int screenNumber,
- xcb_screen_t* xcbScreen, xcb_randr_get_output_info_reply_t *output = NULL);
- void updateScreens();
+ QXcbScreen* createScreen(int screenNumber, xcb_screen_t* xcbScreen,
+ xcb_randr_output_t outputId = XCB_NONE,
+ xcb_randr_get_output_info_reply_t *output = 0);
+ QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc);
+ QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output);
+ xcb_screen_t* xcbScreenForRootWindow(xcb_window_t rootWindow, int *xcbScreenNumber = 0);
+ bool checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_output_t output);
+ void initializeScreens();
+ void updateScreens(const xcb_randr_notify_event_t *event);
void handleButtonPress(xcb_generic_event_t *event);
void handleButtonRelease(xcb_generic_event_t *event);
void handleMotionNotify(xcb_generic_event_t *event);