diff mbox series

[v2] package/sunxi-mali-utgard: support the wayland driver

Message ID 20230424074012.3099559-1-aperez@igalia.com
State Accepted
Headers show
Series [v2] package/sunxi-mali-utgard: support the wayland driver | expand

Commit Message

Adrian Perez de Castro April 24, 2023, 7:40 a.m. UTC
Add a choice to allow using the Wayland variant of the r6p2 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>
---
Changes v1 -> v2:
  - Make Wayland support depend on version r6p2 (suggested by
    Giulio Benetti).
---
 package/sunxi-mali-utgard/Config.in           | 28 +++++++++++++++++++
 .../sunxi-mali-utgard/sunxi-mali-utgard.mk    | 18 ++++++++++--
 2 files changed, 43 insertions(+), 3 deletions(-)

Comments

Thomas Petazzoni Jan. 10, 2024, 9:34 p.m. UTC | #1
Hello,

On Mon, 24 Apr 2023 10:40:12 +0300
Adrian Perez de Castro <aperez@igalia.com> wrote:

> Add a choice to allow using the Wayland variant of the r6p2 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>
> ---
> Changes v1 -> v2:
>   - Make Wayland support depend on version r6p2 (suggested by
>     Giulio Benetti).

Thanks, I have applied, with two changes. See below.


> +config BR2_PACKAGE_SUNXI_MALI_UTGARD_WAYLAND
> +	bool "wayland"
> +	depends on BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
> +	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
> +	select BR2_PACKAGE_HAS_LIBGBM

	select BR2_PACKAGE_WAYLAND

was missing here. Indeed, you have "wayland" in the <pkg>_DEPENDENCIES,
but you didn't select it, causing a build failure.

> -	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* \

I have introduced an intermediate SUNXI_MALI_UTGARD_PLATFORM which
contains the qstripped value of BR2_PACKAGE_SUNXI_MALI_UTGARD_PLATFORM,
to keep things a bit nicer and aligned with what the package was
already doing for other variables.

Thanks a lot for this contribution, and sorry for the huge delay!

Thomas
diff mbox series

Patch

diff --git a/package/sunxi-mali-utgard/Config.in b/package/sunxi-mali-utgard/Config.in
index 59ac21f5ab..ffc4008c04 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,31 @@  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"
+	depends on BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
+	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
+	select BR2_PACKAGE_HAS_LIBGBM
+
+comment "wayland support requires version r6p2"
+	depends on !BR2_PACKAGE_SUNXI_MALI_UTGARD_R6P2
+
+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