Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/seat/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,8 @@ void Helper::init(Treeland::Treeland *treeland)
}
if (!wlr_subcompositor_create(m_server->handle()))
qCCritical(lcTlCore) << "Failed to create subcompositor";
if (!wlr_presentation_create(m_server->handle(), m_backend->handle(), 2))
qCCritical(lcTlCore) << "Failed to create presentation-time manager";
if (!wlr_screencopy_manager_v1_create(m_server->handle()))
qCCritical(lcTlCore) << "Failed to create screencopy manager";
if (!wlr_ext_image_copy_capture_manager_v1_create(m_server->handle(), 1))
Expand Down
1 change: 1 addition & 0 deletions waylib/src/server/kernel/wlr_all.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,13 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output_management_v1.h>
#include <wlr/types/wlr_output_power_management_v1.h>
#include <wlr/types/wlr_pointer.h>

Check warning on line 107 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_pointer.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_pointer_constraints_v1.h>

Check warning on line 108 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_pointer_constraints_v1.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_pointer_gestures_v1.h>

Check warning on line 109 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_pointer_gestures_v1.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_presentation_time.h>

Check warning on line 110 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_presentation_time.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_primary_selection.h>

Check warning on line 111 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_primary_selection.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_primary_selection_v1.h>

Check warning on line 112 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_primary_selection_v1.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_relative_pointer_v1.h>

Check warning on line 113 in waylib/src/server/kernel/wlr_all.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wlr/types/wlr_relative_pointer_v1.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_session_lock_v1.h>
Expand Down
5 changes: 4 additions & 1 deletion waylib/src/server/qtquick/woutputrenderwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,12 @@ void WOutputRenderWindowPrivate::doRender(wlr_output *needsFrameOutput,
// transactions. It must not be suppressed merely because the
// transaction itself scheduled the next frame.
if (forceRender || Q_UNLIKELY(!i.first->framePending())) {
auto output = i.first->outputViewport()->output();
// Let consumers sample wp_presentation_time feedback (and other
// last-minute per-output work) before the output state is committed.
Q_EMIT q->outputAboutToCommit(output);
if (Q_LIKELY(i.first->commit(i.second))) {
// Make sure the output is still valid after commit
auto output = i.first->outputViewport()->output();
if (Q_LIKELY(needsFrameOutput)) {
Q_ASSERT(output->handle() == needsFrameOutput);
if (committedOutputs.isEmpty())
Expand Down
5 changes: 5 additions & 0 deletions waylib/src/server/qtquick/woutputrenderwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public Q_SLOTS:
void initialized();
void disableLayersChanged();
void renderEnd(QList<QPointer<WOutput>> committedOutputs);
// Emitted synchronously right before each output's state is committed in
// doRender(). Compositors can use this to perform last-minute per-output
// work that must happen before wlr_output_commit_state(), e.g. sampling
// wp_presentation_time feedback via wlr_presentation_surface_textured_on_output().
void outputAboutToCommit(WAYLIB_SERVER_NAMESPACE::WOutput *output);
void effectiveDevicePixelRatioChanged(qreal scale);

private:
Expand Down
20 changes: 20 additions & 0 deletions waylib/src/server/qtquick/wsurfaceitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ class Q_DECL_HIDDEN WSurfaceItemContentPrivate: public QQuickItemPrivate

if (frameDoneConnection)
QObject::disconnect(frameDoneConnection);
if (presentationConnection)
QObject::disconnect(presentationConnection);

Q_ASSERT(!updateTextureConnection);

Expand Down Expand Up @@ -274,6 +276,8 @@ class Q_DECL_HIDDEN WSurfaceItemContentPrivate: public QQuickItemPrivate

if (frameDoneConnection)
QObject::disconnect(frameDoneConnection);
if (presentationConnection)
QObject::disconnect(presentationConnection);
if (!q->window()) // maybe null due to item not fully initialized
return;

Expand All @@ -290,6 +294,19 @@ class Q_DECL_HIDDEN WSurfaceItemContentPrivate: public QQuickItemPrivate
rendered = false;
}
}); // if signal is emitted from seperated rendering thread, default QueuedConnection is used

// Unlike frameDoneConnection (which tolerates a queued delivery), this
// connection MUST be synchronous: the feedback has to be sampled before
// wlr_output_commit_state() runs, so use Qt::DirectConnection explicitly.
presentationConnection = QObject::connect(rw, &WOutputRenderWindow::outputAboutToCommit,
q, [this, q] (WOutput *output) {
if (Q_LIKELY((rendered || q->isVisible()) && live)
&& surface &&
output == surface->framePacingOutput()) {
wlr_presentation_surface_textured_on_output(
surface->handle(), output->handle());
}
}, Qt::DirectConnection);
} else {
qCFatal(lcWlSurface) << "Needs a WOutputRenderWindow to render the WSurfaceItemContent, "
"but the current window is:" << q->window();
Expand Down Expand Up @@ -358,6 +375,7 @@ class Q_DECL_HIDDEN WSurfaceItemContentPrivate: public QQuickItemPrivate
qreal alphaModifier = 1.0;

QMetaObject::Connection frameDoneConnection;
QMetaObject::Connection presentationConnection;
mutable WSGTextureProvider *textureProvider = nullptr;
BufferRef buffer;
BufferRef pendingBuffer;
Expand Down Expand Up @@ -385,6 +403,8 @@ WSurfaceItemContent::~WSurfaceItemContent()

if (d->frameDoneConnection)
QObject::disconnect(d->frameDoneConnection);
if (d->presentationConnection)
QObject::disconnect(d->presentationConnection);

//`d->window` will become nullptr in ~QQuickItem
// Don't move this to private class
Expand Down
Loading