Skip to contentSkip to conversation

package/mesa3d: add Gallium VA-API support

PATCH Applied Thomas Devoogdt 2 participants 4 messages May 17 – May 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/mesa3d: add Gallium VA-API support

Since commit 361bfbc70b2b (package/mesa3d: disable libva support), VA-API has been unconditionally disabled in mesa3d due to a circular dependency between mesa3d, libva and libgl.

The circular dependency only occurs when mesa3d is the libgl provider, i.e. when GLX is enabled without libglvnd. In that case:
mesa3d -> libva -> libgl -> mesa3d

Re-enable VA-API support as a new BR2_PACKAGE_MESA3D_GALLIUM_VA option, guarded by a dependency that prevents the circular case. This allows hardware video acceleration on AMD, Intel and other GPUs with Gallium drivers.

---
 package/mesa3d/Config.in | 13 +++++++++++++
 package/mesa3d/mesa3d.mk |  7 +++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
package/mesa3d/Config.in +13 -0
index 66ebe04394..bfd072d6d0 100644
@@ -461,6 +461,19 @@ config BR2_PACKAGE_MESA3D_OPENGL_ES
 
 endif # BR2_PACKAGE_MESA3D_DRIVER
 
+config BR2_PACKAGE_MESA3D_GALLIUM_VA
+	bool "Gallium VA-API"
+	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
+	# circular dependency: mesa3d -> libva -> libgl -> mesa3d
+	depends on !BR2_PACKAGE_MESA3D_OPENGL_GLX || BR2_PACKAGE_LIBGLVND
+	select BR2_PACKAGE_LIBVA
+	help
+	  Enable VA-API video acceleration support in Gallium drivers.
+
+comment "Gallium VA-API needs a gallium driver, incompatible with GLX w/o libglvnd"
+	depends on !BR2_PACKAGE_MESA3D_GALLIUM_DRIVER || \
+		(BR2_PACKAGE_MESA3D_OPENGL_GLX && !BR2_PACKAGE_LIBGLVND)
+
 config BR2_PACKAGE_PROVIDES_LIBGBM
 	default "mesa3d" if BR2_PACKAGE_MESA3D_GBM
 
package/mesa3d/mesa3d.mk +5 -2
index 1eaa4c577e..98f1c6c2bb 100644
@@ -182,9 +182,12 @@ endif
 #   - Building OpenGL ES without OpenGL is not supported, so always keep opengl enabled.
 MESA3D_CONF_OPTS += -Dopengl=true
 
-# libva and mesa3d have a circular dependency
-# we do not need libva support in mesa3d, therefore disable this option
+ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_VA),y)
+MESA3D_CONF_OPTS += -Dgallium-va=enabled
+MESA3D_DEPENDENCIES += libva
+else
 MESA3D_CONF_OPTS += -Dgallium-va=disabled
+endif
 
 # libGL is only provided for a full xorg stack, without libglvnd
 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/mesa3d: add option to enable patent video codecs

By default, mesa uses -Dvideo-codecs=all_free which only includes royalty-free codecs (AV1, VP9, MPEG-1/2, JPEG).

Add a new BR2_PACKAGE_MESA3D_VIDEO_CODECS option to set -Dvideo-codecs=all, which additionally enables patent-encumbered codecs (H.264, H.265, VC-1) for both Gallium VA-API and Vulkan video decode/encode.

---
 package/mesa3d/Config.in | 14 ++++++++++++++
 package/mesa3d/mesa3d.mk |  6 ++++++
 2 files changed, 20 insertions(+)
package/mesa3d/Config.in +14 -0
index bfd072d6d0..851faeae0a 100644
@@ -474,6 +474,20 @@ comment "Gallium VA-API needs a gallium driver, incompatible with GLX w/o libglv
 	depends on !BR2_PACKAGE_MESA3D_GALLIUM_DRIVER || \
 		(BR2_PACKAGE_MESA3D_OPENGL_GLX && !BR2_PACKAGE_LIBGLVND)
 
