Monday, September 23, 2024

Re: VLC; 7.6-beta AMD64 Sept. 17th

This seems like something that might make sense to get in for release
if someone with an affected system (with vlc defaults i.e. hw accel
set to automatic) can get it tested quickly enough.

On 2024/09/23 00:14, Brad Smith wrote:
> On Fri, Sep 20, 2024 at 04:21:29PM +0100, Stuart Henderson wrote:
> > On 2024/09/18 09:38, Byron Campbell - WA4GEG wrote:
> > >
> > > Okay, launched VLC from terminal. Here's the output when attempting to play
> > > an MP4, and audio plays but not the video portion:
> > >
> > > $ vlc
> > > VLC media player 3.0.20 Vetinari (revision 3.0.20-0-g6f0d0ab126b)
> > > [00000d0660d53220] main libvlc: Running vlc with the default interface. Use
> > > 'cvlc' to use vlc without interface.
> > > [00000d0660d64ca0] main playlist: playlist is empty
> > > libva info: VA-API version 1.22.0
> > > libva info: Trying to open /usr/X11R6/lib/modules/dri/r600_drv_video.so
> > > libva info: Found init function __vaDriverInit_1_22
> > > libva info: va_openDriver() returns 0
> > > [00000d06e842d060] avcodec decoder: Using Mesa Gallium driver 23.3.6 for AMD
> > > CEDAR (DRM 2.50.0 / 7.6, LLVM 16.0.6) for hardware decoding
> > ...
> > > radeondrm0 at pci3 dev 0 function 0 "ATI Radeon HD 5450" rev 0x00
> > > drm0 at radeondrm0
> > > radeondrm0: msi
> >
> > I only have machines with Intel graphics handy - in that case things
> > are working fine for me with or without hardware decoding (to actually
> > use it there requires the intel-media-driver package to be installed).
> >
> > I'm not familiar with how it works with AMD and wasn't keeping a close
> > eye when VA-API was brought in but based on your debug messages it seems
> > that it's included directly in the driver in xenocara so that programs
> > supporting it will try to use it automatically without installing any
> > extra packages.
> >
> >
> > On 2024/09/18 13:33, Byron Campbell - WA4GEG wrote:
> > >
> > > Turns out that VLC had "hardware acceleration" set to automatic. I assume
> > > that it is shipped that way, since I generally have no need to alter the
> > > default settings. And the problem is indeed due to the VA-API stuff as
> > > Stuart suspected.
> > >
> > > I got it to work by going into VLC's settings > Tools, Prefs., Input/Codecs
> > > tab, and set the "hardware acceleration" to disable. Then VLC stopped
> > > seg-faulting and plays both MP4 files and one test DVD okay.
> > >
> > > Interestingly, VLC with hardware acceleration set to automatic, works just
> > > fine in my OpenBSD 7.5 box.
> >
> > OpenBSD didn't support hardware acceleration VA-API until after 7.5.
> > AFAIK it's currently enabled in FFmpeg, mpv and vlc and disabled in
> > other ports where it was noticed that they might pick it up.
> >
> > I think we could probably do with some kind of mention in the 7.6
> > upgrade notes, both to help people track down problems like this,
> > and to help them get it used on Intel systems (where it seems to work
> > pretty well).
>
> Looks like there are some VA-API bug fixes pending in the 3.0 branch
> backported to fix issues specically mentioned with the AMD r600 Mesa
> driver.
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/x11/vlc/Makefile,v
> retrieving revision 1.275
> diff -u -p -u -p -r1.275 Makefile
> --- Makefile 16 Aug 2024 16:40:31 -0000 1.275
> +++ Makefile 22 Sep 2024 00:48:01 -0000
> @@ -5,10 +5,10 @@ V= 3.0.20
> DISTNAME= vlc-${V}
> PKGNAME-main= ${DISTNAME}
> PKGNAME-jack= vlc-jack-${V}
> +REVISION-main= 5
> CATEGORIES= x11
> SITES= https://download.videolan.org/pub/videolan/vlc/${V}/
> EXTRACT_SUFX= .tar.xz
> -REVISION-main= 4
>
> USE_NOBTCFI= Yes
>
> Index: patches/patch-modules_hw_vaapi_chroma_c
> ===================================================================
> RCS file: patches/patch-modules_hw_vaapi_chroma_c
> diff -N patches/patch-modules_hw_vaapi_chroma_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-modules_hw_vaapi_chroma_c 22 Sep 2024 00:48:01 -0000
> @@ -0,0 +1,54 @@
> +- vaapi: chroma: Implement vaPutImage upload fallback
> + 374ce3b5e1cdbdc94a2a8ea9714e9dfdbc1d2f9f
> +
> +Index: modules/hw/vaapi/chroma.c
> +--- modules/hw/vaapi/chroma.c.orig
> ++++ modules/hw/vaapi/chroma.c
> +@@ -252,18 +252,40 @@ UploadSurface(filter_t *filter, picture_t *src)
> + vlc_vaapi_PicAttachContext(dest_pic);
> + picture_CopyProperties(dest_pic, src);
> +
> +- if (vlc_vaapi_DeriveImage(VLC_OBJECT(filter), va_dpy,
> +- vlc_vaapi_PicGetSurface(dest_pic), &dest_img)
> +- || vlc_vaapi_MapBuffer(VLC_OBJECT(filter), va_dpy,
> +- dest_img.buf, &dest_buf))
> ++ if (filter->p_sys->derive_failed ||
> ++ vlc_vaapi_DeriveImage(VLC_OBJECT(filter), va_dpy,
> ++ vlc_vaapi_PicGetSurface(dest_pic), &dest_img))
> ++ {
> ++ if (filter->p_sys->image_fallback_failed)
> ++ goto error;
> ++
> ++ filter->p_sys->derive_failed = true;
> ++
> ++ if (CreateFallbackImage(filter, dest_pic, va_dpy, &dest_img))
> ++ {
> ++ filter->p_sys->image_fallback_failed = true;
> ++ goto error;
> ++ }
> ++ }
> ++
> ++ if (vlc_vaapi_MapBuffer(VLC_OBJECT(filter), va_dpy,
> ++ dest_img.buf, &dest_buf))
> + goto error;
> +
> + FillVAImageFromPicture(&dest_img, dest_buf, dest_pic,
> + src, &filter->p_sys->cache);
> +
> +- if (vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter), va_dpy, dest_img.buf)
> +- || vlc_vaapi_DestroyImage(VLC_OBJECT(filter),
> +- va_dpy, dest_img.image_id))
> ++ if (vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter), va_dpy, dest_img.buf))
> ++ goto error;
> ++
> ++ if (filter->p_sys->derive_failed &&
> ++ vaPutImage(va_dpy, vlc_vaapi_PicGetSurface(dest_pic), dest_img.image_id,
> ++ 0, 0, dest_pic->format.i_width, dest_pic->format.i_height,
> ++ 0, 0, dest_pic->format.i_width, dest_pic->format.i_height))
> ++ goto error;
> ++
> ++ if (vlc_vaapi_DestroyImage(VLC_OBJECT(filter),
> ++ va_dpy, dest_img.image_id))
> + goto error;
> +
> + ret:
> Index: patches/patch-modules_video_output_opengl_converter_vaapi_c
> ===================================================================
> RCS file: patches/patch-modules_video_output_opengl_converter_vaapi_c
> diff -N patches/patch-modules_video_output_opengl_converter_vaapi_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-modules_video_output_opengl_converter_vaapi_c 22 Sep 2024 00:48:01 -0000
> @@ -0,0 +1,138 @@
> +- converter_vaapi: Don't use DeriveImage with ExportSurfaceHandle
> + ea9463607f71fe4d094b99b8d0a6181452688228
> +
> +Index: modules/video_output/opengl/converter_vaapi.c
> +--- modules/video_output/opengl/converter_vaapi.c.orig
> ++++ modules/video_output/opengl/converter_vaapi.c
> +@@ -72,9 +72,10 @@ struct priv
> + * (GPU tiling, compression, etc...) */
> + VADRMPRIMESurfaceDescriptor va_surface_descriptor;
> + #else
> ++ VAImage va_image;
> + VABufferInfo va_buffer_info;
> +

No comments:

Post a Comment