From ae56140b50bccde9e6cfdc6757f345c989ccd755 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 30 Dec 2013 12:42:56 +0100 Subject: xcb: Remove useless flushes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calling xcb_flush() right before QXcbConnection::sync() is pointless. The flush sends all requests that were already queued to the server and the call to sync() then just sends another request, flushes it and waits for its reply. Having just sync() implicitly flush for us means less overhead and has the same effect. Another useless flush is in QXcbShmImage::put(). The only caller is QXcbBackingStore::flush() and this calls put() in a loop. If we just call xcb_flush() from flush(), then xcb can send more requests in a single write() call again. Finally, calling Q_XCB_NOOP() twice in a row without doing any interaction with xcb in between doesn't help much, so remove one of the two calls from QXcbShmImage::put() Change-Id: Ia3d6945b8d961e2844fc3e31fdf8189c47b534d1 Signed-off-by: Uli Schlachter Reviewed-by: Jørgen Lind Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 6 ++---- src/plugins/platforms/xcb/qxcbwindow.cpp | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index e93b36cb99..366e043e98 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -232,9 +232,6 @@ void QXcbShmImage::put(xcb_window_t window, const QPoint &target, const QRect &s Q_XCB_NOOP(connection()); m_dirty = m_dirty | source; - - xcb_flush(xcb_connection()); - Q_XCB_NOOP(connection()); } void QXcbShmImage::preparePaint(const QRegion ®ion) @@ -314,10 +311,11 @@ void QXcbBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin Q_XCB_NOOP(connection()); if (m_syncingResize) { - xcb_flush(xcb_connection()); connection()->sync(); m_syncingResize = false; platformWindow->updateSyncRequestCounter(); + } else { + xcb_flush(xcb_connection()); } } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 806f948cc2..81134ced49 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -668,8 +668,6 @@ void QXcbWindow::show() m_screen->windowShown(this); - xcb_flush(xcb_connection()); - connection()->sync(); } @@ -1889,7 +1887,6 @@ void QXcbWindow::updateSyncRequestCounter() { if (m_usingSyncProtocol && (m_syncValue.lo != 0 || m_syncValue.hi != 0)) { Q_XCB_CALL(xcb_sync_set_counter(xcb_connection(), m_syncCounter, m_syncValue)); - xcb_flush(xcb_connection()); connection()->sync(); m_syncValue.lo = 0; -- cgit v1.2.3