diff mbox series

[2/3] package/freescale-imx/imx-gpu-viv: add IMX8 framebuffer support

Message ID VI1P190MB0493F59C8F6F866D287232FC9FFF9@VI1P190MB0493.EURP190.PROD.OUTLOOK.COM
State Superseded
Headers show
Series [1/3] package/freescale-imx/imx-gpu-viv: drop X11 output | expand

Commit Message

Lang Daniel Jan. 10, 2023, 9:33 a.m. UTC
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

Signed-off-by: Daniel Lang <d.lang@abatec.at>
---
 package/freescale-imx/imx-gpu-viv/Config.in   |  4 ++--
 .../freescale-imx/imx-gpu-viv/imx-gpu-viv.mk  | 20 ++++++++++---------
 2 files changed, 13 insertions(+), 11 deletions(-)

Comments

Thomas Petazzoni Jan. 14, 2023, 10:04 p.m. UTC | #1
On Tue, 10 Jan 2023 09:33:14 +0000
Lang Daniel via buildroot <buildroot@buildroot.org> wrote:

> 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.

Indeed. I've seen something similar on the Vivante binaries used on
STM32MP1 platforms, where the "framebuffer" libs are linked against
libwayland even though they don't use it.

> -# Libraries are linked against libdrm, except framebuffer output on ARM
> +# Libraries are linked against libdrm and wayland, 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
> +IMX_GPU_VIV_DEPENDENCIES += libdrm wayland
>  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)
> +ifeq ($(IMX_GPU_VIV_LIB_TARGET)$(BR2_arm),fby)
> +IMX_GPU_VIV_BACKEND_DIR = fb
>  define IMX_GPU_VIV_FIXUP_PKGCONFIG
>       ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
>  endef
> -else ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
> +else
> +# Framebuffer output on IMX8 (ARM64) uses egl.pc
> +# and the same libraries as the wayland backend.
> +IMX_GPU_VIV_BACKEND_DIR = wayland
> +ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
>  define IMX_GPU_VIV_FIXUP_PKGCONFIG
>       ln -sf egl_wayland.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
>  endef
>  endif
> +endif

On this second part I'm a bit confused because in the "fb" case on
ARM64 you're don't have any egl.pc pkgconfig fixup. Are you sure this
is normal?

Indeed the code you have does this:

if framebuffer output and ARM:
	install egl.pc as a symlink to egl_linuxfb.pc
else:
	if wayland output:
		install egl.pc as a symlink to egl_wayland.pc

which means that in the framebuffer case on ARM64, you're not
installing any egl.pc symlink. Is this really OK?

Thanks!

Thomas
Lang Daniel Jan. 16, 2023, 8:01 a.m. UTC | #2
Hello Thomas,

> On Tue, 10 Jan 2023 09:33:14 +0000
> Lang Daniel via buildroot <buildroot@buildroot.org> wrote:
> 
> > 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.
> 
> Indeed. I've seen something similar on the Vivante binaries used on
> STM32MP1 platforms, where the "framebuffer" libs are linked against
> libwayland even though they don't use it.
> 
> > -# Libraries are linked against libdrm, except framebuffer output on ARM
> > +# Libraries are linked against libdrm and wayland, 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
> > +IMX_GPU_VIV_DEPENDENCIES += libdrm wayland
> >  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)
> > +ifeq ($(IMX_GPU_VIV_LIB_TARGET)$(BR2_arm),fby)
> > +IMX_GPU_VIV_BACKEND_DIR = fb
> >  define IMX_GPU_VIV_FIXUP_PKGCONFIG
> >       ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
> >  endef
> > -else ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
> > +else
> > +# Framebuffer output on IMX8 (ARM64) uses egl.pc
> > +# and the same libraries as the wayland backend.
> > +IMX_GPU_VIV_BACKEND_DIR = wayland
> > +ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
> >  define IMX_GPU_VIV_FIXUP_PKGCONFIG
> >       ln -sf egl_wayland.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
> >  endef
> >  endif
> > +endif
> 
> On this second part I'm a bit confused because in the "fb" case on
> ARM64 you're don't have any egl.pc pkgconfig fixup. Are you sure this
> is normal?
> 
> Indeed the code you have does this:
> 
> if framebuffer output and ARM:
>         install egl.pc as a symlink to egl_linuxfb.pc
> else:
>         if wayland output:
>                 install egl.pc as a symlink to egl_wayland.pc
> 
> which means that in the framebuffer case on ARM64, you're not
> installing any egl.pc symlink. Is this really OK?
> 

The AMD64 blob contains multiple versions of egl.pc:
- egl_linuxfb.pc
- egl_wayland.pc
- egl.pc

meta-freescale [1] installs
- egl_linuxfb.pc as egl.pc for framebuffer backend on imx6 and 7.
- egl_wayland.pc as egl.pc for wayland backend
- egl.pc as egl.pc for framebuffer backend on imx8 and beyond.

The imx-gpu-viv package installs/copies everything in one go,
therefore symlinks are created that replace the originally provided
egl.pc if another version is needed.
AMD64 framebuffer backend uses egl.pc directly.

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

> Thanks!
> 
> Thomas

Regards
Daniel
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 bc30798ca5..a245a1d089 100644
--- a/package/freescale-imx/imx-gpu-viv/Config.in
+++ b/package/freescale-imx/imx-gpu-viv/Config.in
@@ -45,8 +45,8 @@  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
+     # Framebuffer output on IMX8 (ARM64) uses the wayland libraries
+     select BR2_PACKAGE_WAYLAND if BR2_aarch64
 
 config BR2_PACKAGE_IMX_GPU_VIV_OUTPUT_WL
      bool "Wayland"
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 e0e8a31533..35929b0e5c 100644
--- a/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
+++ b/package/freescale-imx/imx-gpu-viv/imx-gpu-viv.mk
@@ -26,34 +26,36 @@  endif
 
 IMX_GPU_VIV_LIB_TARGET = $(call qstrip,$(BR2_PACKAGE_IMX_GPU_VIV_OUTPUT))
 
-# Libraries are linked against libdrm, except framebuffer output on ARM
+# Libraries are linked against libdrm and wayland, 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
+IMX_GPU_VIV_DEPENDENCIES += libdrm wayland
 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)
+ifeq ($(IMX_GPU_VIV_LIB_TARGET)$(BR2_arm),fby)
+IMX_GPU_VIV_BACKEND_DIR = fb
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
      ln -sf egl_linuxfb.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
 endef
-else ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
+else
+# Framebuffer output on IMX8 (ARM64) uses egl.pc
+# and the same libraries as the wayland backend.
+IMX_GPU_VIV_BACKEND_DIR = wayland
+ifeq ($(IMX_GPU_VIV_LIB_TARGET),wayland)
 define IMX_GPU_VIV_FIXUP_PKGCONFIG
      ln -sf egl_wayland.pc $(@D)/gpu-core/usr/lib/pkgconfig/egl.pc
 endef
 endif
+endif
 
 # Instead of building, we fix up the inconsistencies that exist
 # 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_BACKEND_DIR)/* $(@D)/gpu-core/usr/lib/
      $(foreach backend,fb wayland, \
            $(RM) -r $(@D)/gpu-core/usr/lib/$(backend)
      )