<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Thanks a lot for pointing out, I add meson changes too.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Regards,</p>
<p style="margin-top:0;margin-bottom:0">Boyuan</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><br>
From: Boyuan Zhang <boyuan.zhang@amd.com><br>
<br>
Subject: [PATCH 06/12] st/va: move H264 enc functions into separate file<br>
<br>
Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com><br>
---<br>
 src/gallium/state_trackers/va/Makefile.sources   |   1 +<br>
 src/gallium/state_trackers/va/meson.build        |   2 +-<br>
 src/gallium/state_trackers/va/picture.c          | 146 +++++++-------------<br>
 src/gallium/state_trackers/va/picture_h264_enc.c | 163 +++++++++++++++++++++++<br>
 src/gallium/state_trackers/va/va_private.h       |   5 +<br>
 5 files changed, 219 insertions(+), 98 deletions(-)<br>
 create mode 100644 src/gallium/state_trackers/va/picture_h264_enc.c<br>
<br>
diff --git a/src/gallium/state_trackers/va/Makefile.sources b/src/gallium/state_trackers/va/Makefile.sources<br>
index 2d6546b..8a69828 100644<br>
--- a/src/gallium/state_trackers/va/Makefile.sources<br>
+++ b/src/gallium/state_trackers/va/Makefile.sources<br>
@@ -8,6 +8,7 @@ C_SOURCES := \<br>
     picture_mpeg12.c \<br>
     picture_mpeg4.c \<br>
     picture_h264.c \<br>
+    picture_h264_enc.c \<br>
     picture_hevc.c \<br>
     picture_vc1.c \<br>
     picture_mjpeg.c \<br>
diff --git a/src/gallium/state_trackers/va/meson.build b/src/gallium/state_trackers/va/meson.build<br>
index 56e68e9..bddd5ef 100644<br>
--- a/src/gallium/state_trackers/va/meson.build<br>
+++ b/src/gallium/state_trackers/va/meson.build<br>
@@ -26,7 +26,7 @@ libva_st = static_library(<br>
     'buffer.c', 'config.c', 'context.c', 'display.c', 'image.c', 'picture.c',<br>
     'picture_mpeg12.c', 'picture_mpeg4.c', 'picture_h264.c', 'picture_hevc.c',<br>
     'picture_vc1.c', 'picture_mjpeg.c', 'postproc.c', 'subpicture.c',<br>
-    'surface.c',<br>
+    'surface.c', 'picture_h264_enc.c', 'picture_hevc_enc.c',<br>
   ),<br>
   c_args : [<br>
     c_vis_args,<br>
diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c<br>
index 8951573..77d379b 100644<br>
--- a/src/gallium/state_trackers/va/picture.c<br>
+++ b/src/gallium/state_trackers/va/picture.c<br>
@@ -349,55 +349,52 @@ handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf)<br>
 static VAStatus<br>
 handleVAEncMiscParameterTypeRateControl(vlVaContext *context, VAEncMiscParameterBuffer *misc)<br>
 {<br>
-   VAEncMiscParameterRateControl *rc = (VAEncMiscParameterRateControl *)misc->data;<br>
-   if (context->desc.h264enc.rate_ctrl.rate_ctrl_method ==<br>
-       PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT)<br>
-      context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second;<br>
-   else<br>
-      context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second * (rc->target_percentage / 100.0);<br>
-   context->desc.h264enc.rate_ctrl.peak_bitrate = rc->bits_per_second;<br>
-   if (context->desc.h264enc.rate_ctrl.target_bitrate < 2000000)<br>
-      context->desc.h264enc.rate_ctrl.vbv_buffer_size = MIN2((context->desc.h264enc.rate_ctrl.target_bitrate * 2.75), 2000000);<br>
-   else<br>
-      context->desc.h264enc.rate_ctrl.vbv_buffer_size = context->desc.h264enc.rate_ctrl.target_bitrate;<br>
+   VAStatus status = VA_STATUS_SUCCESS;<br>
 <br>
-   return VA_STATUS_SUCCESS;<br>
+   switch (u_reduce_video_profile(context->templat.profile)) {<br>
+   case PIPE_VIDEO_FORMAT_MPEG4_AVC:<br>
+      status = vlVaHandleVAEncMiscParameterTypeRateControlH264(context, misc);<br>
+      break;<br>
+<br>
+   default:<br>
+      break;<br>
+   }<br>
+<br>
+   return status;<br>
 }<br>
 <br>
 static VAStatus<br>
 handleVAEncMiscParameterTypeFrameRate(vlVaContext *context, VAEncMiscParameterBuffer *misc)<br>
 {<br>
-   VAEncMiscParameterFrameRate *fr = (VAEncMiscParameterFrameRate *)misc->data;<br>
-   if (fr->framerate & 0xffff0000) {<br>
-      context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate       & 0xffff;<br>
-      context->desc.h264enc.rate_ctrl.frame_rate_den = fr->framerate >> 16 & 0xffff;<br>
-   } else {<br>
-      context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate;<br>
-      context->desc.h264enc.rate_ctrl.frame_rate_den = 1;<br>
+   VAStatus status = VA_STATUS_SUCCESS;<br>
+<br>
+   switch (u_reduce_video_profile(context->templat.profile)) {<br>
+   case PIPE_VIDEO_FORMAT_MPEG4_AVC:<br>
+      status = vlVaHandleVAEncMiscParameterTypeFrameRateH264(context, misc);<br>
+      break;<br>
+<br>
+   default:<br>
+      break;<br>
    }<br>
-   return VA_STATUS_SUCCESS;<br>
+<br>
+   return status;<br>
 }<br>
 <br>
 static VAStatus<br>
 handleVAEncSequenceParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
 {<br>
-   VAEncSequenceParameterBufferH264 *h264 = (VAEncSequenceParameterBufferH264 *)buf->data;<br>
-   if (!context->decoder) {<br>
-      context->templat.max_references = h264->max_num_ref_frames;<br>
-      context->templat.level = h264->level_idc;<br>
-      context->decoder = drv->pipe->create_video_codec(drv->pipe, &context->templat);<br>
-      if (!context->decoder)<br>
-         return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
+   VAStatus status = VA_STATUS_SUCCESS;<br>
+<br>
+   switch (u_reduce_video_profile(context->templat.profile)) {<br>
+   case PIPE_VIDEO_FORMAT_MPEG4_AVC:<br>
+      status = vlVaHandleVAEncSequenceParameterBufferTypeH264(drv, context, buf);<br>
+      break;<br>
+<br>
+   default:<br>
+      break;<br>
    }<br>
 <br>
-   context->gop_coeff = ((1024 + h264->intra_idr_period - 1) / h264->intra_idr_period + 1) / 2 * 2;<br>
-   if (context->gop_coeff > VL_VA_ENC_GOP_COEFF)<br>
-      context->gop_coeff = VL_VA_ENC_GOP_COEFF;<br>
-   context->desc.h264enc.gop_size = h264->intra_idr_period * context->gop_coeff;<br>
-   context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;<br>
-   context->desc.h264enc.rate_ctrl.frame_rate_den = h264->num_units_in_tick;<br>
-   context->desc.h264enc.pic_order_cnt_type = h264->seq_fields.bits.pic_order_cnt_type;<br>
-   return VA_STATUS_SUCCESS;<br>
+   return status;<br>
 }<br>
 <br>
 static VAStatus<br>
@@ -426,80 +423,35 @@ handleVAEncMiscParameterBufferType(vlVaContext *context, vlVaBuffer *buf)<br>
 static VAStatus<br>
 handleVAEncPictureParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
 {<br>
-   VAEncPictureParameterBufferH264 *h264;<br>
-   vlVaBuffer *coded_buf;<br>
+   VAStatus status = VA_STATUS_SUCCESS;<br>
 <br>
-   h264 = buf->data;<br>
-   context->desc.h264enc.frame_num = h264->frame_num;<br>
-   context->desc.h264enc.not_referenced = false;<br>
-   context->desc.h264enc.pic_order_cnt = h264->CurrPic.TopFieldOrderCnt;<br>
-   if (context->desc.h264enc.gop_cnt == 0)<br>
-      context->desc.h264enc.i_remain = context->gop_coeff;<br>
-   else if (context->desc.h264enc.frame_num == 1)<br>
-      context->desc.h264enc.i_remain--;<br>
-<br>
-   context->desc.h264enc.p_remain = context->desc.h264enc.gop_size - context->desc.h264enc.gop_cnt - context->desc.h264enc.i_remain;<br>
-<br>
-   coded_buf = handle_table_get(drv->htab, h264->coded_buf);<br>
-   if (!coded_buf->derived_surface.resource)<br>
-      coded_buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,<br>
-                                            PIPE_USAGE_STREAM, coded_buf->size);<br>
-   context->coded_buf = coded_buf;<br>
-<br>
-   util_hash_table_set(context->desc.h264enc.frame_idx,<br>
-               UINT_TO_PTR(h264->CurrPic.picture_id),<br>
-               UINT_TO_PTR(h264->frame_num));<br>
-<br>
-   if (h264->pic_fields.bits.idr_pic_flag == 1)<br>
-      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_IDR;<br>
-   else<br>
-      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_P;<br>
+   switch (u_reduce_video_profile(context->templat.profile)) {<br>
+   case PIPE_VIDEO_FORMAT_MPEG4_AVC:<br>
+      status = vlVaHandleVAEncPictureParameterBufferTypeH264(drv, context, buf);<br>
+      break;<br>
 <br>
-   context->desc.h264enc.quant_i_frames = h264->pic_init_qp;<br>
-   context->desc.h264enc.quant_b_frames = h264->pic_init_qp;<br>
-   context->desc.h264enc.quant_p_frames = h264->pic_init_qp;<br>
-   context->desc.h264enc.gop_cnt++;<br>
-   if (context->desc.h264enc.gop_cnt == context->desc.h264enc.gop_size)<br>
-      context->desc.h264enc.gop_cnt = 0;<br>
+   default:<br>
+      break;<br>
+   }<br>
 <br>
-   return VA_STATUS_SUCCESS;<br>
+   return status;<br>
 }<br>
 <br>
 static VAStatus<br>
 handleVAEncSliceParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
 {<br>
-   VAEncSliceParameterBufferH264 *h264;<br>
+   VAStatus status = VA_STATUS_SUCCESS;<br>
 <br>
-   h264 = buf->data;<br>
-   context->desc.h264enc.ref_idx_l0 = VA_INVALID_ID;<br>
-   context->desc.h264enc.ref_idx_l1 = VA_INVALID_ID;<br>
+   switch (u_reduce_video_profile(context->templat.profile)) {<br>
+   case PIPE_VIDEO_FORMAT_MPEG4_AVC:<br>
+      status = vlVaHandleVAEncSliceParameterBufferTypeH264(drv, context, buf);<br>
+      break;<br>
 <br>
-   for (int i = 0; i < 32; i++) {<br>
-      if (h264->RefPicList0[i].picture_id != VA_INVALID_ID) {<br>
-         if (context->desc.h264enc.ref_idx_l0 == VA_INVALID_ID)<br>
-            context->desc.h264enc.ref_idx_l0 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx,<br>
-                                           UINT_TO_PTR(h264->RefPicList0[i].picture_id)));<br>
-      }<br>
-      if (h264->RefPicList1[i].picture_id != VA_INVALID_ID && h264->slice_type == 1) {<br>
-         if (context->desc.h264enc.ref_idx_l1 == VA_INVALID_ID)<br>
-            context->desc.h264enc.ref_idx_l1 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx,<br>
-                                           UINT_TO_PTR(h264->RefPicList1[i].picture_id)));<br>
-      }<br>
+   default:<br>
+      break;<br>
    }<br>
 <br>
