[vlc-devel] [vlc-commits] XCB/XVideo: request correct picture format from the adaptor

Thomas Guillem thomas at gllm.fr
Tue Dec 16 14:32:18 CET 2014


On Fri, Dec 12, 2014, at 16:31, Rémi Denis-Courmont wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Dec 12
> 17:02:45 2014 +0200| [4aa17707fc63c59ea173347d9b695a9a415822fe] |
> committer: Rémi Denis-Courmont
> 
> XCB/XVideo: request correct picture format from the adaptor
> 
> This is bug compatibility for XVideo drivers that scale the whole
> picture rather than the source rectangle (the XVideo 2 specification
> does not really state which behaviour is correct).
> 
> This works because the video output core only applies crop parameters
> *after* the vout display plugin is activated. This is brittle though:
> the A/R and crop parameters should probably be passed as configuration
> like zoom.
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4aa17707fc63c59ea173347d9b695a9a415822fe
> ---
> 
>  modules/video_output/xcb/xvideo.c |   32
>  +++++++-------------------------
>  1 file changed, 7 insertions(+), 25 deletions(-)
> 
> diff --git a/modules/video_output/xcb/xvideo.c
> b/modules/video_output/xcb/xvideo.c
> index bddc52b..d596538 100644
> --- a/modules/video_output/xcb/xvideo.c
> +++ b/modules/video_output/xcb/xvideo.c
> @@ -313,38 +313,20 @@ FindFormat (vlc_object_t *obj, xcb_connection_t
> *conn, video_format_t *fmt,
>          if (!BetterFormat (chroma, chromav, &rank))
>              continue;
>  
> -        /* VLC pads scanline to 16 pixels internally */
> -        unsigned width = (fmt->i_width + 31) & ~31;
> -        unsigned height = (fmt->i_height + 15) & ~15;
>          xcb_xv_query_image_attributes_reply_t *i;
>          i = xcb_xv_query_image_attributes_reply (conn,
>              xcb_xv_query_image_attributes (conn, a->base_id, f->id,
> -                                           width, height), NULL);
> +                                           fmt->i_visible_width,
> +                                           fmt->i_visible_height),
> NULL);
>          if (i == NULL)
>              continue;
>  
> -        if (i->width != width || i->height != height)
> -        {
> -            msg_Warn (obj, "incompatible size %ux%u ->
> %"PRIu32"x%"PRIu32,
> -                      fmt->i_width, fmt->i_height,
> -                      i->width, i->height);
> -            var_Create (obj->p_libvlc, "xvideo-res-error",
> VLC_VAR_BOOL);
> -            if (!var_GetBool (obj->p_libvlc, "xvideo-res-error"))
> -            {
> -                dialog_FatalWait (obj, _("Video acceleration not
> available"),
> -                    _("The XVideo rendering acceleration driver does not
> "
> -                      "support the required resolution of %ux%u pixels
> but "
> -                      "%"PRIu32"x%"PRIu32" pixels instead.\n"
> -                      "Acceleration will thus be disabled. Performance
> may "
> -                      "be degraded severely if the resolution is
> large."),
> -                                  width, height, i->width, i->height);
> -                var_SetBool (obj->p_libvlc, "xvideo-res-error", true);
> -            }
> -            free (i);
> -            continue;
> -        }
> -
>          fmt->i_chroma = chroma;
> +        fmt->i_x_offset = 0;
> +        fmt->i_y_offset = 0;
> +        fmt->i_width = i->width;
> +        fmt->i_height = i->height;

This add a new filter (swscale) in the chain when i_width/height !=
i_visible_width/height.

I'm not sure if it is necessary: "swscale filter debug: 854x480
(864x482) chroma: I420 -> 854x480 (854x480) chroma: I420 with scaling
using Bicubic (good quality)"

I tested, it works without swscale in that case (when I comments out
fmt->i_width = i->width; and fmt->i_height = i->height;)

> +
>          if (f->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB)
>          {
>              fmt->i_rmask = f->red_mask;
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits



More information about the vlc-devel mailing list