[Mesa-dev] [PATCH 3/5] st/va: Return surface formats depending on config chroma format

Julien Isorce julien.isorce at gmail.com
Mon Oct 17 14:21:03 UTC 2016


Hi Mark,

Thx for the patch. I can see it has already landed.

I just tried it with gstreamer-vaapi and it causes problem since they
create the config like this for VPP:

va_status = vaCreateConfig (filter->va_display, VAProfileNone,
      VAEntrypointVideoProc, NULL, 0, &filter->va_config);

As you can see num attrivs is 0 so it makes vaQuerySurfaceAttributes to
return no supported format
because config->rt_format is 0.

So I plan to make a patch that looks like this:


--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -419,7 +419,7 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx,
VAConfigID config_id,
    /* vlVaCreateConfig returns PIPE_VIDEO_PROFILE_UNKNOWN
     * only for VAEntrypointVideoProc. */
    if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) {
-      if (config->rt_format == VA_RT_FORMAT_RGB32) {
+      if (!config->rt_format || config->rt_format == VA_RT_FORMAT_RGB32) {
          for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) {
             attribs[i].type = VASurfaceAttribPixelFormat;
             attribs[i].value.type = VAGenericValueTypeInteger;
@@ -427,7 +427,8 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx,
VAConfigID config_id,
             attribs[i].value.value.i =
PipeFormatToVaFourcc(vpp_surface_formats[j]);
             i++;
          }
-      } else if (config->rt_format == VA_RT_FORMAT_YUV420) {
+      }
+      if (!config->rt_format || config->rt_format == VA_RT_FORMAT_YUV420) {
          attribs[i].type = VASurfaceAttribPixelFormat;
          attribs[i].value.type = VAGenericValueTypeInteger;
          attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE |
VA_SURFACE_ATTRIB_SETTABLE;


Will it be ok for whatever test application you are using ?

Not that the intel va driver always return the full list for vpp.

Cheers
Julien







On 12 October 2016 at 23:53, Mark Thompson <sw at jkqxz.net> wrote:

> This makes the supported format actually match the configuration, and
> allows the user to observe that NV12 is supported for video processing
> where previously they couldn't (though it did always work if they
> blindly tried to use it anyway).
> ---
>  src/gallium/state_trackers/va/surface.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/va/surface.c
> b/src/gallium/state_trackers/va/surface.c
> index 173e7d9..5e92980 100644
> --- a/src/gallium/state_trackers/va/surface.c
> +++ b/src/gallium/state_trackers/va/surface.c
> @@ -419,11 +419,19 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx,
> VAConfigID config_id,
>     /* vlVaCreateConfig returns PIPE_VIDEO_PROFILE_UNKNOWN
>      * only for VAEntrypointVideoProc. */
>     if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) {
> -      for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) {
> +      if (config->rt_format == VA_RT_FORMAT_RGB32) {
> +         for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) {
> +            attribs[i].type = VASurfaceAttribPixelFormat;
> +            attribs[i].value.type = VAGenericValueTypeInteger;
> +            attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE |
> VA_SURFACE_ATTRIB_SETTABLE;
> +            attribs[i].value.value.i = PipeFormatToVaFourcc(vpp_
> surface_formats[j]);
> +            i++;
> +         }
> +      } else if (config->rt_format == VA_RT_FORMAT_YUV420) {
>           attribs[i].type = VASurfaceAttribPixelFormat;
>           attribs[i].value.type = VAGenericValueTypeInteger;
>           attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE |
> VA_SURFACE_ATTRIB_SETTABLE;
> -         attribs[i].value.value.i = PipeFormatToVaFourcc(vpp_
> surface_formats[j]);
> +         attribs[i].value.value.i = VA_FOURCC_NV12;
>           i++;
>        }
>     } else {
> --
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161017/f66bfbdc/attachment.html>


More information about the mesa-dev mailing list