Re: [Mesa-dev] [PATCH 2/3] st/va: Save surface chroma format in config

2016-09-27 Thread Emil Velikov
Hi Mark,

Patches without any commit message are a bad idea, generally. Please
don't do that.
Here are some articles which should help you on the topic.

[1] http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[2] http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[3] http://chris.beams.io/posts/git-commit/

On 19 September 2016 at 00:10, Mark Thompson  wrote:
> ---
> We need this stored somewhere to be able to return useful information from 
> vaQuerySurfaceAttributes() in the following patch.
>
>
>  src/gallium/state_trackers/va/config.c | 23 +--
>  src/gallium/state_trackers/va/va_private.h |  1 +
>  2 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/va/config.c 
> b/src/gallium/state_trackers/va/config.c
> index c6c5bb1..bd47381 100644
> --- a/src/gallium/state_trackers/va/config.c
> +++ b/src/gallium/state_trackers/va/config.c
> @@ -191,6 +191,17 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile 
> profile, VAEntrypoint entrypoin
> if (profile == VAProfileNone && entrypoint == VAEntrypointVideoProc) {
>config->entrypoint = VAEntrypointVideoProc;
>config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;
> +  for (int i = 0; i < num_attribs; i++) {
> + if (attrib_list[i].type == VAConfigAttribRTFormat) {
> +if (attrib_list[i].value & (VA_RT_FORMAT_YUV420 |
> +VA_RT_FORMAT_RGB32)) {
Nit: move this to the previous line. Then again, why is
VA_RT_FORMAT_RGB32 in here ?

> +   config->rt_format = attrib_list[i].value;
> +} else {
> +   FREE(config);
> +   return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
> +}
> + }
> +  }
>pipe_mutex_lock(drv->mutex);
>*config_id = handle_table_add(drv->htab, config);
>pipe_mutex_unlock(drv->mutex);
> @@ -233,7 +244,7 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, 
> VAEntrypoint entrypoin
>
> config->profile = p;
>
> -   for (int i = 0; i  +   for (int i = 0; i < num_attribs; i++) {
Unrelated whitespace change ?

>if (attrib_list[i].type == VAConfigAttribRateControl) {
>   if (attrib_list[i].value == VA_RC_CBR)
>  config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT;
> @@ -242,6 +253,14 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile 
> profile, VAEntrypoint entrypoin
>   else
>  config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE;
>}
> +  if (attrib_list[i].type == VAConfigAttribRTFormat) {
> + if (attrib_list[i].value & VA_RT_FORMAT_YUV420) {
s/&/==/ ?

Regards,
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] st/va: Save surface chroma format in config

2016-09-18 Thread Mark Thompson
---
We need this stored somewhere to be able to return useful information from 
vaQuerySurfaceAttributes() in the following patch.


 src/gallium/state_trackers/va/config.c | 23 +--
 src/gallium/state_trackers/va/va_private.h |  1 +
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/va/config.c 
b/src/gallium/state_trackers/va/config.c
index c6c5bb1..bd47381 100644
--- a/src/gallium/state_trackers/va/config.c
+++ b/src/gallium/state_trackers/va/config.c
@@ -191,6 +191,17 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, 
VAEntrypoint entrypoin
if (profile == VAProfileNone && entrypoint == VAEntrypointVideoProc) {
   config->entrypoint = VAEntrypointVideoProc;
   config->profile = PIPE_VIDEO_PROFILE_UNKNOWN;
+  for (int i = 0; i < num_attribs; i++) {
+ if (attrib_list[i].type == VAConfigAttribRTFormat) {
+if (attrib_list[i].value & (VA_RT_FORMAT_YUV420 |
+VA_RT_FORMAT_RGB32)) {
+   config->rt_format = attrib_list[i].value;
+} else {
+   FREE(config);
+   return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
+}
+ }
+  }
   pipe_mutex_lock(drv->mutex);
   *config_id = handle_table_add(drv->htab, config);
   pipe_mutex_unlock(drv->mutex);
@@ -233,7 +244,7 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, 
VAEntrypoint entrypoin

config->profile = p;

-   for (int i = 0; i rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT;
@@ -242,6 +253,14 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, 
VAEntrypoint entrypoin
  else
 config->rc = PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE;
   }
+  if (attrib_list[i].type == VAConfigAttribRTFormat) {
+ if (attrib_list[i].value & VA_RT_FORMAT_YUV420) {
+config->rt_format = attrib_list[i].value;
+ } else {
+FREE(config);
+return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
+ }
+  }
}

pipe_mutex_lock(drv->mutex);
@@ -312,7 +331,7 @@ vlVaQueryConfigAttributes(VADriverContextP ctx, VAConfigID 
config_id, VAProfile

*num_attribs = 1;
attrib_list[0].type = VAConfigAttribRTFormat;
-   attrib_list[0].value = VA_RT_FORMAT_YUV420;
+   attrib_list[0].value = config->rt_format;

return VA_STATUS_SUCCESS;
 }
diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index e9ccdbf..7562e14 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -250,6 +250,7 @@ typedef struct {
enum pipe_video_profile profile;
enum pipe_video_entrypoint entrypoint;
enum pipe_h264_enc_rate_control_method rc;
+   unsigned int rt_format;
 } vlVaConfig;

 typedef struct {
-- 
2.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev