Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 884 Lines • ▼ Show 20 Line(s) | |||||
885 | int WaylandCompositor::refreshRate() const | 885 | int WaylandCompositor::refreshRate() const | ||
886 | { | 886 | { | ||
887 | // TODO: This makes no sense on Wayland. First step would be to atleast | 887 | // TODO: This makes no sense on Wayland. First step would be to atleast | ||
888 | // set the refresh rate to the highest available one. Second step | 888 | // set the refresh rate to the highest available one. Second step | ||
889 | // would be to not use a uniform value at all but per screen. | 889 | // would be to not use a uniform value at all but per screen. | ||
890 | return KWin::currentRefreshRate(); | 890 | return KWin::currentRefreshRate(); | ||
891 | } | 891 | } | ||
892 | 892 | | |||
893 | void WaylandCompositor::updateCompositeBlocking() | | |||
894 | { | | |||
895 | // Composite blocking not possible on Wayland. | | |||
896 | } | | |||
897 | | ||||
898 | void WaylandCompositor::updateClientCompositeBlocking(Client *c) | | |||
899 | { | | |||
900 | Q_UNUSED(c) | | |||
901 | // Composite blocking not possible on Wayland. | | |||
902 | } | | |||
903 | | ||||
904 | X11Compositor::X11Compositor(QObject *parent) | 893 | X11Compositor::X11Compositor(QObject *parent) | ||
905 | : Compositor(parent) | 894 | : Compositor(parent) | ||
906 | , m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend) | 895 | , m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend) | ||
907 | , m_xrrRefreshRate(0) | 896 | , m_xrrRefreshRate(0) | ||
908 | { | 897 | { | ||
909 | qRegisterMetaType<X11Compositor::SuspendReason>("X11Compositor::SuspendReason"); | 898 | qRegisterMetaType<X11Compositor::SuspendReason>("X11Compositor::SuspendReason"); | ||
910 | } | 899 | } | ||
911 | 900 | | |||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 1006 | { | |||
1024 | return scene()->overlayWindow()->isVisible(); | 1013 | return scene()->overlayWindow()->isVisible(); | ||
1025 | } | 1014 | } | ||
1026 | 1015 | | |||
1027 | int X11Compositor::refreshRate() const | 1016 | int X11Compositor::refreshRate() const | ||
1028 | { | 1017 | { | ||
1029 | return m_xrrRefreshRate; | 1018 | return m_xrrRefreshRate; | ||
1030 | } | 1019 | } | ||
1031 | 1020 | | |||
1032 | void X11Compositor::updateCompositeBlocking() | | |||
1033 | { | | |||
1034 | updateClientCompositeBlocking(NULL); | | |||
1035 | } | | |||
1036 | | ||||
1037 | void X11Compositor::updateClientCompositeBlocking(Client *c) | 1021 | void X11Compositor::updateClientCompositeBlocking(Client *c) | ||
1038 | { | 1022 | { | ||
1039 | if (c) { | 1023 | if (c) { | ||
1040 | if (c->isBlockingCompositing()) { | 1024 | if (c->isBlockingCompositing()) { | ||
1041 | // Do NOT attempt to call suspend(true) from within the eventchain! | 1025 | // Do NOT attempt to call suspend(true) from within the eventchain! | ||
1042 | if (!(m_suspended & BlockRuleSuspend)) | 1026 | if (!(m_suspended & BlockRuleSuspend)) | ||
1043 | QMetaObject::invokeMethod(this, "suspend", Qt::QueuedConnection, | 1027 | QMetaObject::invokeMethod(this, "suspend", Qt::QueuedConnection, | ||
1044 | Q_ARG(SuspendReason, BlockRuleSuspend)); | 1028 | Q_ARG(SuspendReason, BlockRuleSuspend)); | ||
Show All 13 Lines | 1031 | else if (m_suspended & BlockRuleSuspend) { | |||
1058 | if (resume) { | 1042 | if (resume) { | ||
1059 | // Do NOT attempt to call suspend(false) from within the eventchain! | 1043 | // Do NOT attempt to call suspend(false) from within the eventchain! | ||
1060 | QMetaObject::invokeMethod(this, "resume", Qt::QueuedConnection, | 1044 | QMetaObject::invokeMethod(this, "resume", Qt::QueuedConnection, | ||
1061 | Q_ARG(SuspendReason, BlockRuleSuspend)); | 1045 | Q_ARG(SuspendReason, BlockRuleSuspend)); | ||
1062 | } | 1046 | } | ||
1063 | } | 1047 | } | ||
1064 | } | 1048 | } | ||
1065 | 1049 | | |||
1050 | X11Compositor *X11Compositor::self() | ||||
1051 | { | ||||
1052 | return qobject_cast<X11Compositor *>(Compositor::self()); | ||||
anthonyfieroni: qobject_cast is slower in some cases can you do it
```
static QPointer<X11Compositor> x11;
if (! | |||||
zzag: > qobject_cast is slower in some cases
When? | |||||
Also static in a method or a function means taking a lock on a mutex... Performance impact won't be huge, but still... zzag: Also `static` in a method or a function means taking a lock on a mutex... Performance impact… | |||||
Being at construction time is no-op, cannot compare to qt cast. At least one commit in this repo is removing of qobject_cast being slow in drawing. anthonyfieroni: Being at construction time is no-op, cannot compare to qt cast. At least one commit in this… | |||||
zzag: Which commit? | |||||
I can't imagine it making a big difference. For now we only need it in two setup functions being called not regularly. But do you have some data on the difference in performance? If it's called more often in the future it might be an idea to benchmark it. romangg: I can't imagine it making a big difference. For now we only need it in two setup functions… | |||||
1053 | } | ||||
1054 | | ||||
1066 | } | 1055 | } | ||
1067 | 1056 | | |||
1068 | // included for CompositorSelectionOwner | 1057 | // included for CompositorSelectionOwner | ||
1069 | #include "composite.moc" | 1058 | #include "composite.moc" |
qobject_cast is slower in some cases can you do it