diff mbox series

mesa: fix non-trivial designated initializers issue

Message ID 20230404092124.27242-1-kai.kang@windriver.com
State New
Headers show
Series mesa: fix non-trivial designated initializers issue | expand

Commit Message

Kai April 4, 2023, 9:21 a.m. UTC
From: Kai Kang <kai.kang@windriver.com>

It fails to compile intel/compiler/brw_simd_selection.cpp with g++ 7.5.0:

| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp: In function ‘int
  brw_simd_select_for_workgroup_size(const intel_device_info*,
  const brw_cs_prog_data*, const unsigned int*)’:
| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp:205:7: sorry,
  unimplemented: non-trivial designated initializers not supported
|        };
|        ^

Initialize the leading 2 members to fix the issue.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 ...on.cpp-fix-non-trivial-designated-in.patch | 59 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  1 +
 2 files changed, 60 insertions(+)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch

Comments

Böszörményi Zoltán April 4, 2023, 10:49 a.m. UTC | #1
2023. 04. 04. 11:21 keltezéssel, Kai Kang írta:
> From: Kai Kang <kai.kang@windriver.com>
>
> It fails to compile intel/compiler/brw_simd_selection.cpp with g++ 7.5.0:

Mesa officially needs GCC 8.0.0 or later.
https://docs.mesa3d.org/install.html

