From ba51832b832d12367467be15efebcea760387fdc Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 14 Dec 2015 08:14:41 -0600 Subject: [PATCH] .spec cosmetics, pull in upstream fixed, minimal qt5 dep --- ...-Don-t-call-for-xrandr-if-it-s-not-a.patch | 38 ++++++++++ ...ess-Cache-XCB-connection-in-variable.patch | 71 +++++++++++++++++++ powerdevil.spec | 55 +++++++------- 3 files changed, 138 insertions(+), 26 deletions(-) create mode 100644 0001-XRandRBrightness-Don-t-call-for-xrandr-if-it-s-not-a.patch create mode 100644 0002-XRandRBrightness-Cache-XCB-connection-in-variable.patch diff --git a/0001-XRandRBrightness-Don-t-call-for-xrandr-if-it-s-not-a.patch b/0001-XRandRBrightness-Don-t-call-for-xrandr-if-it-s-not-a.patch new file mode 100644 index 0000000..6aedf8f --- /dev/null +++ b/0001-XRandRBrightness-Don-t-call-for-xrandr-if-it-s-not-a.patch @@ -0,0 +1,38 @@ +From dde0ecce02259a26655737e6674950e2e303bc6f Mon Sep 17 00:00:00 2001 +From: Kai Uwe Broulik +Date: Sun, 13 Dec 2015 21:15:44 +0100 +Subject: [PATCH 1/2] [XRandRBrightness] Don't call for xrandr if it's not + available + +Check whether the extension is available before calling into it. + +REVIEW: 126146 +BUG: 352462 +FIXED-IN: 5.5.1 +--- + daemon/backends/upower/xrandrbrightness.cpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/daemon/backends/upower/xrandrbrightness.cpp b/daemon/backends/upower/xrandrbrightness.cpp +index 0abcefe..f899400 100644 +--- a/daemon/backends/upower/xrandrbrightness.cpp ++++ b/daemon/backends/upower/xrandrbrightness.cpp +@@ -29,6 +29,15 @@ XRandrBrightness::XRandrBrightness() + if (!QX11Info::isPlatformX11()) { + return; + } ++ ++ xcb_prefetch_extension_data(QX11Info::connection(), &xcb_randr_id); ++ // this reply, for once, does not need to be managed by us ++ auto *extension = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id); ++ if (!extension || !extension->present) { ++ qCWarning(POWERDEVIL) << "XRandR extension not available"; ++ return; ++ } ++ + ScopedCPointer versionReply(xcb_randr_query_version_reply(QX11Info::connection(), + xcb_randr_query_version(QX11Info::connection(), 1, 2), + nullptr)); +-- +2.5.0 + diff --git a/0002-XRandRBrightness-Cache-XCB-connection-in-variable.patch b/0002-XRandRBrightness-Cache-XCB-connection-in-variable.patch new file mode 100644 index 0000000..04642e7 --- /dev/null +++ b/0002-XRandRBrightness-Cache-XCB-connection-in-variable.patch @@ -0,0 +1,71 @@ +From 284ca7af172ea94a3fb8a631b220db50f1da7b91 Mon Sep 17 00:00:00 2001 +From: Kai Uwe Broulik +Date: Sun, 13 Dec 2015 21:16:49 +0100 +Subject: [PATCH 2/2] [XRandRBrightness] Cache XCB connection in variable + +QX11Info::connection() is expensive +--- + daemon/backends/upower/xrandrbrightness.cpp | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/daemon/backends/upower/xrandrbrightness.cpp b/daemon/backends/upower/xrandrbrightness.cpp +index f899400..586801c 100644 +--- a/daemon/backends/upower/xrandrbrightness.cpp ++++ b/daemon/backends/upower/xrandrbrightness.cpp +@@ -30,16 +30,18 @@ XRandrBrightness::XRandrBrightness() + return; + } + +- xcb_prefetch_extension_data(QX11Info::connection(), &xcb_randr_id); ++ auto *c = QX11Info::connection(); ++ ++ xcb_prefetch_extension_data(c, &xcb_randr_id); + // this reply, for once, does not need to be managed by us +- auto *extension = xcb_get_extension_data(QX11Info::connection(), &xcb_randr_id); ++ auto *extension = xcb_get_extension_data(c, &xcb_randr_id); + if (!extension || !extension->present) { + qCWarning(POWERDEVIL) << "XRandR extension not available"; + return; + } + +- ScopedCPointer versionReply(xcb_randr_query_version_reply(QX11Info::connection(), +- xcb_randr_query_version(QX11Info::connection(), 1, 2), ++ ScopedCPointer versionReply(xcb_randr_query_version_reply(c, ++ xcb_randr_query_version(c, 1, 2), + nullptr)); + + if (!versionReply) { +@@ -52,8 +54,8 @@ XRandrBrightness::XRandrBrightness() + return; + } + +- ScopedCPointer backlightReply(xcb_intern_atom_reply(QX11Info::connection(), +- xcb_intern_atom (QX11Info::connection(), 1, strlen("Backlight"), "Backlight"), ++ ScopedCPointer backlightReply(xcb_intern_atom_reply(c, ++ xcb_intern_atom(c, 1, strlen("Backlight"), "Backlight"), + nullptr)); + + if (!backlightReply) { +@@ -68,7 +70,7 @@ XRandrBrightness::XRandrBrightness() + return; + } + +- xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(QX11Info::connection())); ++ xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(c)); + if (!iter.rem) { + qCWarning(POWERDEVIL, "XCB Screen Roots Iterator rem was null"); + return; +@@ -77,8 +79,8 @@ XRandrBrightness::XRandrBrightness() + xcb_screen_t *screen = iter.data; + xcb_window_t root = screen->root; + +- m_resources.reset(xcb_randr_get_screen_resources_current_reply(QX11Info::connection(), +- xcb_randr_get_screen_resources_current(QX11Info::connection(), root) ++ m_resources.reset(xcb_randr_get_screen_resources_current_reply(c, ++ xcb_randr_get_screen_resources_current(c, root) + , nullptr)); + + if (!m_resources) { +-- +2.5.0 + diff --git a/powerdevil.spec b/powerdevil.spec index f9f2fc0..d8c88cf 100644 --- a/powerdevil.spec +++ b/powerdevil.spec @@ -1,10 +1,10 @@ Name: powerdevil Version: 5.5.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Manages the power consumption settings of a Plasma Shell License: GPLv2+ -URL: https://projects.kde.org/projects/kde/workspace/powerdevil +URL: https://projects.kde.org/powerdevil %global revision %(echo %{version} | cut -d. -f3) %if %{revision} >= 50 @@ -14,40 +14,42 @@ URL: https://projects.kde.org/projects/kde/workspace/powerdevil %endif Source0: http://download.kde.org/%{stable}/plasma/%{version}/%{name}-%{version}.tar.xz -# TODO: document why this is (still) needed and not yet upstreamed? -- rex -Patch0: powerdevil-enable-upower.patch - -BuildRequires: libxcb-devel -BuildRequires: xcb-util-keysyms-devel -BuildRequires: xcb-util-image-devel -BuildRequires: xcb-util-wm-devel -BuildRequires: libXrandr-devel -BuildRequires: systemd-devel +## upstream patches +Patch1: 0001-XRandRBrightness-Don-t-call-for-xrandr-if-it-s-not-a.patch +Patch2: 0002-XRandRBrightness-Cache-XCB-connection-in-variable.patch -BuildRequires: qt5-qtbase-devel -BuildRequires: qt5-qtx11extras-devel +# TODO: document why this is (still) needed and not yet upstreamed? -- rex +Patch100: powerdevil-enable-upower.patch -BuildRequires: kf5-rpm-macros +BuildRequires: cmake BuildRequires: extra-cmake-modules - +BuildRequires: kf5-kactivities-devel BuildRequires: kf5-kauth-devel -BuildRequires: kf5-kidletime-devel BuildRequires: kf5-kconfig-devel -BuildRequires: kf5-solid-devel -BuildRequires: kf5-ki18n-devel +BuildRequires: kf5-kdelibs4support-devel BuildRequires: kf5-kglobalaccel-devel +BuildRequires: kf5-ki18n-devel +BuildRequires: kf5-kidletime-devel BuildRequires: kf5-kio-devel +BuildRequires: kf5-knotifyconfig-devel +BuildRequires: kf5-kwayland-devel BuildRequires: kf5-kwindowsystem-devel BuildRequires: kf5-plasma-devel -BuildRequires: kf5-knotifyconfig-devel -BuildRequires: kf5-kdelibs4support-devel -BuildRequires: kf5-kactivities-devel - +BuildRequires: kf5-rpm-macros +BuildRequires: kf5-solid-devel BuildRequires: libkscreen-qt5-devel -BuildRequires: kf5-kwayland-devel +BuildRequires: libxcb-devel +BuildRequires: libXrandr-devel BuildRequires: plasma-workspace-devel +BuildRequires: qt5-qtbase-devel +BuildRequires: qt5-qtx11extras-devel +BuildRequires: systemd-devel +BuildRequires: xcb-util-image-devel +BuildRequires: xcb-util-keysyms-devel +BuildRequires: xcb-util-wm-devel Requires: kf5-filesystem +%{?_qt5:Requires: %{_qt5}%{?_isa} >= %{_qt5_version}} %description Powerdevil is an utility for powermanagement. It consists @@ -55,9 +57,7 @@ of a daemon (a KDED module) and a KCModule for its configuration. %prep -%setup -q -n %{name}-%{version} - -%patch0 -p1 -b .enable-upower +%autosetup -n %{name}-%{version} -p1 %build @@ -99,6 +99,9 @@ rm %{buildroot}/%{_libdir}/libpowerdevil{configcommonprivate,core,ui}.so %changelog +* Mon Dec 14 2015 Rex Dieter 5.5.0-3 +- .spec cosmetics, pull in upstream fixed, minimal qt5 dep + * Mon Dec 14 2015 Jan Grulich - 5.5.0-2 - Rebuild