[v2] mesa: Fix broadcom vulkan driver build on 32bit arches with 64bit time_t

Message ID 20211207201423.1109106-1-raj.khem@gmail.com
State Accepted, archived
Commit 42067ccbf465197ab8d5d6be6d15b71a526decf8
Headers show
Series [v2] mesa: Fix broadcom vulkan driver build on 32bit arches with 64bit time_t | expand

Commit Message

Khem Raj Dec. 7, 2021, 8:14 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Update patch status

 ...unt-for-64bit-time_t-on-32bit-arches.patch | 41 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch

Comments

Alexander Kanavin Dec. 7, 2021, 8:17 p.m. UTC | #1
Thanks :)

Alex

On Tue, 7 Dec 2021 at 21:14, Khem Raj <raj.khem@gmail.com> wrote:

> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> v2: Update patch status
>
>  ...unt-for-64bit-time_t-on-32bit-arches.patch | 41 +++++++++++++++++++
>  meta/recipes-graphics/mesa/mesa.inc           |  1 +
>  2 files changed, 42 insertions(+)
>  create mode 100644
> meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch
>
> diff --git
> a/meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch
> b/meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch
> new file mode 100644
> index 00000000000..e87d7d73114
> --- /dev/null
> +++
> b/meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch
> @@ -0,0 +1,41 @@
> +From e2e2fe86dd61b6fae682a1fec31bd0755ced5cd5 Mon Sep 17 00:00:00 2001
> +From: Khem Raj <raj.khem@gmail.com>
> +Date: Tue, 7 Dec 2021 11:13:27 -0800
> +Subject: [PATCH] v3dv: account for 64bit time_t on 32bit arches
> +
> +This makes is a bit more portable, especially on 32bit architectures
> +with 64bit time_t defaults. Especially on musl its a must.
> +
> +Fixes
> +../mesa-21.3.0/src/broadcom/vulkan/v3dv_bo.c:71:15: error: format
> specifies type 'long' but the argument has type 'time_t' (aka 'long long')
> [-Werror,-Wformat]
> +              time.tv_sec);
> +              ^~~~~~~~~~~
> +
> +Also reported here [1]
> +
> +[1] https://github.com/agherzan/meta-raspberrypi/issues/969
> +
> +Upstream-Status: Submitted [
> https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14118]
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +---
> + src/broadcom/vulkan/v3dv_bo.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/broadcom/vulkan/v3dv_bo.c b/src/broadcom/vulkan/v3dv_bo.c
> +index 71679ce..dc5e7f5 100644
> +--- a/src/broadcom/vulkan/v3dv_bo.c
> ++++ b/src/broadcom/vulkan/v3dv_bo.c
> +@@ -67,8 +67,8 @@ bo_dump_stats(struct v3dv_device *device)
> +
> +       struct timespec time;
> +       clock_gettime(CLOCK_MONOTONIC, &time);
> +-      fprintf(stderr, "  now:               %ld\n",
> +-              time.tv_sec);
> ++      fprintf(stderr, "  now:               %lld\n",
> ++              (long long)time.tv_sec);
> +    }
> +
> +    if (cache->size_list_size) {
> +--
> +2.34.1
> +
> diff --git a/meta/recipes-graphics/mesa/mesa.inc
> b/meta/recipes-graphics/mesa/mesa.inc
> index 30b9e93f630..31ff38dfdca 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -20,6 +20,7 @@ SRC_URI = "
> https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
>             file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch
> \
>
> file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
>             file://0001-util-format-Check-for-NEON-before-using-it.patch \
> +
>  file://0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch \
>             "
>
>  SRC_URI[sha256sum] =
> "a2753c09deef0ba14d35ae8a2ceff3fe5cd13698928c7bb62c2ec8736eb09ce1"
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#159333):
> https://lists.openembedded.org/g/openembedded-core/message/159333
> Mute This Topic: https://lists.openembedded.org/mt/87573662/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

Patch

diff --git a/meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch b/meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch
new file mode 100644
index 00000000000..e87d7d73114
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch
@@ -0,0 +1,41 @@ 
+From e2e2fe86dd61b6fae682a1fec31bd0755ced5cd5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 7 Dec 2021 11:13:27 -0800
+Subject: [PATCH] v3dv: account for 64bit time_t on 32bit arches
+
+This makes is a bit more portable, especially on 32bit architectures
+with 64bit time_t defaults. Especially on musl its a must.
+
+Fixes
+../mesa-21.3.0/src/broadcom/vulkan/v3dv_bo.c:71:15: error: format specifies type 'long' but the argument has type 'time_t' (aka 'long long') [-Werror,-Wformat]
+              time.tv_sec);
+              ^~~~~~~~~~~
+
+Also reported here [1]
+
+[1] https://github.com/agherzan/meta-raspberrypi/issues/969
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14118]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/broadcom/vulkan/v3dv_bo.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/broadcom/vulkan/v3dv_bo.c b/src/broadcom/vulkan/v3dv_bo.c
+index 71679ce..dc5e7f5 100644
+--- a/src/broadcom/vulkan/v3dv_bo.c
++++ b/src/broadcom/vulkan/v3dv_bo.c
+@@ -67,8 +67,8 @@ bo_dump_stats(struct v3dv_device *device)
+ 
+       struct timespec time;
+       clock_gettime(CLOCK_MONOTONIC, &time);
+-      fprintf(stderr, "  now:               %ld\n",
+-              time.tv_sec);
++      fprintf(stderr, "  now:               %lld\n",
++              (long long)time.tv_sec);
+    }
+ 
+    if (cache->size_list_size) {
+-- 
+2.34.1
+
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 30b9e93f630..31ff38dfdca 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -20,6 +20,7 @@  SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
            file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \
            file://0001-util-format-Check-for-NEON-before-using-it.patch \
+           file://0001-v3dv-account-for-64bit-time_t-on-32bit-arches.patch \
            "
 
 SRC_URI[sha256sum] = "a2753c09deef0ba14d35ae8a2ceff3fe5cd13698928c7bb62c2ec8736eb09ce1"