st/va: Fix config entrypoint handling
authorMark Thompson <sw@jkqxz.net>
Tue, 10 Oct 2017 21:21:04 +0000 (22:21 +0100)
committerLeo Liu <leo.liu@amd.com>
Tue, 17 Oct 2017 12:23:55 +0000 (08:23 -0400)
Consistently use it as a PIPE_VIDEO_ENTRYPOINT.

v2: Return an error if the entrypoint is not set (Christian).

Signed-off-by: Mark Thompson <sw@jkqxz.net>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/state_trackers/va/config.c

index 1484fcacce1266e1049628fa5f6da975c14d495f..25043d63742c23e513a0c2ec8788ffcb5f7e3414 100644 (file)
@@ -195,7 +195,7 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, VAEntrypoint entrypoin
       return VA_STATUS_ERROR_ALLOCATION_FAILED;
 
    if (profile == VAProfileNone && entrypoint == VAEntrypointVideoProc) {
-      config->entrypoint = VAEntrypointVideoProc;
+      config->entrypoint = PIPE_VIDEO_ENTRYPOINT_UNKNOWN;
       config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;
       supported_rt_formats = VA_RT_FORMAT_YUV420 |
                              VA_RT_FORMAT_YUV420_10BPP |
@@ -342,14 +342,20 @@ vlVaQueryConfigAttributes(VADriverContextP ctx, VAConfigID config_id, VAProfile
 
    *profile = PipeToProfile(config->profile);
 
-   if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) {
+   switch (config->entrypoint) {
+   case PIPE_VIDEO_ENTRYPOINT_BITSTREAM:
+      *entrypoint = VAEntrypointVLD;
+      break;
+   case PIPE_VIDEO_ENTRYPOINT_ENCODE:
+      *entrypoint = VAEntrypointEncSlice;
+      break;
+   case PIPE_VIDEO_ENTRYPOINT_UNKNOWN:
       *entrypoint = VAEntrypointVideoProc;
-      *num_attribs = 0;
-      return VA_STATUS_SUCCESS;
+      break;
+   default:
+      return VA_STATUS_ERROR_INVALID_CONFIG;
    }
 
-   *entrypoint = config->entrypoint;
-
    *num_attribs = 1;
    attrib_list[0].type = VAConfigAttribRTFormat;
    attrib_list[0].value = config->rt_format;