diff --git a/.github/release-nest-v3 b/.github/release-nest-v3 index 56a6051..d8263ee 100644 --- a/.github/release-nest-v3 +++ b/.github/release-nest-v3 @@ -1 +1 @@ -1 \ No newline at end of file +2 \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index ea61171..67bec88 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hyprland (0.45.1git-101pika10) pika; urgency=medium +hyprland (0.45.1git-101pika11) pika; urgency=medium * Upstream update diff --git a/debian/patches/0001-Bezier-Opti.patch b/debian/patches/0001-Bezier-Opti.patch new file mode 100644 index 0000000..6ee272a --- /dev/null +++ b/debian/patches/0001-Bezier-Opti.patch @@ -0,0 +1,113 @@ +From 3b7208caffa1362e43eff57d58b86d38e484193b Mon Sep 17 00:00:00 2001 +From: Tom Englund +Date: Tue, 19 Nov 2024 18:46:03 +0100 +Subject: [PATCH] bezier: optimize setup of bezier curves +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +avoid reallocations by resizing and copy the pVec into the resized +m_dPoints, reduce the amount of calculations in baking to only do it +once per iteration instead of twice. precompute in getYforT and getXforT +return early in getYForPoint if x is equal or below 0. and use const +references where we can. + +these changes we are now down to an average of "time to bake: 2.50µs." +on my machine compared to before average of "time to bake: 11.15µs" +--- + src/helpers/BezierCurve.cpp | 35 ++++++++++++++++++++--------------- + src/helpers/BezierCurve.hpp | 8 ++++---- + 2 files changed, 24 insertions(+), 19 deletions(-) + +diff --git a/src/helpers/BezierCurve.cpp b/src/helpers/BezierCurve.cpp +index ea567ad61ca..0ef0883f805 100644 +--- a/src/helpers/BezierCurve.cpp ++++ b/src/helpers/BezierCurve.cpp +@@ -6,24 +6,21 @@ + #include + + void CBezierCurve::setup(std::vector* pVec) { +- m_dPoints.clear(); +- + const auto BEGIN = std::chrono::high_resolution_clock::now(); + +- m_dPoints.emplace_back(Vector2D(0, 0)); +- +- for (auto const& p : *pVec) { +- m_dPoints.push_back(p); +- } +- +- m_dPoints.emplace_back(Vector2D(1, 1)); ++ // Avoid reallocations by reserving enough memory upfront ++ m_dPoints.resize(pVec->size() + 2); ++ m_dPoints[0] = Vector2D(0, 0); // Start point ++ std::copy(pVec->begin(), pVec->end(), m_dPoints.begin() + 1); ++ m_dPoints.back() = Vector2D(1, 1); // End point + + RASSERT(m_dPoints.size() == 4, "CBezierCurve only supports cubic beziers! (points num: {})", m_dPoints.size()); + + // bake BAKEDPOINTS points for faster lookups + // T -> X ( / BAKEDPOINTS ) + for (int i = 0; i < BAKEDPOINTS; ++i) { +- m_aPointsBaked[i] = Vector2D(getXForT((i + 1) / (float)BAKEDPOINTS), getYForT((i + 1) / (float)BAKEDPOINTS)); ++ float const t = (i + 1) / (float)BAKEDPOINTS; ++ m_aPointsBaked[i] = Vector2D(getXForT(t), getYForT(t)); + } + + const auto ELAPSEDUS = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - BEGIN).count() / 1000.f; +@@ -40,18 +37,26 @@ void CBezierCurve::setup(std::vector* pVec) { + ELAPSEDUS, ELAPSEDCALCAVG); + } + +-float CBezierCurve::getYForT(float t) { +- return 3 * t * pow(1 - t, 2) * m_dPoints[1].y + 3 * pow(t, 2) * (1 - t) * m_dPoints[2].y + pow(t, 3); ++float CBezierCurve::getXForT(float const& t) { ++ float t2 = t * t; ++ float t3 = t2 * t; ++ ++ return 3 * t * (1 - t) * (1 - t) * m_dPoints[1].x + 3 * t2 * (1 - t) * m_dPoints[2].x + t3 * m_dPoints[3].x; + } + +-float CBezierCurve::getXForT(float t) { +- return 3 * t * pow(1 - t, 2) * m_dPoints[1].x + 3 * pow(t, 2) * (1 - t) * m_dPoints[2].x + pow(t, 3); ++float CBezierCurve::getYForT(float const& t) { ++ float t2 = t * t; ++ float t3 = t2 * t; ++ ++ return 3 * t * (1 - t) * (1 - t) * m_dPoints[1].y + 3 * t2 * (1 - t) * m_dPoints[2].y + t3 * m_dPoints[3].y; + } + + // Todo: this probably can be done better and faster +-float CBezierCurve::getYForPoint(float x) { ++float CBezierCurve::getYForPoint(float const& x) { + if (x >= 1.f) + return 1.f; ++ if (x <= 0.f) ++ return 0.f; + + int index = 0; + bool below = true; +diff --git a/src/helpers/BezierCurve.hpp b/src/helpers/BezierCurve.hpp +index 54af46a6b0f..1a842f5a833 100644 +--- a/src/helpers/BezierCurve.hpp ++++ b/src/helpers/BezierCurve.hpp +@@ -16,13 +16,13 @@ class CBezierCurve { + // this EXCLUDES the 0,0 and 1,1 points, + void setup(std::vector* points); + +- float getYForT(float t); +- float getXForT(float t); +- float getYForPoint(float x); ++ float getYForT(float const& t); ++ float getXForT(float const& t); ++ float getYForPoint(float const& x); + + private: + // this INCLUDES the 0,0 and 1,1 points. +- std::deque m_dPoints; ++ std::vector m_dPoints; + + std::array m_aPointsBaked; + }; + + diff --git a/debian/patches/0001-Fix-tearing.patch b/debian/patches/0001-Fix-tearing.patch new file mode 100644 index 0000000..767788e --- /dev/null +++ b/debian/patches/0001-Fix-tearing.patch @@ -0,0 +1,25 @@ +From cafa3320de70dada2f48cbb8b45f7b42a29da22d Mon Sep 17 00:00:00 2001 +From: ferreo +Date: Tue, 19 Nov 2024 20:43:53 +0000 +Subject: [PATCH] Fix tearing + +--- + src/render/Renderer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp +index fc17ef9f..d1d5c250 100644 +--- a/src/render/Renderer.cpp ++++ b/src/render/Renderer.cpp +@@ -1515,7 +1515,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) { + if (inFD >= 0) + pMonitor->output->state->setExplicitInFence(inFD); + auto explicitOptions = getExplicitSyncSettings(); +- if (explicitOptions.explicitEnabled && explicitOptions.explicitKMSEnabled) ++ if (explicitOptions.explicitEnabled && explicitOptions.explicitKMSEnabled && !pMonitor->tearingState.canTear) + pMonitor->output->state->enableExplicitOutFenceForNextCommit(); + + if (pMonitor->ctmUpdated) { +-- +2.45.2 + diff --git a/debian/patches/series b/debian/patches/series index 6de7a4e..ddeebb2 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,3 @@ -0001-Revert-windows-xdg-minor-cleanup-of-min-max-size-cal.patch \ No newline at end of file +0001-Revert-windows-xdg-minor-cleanup-of-min-max-size-cal.patch +0001-Fix-tearing.patch +0001-Bezier-Opti.patch