graphics/igt-gpu-tools: fix build on big-endian

../lib/igt_fb.c:4476:21: error: implicit declaration of function 'bswap_32' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                        uint32_t pixel = le32_to_cpu(line[x]);
                                         ^
../lib/igt_core.h:1459:25: note: expanded from macro 'le32_to_cpu'
This commit is contained in:
Piotr Kubaj 2022-09-16 21:02:37 +00:00
parent 80fa80f5a5
commit aed3a7bf4e
1 changed files with 16 additions and 3 deletions

View File

@ -1,16 +1,18 @@
--- lib/igt_core.h.orig 2022-08-31 20:00:01 UTC
--- lib/igt_core.h.orig 2022-08-30 07:06:59 UTC
+++ lib/igt_core.h
@@ -31,7 +31,9 @@
@@ -31,7 +31,11 @@
#define IGT_CORE_H
#include <assert.h>
+#ifdef __linux__
#include <byteswap.h>
+#elif defined(__FreeBSD__)
+#include <sys/endian.h>
+#endif
#include <setjmp.h>
#include <stdbool.h>
#include <stdint.h>
@@ -47,6 +49,10 @@
@@ -47,6 +51,10 @@
#define IGT_LOG_DOMAIN (NULL)
#endif
@ -21,3 +23,14 @@
#ifndef STATIC_ANALYSIS_BUILD
#if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
@@ -1449,8 +1457,8 @@ void igt_kmsg(const char *format, ...);
#define WRITE_ONCE(x, v) do *(volatile typeof(x) *)(&(x)) = (v); while (0)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#define cpu_to_le32(x) bswap_32(x)
-#define le32_to_cpu(x) bswap_32(x)
+#define cpu_to_le32(x) bswap32(x)
+#define le32_to_cpu(x) bswap32(x)
#else
#define cpu_to_le32(x) (x)
#define le32_to_cpu(x) (x)