+config BR2_PACKAGE_MESA3D_VIDEO_CODECS
+	bool "patent video codecs (H.264, H.265)"
+	depends on BR2_PACKAGE_MESA3D_GALLIUM_VA || BR2_PACKAGE_MESA3D_VULKAN_DRIVER
+	help
+	  Enable patent-encumbered video codec support (H.264, H.265,
+	  VC-1 decode/encode) for Gallium VA-API and/or Vulkan video.
+
+	  Without this, only royalty-free codecs are supported
+	  (AV1, VP9, MPEG-1/2, JPEG).
+
+comment "patent video codecs need Gallium VA-API or a Vulkan driver"
+	depends on !BR2_PACKAGE_MESA3D_GALLIUM_VA && \
+		!BR2_PACKAGE_MESA3D_VULKAN_DRIVER
+
 config BR2_PACKAGE_PROVIDES_LIBGBM
 	default "mesa3d" if BR2_PACKAGE_MESA3D_GBM
 
package/mesa3d/mesa3d.mk +6 -0
index 98f1c6c2bb..8734176c45 100644
@@ -189,6 +189,12 @@ else
 MESA3D_CONF_OPTS += -Dgallium-va=disabled
 endif
 
+ifeq ($(BR2_PACKAGE_MESA3D_VIDEO_CODECS),y)
+MESA3D_CONF_OPTS += -Dvideo-codecs=all
+else
+MESA3D_CONF_OPTS += -Dvideo-codecs=all_free
+endif
+
 # libGL is only provided for a full xorg stack, without libglvnd
 ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
 MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v1 2/2] package/mesa3d: add option to enable patent video codecs

Quoted 19 lines · Thomas Devoogdt

By default, mesa uses -Dvideo-codecs=all_free which only includes royalty-free codecs (AV1, VP9, MPEG-1/2, JPEG).

Add a new BR2_PACKAGE_MESA3D_VIDEO_CODECS option to set -Dvideo-codecs=all, which additionally enables patent-encumbered codecs (H.264, H.265, VC-1) for both Gallium VA-API and Vulkan video decode/encode.

---
  package/mesa3d/Config.in | 14 ++++++++++++++
  package/mesa3d/mesa3d.mk |  6 ++++++
  2 files changed, 20 insertions(+)
package/mesa3d/Config.in +0 -0
index bfd072d6d0..851faeae0a 100644

package/mesa3d/Config.in comment "Gallium VA-API needs a gallium driver, incompatible with GLX w/o libglv · line 477

Quoted 4 lines
package/mesa3d/Config.in +1 -0
@@ -474,6 +474,20 @@ comment "Gallium VA-API needs a gallium driver, incompatible with GLX w/o libglv
  	depends on !BR2_PACKAGE_MESA3D_GALLIUM_DRIVER || \
  		(BR2_PACKAGE_MESA3D_OPENGL_GLX && !BR2_PACKAGE_LIBGLVND)
 
+config BR2_PACKAGE_MESA3D_VIDEO_CODECS

I've changed the symbol name to BR2_PACKAGE_MESA3D_PATENTED_VIDEO_CODECS
(sorry that that creates more work for you...).

package/mesa3d/Config.in comment "Gallium VA-API needs a gallium driver, incompatible with GLX w/o libglv · line 478

Quoted 1 line
package/mesa3d/Config.in +1 -0
+	bool "patent video codecs (H.264, H.265)"

I think the proper term here is "patented".

Applied to next with those changes, thanks.

Regards,
Arnout

Quoted 22 lines
package/mesa3d/Config.in +12 -0
+	depends on BR2_PACKAGE_MESA3D_GALLIUM_VA || BR2_PACKAGE_MESA3D_VULKAN_DRIVER
+	help
+	  Enable patent-encumbered video codec support (H.264, H.265,
+	  VC-1 decode/encode) for Gallium VA-API and/or Vulkan video.
+
+	  Without this, only royalty-free codecs are supported
+	  (AV1, VP9, MPEG-1/2, JPEG).
+
+comment "patent video codecs need Gallium VA-API or a Vulkan driver"
+	depends on !BR2_PACKAGE_MESA3D_GALLIUM_VA && \
+		!BR2_PACKAGE_MESA3D_VULKAN_DRIVER
+
  config BR2_PACKAGE_PROVIDES_LIBGBM
  	default "mesa3d" if BR2_PACKAGE_MESA3D_GBM
 
package/mesa3d/mesa3d.mk +0 -0
index 98f1c6c2bb..8734176c45 100644
@@ -189,6 +189,12 @@ else
  MESA3D_CONF_OPTS += -Dgallium-va=disabled
  endif

package/mesa3d/mesa3d.mk else · line 200

Quoted 10 lines
package/mesa3d/mesa3d.mk +6 -0
 
+ifeq ($(BR2_PACKAGE_MESA3D_VIDEO_CODECS),y)
+MESA3D_CONF_OPTS += -Dvideo-codecs=all
+else
+MESA3D_CONF_OPTS += -Dvideo-codecs=all_free
+endif
+
  # libGL is only provided for a full xorg stack, without libglvnd
  ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)
  MESA3D_PROVIDES += $(if $(BR2_PACKAGE_LIBGLVND),,libgl)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Thomas Devoogdt
Quoted 6 lines · Thomas Devoogdt

Since commit 361bfbc70b2b (package/mesa3d: disable libva support), VA-API has been unconditionally disabled in mesa3d due to a circular dependency between mesa3d, libva and libgl.

The circular dependency only occurs when mesa3d is the libgl provider, i.e. when GLX is enabled without libglvnd. In that case:

Quoted 8 lines
   mesa3d -> libva -> libgl -> mesa3d

Re-enable VA-API support as a new BR2_PACKAGE_MESA3D_GALLIUM_VA option, guarded by a dependency that prevents the circular case. This allows hardware video acceleration on AMD, Intel and other GPUs with Gallium drivers.

Since the Signed-off-by has your barco address, I used that as the author
address as well.

Applied to next with that changed, thanks.

Regards,
Arnout

Quoted 38 lines
---
  package/mesa3d/Config.in | 13 +++++++++++++
  package/mesa3d/mesa3d.mk |  7 +++++--
  2 files changed, 18 insertions(+), 2 deletions(-)
package/mesa3d/Config.in +13 -0
index 66ebe04394..bfd072d6d0 100644
@@ -461,6 +461,19 @@ config BR2_PACKAGE_MESA3D_OPENGL_ES
 
  endif # BR2_PACKAGE_MESA3D_DRIVER
 
+config BR2_PACKAGE_MESA3D_GALLIUM_VA
+	bool "Gallium VA-API"
+	depends on BR2_PACKAGE_MESA3D_GALLIUM_DRIVER
+	# circular dependency: mesa3d -> libva -> libgl -> mesa3d
+	depends on !BR2_PACKAGE_MESA3D_OPENGL_GLX || BR2_PACKAGE_LIBGLVND
+	select BR2_PACKAGE_LIBVA
+	help
+	  Enable VA-API video acceleration support in Gallium drivers.
+
+comment "Gallium VA-API needs a gallium driver, incompatible with GLX w/o libglvnd"
+	depends on !BR2_PACKAGE_MESA3D_GALLIUM_DRIVER || \
+		(BR2_PACKAGE_MESA3D_OPENGL_GLX && !BR2_PACKAGE_LIBGLVND)
+
  config BR2_PACKAGE_PROVIDES_LIBGBM
  	default "mesa3d" if BR2_PACKAGE_MESA3D_GBM
 
package/mesa3d/mesa3d.mk +0 -1
index 1eaa4c577e..98f1c6c2bb 100644
@@ -182,9 +182,12 @@ endif
  #   - Building OpenGL ES without OpenGL is not supported, so always keep opengl enabled.
  MESA3D_CONF_OPTS += -Dopengl=true
 
-# libva and mesa3d have a circular dependency

package/mesa3d/mesa3d.mk endif · line 193

Quoted 10 lines
package/mesa3d/mesa3d.mk +5 -1
-# we do not need libva support in mesa3d, therefore disable this option
+ifeq ($(BR2_PACKAGE_MESA3D_GALLIUM_VA),y)
+MESA3D_CONF_OPTS += -Dgallium-va=enabled
+MESA3D_DEPENDENCIES += libva
+else
  MESA3D_CONF_OPTS += -Dgallium-va=disabled
+endif
 
  # libGL is only provided for a full xorg stack, without libglvnd
  ifeq ($(BR2_PACKAGE_MESA3D_OPENGL_GLX),y)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot