diff mbox series

[v3] package/freescale-imx/imx-gpu-viv: fix aarch64 framebuffer support

Message ID VI1P190MB04933DDA75BE1BC9A23B06929FB99@VI1P190MB0493.EURP190.PROD.OUTLOOK.COM
State New
Headers show
Series [v3] package/freescale-imx/imx-gpu-viv: fix aarch64 framebuffer support | expand

Commit Message

Lang Daniel March 13, 2023, 9:16 a.m. UTC
Since e8df0f7 (package/freescale-imx/imx-gpu-viv: bump to version 6.4.3.p4.4)
the fb folder for aarch64 is no longer included in the archive.

According to meta-freescale [0] the framebuffer output can be enabled on
IMX8 by using the wayland libraries together with egl.pc.

Tested on an imx8mn by running kmscube. EGL and GLES support detected.

[0]: https://git.yoctoproject.org/meta-freescale/tree/recipes-graphics/imx-gpu-viv/imx-gpu-viv-6.inc

Fixes:
cp: cannot stat '/home/d.lang/buildroot/output/build/imx-gpu-viv-6.4.3.p4.4-aarch64/gpu-core/usr/lib/fb/*': No such file or directory

Signed-off-by: Daniel Lang <d.lang@abatec.at>
---
v1 -> v2:
 - Mention current build failure
 - Add information for egl.pc selection
v2 -> v3:
- Introduce BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND
---
 package/freescale-imx/imx-gpu-viv/Config.in   | 16 +++++++++-----
 .../freescale-imx/imx-gpu-viv/imx-gpu-viv.mk  | 22 +++++++++++--------
 2 files changed, 23 insertions(+), 15 deletions(-)

Comments

Gary Bisson May 12, 2023, 4:07 p.m. UTC | #1
Hi,

On Mon, Mar 13, 2023 at 09:16:31AM +0000, Lang Daniel wrote:
> Since e8df0f7 (package/freescale-imx/imx-gpu-viv: bump to version 6.4.3.p4.4)
> the fb folder for aarch64 is no longer included in the archive.
> 
> According to meta-freescale [0] the framebuffer output can be enabled on
> IMX8 by using the wayland libraries together with egl.pc.
> 
> Tested on an imx8mn by running kmscube. EGL and GLES support detected.
> 
> [0]: https://git.yoctoproject.org/meta-freescale/tree/recipes-graphics/imx-gpu-viv/imx-gpu-viv-6.inc

A possible improvement, that can be done in a follow-up patch, would be
to remove the examples option when arm64+fb is used. It won't cause any
build issue anyway, just that the examples require a wayland compositor.

> Fixes:
> cp: cannot stat '/home/d.lang/buildroot/output/build/imx-gpu-viv-6.4.3.p4.4-aarch64/gpu-core/usr/lib/fb/*': No such file or directory
> 
> Signed-off-by: Daniel Lang <d.lang@abatec.at>

Reviewed-by: Gary Bisson <bisson.gary@gmail.com>

Regards,
Gary
diff mbox series

Patch

diff --git a/package/freescale-imx/imx-gpu-viv/Config.in b/package/freescale-imx/imx-gpu-viv/Config.in
index 3e095b730c..0e759f6183 100644
--- a/package/freescale-imx/imx-gpu-viv/Config.in
+++ b/package/freescale-imx/imx-gpu-viv/Config.in
@@ -12,9 +12,6 @@  config BR2_PACKAGE_IMX_GPU_VIV
 	depends on (BR2_arm && BR2_ARM_EABIHF) || BR2_aarch64
 	# Library binaries are linked against libc.so.6
 	depends on BR2_TOOLCHAIN_USES_GLIBC
-	# Library binaries are linked against libdrm.so.2, except framebuffer
-	# output on ARM
-	select BR2_PACKAGE_LIBDRM if !(BR2_arm && BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_FB)
 	select BR2_PACKAGE_HAS_LIBEGL
 	select BR2_PACKAGE_HAS_LIBGLES
 	# gbm is only available in the aarch64 blobs
@@ -45,12 +42,9 @@  choice
 
 config BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_FB
 	bool "Framebuffer"
-	# The i.MX8 blob doesn't support FB output
-	depends on !BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M
 
 config BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_WL
 	bool "Wayland"
-	select BR2_PACKAGE_WAYLAND
 	select BR2_PACKAGE_HAS_LIBEGL_WAYLAND
 
 endchoice
@@ -85,6 +79,16 @@  config BR2_PACKAGE_IMX_GPU_VIV_PLATFORM
 	default "mx8qm" if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8
 	default "mx8qxp" if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X
 
+# Library binaries are linked against libdrm and wayland,
+# except framebuffer output on ARM.
+# Framebuffer output on aarch64 uses the same libraries
+# as wayland output.
+config BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND
+	bool
+	default y if !(BR2_arm && BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_FB)
+	select BR2_PACKAGE_LIBDRM
+	select BR2_PACKAGE_WAYLAND
+
 endif
 
 config BR2_PACKAGE_IMX_GPU_VIV_EXAMPLES
diff --git a/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk b/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
index f72735e093..359dcc5923 100644
--- a/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
+++ b/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
@@ -26,20 +26,24 @@  endif
 
 IMX_GPU_VIV_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_IMX_GPU_VIV_OUTPUT))
 
-# Libraries are linked against libdrm, except framebuffer output on ARM
-ifneq ($(IMX_GPU_VIV_LIB_TARGET)$(BR2_arm),fby)
-IMX_GPU_VIV_DEPENDENCIES += libdrm
-endif
-
-ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
-IMX_GPU_VIV_DEPENDENCIES += wayland
+ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND),y)
+IMX_GPU_VIV_DEPENDENCIES += libdrm wayland
+IMX_GPU_VIV_OUTPUT_DIR = wayland
+else
+IMX_GPU_VIV_OUTPUT_DIR = fb
 endif
 
 define IMX_GPU_VIV_EXTRACT_CMDS
 	$(call NXP_EXTRACT_HELPER,$(IMX_GPU_VIV_DL_DIR)/$(IMX_GPU_VIV_SOURCE))
 endef
 
-ifeq ($(IMX_GPU_VIV_LIB_TARGET),fb)
+# The package comes with multiple versions of egl.pc,
+# depending on the output the original egl.pc is replaced
+# with a symlink:
+# - arm/frambuffer: symlink to egl_linuxfb.pc
+# - aarch64/framebuffer: original egl.pc without a symlink
+# - wayland: symblink to egl_wayland.pc
+ifeq ($(IMX_GPU_VIV_LIB_TARGET)$(BR2_arm),fby)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
 	ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
 endef
@@ -60,7 +64,7 @@  endif
 # in the upstream archive here. We also remove unused backend files.
 # Make sure these commands are idempotent.
 define IMX_GPU_VIV_BUILD_CMDS
-	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIB_TARGET)/* $(@D)/gpu-core/usr/lib/
+	cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_OUTPUT_DIR)/* $(@D)/gpu-core/usr/lib/
 	$(foreach backend,fb wayland, \
 		$(RM) -r $(@D)/gpu-core/usr/lib/$(backend)
 	)