Backport MR#8 to fix builds of cogl-using packages in F31+

This commit is contained in:
Adam Williamson 2019-04-16 14:04:12 -07:00
parent d24eac963c
commit c00e9d6125
2 changed files with 189 additions and 1 deletions

View File

@ -0,0 +1,179 @@
From ca9db0bfdb9b78e48e2fd078c6c5aa86bea102b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20Jard=C3=B3n?= <jjardon@gnome.org>
Date: Sun, 17 Mar 2019 17:33:00 -0700
Subject: [PATCH] cogl/deprecated/cogl-fixed.h: Use "static inline" instead
G_INLINE_FUNC
---
cogl/deprecated/cogl-fixed.c | 45 -------------------
cogl/deprecated/cogl-fixed.h | 85 ++++++++++++++----------------------
2 files changed, 32 insertions(+), 98 deletions(-)
diff --git a/cogl/deprecated/cogl-fixed.c b/cogl/deprecated/cogl-fixed.c
index bdae6cdf..24a6b106 100644
--- a/cogl/deprecated/cogl-fixed.c
+++ b/cogl/deprecated/cogl-fixed.c
@@ -818,51 +818,6 @@ cogl_sqrti (int number)
#endif
}
-CoglFixed
-cogl_fixed_mul (CoglFixed a,
- CoglFixed b)
-{
-#if defined(__arm__) && !defined(__thumb__)
- /* This provides about 12% speedeup on the gcc -O2 optimised
- * C version
- *
- * Based on code found in the following thread:
- * http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2006-August/014405.html
- */
- int res_low, res_hi;
-
- __asm__ ("smull %0, %1, %2, %3 \n"
- "mov %0, %0, lsr %4 \n"
- "add %1, %0, %1, lsl %5 \n"
- : "=&r"(res_hi), "=&r"(res_low) \
- : "r"(a), "r"(b), "i"(COGL_FIXED_Q), "i"(32 - COGL_FIXED_Q));
-
- return (CoglFixed) res_low;
-#else
- int64_t r = (int64_t) a * (int64_t) b;
-
- return (CoglFixed) (r >> COGL_FIXED_Q);
-#endif
-}
-
-CoglFixed
-cogl_fixed_div (CoglFixed a,
- CoglFixed b)
-{
- return (CoglFixed) ((((int64_t) a) << COGL_FIXED_Q) / b);
-}
-
-CoglFixed
-cogl_fixed_mul_div (CoglFixed a,
- CoglFixed b,
- CoglFixed c)
-{
- CoglFixed ab = cogl_fixed_mul (a, b);
- CoglFixed quo = cogl_fixed_div (ab, c);
-
- return quo;
-}
-
/*
* The log2x() and pow2x() functions
*
diff --git a/cogl/deprecated/cogl-fixed.h b/cogl/deprecated/cogl-fixed.h
index 73d0ed59..106c5138 100644
--- a/cogl/deprecated/cogl-fixed.h
+++ b/cogl/deprecated/cogl-fixed.h
@@ -536,18 +536,44 @@ cogl_fixed_atan2 (CoglFixed a,
/*< public >*/
/* Fixed point math routines */
-G_INLINE_FUNC CoglFixed
+static inline CoglFixed
cogl_fixed_mul (CoglFixed a,
- CoglFixed b);
+ CoglFixed b)
+{
+# ifdef __arm__
+ int res_low, res_hi;
+
+ __asm__ ("smull %0, %1, %2, %3 \n"
+ "mov %0, %0, lsr %4 \n"
+ "add %1, %0, %1, lsl %5 \n"
+ : "=r"(res_hi), "=r"(res_low)\
+ : "r"(a), "r"(b), "i"(COGL_FIXED_Q), "i"(32 - COGL_FIXED_Q));
+
+ return (CoglFixed) res_low;
+# else
+ long long r = (long long) a * (long long) b;
+
+ return (unsigned int)(r >> COGL_FIXED_Q);
+# endif
+}
-G_INLINE_FUNC CoglFixed
+static inline CoglFixed
cogl_fixed_div (CoglFixed a,
- CoglFixed b);
+ CoglFixed b)
+{
+ return (CoglFixed) ((((int64_t) a) << COGL_FIXED_Q) / b);
+}
-G_INLINE_FUNC CoglFixed
+static inline CoglFixed
cogl_fixed_mul_div (CoglFixed a,
CoglFixed b,
- CoglFixed c);
+ CoglFixed c)
+{
+ CoglFixed ab = cogl_fixed_mul (a, b);
+ CoglFixed quo = cogl_fixed_div (ab, c);
+
+ return quo;
+}
/**
* COGL_SQRTI_ARG_MAX:
@@ -750,53 +776,6 @@ cogl_angle_tan (CoglAngle angle);
CoglFixed
cogl_angle_cos (CoglAngle angle);
-/*< private >*/
-
-#if defined (G_CAN_INLINE)
-G_INLINE_FUNC CoglFixed
-cogl_fixed_mul (CoglFixed a,
- CoglFixed b)
-{
-# ifdef __arm__
- int res_low, res_hi;
-
- __asm__ ("smull %0, %1, %2, %3 \n"
- "mov %0, %0, lsr %4 \n"
- "add %1, %0, %1, lsl %5 \n"
- : "=r"(res_hi), "=r"(res_low)\
- : "r"(a), "r"(b), "i"(COGL_FIXED_Q), "i"(32 - COGL_FIXED_Q));
-
- return (CoglFixed) res_low;
-# else
- long long r = (long long) a * (long long) b;
-
- return (unsigned int)(r >> COGL_FIXED_Q);
-# endif
-}
-#endif
-
-#if defined (G_CAN_INLINE)
-G_INLINE_FUNC CoglFixed
-cogl_fixed_div (CoglFixed a,
- CoglFixed b)
-{
- return (CoglFixed) ((((int64_t) a) << COGL_FIXED_Q) / b);
-}
-#endif
-
-#if defined(G_CAN_INLINE)
-G_INLINE_FUNC CoglFixed
-cogl_fixed_mul_div (CoglFixed a,
- CoglFixed b,
- CoglFixed c)
-{
- CoglFixed ab = cogl_fixed_mul (a, b);
- CoglFixed quo = cogl_fixed_div (ab, c);
-
- return quo;
-}
-#endif
-
CoglFixed
cogl_double_to_fixed (double value);
--
2.21.0

View File

@ -2,7 +2,7 @@
Name: cogl
Version: 1.22.2
Release: 12%{?dist}
Release: 13%{?dist}
Summary: A library for using 3D graphics hardware to draw pretty pictures
License: LGPLv2+
@ -23,6 +23,11 @@ Patch1: 0002-add-GL_ARB_shader_texture_lod-support.patch
# and do post blurring.
Patch2: 0003-texture-support-copy_sub_image.patch
# Fix use of deprecated G_INLINE_FUNC which broke builds of dependent
# packages
# https://gitlab.gnome.org/GNOME/cogl/merge_requests/8
Patch3: 0001-cogl-deprecated-cogl-fixed.h-Use-static-inline-inste.patch
BuildRequires: chrpath
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(egl)
@ -96,6 +101,7 @@ This package contains the installable tests for %{cogl}.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
CFLAGS="$RPM_OPT_FLAGS -fPIC"
@ -157,6 +163,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libcogl-pango.so
%endif
%changelog
* Tue Apr 16 2019 Adam Williamson <awilliam@redhat.com> - 1.22.2-13
- Backport MR#8 to fix builds of cogl-using packages in F31+
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.22.2-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild