From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Tristan van Berkom via buildroot <buildroot@buildroot.org>
Cc: Romain Naour <romain.naour@gmail.com>,
Bernd Kuhls <bernd@kuhls.net>,
Tristan van Berkom <tristan.vanberkom@codethink.co.uk>
Subject: Re: [Buildroot] [PATCH] package/mesa3d: Allow building patent encumbered video codecs
Date: Tue, 22 Aug 2023 23:28:00 +0200 [thread overview]
Message-ID: <20230822232800.1901678d@windsurf> (raw)
In-Reply-To: <049052a13b668b1243c1a035955b57e2b12c90dc.camel@codethink.co.uk>
Hello Tristan,
On Fri, 04 Aug 2023 20:12:43 +0900
Tristan van Berkom via buildroot <buildroot@buildroot.org> wrote:
> This patch adds some options to allow building the patent encumbered
> codecs in mesa, such as H.264/H.265 encoders/decoders which are useful
> for hardware accelerated decoding via libva/gstreamer.
>
> These codecs are now disabled by default in upstream mesa as per:
> https://gitlab.freedesktop.org/mesa/mesa/-/commit/7d969fe9e91e39e03041cdfac69bf33337bc2c96
>
> Signed-off-by: Tristan van Berkom <tristan.vanberkom@codethink.co.uk>
> ---
> package/mesa3d/Config.in | 36 ++++++++++++++++++++++++++++++++++++
> package/mesa3d/mesa3d.mk | 11 +++++++++++
> 2 files changed, 47 insertions(+)
Thanks for your patch. I have one implementation suggestion (which I
had already implemented locally as I was about to merge your patch) but
also a more fundamental question that I was not able to answer directly.
> +# inform the .mk file of video codec selection
> +config BR2_PACKAGE_MESA3D_VIDEO_CODEC
> + bool
This option is not needed, and all the "select" of it can be dropped.
> +# Video codecs (patent encumbered)
> +MESA3D_VIDEO_CODECS-$(BR2_PACKAGE_MESA3D_VIDEO_CODEC_VC1DEC) += vc1dec
> +MESA3D_VIDEO_CODECS-$(BR2_PACKAGE_MESA3D_VIDEO_CODEC_H264DEC) += h264dec
> +MESA3D_VIDEO_CODECS-$(BR2_PACKAGE_MESA3D_VIDEO_CODEC_H264ENC) += h264enc
> +MESA3D_VIDEO_CODECS-$(BR2_PACKAGE_MESA3D_VIDEO_CODEC_H265DEC) += h265dec
> +MESA3D_VIDEO_CODECS-$(BR2_PACKAGE_MESA3D_VIDEO_CODEC_H265ENC) += h265enc
> +
> +ifeq ($(BR2_PACKAGE_MESA3D_VIDEO_CODEC),y)
Replace this with:
ifneq ($(MESA3D_VIDEO_CODECS-y),)
and tada, the option BR2_PACKAGE_MESA3D_VIDEO_CODEC can be dropped.
However, the more fundamental question is: what do those options do?
If I build a defconfig like this:
BR2_arm=y
BR2_cortex_a9=y
BR2_ARM_ENABLE_VFP=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_VIDEO_CODEC_VC1DEC=y
BR2_PACKAGE_MESA3D_VIDEO_CODEC_H264DEC=y
BR2_PACKAGE_MESA3D_VIDEO_CODEC_H264ENC=y
BR2_PACKAGE_MESA3D_VIDEO_CODEC_H265DEC=y
BR2_PACKAGE_MESA3D_VIDEO_CODEC_H265ENC=y
# BR2_TARGET_ROOTFS_TAR is not set
Then absolutely nothing gets installed by mesa3d.
Looking more closely, the -Dvideo-codecs option is doing this:
_codecs = get_option('video-codecs')
foreach c : ['vc1dec', 'h264dec', 'h264enc', 'h265dec', 'h265enc']
pre_args += '-DVIDEO_CODEC_@0@=@1@'.format(c.to_upper(), _codecs.contains(c).to_int())
endforeach
So it's basically defining VIDEO_CODEC_VC1DEC, VIDEO_CODEC_H264DEC,
etc. So I grepped in the mesa3d tree, and only found references in
src/gallium/auxiliary/vl/vl_codec.c:
bool vl_codec_supported(struct pipe_screen *screen,
enum pipe_video_profile profile,
bool encode)
{
if (profile == PIPE_VIDEO_PROFILE_VC1_SIMPLE ||
profile == PIPE_VIDEO_PROFILE_VC1_MAIN ||
profile == PIPE_VIDEO_PROFILE_VC1_ADVANCED) {
if (!VIDEO_CODEC_VC1DEC)
return false;
}
if (profile >= PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE &&
profile <= PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444) {
if (encode) {
if (!VIDEO_CODEC_H264ENC)
return false;
} else if (!VIDEO_CODEC_H264DEC) {
return false;
}
}
if (profile >= PIPE_VIDEO_PROFILE_HEVC_MAIN &&
profile <= PIPE_VIDEO_PROFILE_HEVC_MAIN_444) {
if (encode) {
if (!VIDEO_CODEC_H265ENC)
return false;
} else if (!VIDEO_CODEC_H265DEC) {
return false;
}
}
return screen->get_video_param(screen, profile, encode ? PIPE_VIDEO_ENTRYPOINT_ENCODE : PIPE_VIDEO_ENTRYPOINT_BITSTREAM, PIPE_VIDEO_CAP_SUPPORTED);
}
So essentially *not* defining those options only make this function
report that some codecs are not supported. Defining those options do
not seem to add any extra functionality to mesa3d.
Could you clarify what's happening here?
Also, since it's affecting code in src/gallium/, maybe those new
options need to be conditional on having at least one Gallium driver
enabled? That being said, even if I enable the swrast Gallium driver,
vl_codec.c doesn't get compiled in, so it's not just having a Gallium
driver enabled.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-08-22 21:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 11:12 [Buildroot] [PATCH] package/mesa3d: Allow building patent encumbered video codecs Tristan van Berkom via buildroot
2023-08-22 4:07 ` Tristan van Berkom via buildroot
2023-08-22 21:28 ` Thomas Petazzoni via buildroot [this message]
2023-08-27 7:45 ` Tristan van Berkom via buildroot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230822232800.1901678d@windsurf \
--to=buildroot@buildroot.org \
--cc=bernd@kuhls.net \
--cc=romain.naour@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=tristan.vanberkom@codethink.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox