[Mesa-dev] [PATCH 1/2] st/va: Fix config entrypoint handling

Mark Thompson sw at jkqxz.net
Tue Oct 10 21:21:04 UTC 2017


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 at jkqxz.net>
---
On 10/10/17 08:32, Christian König wrote:
> Am 09.10.2017 um 22:45 schrieb Mark Thompson:
>> Consistently use it as a PIPE_VIDEO_ENTRYPOINT.
>>
>> Signed-off-by: Mark Thompson <sw at jkqxz.net>
>> ---
>>   src/gallium/state_trackers/va/config.c | 15 +++++++++------
>>   1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c
>> index 1484fcacce..f3000be2fd 100644
>> --- a/src/gallium/state_trackers/va/config.c
>> +++ b/src/gallium/state_trackers/va/config.c
>> @@ -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,17 @@ 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;
>> +   default:
> 
> I prefer an explicit case for PIPE_VIDEO_ENTRYPOINT_UNKNOWN and returning an error in the default case here.
> 
> Apart from that the change looks good to me and seems to be a rather nice cleanup/fix.

Sure!  Here's a new version (2/2 unchanged).

Thanks,

- Mark


 src/gallium/state_trackers/va/config.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/va/config.c b/src/gallium/state_trackers/va/config.c
index 1484fcacce..25043d6374 100644
--- a/src/gallium/state_trackers/va/config.c
+++ b/src/gallium/state_trackers/va/config.c
@@ -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;
-- 
2.11.0


More information about the mesa-dev mailing list