package/freescale-imx/imx-gpu-viv: enable aarch64 framebuffer support

Back when the imx-gpu-viv package was enabled on AArch64 in commit
84afda9ca6, the fb output option was not
enabled.

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

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

This commit does enable fb output on AArch64, which requires a few
precautions as the imx-gpu-viv logic is a bit convoluted:

- FB on ARM is supported using "pure" framebuffer libraries. However,
  a specific egl.pc is needed: egl_linuxfb.pc. The supporting
  libraries are found in the fb/ subdirectory in imx-gpu-viv "code".

- FB on AArch64 is supported using libraries that are linked with
  wayland and libdrm, even though wayland/libdrm is obviously not used
  for framebuffer output. pkg-config wise, this configuration can use
  the default egl.pc. The supporting libraries are found in the
  wayland/ subdirectory in imx-gpu-viv "code", as oddly as it seems.

- Wayland on ARM on AArch64 is supported using libraries that are
  obviously linked against wayland and libdrm. pkg-config wise, egl.pc
  needs to be symlinked to egl_wayland.pc.

This patch solves this situation by introducing a hidden boolean
option BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND that indicates whether
wayland/libdrm is used by the currently selected output. This is of
course true when BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_WL, but also when
BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_FB on AArch64.

Signed-off-by: Daniel Lang <d.lang@abatec.at>
[Thomas: quite significant rework compared to the submission from
Daniel Lang, so we didn't keep the Reviewed-by from Gary Bisson]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Lang Daniel
2023-03-13 09:16:31 +00:00
committed by Thomas Petazzoni
parent c8adccf8df
commit faf2b8a627
2 changed files with 24 additions and 15 deletions

View File

@@ -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
@@ -34,6 +31,13 @@ config BR2_PACKAGE_IMX_GPU_VIV
This library is provided by Freescale as-is and doesn't have
an upstream.
# Library binaries are linked against libdrm.so.2 and libwayland,
# except framebuffer output on ARM
config BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND
bool
select BR2_PACKAGE_LIBDRM
select BR2_PACKAGE_WAYLAND
if BR2_PACKAGE_IMX_GPU_VIV
choice
@@ -45,12 +49,13 @@ choice
config BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_FB
bool "Framebuffer"
# The i.MX8 aarch64 blob doesn't support FB output
depends on BR2_arm
# Yes, the ARM64 framebuffer libraries link against
# libdrm/libwayland.
select BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND if BR2_aarch64
config BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_WL
bool "Wayland"
select BR2_PACKAGE_WAYLAND
select BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND
endchoice

View File

@@ -27,20 +27,24 @@ endif
IMX_GPU_VIV_OUTPUT = $(call qstrip,$(BR2_PACKAGE_IMX_GPU_VIV_OUTPUT))
# Libraries are linked against libdrm, except framebuffer output on ARM
ifneq ($(IMX_GPU_VIV_OUTPUT)$(BR2_arm),fby)
IMX_GPU_VIV_DEPENDENCIES += libdrm
endif
ifeq ($(IMX_GPU_VIV_OUTPUT),wayland)
IMX_GPU_VIV_DEPENDENCIES += wayland
ifeq ($(BR2_PACKAGE_IMX_GPU_VIV_USES_WAYLAND),y)
IMX_GPU_VIV_DEPENDENCIES += libdrm wayland
IMX_GPU_VIV_LIBDIR = wayland
else
IMX_GPU_VIV_LIBDIR = 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_OUTPUT),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_OUTPUT):$(BR2_arm),fb:y)
define IMX_GPU_VIV_FIXUP_PKGCONFIG
ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
endef
@@ -61,7 +65,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_OUTPUT)/* $(@D)/gpu-core/usr/lib/
cp -dpfr $(@D)/gpu-core/usr/lib/$(IMX_GPU_VIV_LIBDIR)/* $(@D)/gpu-core/usr/lib/
$(foreach backend,fb wayland, \
$(RM) -r $(@D)/gpu-core/usr/lib/$(backend)
)