-   if (h264->slice_type == 1)<br>
-      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_B;<br>
-   else if (h264->slice_type == 0)<br>
-      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_P;<br>
-   else if (h264->slice_type == 2) {<br>
-      if (context->desc.h264enc.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR)<br>
-         context->desc.h264enc.idr_pic_id++;<br>
-       else<br>
-         context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_I;<br>
-   } else<br>
-      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_SKIP;<br>
-<br>
-   return VA_STATUS_SUCCESS;<br>
+   return status;<br>
 }<br>
 <br>
 VAStatus<br>
diff --git a/src/gallium/state_trackers/va/picture_h264_enc.c b/src/gallium/state_trackers/va/picture_h264_enc.c<br>
new file mode 100644<br>
index 0000000..f14ebba<br>
--- /dev/null<br>
+++ b/src/gallium/state_trackers/va/picture_h264_enc.c<br>
@@ -0,0 +1,163 @@<br>
+/**************************************************************************<br>
+ *<br>
+ * Copyright 2018 Advanced Micro Devices, Inc.<br>
+ * All Rights Reserved.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the<br>
+ * "Software"), to deal in the Software without restriction, including<br>
+ * without limitation the rights to use, copy, modify, merge, publish,<br>
+ * distribute, sub license, and/or sell copies of the Software, and to<br>
+ * permit persons to whom the Software is furnished to do so, subject to<br>
+ * the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the<br>
+ * next paragraph) shall be included in all copies or substantial portions<br>
+ * of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS<br>
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br>
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.<br>
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR<br>
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,<br>
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE<br>
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
+ *<br>
+ **************************************************************************/<br>
+<br>
+#include "util/u_handle_table.h"<br>
+#include "util/u_video.h"<br>
+#include "va_private.h"<br>
+<br>
+VAStatus<br>
+vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
+{<br>
+   VAEncPictureParameterBufferH264 *h264;<br>
+   vlVaBuffer *coded_buf;<br>
+<br>
+   h264 = buf->data;<br>
+   context->desc.h264enc.frame_num = h264->frame_num;<br>
+   context->desc.h264enc.not_referenced = false;<br>
+   context->desc.h264enc.pic_order_cnt = h264->CurrPic.TopFieldOrderCnt;<br>
+   if (context->desc.h264enc.gop_cnt == 0)<br>
+      context->desc.h264enc.i_remain = context->gop_coeff;<br>
+   else if (context->desc.h264enc.frame_num == 1)<br>
+      context->desc.h264enc.i_remain--;<br>
+<br>
+   context->desc.h264enc.p_remain = context->desc.h264enc.gop_size - context->desc.h264enc.gop_cnt - context->desc.h264enc.i_remain;<br>
+<br>
+   coded_buf = handle_table_get(drv->htab, h264->coded_buf);<br>
+   if (!coded_buf->derived_surface.resource)<br>
+      coded_buf->derived_surface.resource = pipe_buffer_create(drv->pipe->screen, PIPE_BIND_VERTEX_BUFFER,<br>
+                                            PIPE_USAGE_STREAM, coded_buf->size);<br>
+   context->coded_buf = coded_buf;<br>
+<br>
+   util_hash_table_set(context->desc.h264enc.frame_idx,<br>
+               UINT_TO_PTR(h264->CurrPic.picture_id),<br>
+               UINT_TO_PTR(h264->frame_num));<br>
+<br>
+   if (h264->pic_fields.bits.idr_pic_flag == 1)<br>
+      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_IDR;<br>
+   else<br>
+      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_P;<br>
+<br>
+   context->desc.h264enc.quant_i_frames = h264->pic_init_qp;<br>
+   context->desc.h264enc.quant_b_frames = h264->pic_init_qp;<br>
+   context->desc.h264enc.quant_p_frames = h264->pic_init_qp;<br>
+   context->desc.h264enc.gop_cnt++;<br>
+   if (context->desc.h264enc.gop_cnt == context->desc.h264enc.gop_size)<br>
+      context->desc.h264enc.gop_cnt = 0;<br>
+<br>
+   return VA_STATUS_SUCCESS;<br>
+}<br>
+<br>
+VAStatus<br>
+vlVaHandleVAEncSliceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
+{<br>
+   VAEncSliceParameterBufferH264 *h264;<br>
+<br>
+   h264 = buf->data;<br>
+   context->desc.h264enc.ref_idx_l0 = VA_INVALID_ID;<br>
+   context->desc.h264enc.ref_idx_l1 = VA_INVALID_ID;<br>
+<br>
+   for (int i = 0; i < 32; i++) {<br>
+      if (h264->RefPicList0[i].picture_id != VA_INVALID_ID) {<br>
+         if (context->desc.h264enc.ref_idx_l0 == VA_INVALID_ID)<br>
+            context->desc.h264enc.ref_idx_l0 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx,<br>
+                                           UINT_TO_PTR(h264->RefPicList0[i].picture_id)));<br>
+      }<br>
+      if (h264->RefPicList1[i].picture_id != VA_INVALID_ID && h264->slice_type == 1) {<br>
+         if (context->desc.h264enc.ref_idx_l1 == VA_INVALID_ID)<br>
+            context->desc.h264enc.ref_idx_l1 = PTR_TO_UINT(util_hash_table_get(context->desc.h264enc.frame_idx,<br>
+                                           UINT_TO_PTR(h264->RefPicList1[i].picture_id)));<br>
+      }<br>
+   }<br>
+<br>
+   if (h264->slice_type == 1)<br>
+      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_B;<br>
+   else if (h264->slice_type == 0)<br>
+      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_P;<br>
+   else if (h264->slice_type == 2) {<br>
+      if (context->desc.h264enc.picture_type == PIPE_H264_ENC_PICTURE_TYPE_IDR)<br>
+         context->desc.h264enc.idr_pic_id++;<br>
+       else<br>
+         context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_I;<br>
+   } else<br>
+      context->desc.h264enc.picture_type = PIPE_H264_ENC_PICTURE_TYPE_SKIP;<br>
+<br>
+   return VA_STATUS_SUCCESS;<br>
+}<br>
+<br>
+VAStatus<br>
+vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
+{<br>
+   VAEncSequenceParameterBufferH264 *h264 = (VAEncSequenceParameterBufferH264 *)buf->data;<br>
+   if (!context->decoder) {<br>
+      context->templat.max_references = h264->max_num_ref_frames;<br>
+      context->templat.level = h264->level_idc;<br>
+      context->decoder = drv->pipe->create_video_codec(drv->pipe, &context->templat);<br>
+      if (!context->decoder)<br>
+         return VA_STATUS_ERROR_ALLOCATION_FAILED;<br>
+   }<br>
+<br>
+   context->gop_coeff = ((1024 + h264->intra_idr_period - 1) / h264->intra_idr_period + 1) / 2 * 2;<br>
+   if (context->gop_coeff > VL_VA_ENC_GOP_COEFF)<br>
+      context->gop_coeff = VL_VA_ENC_GOP_COEFF;<br>
+   context->desc.h264enc.gop_size = h264->intra_idr_period * context->gop_coeff;<br>
+   context->desc.h264enc.rate_ctrl.frame_rate_num = h264->time_scale / 2;<br>
+   context->desc.h264enc.rate_ctrl.frame_rate_den = h264->num_units_in_tick;<br>
+   context->desc.h264enc.pic_order_cnt_type = h264->seq_fields.bits.pic_order_cnt_type;<br>
+   return VA_STATUS_SUCCESS;<br>
+}<br>
+<br>
+VAStatus<br>
+vlVaHandleVAEncMiscParameterTypeRateControlH264(vlVaContext *context, VAEncMiscParameterBuffer *misc)<br>
+{<br>
+   VAEncMiscParameterRateControl *rc = (VAEncMiscParameterRateControl *)misc->data;<br>
+   if (context->desc.h264enc.rate_ctrl.rate_ctrl_method ==<br>
+         PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT)<br>
+      context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second;<br>
+   else<br>
+      context->desc.h264enc.rate_ctrl.target_bitrate = rc->bits_per_second * (rc->target_percentage / 100.0);<br>
+   context->desc.h264enc.rate_ctrl.peak_bitrate = rc->bits_per_second;<br>
+   if (context->desc.h264enc.rate_ctrl.target_bitrate < 2000000)<br>
+      context->desc.h264enc.rate_ctrl.vbv_buffer_size = MIN2((context->desc.h264enc.rate_ctrl.target_bitrate * 2.75), 2000000);<br>
+   else<br>
+      context->desc.h264enc.rate_ctrl.vbv_buffer_size = context->desc.h264enc.rate_ctrl.target_bitrate;<br>
+<br>
+   return VA_STATUS_SUCCESS;<br>
+}<br>
+<br>
+VAStatus<br>
+vlVaHandleVAEncMiscParameterTypeFrameRateH264(vlVaContext *context, VAEncMiscParameterBuffer *misc)<br>
+{<br>
+   VAEncMiscParameterFrameRate *fr = (VAEncMiscParameterFrameRate *)misc->data;<br>
+   if (fr->framerate & 0xffff0000) {<br>
+      context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate       & 0xffff;<br>
+      context->desc.h264enc.rate_ctrl.frame_rate_den = fr->framerate >> 16 & 0xffff;<br>
+   } else {<br>
+      context->desc.h264enc.rate_ctrl.frame_rate_num = fr->framerate;<br>
+      context->desc.h264enc.rate_ctrl.frame_rate_den = 1;<br>
+   }<br>
+   return VA_STATUS_SUCCESS;<br>
+}<br>
diff --git a/src/gallium/state_trackers/va/va_private.h b/src/gallium/state_trackers/va/va_private.h<br>
index 46f6ba6..520f970 100644<br>
--- a/src/gallium/state_trackers/va/va_private.h<br>
+++ b/src/gallium/state_trackers/va/va_private.h<br>
@@ -426,5 +426,10 @@ void vlVaHandlePictureParameterBufferMJPEG(vlVaDriver *drv, vlVaContext *context<br>
 void vlVaHandleIQMatrixBufferMJPEG(vlVaContext *context, vlVaBuffer *buf);<br>
 void vlVaHandleHuffmanTableBufferType(vlVaContext *context, vlVaBuffer *buf);<br>
 void vlVaHandleSliceParameterBufferMJPEG(vlVaContext *context, vlVaBuffer *buf);<br>
+VAStatus vlVaHandleVAEncPictureParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);<br>
+VAStatus vlVaHandleVAEncSliceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);<br>
+VAStatus vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf);<br>
+VAStatus vlVaHandleVAEncMiscParameterTypeRateControlH264(vlVaContext *context, VAEncMiscParameterBuffer *buf);<br>
+VAStatus vlVaHandleVAEncMiscParameterTypeFrameRateH264(vlVaContext *context, VAEncMiscParameterBuffer *buf);<br>
 <br>
 #endif //VA_PRIVATE_H<br>
