For example, in patch 5/11 when " VaCreateContext", we used to CALLOC_STRUCT 
for "pps" and "sps" whenever we see video format is H.264. This is fine for 
decode ONLY case. Now, since we added H.264 encoding, "pps" and "sps" shouldn't 
be allocated. So we need to use the entry_point to determine this is H.264 
decode or H.264 encode. We can use config to determine the entrypoint since 
config_id is passed to us for VaCreateContext call. However, for 
VaDestoyContext call, only context_id is passed to us. So we need to know the 
entrypoint in order to not free the pps/sps for encoding case.

Regard,
Boyuan

    case PIPE_VIDEO_FORMAT_MPEG4_AVC:
          context->templat.max_references = 0;
-         context->desc.h264.pps = CALLOC_STRUCT(pipe_h264_pps);
-         if (!context->desc.h264.pps) {
-            FREE(context);
-            return VA_STATUS_ERROR_ALLOCATION_FAILED;
-         }
-         context->desc.h264.pps->sps = CALLOC_STRUCT(pipe_h264_sps);
-         if (!context->desc.h264.pps->sps) {
-            FREE(context->desc.h264.pps);
-            FREE(context);
-            return VA_STATUS_ERROR_ALLOCATION_FAILED;
+         if (config->entrypoint != PIPE_VIDEO_ENTRYPOINT_ENCODE) {
+            context->desc.h264.pps = CALLOC_STRUCT(pipe_h264_pps);
+            if (!context->desc.h264.pps) {
+               FREE(context);
+               return VA_STATUS_ERROR_ALLOCATION_FAILED;
+            }
+            context->desc.h264.pps->sps = CALLOC_STRUCT(pipe_h264_sps);
+            if (!context->desc.h264.pps->sps) {
+               FREE(context->desc.h264.pps);
+               FREE(context);
+               return VA_STATUS_ERROR_ALLOCATION_FAILED;
+            }
          }
          break;

-----Original Message-----
From: Christian König [mailto:deathsim...@vodafone.de] 
Sent: July-14-16 4:07 AM
To: Zhang, Boyuan; mesa-dev@lists.freedesktop.org
Subject: Re: [PATCH 02/11] vl: add entry point

Am 14.07.2016 um 00:51 schrieb Boyuan Zhang:
> Add entry point for encoding which previously hardcoded for decoding 
> purpose only

I still can't figure out why we would want this? The variable doesn't seem to 
be used in the whole patchset.

Christian.

>
> Signed-off-by: Boyuan Zhang <boyuan.zh...@amd.com>
> ---
>   src/gallium/include/pipe/p_video_state.h | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/gallium/include/pipe/p_video_state.h 
> b/src/gallium/include/pipe/p_video_state.h
> index 754d013..39b3905 100644
> --- a/src/gallium/include/pipe/p_video_state.h
> +++ b/src/gallium/include/pipe/p_video_state.h
> @@ -131,6 +131,7 @@ enum pipe_h264_enc_rate_control_method
>   struct pipe_picture_desc
>   {
>      enum pipe_video_profile profile;
> +   enum pipe_video_entrypoint entry_point;
>   };
>   
>   struct pipe_quant_matrix

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

Reply via email to