[vlc-devel] [PATCH] copy: fix the cache copy size

Quentin Chateau quentin.chateau at gmail.com
Fri Mar 8 20:23:55 CET 2019


Hi,

You are right, I omitted a few details. I have 2 use case where I
encountered this bug:
- I use a vout plugin that needs to access frame buffers from RAM (with sw
chroma filtering)
- I use the vaapi of my Intel CPU, but my display is plugged to a discrete
Nvidia graphics card (this is not my typical use case but I believe I
observed the bug in this situation as well)

The copy.c path is obvious for the 1st case. And I guess it makes sense at
some point for the 2nd use case.

Quentin C.

On Fri, Mar 8, 2019, 08:38 Thomas Guillem <thomas at gllm.fr> wrote:

>
> On Thu, Mar 7, 2019, at 22:20, Quentin Chateau wrote:
>
> Hi,
>
> this regression has been picked-up by the Ubuntu 18.04 team and is
> therefore affecting quite a big number of people. On a machine with a i7
> 8700k, you cannot even decently play a fullHD video using vaapi (over half
> of the frames are dropped). The proposed fix restores the expected
> performances (low CPU usage and no frame drop for 4K60 HDR videos using
> vaapi).
>
> If there is anything wrong about my patch, please tell and i'll fix it.
>
>
> Tested and merged, thanks a lot for you contribution.
>
> By the way, you may have an other problem, the copy.c code path should not
> be executed if you do a full hardware direct rendering with 0 copy
> (decoding from GPU + display on GPU without going through the CPU). By
> default, without any video filters, deinterlace, VLC should do 0 copy. I'm
> wondering why it's not the case for you.
>
>
> Quentin C.
>
> Le ven. 1 mars 2019 à 23:36, Quentin Chateau <quentin.chateau at gmail.com>
> a écrit :
>
> regression 09d421a20851e1c49aa98e117957dd118620fae4
> ---
>  modules/video_chroma/copy.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
> index e9250b948e..51498f4a06 100644
> --- a/modules/video_chroma/copy.c
> +++ b/modules/video_chroma/copy.c
> @@ -468,7 +468,7 @@ static void SSE_CopyPlane(uint8_t *dst, size_t
> dst_pitch,
>      const size_t copy_pitch = __MIN(src_pitch, dst_pitch);
>      const unsigned w16 = (copy_pitch+15) & ~15;
>      const unsigned hstep = cache_size / w16;
> -    const unsigned cache_width = __MIN(src_pitch, hstep);
> +    const unsigned cache_width = __MIN(src_pitch, cache_size);
>      assert(hstep > 0);
>
>      /* If SSE4.1: CopyFromUswc is faster than memcpy */
> @@ -501,8 +501,8 @@ SSE_InterleavePlanes(uint8_t *dst, size_t dst_pitch,
>      size_t copy_pitch = __MIN(dst_pitch / 2, srcu_pitch);
>      unsigned int const  w16 = (srcu_pitch+15) & ~15;
>      unsigned int const  hstep = (cache_size) / (2*w16);
> -    const unsigned cacheu_width = __MIN(srcu_pitch, hstep);
> -    const unsigned cachev_width = __MIN(srcv_pitch, hstep);
> +    const unsigned cacheu_width = __MIN(srcu_pitch, cache_size);
> +    const unsigned cachev_width = __MIN(srcv_pitch, cache_size);
>      assert(hstep > 0);
>
>      for (unsigned int y = 0; y < height; y += hstep)
> @@ -535,7 +535,7 @@ static void SSE_SplitPlanes(uint8_t *dstu, size_t
> dstu_pitch,
>      size_t copy_pitch = __MIN(__MIN(src_pitch / 2, dstu_pitch),
> dstv_pitch);
>      const unsigned w16 = (src_pitch+15) & ~15;
>      const unsigned hstep = cache_size / w16;
> -    const unsigned cache_width = __MIN(src_pitch, hstep);
> +    const unsigned cache_width = __MIN(src_pitch, cache_size);
>      assert(hstep > 0);
>
>      for (unsigned y = 0; y < height; y += hstep) {
> --
> 2.19.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190308/fcda804e/attachment.html>


More information about the vlc-devel mailing list