[vlc-devel] [PATCH] vdpau: fix video scaling

Rémi Denis-Courmont remi at remlab.net
Mon Jun 13 20:27:12 CEST 2016

[ Adding VDPAU list]

On Monday 13 June 2016 19:53:02 Rinat Ibragimov wrote:
> There is a possible issue in VdpVideoMixerRender [1] call. While
> destination_rect is set to dst_rect, which is fine, destination_video_rect
> parameter is set to NULL, which makes video keep the size, while it's
> expected to fill the entire output rectangle.

The specification states that:
"If [destination_video_rect is]_NULL, the destination rectangle will be sized 
to match the source rectangle, and will be located at the origin."

This is confusing, because the destination rectangle parameter is always set 
explicitly, and so it obviously cannot be (re)sized and (re)positioned 
relative to its own self, but to the output surface. Only the destination 
video rectangle is optional.

You interpret it as:
"If [destination_video_rect is]_NULL, the destination video rectangle will 
have the same size as the source rectangle, and will be located at the 

But I think that the intended meaning was rather:
"If [destination_video_rect is]_NULL, the destination video rectangle will 
fit/match the source rectangle to the destination rectangle, and will be 
located at the origin.

In any case, that appears to be on the behaviour of the de factor reference 
NVIDIA drivers, and it is a much more reasonable and useful default, than what 
you propose.

Aaron, can you bring some clarity here? Either way, I think the Doxygen should 
be clarified.

> Proposed patch sets destination_video_rect to dst_rect, which makes
> video scale when player window is resized.
> [1]
> http://http.download.nvidia.com/XFree86/vdpau/doxygen/html/group___vdp_vide
> o_mixer.html#ga62bf3bf8c5f01322a03b07065c5ea3db
> ---
>  modules/hw/vdpau/chroma.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> diff --git a/modules/hw/vdpau/chroma.c b/modules/hw/vdpau/chroma.c
> index a42aed2..d13515f 100644
> --- a/modules/hw/vdpau/chroma.c
> +++ b/modules/hw/vdpau/chroma.c
> @@ -652,7 +652,8 @@ static picture_t *Render(filter_t *filter, picture_t
> *src, bool import) err = vdp_video_mixer_render(sys->vdp, sys->mixer,
>                                   MAX_PAST, past, surface, MAX_FUTURE,
> future, -                                 &src_rect, output, &dst_rect,
> NULL, 0, NULL); +                                 &src_rect, output,
> &dst_rect, &dst_rect, 0, +                                 NULL);
>      if (err != VDP_STATUS_OK)
>      {
>          msg_Err(filter, "video %s %s failure: %s", "mixer", "rendering",

Rémi Denis-Courmont

More information about the vlc-devel mailing list