From patchwork Thu Sep 8 05:31:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 12495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1538CC38145 for ; Thu, 8 Sep 2022 05:32:19 +0000 (UTC) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mx.groups.io with SMTP id smtpd.web08.1951.1662615133844202013 for ; Wed, 07 Sep 2022 22:32:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JjIhsEY7; spf=pass (domain: gmail.com, ip: 209.85.214.180, mailfrom: raj.khem@gmail.com) Received: by mail-pl1-f180.google.com with SMTP id p18so16736616plr.8 for ; Wed, 07 Sep 2022 22:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=Gdw9fs9aBI3rWthXSSdBytFqn89RBoABK9VigsXyO/c=; b=JjIhsEY790ByrN43i1o29nH0dDcT5TB3P+tFmrREh8od8R7kG4voxZjD0E8J32Ht2n WIxGQuSgIBvr/ElQIlgdvy+cakczRVqGdIupGVZ8rdF+YVzAZkEptn5e2OyH31274UFj jXq0ptFmHno9z+taJT19soOy72uoASLpgRCYuExV+yQGt4oOjqcS+iC9r2frsd1cnFvG /LrLJePv63oJgbQqrsafdLUjNDrUGkvS2AnbbS5uhoxQh+DKlDB3Fl+za/tJM7LOYmR5 bCMTOtbsiiHUQkpZGCXQJWOMnnp0GaPNHNxpc2OBa+CWvAD0Jp3Z2SDij41peCNRzJCz pArQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=Gdw9fs9aBI3rWthXSSdBytFqn89RBoABK9VigsXyO/c=; b=IXt73Q4bAoZq/+EXqbGZ/SP7rViNkUREykDfJWtVWq8RnoFKJ+6ObAj8FWJGE8hoOy 4NguXuzpaLWjVpH5GLZ1EpB0T28Br1hLvOQOppnzwI6GtUpqIu79hZGULYEgUU9/YJfD TASUZEaDJZQuFVh107IEPJJeTFZbf/koOsD/IlDe1RQpV25LueQToe9MbOHjTrYbKxqO 5HIUfcffDwMaR1SuwLVPYS3kBQ8KVhB/oX85c8lCPhZJzY3azufvGPf9lnq9JqVbvipN 8aTcojWx2cwALA/yXH8LGSzXQLRjp8Oj+yyizeOlgI6BsP7eJ+6aMQDMzOXlxg6zKVUQ KBsA== X-Gm-Message-State: ACgBeo2NVONjpZUfUVi/X6LEglxZ0dmSa/+NsmosCyySPyaEoTKbIrlC wR6HZfGvYODAqC4FKS0xy01IYJR5F8QnYQ== X-Google-Smtp-Source: AA6agR66B8LxW6Kcut8j8yptp7P/fWgK8S7nD1wC3MuG23auYVzS8D+7JDPFnGzMGCjTVdelEMPNeQ== X-Received: by 2002:a17:902:e841:b0:177:82b6:e6f7 with SMTP id t1-20020a170902e84100b0017782b6e6f7mr5695973plg.66.1662615103182; Wed, 07 Sep 2022 22:31:43 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:a0f0::1761]) by smtp.gmail.com with ESMTPSA id a3-20020a17090abe0300b001f1f5e812e9sm753613pjs.20.2022.09.07.22.31.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 22:31:42 -0700 (PDT) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj , Mingli Yu Subject: [PATCH v2] webkitgtk: Fix build on 32bit arm Date: Wed, 7 Sep 2022 22:31:40 -0700 Message-Id: <20220908053140.660738-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 08 Sep 2022 05:32:19 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/170450 Signed-off-by: Khem Raj Cc: Mingli Yu --- v2: Fix commit msg format ...44e17d258106617b0e6d783d073b188a2548.patch | 311 ++++++++++++++++++ meta/recipes-sato/webkit/webkitgtk_2.36.7.bb | 1 + 2 files changed, 312 insertions(+) create mode 100644 meta/recipes-sato/webkit/webkitgtk/0d3344e17d258106617b0e6d783d073b188a2548.patch diff --git a/meta/recipes-sato/webkit/webkitgtk/0d3344e17d258106617b0e6d783d073b188a2548.patch b/meta/recipes-sato/webkit/webkitgtk/0d3344e17d258106617b0e6d783d073b188a2548.patch new file mode 100644 index 0000000000..204f76633f --- /dev/null +++ b/meta/recipes-sato/webkit/webkitgtk/0d3344e17d258106617b0e6d783d073b188a2548.patch @@ -0,0 +1,311 @@ +From 0d3344e17d258106617b0e6d783d073b188a2548 Mon Sep 17 00:00:00 2001 +From: Adrian Perez de Castro +Date: Thu, 2 Jun 2022 11:19:06 +0300 +Subject: [PATCH] [ARM][NEON] FELightningNEON.cpp fails to build, NEON fast + path seems unused https://bugs.webkit.org/show_bug.cgi?id=241182 + +Reviewed by NOBODY (OOPS!). + +Move the NEON fast path for the SVG lighting filter effects into +FELightingSoftwareApplier, and arrange to actually use them by +forwarding calls to applyPlatformGeneric() into applyPlatformNeon(). + +Some changes were needed to adapt platformApplyNeon() to the current +state of filters after r286140. This was not detected because the code +bitrotted due to it being guarded with CPU(ARM_TRADITIONAL), which does +not get used much these days: CPU(ARM_THUMB2) is more common. It should +be possible to use the NEON fast paths also in Thumb mode, but that is +left for a follow-up fix. + +* Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp: +(WebCore::FELightingSoftwareApplier::platformApplyNeonWorker): +(WebCore::FELightingSoftwareApplier::getPowerCoefficients): +(WebCore::FELighting::platformApplyNeonWorker): Deleted. +(WebCore::FELighting::getPowerCoefficients): Deleted. +* Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h: +(WebCore::FELightingSoftwareApplier::applyPlatformNeon): +(WebCore::FELighting::platformApplyNeon): Deleted. +* Source/WebCore/platform/graphics/filters/DistantLightSource.h: +* Source/WebCore/platform/graphics/filters/FELighting.h: +* Source/WebCore/platform/graphics/filters/PointLightSource.h: +* Source/WebCore/platform/graphics/filters/SpotLightSource.h: +* Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.h: +--- +Upstream-Status: Submitted [https://github.com/WebKit/WebKit/pull/1233] +Signed-off-by: Khem Raj + + .../cpu/arm/filters/FELightingNEON.cpp | 4 +- + .../graphics/cpu/arm/filters/FELightingNEON.h | 54 +++++++++---------- + .../graphics/filters/DistantLightSource.h | 4 ++ + .../platform/graphics/filters/FELighting.h | 7 --- + .../graphics/filters/PointLightSource.h | 4 ++ + .../graphics/filters/SpotLightSource.h | 4 ++ + .../software/FELightingSoftwareApplier.h | 16 ++++++ + 7 files changed, 57 insertions(+), 36 deletions(-) + +diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp +index f6ff8c20a5a8..42a97ffc5372 100644 +--- a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp ++++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.cpp +@@ -49,7 +49,7 @@ short* feLightingConstantsForNeon() + return s_FELightingConstantsForNeon; + } + +-void FELighting::platformApplyNeonWorker(FELightingPaintingDataForNeon* parameters) ++void FELightingSoftwareApplier::platformApplyNeonWorker(FELightingPaintingDataForNeon* parameters) + { + neonDrawLighting(parameters); + } +@@ -464,7 +464,7 @@ TOSTRING(neonDrawLighting) ":" NL + "b .lightStrengthCalculated" NL + ); // NOLINT + +-int FELighting::getPowerCoefficients(float exponent) ++int FELightingSoftwareApplier::getPowerCoefficients(float exponent) + { + // Calling a powf function from the assembly code would require to save + // and reload a lot of NEON registers. Since the base is in range [0..1] +diff --git a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h +index b17c603d40d3..c6d17f573eca 100644 +--- a/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h ++++ b/Source/WebCore/platform/graphics/cpu/arm/filters/FELightingNEON.h +@@ -24,14 +24,15 @@ + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +-#ifndef FELightingNEON_h +-#define FELightingNEON_h ++#pragma once + + #if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC_COMPATIBLE) + +-#include "FELighting.h" ++#include "FELightingSoftwareApplier.h" ++#include "ImageBuffer.h" + #include "PointLightSource.h" + #include "SpotLightSource.h" ++#include + #include + + namespace WebCore { +@@ -93,14 +94,14 @@ extern "C" { + void neonDrawLighting(FELightingPaintingDataForNeon*); + } + +-inline void FELighting::platformApplyNeon(const LightingData& data, const LightSource::PaintingData& paintingData) ++inline void FELightingSoftwareApplier::applyPlatformNeon(const FELightingSoftwareApplier::LightingData& data, const LightSource::PaintingData& paintingData) + { +- alignas(16) FELightingFloatArgumentsForNeon floatArguments; +- FELightingPaintingDataForNeon neonData = { +- data.pixels->data(), ++ WebCore::FELightingFloatArgumentsForNeon alignas(16) floatArguments; ++ WebCore::FELightingPaintingDataForNeon neonData = { ++ data.pixels->bytes(), + 1, +- data.widthDecreasedByOne - 1, +- data.heightDecreasedByOne - 1, ++ data.width - 2, ++ data.height - 2, + 0, + 0, + 0, +@@ -111,23 +112,23 @@ inline void FELighting::platformApplyNeon(const LightingData& data, const LightS + // Set light source arguments. + floatArguments.constOne = 1; + +- auto color = m_lightingColor.toColorTypeLossy>().resolved(); ++ auto color = data.lightingColor.toColorTypeLossy>().resolved(); + + floatArguments.colorRed = color.red; + floatArguments.colorGreen = color.green; + floatArguments.colorBlue = color.blue; + floatArguments.padding4 = 0; + +- if (m_lightSource->type() == LS_POINT) { ++ if (data.lightSource->type() == LS_POINT) { + neonData.flags |= FLAG_POINT_LIGHT; +- PointLightSource& pointLightSource = static_cast(m_lightSource.get()); ++ const auto& pointLightSource = *static_cast(data.lightSource); + floatArguments.lightX = pointLightSource.position().x(); + floatArguments.lightY = pointLightSource.position().y(); + floatArguments.lightZ = pointLightSource.position().z(); + floatArguments.padding2 = 0; +- } else if (m_lightSource->type() == LS_SPOT) { ++ } else if (data.lightSource->type() == LS_SPOT) { + neonData.flags |= FLAG_SPOT_LIGHT; +- SpotLightSource& spotLightSource = static_cast(m_lightSource.get()); ++ const auto& spotLightSource = *static_cast(data.lightSource); + floatArguments.lightX = spotLightSource.position().x(); + floatArguments.lightY = spotLightSource.position().y(); + floatArguments.lightZ = spotLightSource.position().z(); +@@ -145,7 +146,7 @@ inline void FELighting::platformApplyNeon(const LightingData& data, const LightS + if (spotLightSource.specularExponent() == 1) + neonData.flags |= FLAG_CONE_EXPONENT_IS_1; + } else { +- ASSERT(m_lightSource->type() == LS_DISTANT); ++ ASSERT(data.lightSource->type() == LS_DISTANT); + floatArguments.lightX = paintingData.initialLightingData.lightVector.x(); + floatArguments.lightY = paintingData.initialLightingData.lightVector.y(); + floatArguments.lightZ = paintingData.initialLightingData.lightVector.z(); +@@ -155,38 +156,39 @@ inline void FELighting::platformApplyNeon(const LightingData& data, const LightS + // Set lighting arguments. + floatArguments.surfaceScale = data.surfaceScale; + floatArguments.minusSurfaceScaleDividedByFour = -data.surfaceScale / 4; +- if (m_lightingType == FELighting::DiffuseLighting) +- floatArguments.diffuseConstant = m_diffuseConstant; ++ if (data.filterType == FilterEffect::Type::FEDiffuseLighting) ++ floatArguments.diffuseConstant = data.diffuseConstant; + else { + neonData.flags |= FLAG_SPECULAR_LIGHT; +- floatArguments.diffuseConstant = m_specularConstant; +- neonData.specularExponent = getPowerCoefficients(m_specularExponent); +- if (m_specularExponent == 1) ++ floatArguments.diffuseConstant = data.specularConstant; ++ neonData.specularExponent = getPowerCoefficients(data.specularExponent); ++ if (data.specularExponent == 1) + neonData.flags |= FLAG_SPECULAR_EXPONENT_IS_1; + } + if (floatArguments.diffuseConstant == 1) + neonData.flags |= FLAG_DIFFUSE_CONST_IS_1; + +- int optimalThreadNumber = ((data.widthDecreasedByOne - 1) * (data.heightDecreasedByOne - 1)) / s_minimalRectDimension; ++ static constexpr int minimalRectDimension = 100 * 100; // Empirical data limit for parallel jobs ++ int optimalThreadNumber = ((data.width - 2) * (data.height - 2)) / minimalRectDimension; + if (optimalThreadNumber > 1) { + // Initialize parallel jobs +- ParallelJobs parallelJobs(&WebCore::FELighting::platformApplyNeonWorker, optimalThreadNumber); ++ ParallelJobs parallelJobs(&FELightingSoftwareApplier::platformApplyNeonWorker, optimalThreadNumber); + + // Fill the parameter array + int job = parallelJobs.numberOfJobs(); + if (job > 1) { + int yStart = 1; +- int yStep = (data.heightDecreasedByOne - 1) / job; ++ int yStep = (data.height - 2) / job; + for (--job; job >= 0; --job) { + FELightingPaintingDataForNeon& params = parallelJobs.parameter(job); + params = neonData; + params.yStart = yStart; +- params.pixels += (yStart - 1) * (data.widthDecreasedByOne + 1) * 4; ++ params.pixels += (yStart - 1) * data.width * 4; + if (job > 0) { + params.absoluteHeight = yStep; + yStart += yStep; + } else +- params.absoluteHeight = data.heightDecreasedByOne - yStart; ++ params.absoluteHeight = (data.height - 1) - yStart; + } + parallelJobs.execute(); + return; +@@ -199,5 +201,3 @@ inline void FELighting::platformApplyNeon(const LightingData& data, const LightS + } // namespace WebCore + + #endif // CPU(ARM_NEON) && COMPILER(GCC_COMPATIBLE) +- +-#endif // FELightingNEON_h +diff --git a/Source/WebCore/platform/graphics/filters/DistantLightSource.h b/Source/WebCore/platform/graphics/filters/DistantLightSource.h +index 0660143fc1cf..2b1e86d99fa4 100644 +--- a/Source/WebCore/platform/graphics/filters/DistantLightSource.h ++++ b/Source/WebCore/platform/graphics/filters/DistantLightSource.h +@@ -25,6 +25,10 @@ + #include "LightSource.h" + #include + ++namespace WTF { ++class TextStream; ++} // namespace WTF ++ + namespace WebCore { + + class DistantLightSource : public LightSource { +diff --git a/Source/WebCore/platform/graphics/filters/FELighting.h b/Source/WebCore/platform/graphics/filters/FELighting.h +index 0c073bc13f8c..e0db00545c17 100644 +--- a/Source/WebCore/platform/graphics/filters/FELighting.h ++++ b/Source/WebCore/platform/graphics/filters/FELighting.h +@@ -35,8 +35,6 @@ + + namespace WebCore { + +-struct FELightingPaintingDataForNeon; +- + class FELighting : public FilterEffect { + public: + const Color& lightingColor() const { return m_lightingColor; } +@@ -67,11 +65,6 @@ class FELighting : public FilterEffect { + + std::unique_ptr createSoftwareApplier() const override; + +-#if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC_COMPATIBLE) +- static int getPowerCoefficients(float exponent); +- inline void platformApplyNeon(const LightingData&, const LightSource::PaintingData&); +-#endif +- + Color m_lightingColor; + float m_surfaceScale; + float m_diffuseConstant; +diff --git a/Source/WebCore/platform/graphics/filters/PointLightSource.h b/Source/WebCore/platform/graphics/filters/PointLightSource.h +index 5c9c7fb783e6..e53aa012ac1c 100644 +--- a/Source/WebCore/platform/graphics/filters/PointLightSource.h ++++ b/Source/WebCore/platform/graphics/filters/PointLightSource.h +@@ -26,6 +26,10 @@ + #include "LightSource.h" + #include + ++namespace WTF { ++class TextStream; ++} // namespace WTF ++ + namespace WebCore { + + class PointLightSource : public LightSource { +diff --git a/Source/WebCore/platform/graphics/filters/SpotLightSource.h b/Source/WebCore/platform/graphics/filters/SpotLightSource.h +index 04e331ec4ec0..763c8d400b00 100644 +--- a/Source/WebCore/platform/graphics/filters/SpotLightSource.h ++++ b/Source/WebCore/platform/graphics/filters/SpotLightSource.h +@@ -26,6 +26,10 @@ + #include "LightSource.h" + #include + ++namespace WTF { ++class TextStream; ++} // namespace WTF ++ + namespace WebCore { + + class SpotLightSource : public LightSource { +diff --git a/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.h b/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.h +index c974d92115ff..e2896660cfbd 100644 +--- a/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.h ++++ b/Source/WebCore/platform/graphics/filters/software/FELightingSoftwareApplier.h +@@ -36,6 +36,7 @@ + namespace WebCore { + + class FELighting; ++struct FELightingPaintingDataForNeon; + + class FELightingSoftwareApplier final : public FilterEffectConcreteApplier { + WTF_MAKE_FAST_ALLOCATED; +@@ -132,8 +133,23 @@ class FELightingSoftwareApplier final : public FilterEffectConcreteApplier