-- <br>
2.7.4<br>
<br>
</div>
<br>
<p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> mesa-dev <mesa-dev-bounces@lists.freedesktop.org> on behalf of Christoph Haag <haagch@frickel.club><br>
<b>Sent:</b> January 25, 2018 8:56:08 PM<br>
<b>To:</b> mesa-dev@lists.freedesktop.org<br>
<b>Cc:</b> Christoph Haag<br>
<b>Subject:</b> [Mesa-dev] [PATCH] meson: Add new picture_{h264, hevc}_enc.c files to meson too</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">---<br>
<br>
Very nice that this finally arrives. Can you add the files to meson too,<br>
something like this patch?<br>
I can't test it because I only have Polaris here.<br>
<br>
<br>
 src/gallium/state_trackers/va/meson.build | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/state_trackers/va/meson.build b/src/gallium/state_trackers/va/meson.build<br>
index 35da5ab532..2eb312ce4c 100644<br>
--- a/src/gallium/state_trackers/va/meson.build<br>
+++ b/src/gallium/state_trackers/va/meson.build<br>
@@ -26,7 +26,7 @@ libva_st = static_library(<br>
     'buffer.c', 'config.c', 'context.c', 'display.c', 'image.c', 'picture.c',<br>
     'picture_mpeg12.c', 'picture_mpeg4.c', 'picture_h264.c', 'picture_hevc.c',<br>
     'picture_vc1.c', 'picture_mjpeg.c', 'postproc.c', 'subpicture.c',<br>
-    'surface.c',<br>
+    'surface.c', 'picture_h264_enc.c', 'picture_hevc_enc.c'<br>
   ),<br>
   c_args : [<br>
     c_vis_args,<br>
-- <br>
2.16.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
mesa-dev@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div>
</span></font></div>
</body>
</html>