[PATCH] ipa: tweak constant expressions that fail to be determined on ppc64el

Olivier Gayot olivier.gayot at sigexec.com
Mon Oct 10 15:45:08 CEST 2022


From: Olivier Gayot <olivier.gayot at canonical.com>

On ppc64el, GCC fails to determine the result of some long double
expressions at compile time. This makes libcamera fail to build with GCC
on that architecture.

e.g.:

constexpr auto x = 1.0l/30.0;

in ‘constexpr’ expansion of ‘std::chrono::operator/<long double, std::ratio<1>,
  double>(std::literals::chrono_literals::operator""s(1.0e+0l), 6.0e+1)’
/usr/include/c++/11/chrono:710:39: error: ‘(1.0e+0l / 6.0e+1)’ is not a constant expression
  710 |         return __cd(__cd(__d).count() / __s);

Tweaking the expressions just a bit makes GCC happy and allows libcamera
to build properly on ppc64el.

Signed-off-by: Olivier Gayot <olivier.gayot at canonical.com>
---
 src/ipa/raspberrypi/raspberrypi.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index 14b06a4f..3e4383f9 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -60,7 +60,7 @@ using utils::Duration;
 /* Configure the sensor with these values initially. */
 constexpr double defaultAnalogueGain = 1.0;
 constexpr Duration defaultExposureTime = 20.0ms;
-constexpr Duration defaultMinFrameDuration = 1.0s / 30.0;
+constexpr Duration defaultMinFrameDuration = 1s / 30.0;
 constexpr Duration defaultMaxFrameDuration = 250.0s;
 
 /*
@@ -69,7 +69,7 @@ constexpr Duration defaultMaxFrameDuration = 250.0s;
  * we rate-limit the controller Prepare() and Process() calls to lower than or
  * equal to this rate.
  */
-constexpr Duration controllerMinFrameDuration = 1.0s / 30.0;
+constexpr Duration controllerMinFrameDuration = 1s / 30.0;
 
 /* List of controls handled by the Raspberry Pi IPA */
 static const ControlInfoMap::Map ipaControls{
-- 
2.34.1



More information about the libcamera-devel mailing list