diff options
Diffstat (limited to 'source/kde/kde/patch/libkscreen/7eb0390bf70fc7fb5a39bd501ffcc327a07c328a.patch')
-rw-r--r-- | source/kde/kde/patch/libkscreen/7eb0390bf70fc7fb5a39bd501ffcc327a07c328a.patch | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/source/kde/kde/patch/libkscreen/7eb0390bf70fc7fb5a39bd501ffcc327a07c328a.patch b/source/kde/kde/patch/libkscreen/7eb0390bf70fc7fb5a39bd501ffcc327a07c328a.patch new file mode 100644 index 000000000..b0e5e7136 --- /dev/null +++ b/source/kde/kde/patch/libkscreen/7eb0390bf70fc7fb5a39bd501ffcc327a07c328a.patch @@ -0,0 +1,240 @@ +From 7eb0390bf70fc7fb5a39bd501ffcc327a07c328a Mon Sep 17 00:00:00 2001 +From: Ilya Pominov <ipominov@astralinux.ru> +Date: Thu, 23 Sep 2021 14:24:16 +0300 +Subject: [PATCH] XrandR: Fix impossibilty to change resolution in VirtualBox + +In VirtualBox KDE runs at low resolution, +and when you try to change the resolution through the "Screen Settings" +it returns to the original one again. +How to check: +- run KDE neon on VirtualBox +- change the resolution + +VirtualBox sets the hotplug_mode_update property, but its preferred mode +is always 800x600, and KScreen returns the resolution to 800x600. + +Now XRandRCrtc stores the timestamp of the last resolution change +request from backend, and the timestamp of the last config update from +X11. +If the changes were initiated by XRandR backend (i.e. 'timestamp of the +last config update from X11' less or equal 'last resolution change +request'), then the followPreferedMode flag in KScreenConfig is set to +false. + +BUG: 407058 +--- + backends/xcbeventlistener.cpp | 7 ++++++- + backends/xcbeventlistener.h | 2 +- + backends/xrandr/xrandr.cpp | 4 +++- + backends/xrandr/xrandr.h | 2 +- + backends/xrandr/xrandrconfig.cpp | 9 +++++++-- + backends/xrandr/xrandrcrtc.cpp | 23 +++++++++++++++++++++++ + backends/xrandr/xrandrcrtc.h | 7 +++++++ + backends/xrandr/xrandroutput.cpp | 2 +- + 8 files changed, 49 insertions(+), 7 deletions(-) + +diff --git a/backends/xcbeventlistener.cpp b/backends/xcbeventlistener.cpp +index dba81dc..4c3a527 100644 +--- a/backends/xcbeventlistener.cpp ++++ b/backends/xcbeventlistener.cpp +@@ -139,6 +139,8 @@ void XCBEventListener::handleScreenChange(xcb_generic_event_t *e) + } + + qCDebug(KSCREEN_XCB_HELPER) << "RRScreenChangeNotify"; ++ qCDebug(KSCREEN_XCB_HELPER) << "\tTimestamp: " << e2->timestamp; ++ qCDebug(KSCREEN_XCB_HELPER) << "\tConfig_timestamp: " << e2->config_timestamp; + qCDebug(KSCREEN_XCB_HELPER) << "\tWindow:" << e2->request_window; + qCDebug(KSCREEN_XCB_HELPER) << "\tRoot:" << e2->root; + qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t)e2->rotation); +@@ -157,15 +159,17 @@ void XCBEventListener::handleXRandRNotify(xcb_generic_event_t *e) + if (randrEvent->subCode == XCB_RANDR_NOTIFY_CRTC_CHANGE) { + xcb_randr_crtc_change_t crtc = randrEvent->u.cc; + qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_CrtcChange"; ++ qCDebug(KSCREEN_XCB_HELPER) << "\tTimestamp: " << crtc.timestamp; + qCDebug(KSCREEN_XCB_HELPER) << "\tCRTC: " << crtc.crtc; + qCDebug(KSCREEN_XCB_HELPER) << "\tMode: " << crtc.mode; + qCDebug(KSCREEN_XCB_HELPER) << "\tRotation: " << rotationToString((xcb_randr_rotation_t)crtc.rotation); + qCDebug(KSCREEN_XCB_HELPER) << "\tGeometry: " << crtc.x << crtc.y << crtc.width << crtc.height; +- Q_EMIT crtcChanged(crtc.crtc, crtc.mode, (xcb_randr_rotation_t)crtc.rotation, QRect(crtc.x, crtc.y, crtc.width, crtc.height)); ++ Q_EMIT crtcChanged(crtc.crtc, crtc.mode, (xcb_randr_rotation_t)crtc.rotation, QRect(crtc.x, crtc.y, crtc.width, crtc.height), crtc.timestamp); + + } else if (randrEvent->subCode == XCB_RANDR_NOTIFY_OUTPUT_CHANGE) { + xcb_randr_output_change_t output = randrEvent->u.oc; + qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_OutputChange"; ++ qCDebug(KSCREEN_XCB_HELPER) << "\tTimestamp: " << output.timestamp; + qCDebug(KSCREEN_XCB_HELPER) << "\tOutput: " << output.output; + qCDebug(KSCREEN_XCB_HELPER) << "\tCRTC: " << output.crtc; + qCDebug(KSCREEN_XCB_HELPER) << "\tMode: " << output.mode; +@@ -181,6 +185,7 @@ void XCBEventListener::handleXRandRNotify(xcb_generic_event_t *e) + xcb_get_atom_name_reply(QX11Info::connection(), xcb_get_atom_name(QX11Info::connection(), property.atom), nullptr)); + + qCDebug(KSCREEN_XCB_HELPER) << "RRNotify_OutputProperty (ignored)"; ++ qCDebug(KSCREEN_XCB_HELPER) << "\tTimestamp: " << property.timestamp; + qCDebug(KSCREEN_XCB_HELPER) << "\tOutput: " << property.output; + qCDebug(KSCREEN_XCB_HELPER) << "\tProperty: " << xcb_get_atom_name_name(reply.data()); + qCDebug(KSCREEN_XCB_HELPER) << "\tState (newValue, Deleted): " << property.status; +diff --git a/backends/xcbeventlistener.h b/backends/xcbeventlistener.h +index 35577d9..68136d8 100644 +--- a/backends/xcbeventlistener.h ++++ b/backends/xcbeventlistener.h +@@ -30,7 +30,7 @@ Q_SIGNALS: + void outputsChanged(); + + /* Emitted only when XRandR 1.2 or newer is available */ +- void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom); ++ void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom, xcb_timestamp_t timestamp); + void outputChanged(xcb_randr_output_t output, xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_connection_t connection); + void outputPropertyChanged(xcb_randr_output_t output); + +diff --git a/backends/xrandr/xrandr.cpp b/backends/xrandr/xrandr.cpp +index 71cbd77..115f268 100644 +--- a/backends/xrandr/xrandr.cpp ++++ b/backends/xrandr/xrandr.cpp +@@ -45,6 +45,7 @@ XRandR::XRandR() + qRegisterMetaType<xcb_randr_mode_t>("xcb_randr_mode_t"); + qRegisterMetaType<xcb_randr_connection_t>("xcb_randr_connection_t"); + qRegisterMetaType<xcb_randr_rotation_t>("xcb_randr_rotation_t"); ++ qRegisterMetaType<xcb_timestamp_t>("xcb_timestamp_t"); + + // Use our own connection to make sure that we won't mess up Qt's connection + // if something goes wrong on our side. +@@ -143,7 +144,7 @@ void XRandR::outputChanged(xcb_randr_output_t output, xcb_randr_crtc_t crtc, xcb + qCDebug(KSCREEN_XRANDR) << "Output" << xOutput->id() << ": connected =" << xOutput->isConnected() << ", enabled =" << xOutput->isEnabled(); + } + +-void XRandR::crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom) ++void XRandR::crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom, xcb_timestamp_t timestamp) + { + XRandRCrtc *xCrtc = s_internalConfig->crtc(crtc); + if (!xCrtc) { +@@ -152,6 +153,7 @@ void XRandR::crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr + xCrtc->update(mode, rotation, geom); + } + ++ xCrtc->updateConfigTimestamp(timestamp); + m_configChangeCompressor->start(); + } + +diff --git a/backends/xrandr/xrandr.h b/backends/xrandr/xrandr.h +index 91dd7aa..6b998c8 100644 +--- a/backends/xrandr/xrandr.h ++++ b/backends/xrandr/xrandr.h +@@ -44,7 +44,7 @@ public: + + private: + void outputChanged(xcb_randr_output_t output, xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_connection_t connection); +- void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom); ++ void crtcChanged(xcb_randr_crtc_t crtc, xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, const QRect &geom, xcb_timestamp_t timestamp); + void screenChanged(xcb_randr_rotation_t rotation, const QSize &sizePx, const QSize &sizeMm); + + static quint8 *getXProperty(xcb_randr_output_t output, xcb_atom_t atom, size_t &len); +diff --git a/backends/xrandr/xrandrconfig.cpp b/backends/xrandr/xrandrconfig.cpp +index fa0929c..5cbf4c7 100644 +--- a/backends/xrandr/xrandrconfig.cpp ++++ b/backends/xrandr/xrandrconfig.cpp +@@ -504,6 +504,8 @@ bool XRandRConfig::disableOutput(const OutputPtr &kscreenOutput) const + XCB_NONE, + xOutput->isConnected() ? XCB_RANDR_CONNECTION_CONNECTED : XCB_RANDR_CONNECTION_DISCONNECTED, + kscreenOutput->isPrimary()); ++ if (xOutput->crtc()) ++ xOutput->crtc()->updateTimestamp(reply->timestamp); + } + return (reply->status == XCB_RANDR_SET_CONFIG_SUCCESS); + } +@@ -573,7 +575,7 @@ bool XRandRConfig::changeOutput(const KScreen::OutputPtr &kscreenOutput) const + << "\n" + << "\tCRTC:" << xOutput->crtc()->crtc() << "\n" + << "\tPos:" << kscreenOutput->pos() << "\n" +- << "\tMode:" << modeId << kscreenOutput->currentMode() << "\n" ++ << "\tMode:" << kscreenOutput->currentMode() << "Preferred:" << kscreenOutput->preferredModeId() << "\n" + << "\tRotation:" << kscreenOutput->rotation(); + + if (!sendConfig(kscreenOutput, xOutput->crtc())) { +@@ -605,6 +607,9 @@ bool XRandRConfig::sendConfig(const KScreen::OutputPtr &kscreenOutput, XRandRCrt + qCDebug(KSCREEN_XRANDR) << "\tResult: unknown (error)"; + return false; + } +- qCDebug(KSCREEN_XRANDR) << "\tResult: " << reply->status; ++ ++ crtc->updateTimestamp(reply->timestamp); ++ ++ qCDebug(KSCREEN_XRANDR) << "\tResult: " << reply->status << " timestamp: " << reply->timestamp; + return (reply->status == XCB_RANDR_SET_CONFIG_SUCCESS); + } +diff --git a/backends/xrandr/xrandrcrtc.cpp b/backends/xrandr/xrandrcrtc.cpp +index c3cd291..9209501 100644 +--- a/backends/xrandr/xrandrcrtc.cpp ++++ b/backends/xrandr/xrandrcrtc.cpp +@@ -16,6 +16,8 @@ XRandRCrtc::XRandRCrtc(xcb_randr_crtc_t crtc, XRandRConfig *config) + , m_crtc(crtc) + , m_mode(0) + , m_rotation(XCB_RANDR_ROTATION_ROTATE_0) ++ , m_timestamp(XCB_CURRENT_TIME) ++ , m_configTimestamp(XCB_CURRENT_TIME) + { + update(); + } +@@ -111,3 +113,24 @@ void XRandRCrtc::update(xcb_randr_mode_t mode, xcb_randr_rotation_t rotation, co + m_geometry = geom; + m_rotation = rotation; + } ++ ++void XRandRCrtc::updateTimestamp(const xcb_timestamp_t tmstamp) ++{ ++ if (tmstamp > m_timestamp) { ++ qCDebug(KSCREEN_XRANDR) << "XRandRCrtc " << m_crtc << " m_timestamp update " << m_timestamp << " => " << tmstamp; ++ m_timestamp = tmstamp; ++ } ++} ++ ++void XRandRCrtc::updateConfigTimestamp(const xcb_timestamp_t tmstamp) ++{ ++ if (tmstamp > m_configTimestamp) { ++ qCDebug(KSCREEN_XRANDR) << "XRandRCrtc " << m_crtc << " m_configTimestamp update" << m_configTimestamp << " => " << tmstamp; ++ m_configTimestamp = tmstamp; ++ } ++} ++ ++bool XRandRCrtc::isChangedFromOutside() const ++{ ++ return m_configTimestamp > m_timestamp; ++} +diff --git a/backends/xrandr/xrandrcrtc.h b/backends/xrandr/xrandrcrtc.h +index 4de4a09..8be23d2 100644 +--- a/backends/xrandr/xrandrcrtc.h ++++ b/backends/xrandr/xrandrcrtc.h +@@ -41,6 +41,10 @@ public: + void update(); + void update(xcb_randr_crtc_t mode, xcb_randr_rotation_t rotation, const QRect &geom); + ++ void updateTimestamp(const xcb_timestamp_t tmstamp); ++ void updateConfigTimestamp(const xcb_timestamp_t tmstamp); ++ bool isChangedFromOutside() const; ++ + private: + xcb_randr_crtc_t m_crtc; + xcb_randr_mode_t m_mode; +@@ -50,4 +54,7 @@ private: + + QVector<xcb_randr_output_t> m_possibleOutputs; + QVector<xcb_randr_output_t> m_outputs; ++ ++ xcb_timestamp_t m_timestamp; ++ xcb_timestamp_t m_configTimestamp; + }; +diff --git a/backends/xrandr/xrandroutput.cpp b/backends/xrandr/xrandroutput.cpp +index 92a39cf..4aa2290 100644 +--- a/backends/xrandr/xrandroutput.cpp ++++ b/backends/xrandr/xrandroutput.cpp +@@ -403,7 +403,7 @@ KScreen::OutputPtr XRandROutput::toKScreenOutput() const + + // See https://bugzilla.redhat.com/show_bug.cgi?id=1290586 + // QXL will be creating a new mode we need to jump to every time the display is resized +- kscreenOutput->setFollowPreferredMode(m_hotplugModeUpdate); ++ kscreenOutput->setFollowPreferredMode(m_hotplugModeUpdate && m_crtc && m_crtc->isChangedFromOutside()); + + kscreenOutput->setConnected(isConnected()); + if (isConnected()) { +-- +GitLab + |