>
> | mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp: In function ‘int
>    brw_simd_select_for_workgroup_size(const intel_device_info*,
>    const brw_cs_prog_data*, const unsigned int*)’:
> | mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp:205:7: sorry,
>    unimplemented: non-trivial designated initializers not supported
> |        };
> |        ^
>
> Initialize the leading 2 members to fix the issue.
>
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>   ...on.cpp-fix-non-trivial-designated-in.patch | 59 +++++++++++++++++++
>   meta/recipes-graphics/mesa/mesa.inc           |  1 +
>   2 files changed, 60 insertions(+)
>   create mode 100644 meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
>
> diff --git a/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch b/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
> new file mode 100644
> index 0000000000..9db738cdc0
> --- /dev/null
> +++ b/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
> @@ -0,0 +1,59 @@
> +From 6fd92cfc8a52a1884b8bc45b9ac0c7ceaf492a58 Mon Sep 17 00:00:00 2001
> +From: Kai Kang <kai.kang@windriver.com>
> +Date: Mon, 27 Mar 2023 21:19:36 +0800
> +Subject: [PATCH] brw_simd_selection.cpp: fix non-trivial designated
> + initializers issue
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +It fails to compile intel/compiler/brw_simd_selection.cpp with g++ 7.5.0:
> +
> +| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp: In function ‘int
> +  brw_simd_select_for_workgroup_size(const intel_device_info*,
> +  const brw_cs_prog_data*, const unsigned int*)’:
> +| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp:205:7: sorry,
> +  unimplemented: non-trivial designated initializers not supported
> +|        };
> +|        ^
> +
> +Initialize the leading 2 members to fix the issue.
> +
> +Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22138]
> +
> +Signed-off-by: Kai Kang <kai.kang@windriver.com>
> +---
> + src/intel/compiler/brw_simd_selection.cpp | 6 ++++--
> + 1 file changed, 4 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/intel/compiler/brw_simd_selection.cpp b/src/intel/compiler/brw_simd_selection.cpp
> +index 1515e538b74..4c065f9884a 100644
> +--- a/src/intel/compiler/brw_simd_selection.cpp
> ++++ b/src/intel/compiler/brw_simd_selection.cpp
> +@@ -232,10 +232,14 @@ brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
> +                                    const struct brw_cs_prog_data *prog_data,
> +                                    const unsigned *sizes)
> + {
> ++   void *mem_ctx = ralloc_context(NULL);
> ++
> +    if (!sizes || (prog_data->local_size[0] == sizes[0] &&
> +                   prog_data->local_size[1] == sizes[1] &&
> +                   prog_data->local_size[2] == sizes[2])) {
> +       brw_simd_selection_state simd_state{
> ++         .mem_ctx = mem_ctx,
> ++         .devinfo = devinfo,
> +          .prog_data = const_cast<struct brw_cs_prog_data *>(prog_data),
> +       };
> +
> +@@ -257,8 +261,6 @@ brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
> +    cloned.prog_mask = 0;
> +    cloned.prog_spilled = 0;
> +
> +-   void *mem_ctx = ralloc_context(NULL);
> +-
> +    brw_simd_selection_state simd_state{
> +       .mem_ctx = mem_ctx,
> +       .devinfo = devinfo,
> +--
> +2.34.1
> +
> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
> index 8f72f25c17..caab1eff6d 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -17,6 +17,7 @@ PE = "2"
>   SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
>              file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
>              file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
> +           file://0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch \
>              "
>   
>   SRC_URI[sha256sum] = "01f3cff3763f09e0adabcb8011e4aebc6ad48f6a4dd4bae904fe918707d253e4"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#179678): https://lists.openembedded.org/g/openembedded-core/message/179678
> Mute This Topic: https://lists.openembedded.org/mt/98056265/3617728
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie April 4, 2023, 11:13 a.m. UTC | #2
On Tue, 2023-04-04 at 17:21 +0800, Kai Kang wrote:
> From: Kai Kang <kai.kang@windriver.com>
> 
> It fails to compile intel/compiler/brw_simd_selection.cpp with g++ 7.5.0:
> 
> > mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp: In function ‘int
>   brw_simd_select_for_workgroup_size(const intel_device_info*,
>   const brw_cs_prog_data*, const unsigned int*)’:
> > mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp:205:7: sorry,
>   unimplemented: non-trivial designated initializers not supported
> >        };
> >        ^
> 
> Initialize the leading 2 members to fix the issue.
> 
> Signed-off-by: Kai Kang <kai.kang@windriver.com>
> ---
>  ...on.cpp-fix-non-trivial-designated-in.patch | 59 +++++++++++++++++++
>  meta/recipes-graphics/mesa/mesa.inc           |  1 +
>  2 files changed, 60 insertions(+)
>  create mode 100644 meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
> 
> diff --git a/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch b/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
> new file mode 100644
> index 0000000000..9db738cdc0
> --- /dev/null
> +++ b/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
> @@ -0,0 +1,59 @@
> +From 6fd92cfc8a52a1884b8bc45b9ac0c7ceaf492a58 Mon Sep 17 00:00:00 2001
> +From: Kai Kang <kai.kang@windriver.com>
> +Date: Mon, 27 Mar 2023 21:19:36 +0800
> +Subject: [PATCH] brw_simd_selection.cpp: fix non-trivial designated
> + initializers issue
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +It fails to compile intel/compiler/brw_simd_selection.cpp with g++ 7.5.0:
> +
> +| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp: In function ‘int
> +  brw_simd_select_for_workgroup_size(const intel_device_info*,
> +  const brw_cs_prog_data*, const unsigned int*)’:
> +| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp:205:7: sorry,
> +  unimplemented: non-trivial designated initializers not supported
> +|        };
> +|        ^
> +
> +Initialize the leading 2 members to fix the issue.
> +
> +Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22138]
> +
> +Signed-off-by: Kai Kang <kai.kang@windriver.com>
> +---
> + src/intel/compiler/brw_simd_selection.cpp | 6 ++++--
> + 1 file changed, 4 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/intel/compiler/brw_simd_selection.cpp b/src/intel/compiler/brw_simd_selection.cpp
> +index 1515e538b74..4c065f9884a 100644
> +--- a/src/intel/compiler/brw_simd_selection.cpp
> ++++ b/src/intel/compiler/brw_simd_selection.cpp
> +@@ -232,10 +232,14 @@ brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
> +                                    const struct brw_cs_prog_data *prog_data,
> +                                    const unsigned *sizes)
> + {
> ++   void *mem_ctx = ralloc_context(NULL);
> ++
> +    if (!sizes || (prog_data->local_size[0] == sizes[0] &&
> +                   prog_data->local_size[1] == sizes[1] &&
> +                   prog_data->local_size[2] == sizes[2])) {
> +       brw_simd_selection_state simd_state{
> ++         .mem_ctx = mem_ctx,
> ++         .devinfo = devinfo,
> +          .prog_data = const_cast<struct brw_cs_prog_data *>(prog_data),
> +       };
> + 
> +@@ -257,8 +261,6 @@ brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
> +    cloned.prog_mask = 0;
> +    cloned.prog_spilled = 0;
> + 
> +-   void *mem_ctx = ralloc_context(NULL);
> +-
> +    brw_simd_selection_state simd_state{
> +       .mem_ctx = mem_ctx,
> +       .devinfo = devinfo,
> +-- 
> +2.34.1
> +
> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
> index 8f72f25c17..caab1eff6d 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -17,6 +17,7 @@ PE = "2"
>  SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
>             file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
>             file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
> +           file://0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch \
>             "
>  
>  SRC_URI[sha256sum] = "01f3cff3763f09e0adabcb8011e4aebc6ad48f6a4dd4bae904fe918707d253e4"

There is feedback upstream suggesting this causes a memory leak?

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch b/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
new file mode 100644
index 0000000000..9db738cdc0
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch
@@ -0,0 +1,59 @@ 
+From 6fd92cfc8a52a1884b8bc45b9ac0c7ceaf492a58 Mon Sep 17 00:00:00 2001
+From: Kai Kang <kai.kang@windriver.com>
+Date: Mon, 27 Mar 2023 21:19:36 +0800
+Subject: [PATCH] brw_simd_selection.cpp: fix non-trivial designated
+ initializers issue
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It fails to compile intel/compiler/brw_simd_selection.cpp with g++ 7.5.0:
+
+| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp: In function ‘int
+  brw_simd_select_for_workgroup_size(const intel_device_info*,
+  const brw_cs_prog_data*, const unsigned int*)’:
+| mesa-23.0.0/src/intel/compiler/brw_simd_selection.cpp:205:7: sorry,
+  unimplemented: non-trivial designated initializers not supported
+|        };
+|        ^
+
+Initialize the leading 2 members to fix the issue.
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22138]
+
+Signed-off-by: Kai Kang <kai.kang@windriver.com>
+---
+ src/intel/compiler/brw_simd_selection.cpp | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/intel/compiler/brw_simd_selection.cpp b/src/intel/compiler/brw_simd_selection.cpp
+index 1515e538b74..4c065f9884a 100644
+--- a/src/intel/compiler/brw_simd_selection.cpp
++++ b/src/intel/compiler/brw_simd_selection.cpp
+@@ -232,10 +232,14 @@ brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
+                                    const struct brw_cs_prog_data *prog_data,
+                                    const unsigned *sizes)
+ {
++   void *mem_ctx = ralloc_context(NULL);
++
+    if (!sizes || (prog_data->local_size[0] == sizes[0] &&
+                   prog_data->local_size[1] == sizes[1] &&
+                   prog_data->local_size[2] == sizes[2])) {
+       brw_simd_selection_state simd_state{
++         .mem_ctx = mem_ctx,
++         .devinfo = devinfo,
+          .prog_data = const_cast<struct brw_cs_prog_data *>(prog_data),
+       };
+ 
+@@ -257,8 +261,6 @@ brw_simd_select_for_workgroup_size(const struct intel_device_info *devinfo,
+    cloned.prog_mask = 0;
+    cloned.prog_spilled = 0;
+ 
+-   void *mem_ctx = ralloc_context(NULL);
+-
+    brw_simd_selection_state simd_state{
+       .mem_ctx = mem_ctx,
+       .devinfo = devinfo,
+-- 
+2.34.1
+
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 8f72f25c17..caab1eff6d 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -17,6 +17,7 @@  PE = "2"
 SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
            file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
+           file://0001-brw_simd_selection.cpp-fix-non-trivial-designated-in.patch \
            "
 
 SRC_URI[sha256sum] = "01f3cff3763f09e0adabcb8011e4aebc6ad48f6a4dd4bae904fe918707d253e4"