From a2be69d47884dd995ac6e9004ba2855f354f7522 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Sun, 15 Dec 2019 00:07:08 +0100 Subject: Client: Fix detection of linux-dmabuf Change I84c8c1008724b49b6bedb4fc3ef398e292f1c6c7 fixed the tests in compositor/configure.json but missed the test in client/configure.json. Change-Id: I65ad424406438baa74ca80a9418e133510142118 Reviewed-by: Johan Helsing --- src/client/configure.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/configure.json b/src/client/configure.json index e9e16324b..062139685 100644 --- a/src/client/configure.json +++ b/src/client/configure.json @@ -74,7 +74,7 @@ "label": "Linux dma-buf Buffer Sharing", "type": "compile", "test": "dmabuf_server_buffer", - "use": "egl" + "use": "egl drm" }, "vulkan-server-buffer": { "label": "Vulkan Buffer Sharing", -- cgit v1.2.3 From 80ed5501cf5dcc4b6ef2a1a126d9d564c1c73851 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 9 Dec 2019 11:06:18 +0100 Subject: Client: Fix inverse repeat rate implementation The rate from wl_keyboard.repeat_info was used as if it was an interval. Fixed by converting from key strokes per second to milliseconds per key stroke. This fixes a regression, as repeat rate used to be hard-coded to something sensible before. [ChangeLog][QPA plugin] Fixed keyboard repeat rate being set inversely, so higher rates would actually result in fewer characters per second, and vice versa. Fixes: QTBUG-80613 Change-Id: Ie783b90cba13dde6f37c0cd1be584d352cddfe7c Reviewed-by: David Edmundson Reviewed-by: Paul Olav Tvete --- src/client/qwaylandinputdevice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index d812918e7..3b26dc427 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -88,7 +88,7 @@ QWaylandInputDevice::Keyboard::Keyboard(QWaylandInputDevice *p) // or the server didn't send an enter event first. return; } - mRepeatTimer.setInterval(mRepeatRate); + mRepeatTimer.setInterval(1000 / mRepeatRate); handleKey(mRepeatKey.time, QEvent::KeyRelease, mRepeatKey.key, mRepeatKey.modifiers, mRepeatKey.code, mRepeatKey.nativeVirtualKey, mRepeatKey.nativeModifiers, mRepeatKey.text, true); -- cgit v1.2.3 From ce15889614f87b5986f997beffd2826471adfe51 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Fri, 13 Dec 2019 22:15:32 +0100 Subject: Drive cursor animation with a timer Using only wl_surface_frame callbacks to update the cursor does so much more often than needed. In addition, at least GNOME and Weston fire the callback for the cursor surface immediately, which ends up updating the cursor at over 3000 Hz here. Use wl_cursor_frame_and_duration to drive a single shot timer. This function is also guaranteed to return 0 for single frame cursors, so we can avoid starting the timer at all. We wait for both the surface frame callback and the timer to fire before updating the cursor for the next frame of animation. This reduces our update rate to the frame rate of the cursor or the rate requested by the compositor, whichever is lower. Change-Id: I10277460ebe9b547ebaf7f73424b9ef17614107f Reviewed-by: Johan Helsing --- src/client/qwaylandinputdevice.cpp | 34 +++++++++++++++++++++++++++++++--- src/client/qwaylandinputdevice_p.h | 5 +++++ 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 3b26dc427..3f0d61d6a 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -143,6 +143,12 @@ QWaylandWindow *QWaylandInputDevice::Keyboard::focusWindow() const QWaylandInputDevice::Pointer::Pointer(QWaylandInputDevice *seat) : mParent(seat) { +#if QT_CONFIG(cursor) + mCursor.frameTimer.setSingleShot(true); + mCursor.frameTimer.callOnTimeout([&]() { + cursorTimerCallback(); + }); +#endif } QWaylandInputDevice::Pointer::~Pointer() @@ -224,7 +230,7 @@ public: if (animated) { m_frameCallback.reset(new WlCallback(frame(), [this](uint32_t time){ Q_UNUSED(time); - m_pointer->updateCursor(); + m_pointer->cursorFrameCallback(); })); } commit(); @@ -328,7 +334,8 @@ void QWaylandInputDevice::Pointer::updateCursor() uint time = seat()->mCursor.animationTimer.elapsed(); if (struct ::wl_cursor *waylandCursor = mCursor.theme->cursor(shape)) { - int frame = wl_cursor_frame(waylandCursor, time); + uint duration = 0; + int frame = wl_cursor_frame_and_duration(waylandCursor, time, &duration); ::wl_cursor_image *image = waylandCursor->images[frame]; struct wl_buffer *buffer = wl_cursor_image_get_buffer(image); @@ -339,7 +346,12 @@ void QWaylandInputDevice::Pointer::updateCursor() int bufferScale = mCursor.themeBufferScale; QPoint hotspot = QPoint(image->hotspot_x, image->hotspot_y) / bufferScale; QSize size = QSize(image->width, image->height) / bufferScale; - bool animated = waylandCursor->image_count > 1 && image->delay > 0; + bool animated = duration > 0; + if (animated) { + mCursor.gotFrameCallback = false; + mCursor.gotTimerCallback = false; + mCursor.frameTimer.start(duration); + } getOrCreateCursorSurface()->update(buffer, hotspot, size, bufferScale, animated); return; } @@ -354,6 +366,22 @@ CursorSurface *QWaylandInputDevice::Pointer::getOrCreateCursorSurface() return mCursor.surface.get(); } +void QWaylandInputDevice::Pointer::cursorTimerCallback() +{ + mCursor.gotTimerCallback = true; + if (mCursor.gotFrameCallback) { + updateCursor(); + } +} + +void QWaylandInputDevice::Pointer::cursorFrameCallback() +{ + mCursor.gotFrameCallback = true; + if (mCursor.gotTimerCallback) { + updateCursor(); + } +} + #endif // QT_CONFIG(cursor) QWaylandInputDevice::Touch::Touch(QWaylandInputDevice *p) diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 60d6f2c17..a567c57b4 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -286,6 +286,8 @@ public: int idealCursorScale() const; void updateCursorTheme(); void updateCursor(); + void cursorTimerCallback(); + void cursorFrameCallback(); CursorSurface *getOrCreateCursorSurface(); #endif QWaylandInputDevice *seat() const { return mParent; } @@ -325,6 +327,9 @@ public: QWaylandCursorTheme *theme = nullptr; int themeBufferScale = 0; QScopedPointer surface; + QTimer frameTimer; + bool gotFrameCallback = false; + bool gotTimerCallback = false; } mCursor; #endif QPointF mSurfacePos; -- cgit v1.2.3