1
0
forked from jengelh/libcamera
libcamera/fix-ppc64.patch
Jan Engelhardt cfc045e257 Accepting request 914665 from home:alarrosa:branches:graphics
- Add patch to work around what seems to be a bug in gcc 11 with
  constexpr being treated as "non const" only in ppc64/ppc64le:
  * fix-ppc64.patch

I'll submit it to upstream next week (on Wednesday)

OBS-URL: https://build.opensuse.org/request/show/914665
OBS-URL: https://build.opensuse.org/package/show/graphics/libcamera?expand=0&rev=24
2021-08-28 13:51:22 +00:00

43 lines
2.1 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From: Antonio Larrosa <alarrosa@suse.com>
Subject: Work around what seems to be a gcc bug only happening in ppc64/ppc64le
When building code like:
constexpr Duration defaultMinFrameDuration = 1.0s / 30.0;
or
constexpr Duration controllerMinFrameDuration = 1.0s / 60.0;
gcc 11.1.1 is giving this error:
[ 235s] In file included from ../include/libcamera/base/log.h:10,
[ 235s] from ../src/ipa/raspberrypi/raspberrypi.cpp:18:
[ 235s] ../src/ipa/raspberrypi/raspberrypi.cpp:64:53: in constexpr expansion of std::chrono::operator/<long double, std::ratio<1>, double>(std::literals::chrono_literals::operator""s(1.0e+0l), 3.0e+1)
[ 235s] /usr/include/c++/11/chrono:710:39: error: (1.0e+0l / 3.0e+1) is not a constant expression
[ 235s] 710 | return __cd(__cd(__d).count() / __s);
[ 235s] | ~~~~~~~~~~~~~~~~~~^~~~~
[ 235s] ../src/ipa/raspberrypi/raspberrypi.cpp:73:56: 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)
This change works around it to let it build fine.
Index: libcamera-0~2809.e0704e97/src/ipa/raspberrypi/raspberrypi.cpp
===================================================================
--- libcamera-0~2809.e0704e97.orig/src/ipa/raspberrypi/raspberrypi.cpp
+++ libcamera-0~2809.e0704e97/src/ipa/raspberrypi/raspberrypi.cpp
@@ -61,7 +61,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;
+const Duration defaultMinFrameDuration = 1.0s / 30.0;
constexpr Duration defaultMaxFrameDuration = 250.0s;
/*
@@ -70,7 +70,7 @@ constexpr Duration defaultMaxFrameDurati
* we rate-limit the controller Prepare() and Process() calls to lower than or
* equal to this rate.
*/
-constexpr Duration controllerMinFrameDuration = 1.0s / 60.0;
+const Duration controllerMinFrameDuration = 1.0s / 60.0;
LOG_DEFINE_CATEGORY(IPARPI)