Thomas Guillem pushed to branch master at VideoLAN / VLC
Commits:
658ac9f7 by Thomas Guillem at 2026-02-27T16:28:37+00:00
vaapi: dec-dev: increase all priorities
Set the priority higher than nvdec, as there are more chance to have a
working vaapi driver working on Linux.
- - - - -
257a3803 by Thomas Guillem at 2026-02-27T16:28:37+00:00
nvdec: check early if dec-dev is compatible
- - - - -
3884d57a by Thomas Guillem at 2026-02-27T16:28:37+00:00
nvdec: increase priority
Note that it won't be used by default on Windows since d3d* dec-dev have
higher priority.
It will be used by default on Linux if vaapi dec-dev failed.
- - - - -
2 changed files:
- modules/hw/nvdec/nvdec.c
- modules/hw/vaapi/decoder_device.c
Changes:
=====================================
modules/hw/nvdec/nvdec.c
=====================================
@@ -39,6 +39,14 @@
# define CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT 14
#endif
+/* Higher than avcodec:
+ * - On Linux, OpenDecoder() will fail if not using a nvidia GPU and fallback
+ * to avcodec with vaapi/other hw decoder
+ * - On Windows, d3d11 dec-dev has a higher priority by default, so nvdec
+ * decoder will fail in favor of avcodec with d3d11 hw decoder
+ */
+#define NVDEC_PRIORITY 71
+
static int OpenDecoder(vlc_object_t *);
static void CloseDecoder(vlc_object_t *);
static int DecoderContextOpen(vlc_decoder_device *, vlc_window_t *);
@@ -60,7 +68,7 @@ static const int ppsi_deinterlace_type[] = {
vlc_module_begin ()
set_description(N_("NVDEC video decoder"))
set_shortname("nvdec")
- set_capability("video decoder", 60)
+ set_capability("video decoder", NVDEC_PRIORITY)
set_subcategory(SUBCAT_INPUT_VCODEC)
add_integer( "nvdec-deint", cudaVideoDeinterlaceMode_Bob,
DEINTERLACE_MODULE_TEXT, DEINTERLACE_MODULE_LONGTEXT )
@@ -773,9 +781,35 @@ static int OpenDecoder(vlc_object_t *p_this)
{
decoder_t *p_dec = (decoder_t *) p_this;
int result;
+
+ /* Check early if has nvdec support */
+ vlc_decoder_device *dec_device = NULL;
+ decoder_device_nvdec_t *devsys = NULL;
+ switch (p_dec->fmt_in->i_codec) {
+ case VLC_CODEC_H264:
+ case VLC_CODEC_HEVC:
+ case VLC_CODEC_VC1:
+ case VLC_CODEC_WMV3:
+ case VLC_CODEC_MP1V:
+ case VLC_CODEC_MP2V:
+ case VLC_CODEC_MPGV:
+ case VLC_CODEC_MP4V:
+ case VLC_CODEC_VP8:
+ case VLC_CODEC_VP9:
+ dec_device = decoder_GetDecoderDevice( p_dec );
+ if (dec_device != NULL)
+ devsys = GetNVDECOpaqueDevice(dec_device);
+ break;
+ }
+ if (devsys == NULL)
+ {
+ msg_Dbg(p_this, "Missing decoder device");
+ return VLC_EGENERIC;
+ }
+
nvdec_ctx_t *p_sys = calloc(1, sizeof(*p_sys));
if (unlikely(!p_sys))
- return VLC_ENOMEM;
+ goto early_exit;
p_dec->p_sys = p_sys;
@@ -838,23 +872,10 @@ static int OpenDecoder(vlc_object_t *p_this)
goto early_exit;
}
- vlc_decoder_device *dec_device = decoder_GetDecoderDevice( p_dec );
- if (dec_device == NULL) {
- if (p_sys->b_is_hxxx)
- hxxx_helper_clean(&p_sys->hh);
- msg_Dbg(p_this, "Missing decoder device");
- goto early_exit;
- }
- p_sys->devsys = GetNVDECOpaqueDevice(dec_device);
- if (p_sys->devsys == NULL)
- {
- vlc_decoder_device_Release(dec_device);
- if (p_sys->b_is_hxxx)
- hxxx_helper_clean(&p_sys->hh);
- goto early_exit;
- }
+ p_sys->devsys = devsys;
p_sys->vctx_out = vlc_video_context_Create( dec_device,
VLC_VIDEO_CONTEXT_NVDEC, 0, NULL );
vlc_decoder_device_Release(dec_device);
+ dec_device = NULL;
if (unlikely(p_sys->vctx_out == NULL))
{
msg_Err(p_dec, "failed to create a video context");
@@ -1044,7 +1065,9 @@ error:
CloseDecoder(p_this);
return VLC_EGENERIC;
early_exit:
- free(p_dec->p_sys);
+ if (dec_device != NULL)
+ vlc_decoder_device_Release(dec_device);
+ free(p_sys);
return VLC_EGENERIC;
}
=====================================
modules/hw/vaapi/decoder_device.c
=====================================
@@ -249,15 +249,15 @@ Open(vlc_decoder_device *device, vlc_window_t *window)
}
#if defined (HAVE_VA_X11)
-# define PRIORITY 2
+# define PRIORITY 5
# define SHORTCUT "vaapi_x11"
# define DESCRIPTION_SUFFIX "X11"
#elif defined(HAVE_VA_WL)
-# define PRIORITY 2
+# define PRIORITY 5
# define SHORTCUT "vaapi_wl"
# define DESCRIPTION_SUFFIX "Wayland"
#elif defined (HAVE_VA_DRM)
-# define PRIORITY 1
+# define PRIORITY 4
# define SHORTCUT "vaapi_drm"
# define DESCRIPTION_SUFFIX "DRM"
#endif
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/aed1ca0c53f78efd70b94294f4441418f6e24f99...3884d57a1f58db1df29acbf216bbe40905781a3e
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/aed1ca0c53f78efd70b94294f4441418f6e24f99...3884d57a1f58db1df29acbf216bbe40905781a3e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits