diff mbox series

package/sunxi-mali-utgard: support the wayland driver

Message ID 20230423214014.2963361-1-aperez@igalia.com
State Superseded
Headers show
Series package/sunxi-mali-utgard: support the wayland driver | expand

Commit Message

Adrian Perez de Castro April 23, 2023, 9:40 p.m. UTC
Add a choice to allow using the Wayland variant of the Mali driver. When
selected, the package is marked as provider for libgbm as libMali.so
includes the symbols and a libgbm.so symlink is installed; and both
BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
---
 package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
 .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
 2 files changed, 38 insertions(+), 3 deletions(-)

Comments

Adrian Perez de Castro April 23, 2023, 9:46 p.m. UTC | #1
Hi,

On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
> Add a choice to allow using the Wayland variant of the Mali driver. When
> selected, the package is marked as provider for libgbm as libMali.so
> includes the symbols and a libgbm.so symlink is installed; and both
> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
> 
> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>

With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
compositor without trouble, but unfortunately I do not have the hardware
to test it... so I cannot really tell whether things work as expected.

> ---
>  package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
>  .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
>  2 files changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
> index 59ac21f5ab..0856f220fd 100644
> --- a/package/sunxi-mali-utgard/Config.in
> +++ b/package/sunxi-mali-utgard/Config.in
> @@ -18,6 +18,9 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
>  config BR2_PACKAGE_PROVIDES_LIBGLES
>  	default "sunxi-mali-utgard"
>  
> +config BR2_PACKAGE_PROVIDES_LIBGBM
> +	default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> +
>  choice
>  	prompt "Version"
>  	default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
> @@ -38,6 +41,26 @@ config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
>  	default "r6p2"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
>  	default "r8p1"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
>  
> +choice
> +	prompt "Platform"
> +	default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> +	help
> +	  Select the target EGL platform.
> +
> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> +	bool "fbdev"
> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> +	bool "wayland"
> +	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
> +	select BR2_PACKAGE_HAS_LIBGBM
> +
> +endchoice
> +
> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM
> +	string
> +	default "fbdev" if BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> +	default "wayland" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> +
>  endif
>  
>  comment "sunxi-mali-utgard needs an EABIhf glibc toolchain"
> diff --git a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> index f693667955..23c6e8ec6e 100644
> --- a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> +++ b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> @@ -24,9 +24,9 @@ endif
>  define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
>  	mkdir -p $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include
>  
> -	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> +	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
>  		$(STAGING_DIR)/usr/lib/
> -	cp -rf $(@D)/include/fbdev/* $(STAGING_DIR)/usr/include/
> +	cp -rf $(@D)/include/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/* $(STAGING_DIR)/usr/include/
>  
>  	$(INSTALL) -D -m 0644 package/sunxi-mali-utgard/egl.pc \
>  		$(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> @@ -34,9 +34,21 @@ define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
>  		$(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
>  endef
>  
> +ifeq ($(BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND),y)
> +define SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> +	sed -e '/^Cflags:/s/$$/ -DWL_EGL_PLATFORM/' \
> +		-e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> +		-i $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> +	sed -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> +		-i $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> +endef
> +SUNXI_MALI_UTGARD_POST_INSTALL_TARGET_HOOKS += SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> +SUNXI_MALI_UTGARD_DEPENDENCIES += wayland
> +endif
> +
>  define SUNXI_MALI_UTGARD_INSTALL_TARGET_CMDS
>  	mkdir -p $(TARGET_DIR)/usr/lib
> -	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> +	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
>  		$(TARGET_DIR)/usr/lib/
>  endef
>  
> -- 
> 2.40.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
> 

Cheers,
—Adrián
Giulio Benetti April 23, 2023, 10:01 p.m. UTC | #2
Hi Adrian,

Il 23/04/2023 23:40, Adrian Perez de Castro ha scritto:
> Add a choice to allow using the Wayland variant of the Mali driver. When
> selected, the package is marked as provider for libgbm as libMali.so
> includes the symbols and a libgbm.so symlink is installed; and both
> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
> 
> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
> ---
>   package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
>   .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
>   2 files changed, 38 insertions(+), 3 deletions(-)
> 
> diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
> index 59ac21f5ab..0856f220fd 100644
> --- a/package/sunxi-mali-utgard/Config.in
> +++ b/package/sunxi-mali-utgard/Config.in
> @@ -18,6 +18,9 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
>   config BR2_PACKAGE_PROVIDES_LIBGLES
>   	default "sunxi-mali-utgard"
>   
> +config BR2_PACKAGE_PROVIDES_LIBGBM
> +	default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> +
>   choice
>   	prompt "Version"
>   	default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
> @@ -38,6 +41,26 @@ config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
>   	default "r6p2"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
>   	default "r8p1"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
>   
> +choice
> +	prompt "Platform"
> +	default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> +	help
> +	  Select the target EGL platform.
> +
> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> +	bool "fbdev"
> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> +	bool "wayland"
> +	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
> +	select BR2_PACKAGE_HAS_LIBGBM

There is a wayland blob only for r6p2 version :-/ so here you need
to depend on BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 and add a comment
for Wayland not available when r8p1 is selected.

Thank you

Best regards
Giulio Benetti April 30, 2023, 9:35 p.m. UTC | #3
Hi Adrian,

On 23/04/23 23:46, Adrian Perez de Castro wrote:
> Hi,
> 
> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
>> Add a choice to allow using the Wayland variant of the Mali driver. When
>> selected, the package is marked as provider for libgbm as libMali.so
>> includes the symbols and a libgbm.so symlink is installed; and both
>> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
>>
>> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
> 
> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
> compositor without trouble, but unfortunately I do not have the hardware
> to test it... so I cannot really tell whether things work as expected.

Can you please pastebin or paste here the defconfig you've used to
build? I'm encountering some issues while building but I would like to
test on a board this patch.

Thank you!

Best regards
Adrian Perez de Castro May 3, 2023, 11:58 a.m. UTC | #4
Hello Giulio,

On Sun, 30 Apr 2023 23:35:03 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Hi Adrian,
> 
> On 23/04/23 23:46, Adrian Perez de Castro wrote:
> > Hi,
> > 
> > On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
> >> Add a choice to allow using the Wayland variant of the Mali driver. When
> >> selected, the package is marked as provider for libgbm as libMali.so
> >> includes the symbols and a libgbm.so symlink is installed; and both
> >> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
> >>
> >> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
> > 
> > With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
> > compositor without trouble, but unfortunately I do not have the hardware
> > to test it... so I cannot really tell whether things work as expected.
> 
> Can you please pastebin or paste here the defconfig you've used to
> build? I'm encountering some issues while building but I would like to
> test on a board this patch.

I am attaching the configuration file to this mail, it's based on
olimex_a20_olinuxino_lime2_defconfig and I have tested building wpewebkit
with the patch applied and it worked here. I hope this helps, and let me
know if I can help out in any other way :-)

> Thank you!
> 
> Best regards
> -- 
> Giulio Benetti
> Benetti Engineering sas
> 
> >> ---
> >>   package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
> >>   .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
> >>   2 files changed, 38 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
> >> index 59ac21f5ab..0856f220fd 100644
> >> --- a/package/sunxi-mali-utgard/Config.in
> >> +++ b/package/sunxi-mali-utgard/Config.in
> >> @@ -18,6 +18,9 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
> >>   config BR2_PACKAGE_PROVIDES_LIBGLES
> >>   	default "sunxi-mali-utgard"
> >>   
> >> +config BR2_PACKAGE_PROVIDES_LIBGBM
> >> +	default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> >> +
> >>   choice
> >>   	prompt "Version"
> >>   	default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
> >> @@ -38,6 +41,26 @@ config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
> >>   	default "r6p2"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
> >>   	default "r8p1"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
> >>   
> >> +choice
> >> +	prompt "Platform"
> >> +	default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> >> +	help
> >> +	  Select the target EGL platform.
> >> +
> >> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> >> +	bool "fbdev"
> >> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> >> +	bool "wayland"
> >> +	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
> >> +	select BR2_PACKAGE_HAS_LIBGBM
> >> +
> >> +endchoice
> >> +
> >> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM
> >> +	string
> >> +	default "fbdev" if BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> >> +	default "wayland" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> >> +
> >>   endif
> >>   
> >>   comment "sunxi-mali-utgard needs an EABIhf glibc toolchain"
> >> diff --git a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> >> index f693667955..23c6e8ec6e 100644
> >> --- a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> >> +++ b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> >> @@ -24,9 +24,9 @@ endif
> >>   define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
> >>   	mkdir -p $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include
> >>   
> >> -	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> >> +	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
> >>   		$(STAGING_DIR)/usr/lib/
> >> -	cp -rf $(@D)/include/fbdev/* $(STAGING_DIR)/usr/include/
> >> +	cp -rf $(@D)/include/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/* $(STAGING_DIR)/usr/include/
> >>   
> >>   	$(INSTALL) -D -m 0644 package/sunxi-mali-utgard/egl.pc \
> >>   		$(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> >> @@ -34,9 +34,21 @@ define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
> >>   		$(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> >>   endef
> >>   
> >> +ifeq ($(BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND),y)
> >> +define SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> >> +	sed -e '/^Cflags:/s/$$/ -DWL_EGL_PLATFORM/' \
> >> +		-e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> >> +		-i $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> >> +	sed -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> >> +		-i $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> >> +endef
> >> +SUNXI_MALI_UTGARD_POST_INSTALL_TARGET_HOOKS += SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> >> +SUNXI_MALI_UTGARD_DEPENDENCIES += wayland
> >> +endif
> >> +
> >>   define SUNXI_MALI_UTGARD_INSTALL_TARGET_CMDS
> >>   	mkdir -p $(TARGET_DIR)/usr/lib
> >> -	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> >> +	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
> >>   		$(TARGET_DIR)/usr/lib/
> >>   endef
> >>   
> >> -- 
> >> 2.40.0
> >>
> >> _______________________________________________
> >> buildroot mailing list
> >> buildroot@buildroot.org
> >> https://lists.buildroot.org/mailman/listinfo/buildroot
> >>
> > 
> > Cheers,
> > —Adrián
> > 
> > 
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

Cheers,
—Adrián
Giulio Benetti May 3, 2023, 7:47 p.m. UTC | #5
Hi Adrian,

> Il giorno 3 mag 2023, alle ore 13:58, Adrian Perez de Castro <aperez@igalia.com> ha scritto:
> 
> Hello Giulio,
> 
>> On Sun, 30 Apr 2023 23:35:03 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
>> Hi Adrian,
>> 
>>> On 23/04/23 23:46, Adrian Perez de Castro wrote:
>>> Hi,
>>> 
>>> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
>>>> Add a choice to allow using the Wayland variant of the Mali driver. When
>>>> selected, the package is marked as provider for libgbm as libMali.so
>>>> includes the symbols and a libgbm.so symlink is installed; and both
>>>> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
>>>> 
>>>> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
>>> 
>>> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
>>> compositor without trouble, but unfortunately I do not have the hardware
>>> to test it... so I cannot really tell whether things work as expected.
>> 
>> Can you please pastebin or paste here the defconfig you've used to
>> build? I'm encountering some issues while building but I would like to
>> test on a board this patch.
> 
> I am attaching the configuration file to this mail, it's based on
> olimex_a20_olinuxino_lime2_defconfig and I have tested building wpewebkit
> with the patch applied and it worked here. I hope this helps, and let me
> know if I can help out in any other way :-)

Thanks a lot. Can you also point me the SHA1 commit you were using to build?
This is because build fails at me not due to host problems.

Thanks again
Best regards
Giulio

> 
>> Thank you!
>> 
>> Best regards
>> -- 
>> Giulio Benetti
>> Benetti Engineering sas
>> 
>>>> ---
>>>>  package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
>>>>  .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
>>>>  2 files changed, 38 insertions(+), 3 deletions(-)
>>>> 
>>>> diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
>>>> index 59ac21f5ab..0856f220fd 100644
>>>> --- a/package/sunxi-mali-utgard/Config.in
>>>> +++ b/package/sunxi-mali-utgard/Config.in
>>>> @@ -18,6 +18,9 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
>>>>  config BR2_PACKAGE_PROVIDES_LIBGLES
>>>>      default "sunxi-mali-utgard"
>>>> 
>>>> +config BR2_PACKAGE_PROVIDES_LIBGBM
>>>> +    default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
>>>> +
>>>>  choice
>>>>      prompt "Version"
>>>>      default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
>>>> @@ -38,6 +41,26 @@ config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
>>>>      default "r6p2"    if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
>>>>      default "r8p1"    if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
>>>> 
>>>> +choice
>>>> +    prompt "Platform"
>>>> +    default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
>>>> +    help
>>>> +      Select the target EGL platform.
>>>> +
>>>> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
>>>> +    bool "fbdev"
>>>> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
>>>> +    bool "wayland"
>>>> +    select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
>>>> +    select BR2_PACKAGE_HAS_LIBGBM
>>>> +
>>>> +endchoice
>>>> +
>>>> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM
>>>> +    string
>>>> +    default "fbdev" if BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
>>>> +    default "wayland" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
>>>> +
>>>>  endif
>>>> 
>>>>  comment "sunxi-mali-utgard needs an EABIhf glibc toolchain"
>>>> diff --git a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
>>>> index f693667955..23c6e8ec6e 100644
>>>> --- a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
>>>> +++ b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
>>>> @@ -24,9 +24,9 @@ endif
>>>>  define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
>>>>      mkdir -p $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include
>>>> 
>>>> -    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
>>>> +    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
>>>>          $(STAGING_DIR)/usr/lib/
>>>> -    cp -rf $(@D)/include/fbdev/* $(STAGING_DIR)/usr/include/
>>>> +    cp -rf $(@D)/include/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/* $(STAGING_DIR)/usr/include/
>>>> 
>>>>      $(INSTALL) -D -m 0644 package/sunxi-mali-utgard/egl.pc \
>>>>          $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
>>>> @@ -34,9 +34,21 @@ define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
>>>>          $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
>>>>  endef
>>>> 
>>>> +ifeq ($(BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND),y)
>>>> +define SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
>>>> +    sed -e '/^Cflags:/s/$$/ -DWL_EGL_PLATFORM/' \
>>>> +        -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
>>>> +        -i $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
>>>> +    sed -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
>>>> +        -i $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
>>>> +endef
>>>> +SUNXI_MALI_UTGARD_POST_INSTALL_TARGET_HOOKS += SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
>>>> +SUNXI_MALI_UTGARD_DEPENDENCIES += wayland
>>>> +endif
>>>> +
>>>>  define SUNXI_MALI_UTGARD_INSTALL_TARGET_CMDS
>>>>      mkdir -p $(TARGET_DIR)/usr/lib
>>>> -    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
>>>> +    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
>>>>          $(TARGET_DIR)/usr/lib/
>>>>  endef
>>>> 
>>>> -- 
>>>> 2.40.0
>>>> 
>>>> _______________________________________________
>>>> buildroot mailing list
>>>> buildroot@buildroot.org
>>>> https://lists.buildroot.org/mailman/listinfo/buildroot
>>>> 
>>> 
>>> Cheers,
>>> —Adrián
>>> 
>>> 
>>> _______________________________________________
>>> buildroot mailing list
>>> buildroot@buildroot.org
>>> https://lists.buildroot.org/mailman/listinfo/buildroot
>> 
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
> 
> Cheers,
> —Adrián
> <lime2-mali-wl-config.xz>
Adrian Perez de Castro May 3, 2023, 8:29 p.m. UTC | #6
Hello Giulio.

On Wed, 03 May 2023 21:47:06 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:

> > Il giorno 3 mag 2023, alle ore 13:58, Adrian Perez de Castro <aperez@igalia.com> ha scritto:
> > 
> > Hello Giulio,
> > 
> >> On Sun, 30 Apr 2023 23:35:03 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> >> Hi Adrian,
> >> 
> >>> On 23/04/23 23:46, Adrian Perez de Castro wrote:
> >>> Hi,
> >>> 
> >>> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
> >>>> Add a choice to allow using the Wayland variant of the Mali driver. When
> >>>> selected, the package is marked as provider for libgbm as libMali.so
> >>>> includes the symbols and a libgbm.so symlink is installed; and both
> >>>> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
> >>>> 
> >>>> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
> >>> 
> >>> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
> >>> compositor without trouble, but unfortunately I do not have the hardware
> >>> to test it... so I cannot really tell whether things work as expected.
> >> 
> >> Can you please pastebin or paste here the defconfig you've used to
> >> build? I'm encountering some issues while building but I would like to
> >> test on a board this patch.
> > 
> > I am attaching the configuration file to this mail, it's based on
> > olimex_a20_olinuxino_lime2_defconfig and I have tested building wpewebkit
> > with the patch applied and it worked here. I hope this helps, and let me
> > know if I can help out in any other way :-)
> 
> Thanks a lot. Can you also point me the SHA1 commit you were using to build?
> This is because build fails at me not due to host problems.

Yes, I just tried a build today on 9a0857d734c5fca74915b1cd85b92555fe15fb93
before sending the .config file earlier.
 
> >> Thank you!
> >> 
> >> Best regards
> >> -- 
> >> Giulio Benetti
> >> Benetti Engineering sas
> >> 
> >>>> ---
> >>>>  package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
> >>>>  .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
> >>>>  2 files changed, 38 insertions(+), 3 deletions(-)
> >>>> 
> >>>> diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
> >>>> index 59ac21f5ab..0856f220fd 100644
> >>>> --- a/package/sunxi-mali-utgard/Config.in
> >>>> +++ b/package/sunxi-mali-utgard/Config.in
> >>>> @@ -18,6 +18,9 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
> >>>>  config BR2_PACKAGE_PROVIDES_LIBGLES
> >>>>      default "sunxi-mali-utgard"
> >>>> 
> >>>> +config BR2_PACKAGE_PROVIDES_LIBGBM
> >>>> +    default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> >>>> +
> >>>>  choice
> >>>>      prompt "Version"
> >>>>      default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
> >>>> @@ -38,6 +41,26 @@ config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
> >>>>      default "r6p2"    if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
> >>>>      default "r8p1"    if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
> >>>> 
> >>>> +choice
> >>>> +    prompt "Platform"
> >>>> +    default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> >>>> +    help
> >>>> +      Select the target EGL platform.
> >>>> +
> >>>> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> >>>> +    bool "fbdev"
> >>>> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> >>>> +    bool "wayland"
> >>>> +    select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
> >>>> +    select BR2_PACKAGE_HAS_LIBGBM
> >>>> +
> >>>> +endchoice
> >>>> +
> >>>> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM
> >>>> +    string
> >>>> +    default "fbdev" if BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> >>>> +    default "wayland" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> >>>> +
> >>>>  endif
> >>>> 
> >>>>  comment "sunxi-mali-utgard needs an EABIhf glibc toolchain"
> >>>> diff --git a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> >>>> index f693667955..23c6e8ec6e 100644
> >>>> --- a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> >>>> +++ b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> >>>> @@ -24,9 +24,9 @@ endif
> >>>>  define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
> >>>>      mkdir -p $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include
> >>>> 
> >>>> -    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> >>>> +    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
> >>>>          $(STAGING_DIR)/usr/lib/
> >>>> -    cp -rf $(@D)/include/fbdev/* $(STAGING_DIR)/usr/include/
> >>>> +    cp -rf $(@D)/include/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/* $(STAGING_DIR)/usr/include/
> >>>> 
> >>>>      $(INSTALL) -D -m 0644 package/sunxi-mali-utgard/egl.pc \
> >>>>          $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> >>>> @@ -34,9 +34,21 @@ define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
> >>>>          $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> >>>>  endef
> >>>> 
> >>>> +ifeq ($(BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND),y)
> >>>> +define SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> >>>> +    sed -e '/^Cflags:/s/$$/ -DWL_EGL_PLATFORM/' \
> >>>> +        -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> >>>> +        -i $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> >>>> +    sed -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> >>>> +        -i $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> >>>> +endef
> >>>> +SUNXI_MALI_UTGARD_POST_INSTALL_TARGET_HOOKS += SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> >>>> +SUNXI_MALI_UTGARD_DEPENDENCIES += wayland
> >>>> +endif
> >>>> +
> >>>>  define SUNXI_MALI_UTGARD_INSTALL_TARGET_CMDS
> >>>>      mkdir -p $(TARGET_DIR)/usr/lib
> >>>> -    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> >>>> +    cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
> >>>>          $(TARGET_DIR)/usr/lib/
> >>>>  endef
> >>>> 
> >>>> -- 
> >>>> 2.40.0
> >>>> 
> >>>> _______________________________________________
> >>>> buildroot mailing list
> >>>> buildroot@buildroot.org
> >>>> https://lists.buildroot.org/mailman/listinfo/buildroot
> >>>> 
> >>> 
> >>> Cheers,
> >>> —Adrián
> >>> 
> >>> 
> >>> _______________________________________________
> >>> buildroot mailing list
> >>> buildroot@buildroot.org
> >>> https://lists.buildroot.org/mailman/listinfo/buildroot
> >> 
> >> _______________________________________________
> >> buildroot mailing list
> >> buildroot@buildroot.org
> >> https://lists.buildroot.org/mailman/listinfo/buildroot
> > 
> > Cheers,
> > —Adrián
> > <lime2-mali-wl-config.xz>
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

Cheers,
—Adrián
Giulio Benetti May 7, 2023, 1 p.m. UTC | #7
Hi Adrian,

On 03/05/23 22:29, Adrian Perez de Castro wrote:
> Hello Giulio.
> 
> On Wed, 03 May 2023 21:47:06 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> 
>>> Il giorno 3 mag 2023, alle ore 13:58, Adrian Perez de Castro <aperez@igalia.com> ha scritto:
>>>
>>> Hello Giulio,
>>>
>>>> On Sun, 30 Apr 2023 23:35:03 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
>>>> Hi Adrian,
>>>>
>>>>> On 23/04/23 23:46, Adrian Perez de Castro wrote:
>>>>> Hi,
>>>>>
>>>>> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
>>>>>> Add a choice to allow using the Wayland variant of the Mali driver. When
>>>>>> selected, the package is marked as provider for libgbm as libMali.so
>>>>>> includes the symbols and a libgbm.so symlink is installed; and both
>>>>>> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
>>>>>>
>>>>>> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
>>>>>
>>>>> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
>>>>> compositor without trouble, but unfortunately I do not have the hardware
>>>>> to test it... so I cannot really tell whether things work as expected.
>>>>
>>>> Can you please pastebin or paste here the defconfig you've used to
>>>> build? I'm encountering some issues while building but I would like to
>>>> test on a board this patch.
>>>
>>> I am attaching the configuration file to this mail, it's based on
>>> olimex_a20_olinuxino_lime2_defconfig and I have tested building wpewebkit
>>> with the patch applied and it worked here. I hope this helps, and let me
>>> know if I can help out in any other way :-)
>>
>> Thanks a lot. Can you also point me the SHA1 commit you were using to build?
>> This is because build fails at me not due to host problems.
> 
> Yes, I just tried a build today on 9a0857d734c5fca74915b1cd85b92555fe15fb93
> before sending the .config file earlier.

Sorry but it still fails with this error:
https://pastebin.com/6Y4HTNfF

I've used the SHA1 you've pointed me that I've seen that refers to:
2022.02.12

I've used buildroot/utils/docker-run too and the error is the same.

Can you please take a look at it?

Maybe it would be better using at least version 2023.04 otherwise even
if it builds and works on the board we're not sure it works on master
branch.
By the way on master branch the error is the same and it's due to libepoxy.

Thank you!

Best regards
Adrian Perez de Castro May 9, 2023, 12:29 p.m. UTC | #8
Hi Giulio,

I had a moment to check your build failure, see the comment below.

On Sun, 07 May 2023 15:00:01 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Hi Adrian,
> 
> On 03/05/23 22:29, Adrian Perez de Castro wrote:
> > Hello Giulio.
> > 
> > On Wed, 03 May 2023 21:47:06 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> > 
> >>> Il giorno 3 mag 2023, alle ore 13:58, Adrian Perez de Castro <aperez@igalia.com> ha scritto:
> >>>
> >>> Hello Giulio,
> >>>
> >>>> On Sun, 30 Apr 2023 23:35:03 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> >>>> Hi Adrian,
> >>>>
> >>>>> On 23/04/23 23:46, Adrian Perez de Castro wrote:
> >>>>> Hi,
> >>>>>
> >>>>> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
> >>>>>> Add a choice to allow using the Wayland variant of the Mali driver. When
> >>>>>> selected, the package is marked as provider for libgbm as libMali.so
> >>>>>> includes the symbols and a libgbm.so symlink is installed; and both
> >>>>>> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
> >>>>>>
> >>>>>> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
> >>>>>
> >>>>> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
> >>>>> compositor without trouble, but unfortunately I do not have the hardware
> >>>>> to test it... so I cannot really tell whether things work as expected.
> >>>>
> >>>> Can you please pastebin or paste here the defconfig you've used to
> >>>> build? I'm encountering some issues while building but I would like to
> >>>> test on a board this patch.
> >>>
> >>> I am attaching the configuration file to this mail, it's based on
> >>> olimex_a20_olinuxino_lime2_defconfig and I have tested building wpewebkit
> >>> with the patch applied and it worked here. I hope this helps, and let me
> >>> know if I can help out in any other way :-)
> >>
> >> Thanks a lot. Can you also point me the SHA1 commit you were using to build?
> >> This is because build fails at me not due to host problems.
> > 
> > Yes, I just tried a build today on 9a0857d734c5fca74915b1cd85b92555fe15fb93
> > before sending the .config file earlier.
> 
> Sorry but it still fails with this error:
> https://pastebin.com/6Y4HTNfF
> 
> I've used the SHA1 you've pointed me that I've seen that refers to:
> 2022.02.12
> 
> I've used buildroot/utils/docker-run too and the error is the same.
> 
> Can you please take a look at it?

You need to apply this patch to make 2.38.x build correctly with drivers
which strictly declare GLESv2 functions and symbols in their headers without
any GLESv3 or Desktop GL additions:

  https://patchwork.ozlabs.org/project/buildroot/patch/20230423213233.2961770-1-aperez@igalia.com/

I actually wrote that patch so I could get WebKit built with this patch I
sent for sunxi-mali-utgard but forgot to mention it before. My apologies,
I've been a bit sleep deprived lately ^_^

> Maybe it would be better using at least version 2023.04 otherwise even
> if it builds and works on the board we're not sure it works on master
> branch.
> By the way on master branch the error is the same and it's due to libepoxy.

There are some warnings related to preprocessor macros redefined by the
headers included as part of libepoxy, but those should be harmless because
they are GLES macros with well-known values that all implementations must
define with the same constants.


Cheers,
—Adrián
Adrian Perez de Castro May 9, 2023, 12:33 p.m. UTC | #9
On Mon, 24 Apr 2023 00:46:42 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
> Hi,
> 
> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
> > Add a choice to allow using the Wayland variant of the Mali driver. When
> > selected, the package is marked as provider for libgbm as libMali.so
> > includes the symbols and a libgbm.so symlink is installed; and both
> > BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
> > 
> > Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
> 
> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
> compositor without trouble, but unfortunately I do not have the hardware
> to test it... so I cannot really tell whether things work as expected.

I forgot to mention that building WebKit{GTK,WPE} needs a small patch
for version 2.38.x, which was already submitted a little while ago:

  https://patchwork.ozlabs.org/project/buildroot/patch/20230423213233.2961770-1-aperez@igalia.com/

Note to self: submit also this for package/webkitgtk O:-)

> > ---
> >  package/sunxi-mali-utgard/Config.in           | 23 +++++++++++++++++++
> >  .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++++---
> >  2 files changed, 38 insertions(+), 3 deletions(-)
> > 
> > diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
> > index 59ac21f5ab..0856f220fd 100644
> > --- a/package/sunxi-mali-utgard/Config.in
> > +++ b/package/sunxi-mali-utgard/Config.in
> > @@ -18,6 +18,9 @@ config BR2_PACKAGE_PROVIDES_LIBEGL
> >  config BR2_PACKAGE_PROVIDES_LIBGLES
> >  	default "sunxi-mali-utgard"
> >  
> > +config BR2_PACKAGE_PROVIDES_LIBGBM
> > +	default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> > +
> >  choice
> >  	prompt "Version"
> >  	default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
> > @@ -38,6 +41,26 @@ config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
> >  	default "r6p2"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
> >  	default "r8p1"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
> >  
> > +choice
> > +	prompt "Platform"
> > +	default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> > +	help
> > +	  Select the target EGL platform.
> > +
> > +config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> > +	bool "fbdev"
> > +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> > +	bool "wayland"
> > +	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
> > +	select BR2_PACKAGE_HAS_LIBGBM
> > +
> > +endchoice
> > +
> > +config BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM
> > +	string
> > +	default "fbdev" if BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
> > +	default "wayland" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> > +
> >  endif
> >  
> >  comment "sunxi-mali-utgard needs an EABIhf glibc toolchain"
> > diff --git a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> > index f693667955..23c6e8ec6e 100644
> > --- a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> > +++ b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
> > @@ -24,9 +24,9 @@ endif
> >  define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
> >  	mkdir -p $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include
> >  
> > -	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> > +	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
> >  		$(STAGING_DIR)/usr/lib/
> > -	cp -rf $(@D)/include/fbdev/* $(STAGING_DIR)/usr/include/
> > +	cp -rf $(@D)/include/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/* $(STAGING_DIR)/usr/include/
> >  
> >  	$(INSTALL) -D -m 0644 package/sunxi-mali-utgard/egl.pc \
> >  		$(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> > @@ -34,9 +34,21 @@ define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
> >  		$(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> >  endef
> >  
> > +ifeq ($(BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND),y)
> > +define SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> > +	sed -e '/^Cflags:/s/$$/ -DWL_EGL_PLATFORM/' \
> > +		-e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> > +		-i $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
> > +	sed -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
> > +		-i $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
> > +endef
> > +SUNXI_MALI_UTGARD_POST_INSTALL_TARGET_HOOKS += SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
> > +SUNXI_MALI_UTGARD_DEPENDENCIES += wayland
> > +endif
> > +
> >  define SUNXI_MALI_UTGARD_INSTALL_TARGET_CMDS
> >  	mkdir -p $(TARGET_DIR)/usr/lib
> > -	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
> > +	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
> >  		$(TARGET_DIR)/usr/lib/
> >  endef
> >  
> > -- 
> > 2.40.0
> > 
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
> > 
> 
> Cheers,
> —Adrián
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

Cheers,
—Adrián
Giulio Benetti May 9, 2023, 8:08 p.m. UTC | #10
Hi Adrian,

On 09/05/23 14:33, Adrian Perez de Castro wrote:
> On Mon, 24 Apr 2023 00:46:42 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
>> Hi,
>>
>> On Mon, 24 Apr 2023 00:40:14 +0300 Adrian Perez de Castro <aperez@igalia.com> wrote:
>>> Add a choice to allow using the Wayland variant of the Mali driver. When
>>> selected, the package is marked as provider for libgbm as libMali.so
>>> includes the symbols and a libgbm.so symlink is installed; and both
>>> BR2_PACKAGE_HAS_{LIBGBM,LIBEGL_WAYLAND} are selected accordingly.
>>>
>>> Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
>>
>> With this I have been able to build WebKitGTK, WPEWebKit, and the Cage
>> compositor without trouble, but unfortunately I do not have the hardware
>> to test it... so I cannot really tell whether things work as expected.
> 
> I forgot to mention that building WebKit{GTK,WPE} needs a small patch
> for version 2.38.x, which was already submitted a little while ago:
> 
>    https://patchwork.ozlabs.org/project/buildroot/patch/20230423213233.2961770-1-aperez@igalia.com/
> 
> Note to self: submit also this for package/webkitgtk O:-)

this is a curse, neither that patch fixes the previous build failure :-/
Attached you find the defconfig I use for olinuxino lime.
Can you confirm that it fails at you too?

Thank you!

Best regards
diff mbox series

Patch

diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
index 59ac21f5ab..0856f220fd 100644
--- a/package/sunxi-mali-utgard/Config.in
+++ b/package/sunxi-mali-utgard/Config.in
@@ -18,6 +18,9 @@  config BR2_PACKAGE_PROVIDES_LIBEGL
 config BR2_PACKAGE_PROVIDES_LIBGLES
 	default "sunxi-mali-utgard"
 
+config BR2_PACKAGE_PROVIDES_LIBGBM
+	default "sunxi-mali-utgard" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
+
 choice
 	prompt "Version"
 	default BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2 if BR2_PACKAGE_SUNXI_MALI_MAINLINE_R6P2 # legacy
@@ -38,6 +41,26 @@  config BR2_PACKAGE_SUNXI_MALI_UTGARD_REVISION
 	default "r6p2"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
 	default "r8p1"	if BR2_PACKAGE_SUNXI_MALI_UTGARD_R8P1
 
+choice
+	prompt "Platform"
+	default BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
+	help
+	  Select the target EGL platform.
+
+config BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
+	bool "fbdev"
+config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
+	bool "wayland"
+	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
+	select BR2_PACKAGE_HAS_LIBGBM
+
+endchoice
+
+config BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM
+	string
+	default "fbdev" if BR2_PACKAGE_SUNXI_MALI_UTGARD_FBDEV
+	default "wayland" if BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
+
 endif
 
 comment "sunxi-mali-utgard needs an EABIhf glibc toolchain"
diff --git a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
index f693667955..23c6e8ec6e 100644
--- a/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
+++ b/package/sunxi-mali-utgard/sunxi-mali-utgard.mk
@@ -24,9 +24,9 @@  endif
 define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
 	mkdir -p $(STAGING_DIR)/usr/lib $(STAGING_DIR)/usr/include
 
-	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
+	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
 		$(STAGING_DIR)/usr/lib/
-	cp -rf $(@D)/include/fbdev/* $(STAGING_DIR)/usr/include/
+	cp -rf $(@D)/include/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/* $(STAGING_DIR)/usr/include/
 
 	$(INSTALL) -D -m 0644 package/sunxi-mali-utgard/egl.pc \
 		$(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
@@ -34,9 +34,21 @@  define SUNXI_MALI_UTGARD_INSTALL_STAGING_CMDS
 		$(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
 endef
 
+ifeq ($(BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND),y)
+define SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
+	sed -e '/^Cflags:/s/$$/ -DWL_EGL_PLATFORM/' \
+		-e '/^Requires:/s/$$/ wayland-client wayland-server/' \
+		-i $(STAGING_DIR)/usr/lib/pkgconfig/egl.pc
+	sed -e '/^Requires:/s/$$/ wayland-client wayland-server/' \
+		-i $(STAGING_DIR)/usr/lib/pkgconfig/glesv2.pc
+endef
+SUNXI_MALI_UTGARD_POST_INSTALL_TARGET_HOOKS += SUNXI_MALI_UTGARD_INSTALL_FIXUP_STAGING_PC_FILES
+SUNXI_MALI_UTGARD_DEPENDENCIES += wayland
+endif
+
 define SUNXI_MALI_UTGARD_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/usr/lib
-	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/fbdev/*.so* \
+	cp -rf $(@D)/$(SUNXI_MALI_UTGARD_REV)/$(SUNXI_MALI_UTGARD_ARCH)/$(BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM)/*.so* \
 		$(TARGET_DIR)/usr/lib/
 endef