On 19/09/2022 07:44, Adrián Larumbe wrote:
> Hi Steven,
> 
> On 13.09.2022 09:45, Steven Price wrote:
>> On 12/09/2022 17:44, Adrián Larumbe wrote:
>>> Building Mesa's Perfetto requires including the panfrost drm uAPI header in
>>> C++ code, but the C++ compiler requires anonymous unions to have only
>>> public non-static data members.
>>>
>>> Commit 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")
>>> introduces one such union, breaking the Mesa build.
>>>
>>> Give it a name, and also rename pan_reg_hdr structure because it will
>>> always be prefixed by the union name.
>>>
>>> Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7195
>>>
>>> Signed-off-by: Adrián Larumbe <adrian.laru...@collabora.com>
> 
>> Ouch! It's frustrating how C++ isn't quite a superset of C. However I
>> think we can solve this with a simpler patch, I'd appreciate testing
>> that this does indeed fix the build issues with Mesa with all supported
>> compilers (I'm not so familiar with C++):
> 
> I just tested your changes on Mesa and they do fix the build.

Thanks Adrián!

Alyssa: Could you give your R-b if you're happy with this change? It
would be good to get this fixed before it hits -rc1.

Thanks,

Steve

> 
>> ----8<----
>>From 492714a7dff0710ac5b8b457bcfe9ae52b458565 Mon Sep 17 00:00:00 2001
>> From: Steven Price <steven.pr...@arm.com>
>> Date: Tue, 13 Sep 2022 09:37:55 +0100
>> Subject: [PATCH] drm/panfrost: Remove type name from internal structs
>>
>> The two structs internal to struct panfrost_dump_object_header were
>> named, but sadly that is incompatible with C++, causing an error: "an
>> anonymous union may only have public non-static data members".
>>
>> However nothing refers to struct pan_reg_hdr and struct pan_bomap_hdr
>> and there's no need to export these definitions, so lets drop them. This
>> fixes the C++ build error with the minimum change in userspace API.
>>
>> Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7195
>> Fixes: 730c2bf4ad39 ("drm/panfrost: Add support for devcoredump")
>> Signed-off-by: Steven Price <steven.pr...@arm.com>
>> ---
>> include/uapi/drm/panfrost_drm.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/uapi/drm/panfrost_drm.h
>> b/include/uapi/drm/panfrost_drm.h
>> index eac87310b348..bd77254be121 100644
>> --- a/include/uapi/drm/panfrost_drm.h
>> +++ b/include/uapi/drm/panfrost_drm.h
>> @@ -242,7 +242,7 @@ struct panfrost_dump_object_header {
>>      __le32 file_offset;
>>
>>      union {
>> -            struct pan_reg_hdr {
>> +            struct {
>>                      __le64 jc;
>>                      __le32 gpu_id;
>>                      __le32 major;
>> @@ -250,7 +250,7 @@ struct panfrost_dump_object_header {
>>                      __le64 nbos;
>>              } reghdr;
>>
>> -            struct pan_bomap_hdr {
>> +            struct {
>>                      __le32 valid;
>>                      __le64 iova;
>>                      __le32 data[2];
>> -- 
>> 2.34.1

Reply via email to