1 /**************************************************************************
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
4 * Copyright 2014 Advanced Micro Devices, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
29 #include "pipe/p_video_codec.h"
31 #include "util/u_handle_table.h"
32 #include "util/u_video.h"
34 #include "vl/vl_vlc.h"
35 #include "vl/vl_winsys.h"
37 #include "va_private.h"
40 vlVaBeginPicture(VADriverContextP ctx
, VAContextID context_id
, VASurfaceID render_target
)
47 return VA_STATUS_ERROR_INVALID_CONTEXT
;
49 drv
= VL_VA_DRIVER(ctx
);
51 return VA_STATUS_ERROR_INVALID_CONTEXT
;
53 mtx_lock(&drv
->mutex
);
54 context
= handle_table_get(drv
->htab
, context_id
);
56 mtx_unlock(&drv
->mutex
);
57 return VA_STATUS_ERROR_INVALID_CONTEXT
;
60 if (u_reduce_video_profile(context
->templat
.profile
) == PIPE_VIDEO_FORMAT_MPEG12
) {
61 context
->desc
.mpeg12
.intra_matrix
= NULL
;
62 context
->desc
.mpeg12
.non_intra_matrix
= NULL
;
65 surf
= handle_table_get(drv
->htab
, render_target
);
66 mtx_unlock(&drv
->mutex
);
67 if (!surf
|| !surf
->buffer
)
68 return VA_STATUS_ERROR_INVALID_SURFACE
;
70 context
->target_id
= render_target
;
71 surf
->ctx
= context_id
;
72 context
->target
= surf
->buffer
;
73 context
->mjpeg
.sampling_factor
= 0;
75 if (!context
->decoder
) {
78 if (context
->templat
.profile
== PIPE_VIDEO_PROFILE_UNKNOWN
&&
79 context
->target
->buffer_format
!= PIPE_FORMAT_B8G8R8A8_UNORM
&&
80 context
->target
->buffer_format
!= PIPE_FORMAT_R8G8B8A8_UNORM
&&
81 context
->target
->buffer_format
!= PIPE_FORMAT_B8G8R8X8_UNORM
&&
82 context
->target
->buffer_format
!= PIPE_FORMAT_R8G8B8X8_UNORM
&&
83 context
->target
->buffer_format
!= PIPE_FORMAT_NV12
&&
84 context
->target
->buffer_format
!= PIPE_FORMAT_P010
&&
85 context
->target
->buffer_format
!= PIPE_FORMAT_P016
)
86 return VA_STATUS_ERROR_UNIMPLEMENTED
;
88 return VA_STATUS_SUCCESS
;
91 if (context
->decoder
->entrypoint
!= PIPE_VIDEO_ENTRYPOINT_ENCODE
)
92 context
->needs_begin_frame
= true;
94 return VA_STATUS_SUCCESS
;
98 vlVaGetReferenceFrame(vlVaDriver
*drv
, VASurfaceID surface_id
,
99 struct pipe_video_buffer
**ref_frame
)
101 vlVaSurface
*surf
= handle_table_get(drv
->htab
, surface_id
);
103 *ref_frame
= surf
->buffer
;
109 handlePictureParameterBuffer(vlVaDriver
*drv
, vlVaContext
*context
, vlVaBuffer
*buf
)
111 VAStatus vaStatus
= VA_STATUS_SUCCESS
;
113 switch (u_reduce_video_profile(context
->templat
.profile
)) {
114 case PIPE_VIDEO_FORMAT_MPEG12
:
115 vlVaHandlePictureParameterBufferMPEG12(drv
, context
, buf
);
118 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
119 vlVaHandlePictureParameterBufferH264(drv
, context
, buf
);
122 case PIPE_VIDEO_FORMAT_VC1
:
123 vlVaHandlePictureParameterBufferVC1(drv
, context
, buf
);
126 case PIPE_VIDEO_FORMAT_MPEG4
:
127 vlVaHandlePictureParameterBufferMPEG4(drv
, context
, buf
);
130 case PIPE_VIDEO_FORMAT_HEVC
:
131 vlVaHandlePictureParameterBufferHEVC(drv
, context
, buf
);
134 case PIPE_VIDEO_FORMAT_JPEG
:
135 vlVaHandlePictureParameterBufferMJPEG(drv
, context
, buf
);
138 case PIPE_VIDEO_FORMAT_VP9
:
139 vlVaHandlePictureParameterBufferVP9(drv
, context
, buf
);
146 /* Create the decoder once max_references is known. */
147 if (!context
->decoder
) {
148 enum pipe_video_format format
=
149 u_reduce_video_profile(context
->templat
.profile
);
151 if (!context
->target
)
152 return VA_STATUS_ERROR_INVALID_CONTEXT
;
154 if (context
->templat
.max_references
== 0 &&
155 format
!= PIPE_VIDEO_FORMAT_JPEG
)
156 return VA_STATUS_ERROR_INVALID_BUFFER
;
158 if (format
== PIPE_VIDEO_FORMAT_MPEG4_AVC
)
159 context
->templat
.level
= u_get_h264_level(context
->templat
.width
,
160 context
->templat
.height
, &context
->templat
.max_references
);
162 context
->decoder
= drv
->pipe
->create_video_codec(drv
->pipe
,
165 if (!context
->decoder
)
166 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
168 context
->needs_begin_frame
= true;
175 handleIQMatrixBuffer(vlVaContext
*context
, vlVaBuffer
*buf
)
177 switch (u_reduce_video_profile(context
->templat
.profile
)) {
178 case PIPE_VIDEO_FORMAT_MPEG12
:
179 vlVaHandleIQMatrixBufferMPEG12(context
, buf
);
182 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
183 vlVaHandleIQMatrixBufferH264(context
, buf
);
186 case PIPE_VIDEO_FORMAT_MPEG4
:
187 vlVaHandleIQMatrixBufferMPEG4(context
, buf
);
190 case PIPE_VIDEO_FORMAT_HEVC
:
191 vlVaHandleIQMatrixBufferHEVC(context
, buf
);
194 case PIPE_VIDEO_FORMAT_JPEG
:
195 vlVaHandleIQMatrixBufferMJPEG(context
, buf
);
204 handleSliceParameterBuffer(vlVaContext
*context
, vlVaBuffer
*buf
)
206 switch (u_reduce_video_profile(context
->templat
.profile
)) {
207 case PIPE_VIDEO_FORMAT_MPEG12
:
208 vlVaHandleSliceParameterBufferMPEG12(context
, buf
);
211 case PIPE_VIDEO_FORMAT_VC1
:
212 vlVaHandleSliceParameterBufferVC1(context
, buf
);
215 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
216 vlVaHandleSliceParameterBufferH264(context
, buf
);
219 case PIPE_VIDEO_FORMAT_MPEG4
:
220 vlVaHandleSliceParameterBufferMPEG4(context
, buf
);
223 case PIPE_VIDEO_FORMAT_HEVC
:
224 vlVaHandleSliceParameterBufferHEVC(context
, buf
);
227 case PIPE_VIDEO_FORMAT_JPEG
:
228 vlVaHandleSliceParameterBufferMJPEG(context
, buf
);
231 case PIPE_VIDEO_FORMAT_VP9
:
232 vlVaHandleSliceParameterBufferVP9(context
, buf
);
241 bufHasStartcode(vlVaBuffer
*buf
, unsigned int code
, unsigned int bits
)
243 struct vl_vlc vlc
= {0};
246 /* search the first 64 bytes for a startcode */
247 vl_vlc_init(&vlc
, 1, (const void * const*)&buf
->data
, &buf
->size
);
248 for (i
= 0; i
< 64 && vl_vlc_bits_left(&vlc
) >= bits
; ++i
) {
249 if (vl_vlc_peekbits(&vlc
, bits
) == code
)
251 vl_vlc_eatbits(&vlc
, 8);
252 vl_vlc_fillbits(&vlc
);
259 handleVASliceDataBufferType(vlVaContext
*context
, vlVaBuffer
*buf
)
261 enum pipe_video_format format
;
262 unsigned num_buffers
= 0;
263 void * const *buffers
[3];
265 static const uint8_t start_code_h264
[] = { 0x00, 0x00, 0x01 };
266 static const uint8_t start_code_h265
[] = { 0x00, 0x00, 0x01 };
267 static const uint8_t start_code_vc1
[] = { 0x00, 0x00, 0x01, 0x0d };
268 static const uint8_t eoi_jpeg
[] = { 0xff, 0xd9 };
270 format
= u_reduce_video_profile(context
->templat
.profile
);
272 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
273 if (bufHasStartcode(buf
, 0x000001, 24))
276 buffers
[num_buffers
] = (void *const)&start_code_h264
;
277 sizes
[num_buffers
++] = sizeof(start_code_h264
);
279 case PIPE_VIDEO_FORMAT_HEVC
:
280 if (bufHasStartcode(buf
, 0x000001, 24))
283 buffers
[num_buffers
] = (void *const)&start_code_h265
;
284 sizes
[num_buffers
++] = sizeof(start_code_h265
);
286 case PIPE_VIDEO_FORMAT_VC1
:
287 if (bufHasStartcode(buf
, 0x0000010d, 32) ||
288 bufHasStartcode(buf
, 0x0000010c, 32) ||
289 bufHasStartcode(buf
, 0x0000010b, 32))
292 if (context
->decoder
->profile
== PIPE_VIDEO_PROFILE_VC1_ADVANCED
) {
293 buffers
[num_buffers
] = (void *const)&start_code_vc1
;
294 sizes
[num_buffers
++] = sizeof(start_code_vc1
);
297 case PIPE_VIDEO_FORMAT_MPEG4
:
298 if (bufHasStartcode(buf
, 0x000001, 24))
301 vlVaDecoderFixMPEG4Startcode(context
);
302 buffers
[num_buffers
] = (void *)context
->mpeg4
.start_code
;
303 sizes
[num_buffers
++] = context
->mpeg4
.start_code_size
;
305 case PIPE_VIDEO_FORMAT_JPEG
:
306 vlVaGetJpegSliceHeader(context
);
307 buffers
[num_buffers
] = (void *)context
->mjpeg
.slice_header
;
308 sizes
[num_buffers
++] = context
->mjpeg
.slice_header_size
;
310 case PIPE_VIDEO_FORMAT_VP9
:
311 vlVaDecoderVP9BitstreamHeader(context
, buf
);
317 buffers
[num_buffers
] = buf
->data
;
318 sizes
[num_buffers
] = buf
->size
;
321 if (format
== PIPE_VIDEO_FORMAT_JPEG
) {
322 buffers
[num_buffers
] = (void *const)&eoi_jpeg
;
323 sizes
[num_buffers
++] = sizeof(eoi_jpeg
);
326 if (context
->needs_begin_frame
) {
327 context
->decoder
->begin_frame(context
->decoder
, context
->target
,
328 &context
->desc
.base
);
329 context
->needs_begin_frame
= false;
331 context
->decoder
->decode_bitstream(context
->decoder
, context
->target
, &context
->desc
.base
,
332 num_buffers
, (const void * const*)buffers
, sizes
);
336 handleVAEncMiscParameterTypeRateControl(vlVaContext
*context
, VAEncMiscParameterBuffer
*misc
)
338 VAStatus status
= VA_STATUS_SUCCESS
;
340 switch (u_reduce_video_profile(context
->templat
.profile
)) {
341 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
342 status
= vlVaHandleVAEncMiscParameterTypeRateControlH264(context
, misc
);
345 case PIPE_VIDEO_FORMAT_HEVC
:
346 status
= vlVaHandleVAEncMiscParameterTypeRateControlHEVC(context
, misc
);
357 handleVAEncMiscParameterTypeFrameRate(vlVaContext
*context
, VAEncMiscParameterBuffer
*misc
)
359 VAStatus status
= VA_STATUS_SUCCESS
;
361 switch (u_reduce_video_profile(context
->templat
.profile
)) {
362 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
363 status
= vlVaHandleVAEncMiscParameterTypeFrameRateH264(context
, misc
);
366 case PIPE_VIDEO_FORMAT_HEVC
:
367 status
= vlVaHandleVAEncMiscParameterTypeFrameRateHEVC(context
, misc
);
378 handleVAEncSequenceParameterBufferType(vlVaDriver
*drv
, vlVaContext
*context
, vlVaBuffer
*buf
)
380 VAStatus status
= VA_STATUS_SUCCESS
;
382 switch (u_reduce_video_profile(context
->templat
.profile
)) {
383 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
384 status
= vlVaHandleVAEncSequenceParameterBufferTypeH264(drv
, context
, buf
);
387 case PIPE_VIDEO_FORMAT_HEVC
:
388 status
= vlVaHandleVAEncSequenceParameterBufferTypeHEVC(drv
, context
, buf
);
399 handleVAEncMiscParameterBufferType(vlVaContext
*context
, vlVaBuffer
*buf
)
401 VAStatus vaStatus
= VA_STATUS_SUCCESS
;
402 VAEncMiscParameterBuffer
*misc
;
405 switch (misc
->type
) {
406 case VAEncMiscParameterTypeRateControl
:
407 vaStatus
= handleVAEncMiscParameterTypeRateControl(context
, misc
);
410 case VAEncMiscParameterTypeFrameRate
:
411 vaStatus
= handleVAEncMiscParameterTypeFrameRate(context
, misc
);
422 handleVAEncPictureParameterBufferType(vlVaDriver
*drv
, vlVaContext
*context
, vlVaBuffer
*buf
)
424 VAStatus status
= VA_STATUS_SUCCESS
;
426 switch (u_reduce_video_profile(context
->templat
.profile
)) {
427 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
428 status
= vlVaHandleVAEncPictureParameterBufferTypeH264(drv
, context
, buf
);
431 case PIPE_VIDEO_FORMAT_HEVC
:
432 status
= vlVaHandleVAEncPictureParameterBufferTypeHEVC(drv
, context
, buf
);
443 handleVAEncSliceParameterBufferType(vlVaDriver
*drv
, vlVaContext
*context
, vlVaBuffer
*buf
)
445 VAStatus status
= VA_STATUS_SUCCESS
;
447 switch (u_reduce_video_profile(context
->templat
.profile
)) {
448 case PIPE_VIDEO_FORMAT_MPEG4_AVC
:
449 status
= vlVaHandleVAEncSliceParameterBufferTypeH264(drv
, context
, buf
);
452 case PIPE_VIDEO_FORMAT_HEVC
:
453 status
= vlVaHandleVAEncSliceParameterBufferTypeHEVC(drv
, context
, buf
);
464 vlVaRenderPicture(VADriverContextP ctx
, VAContextID context_id
, VABufferID
*buffers
, int num_buffers
)
467 vlVaContext
*context
;
468 VAStatus vaStatus
= VA_STATUS_SUCCESS
;
473 return VA_STATUS_ERROR_INVALID_CONTEXT
;
475 drv
= VL_VA_DRIVER(ctx
);
477 return VA_STATUS_ERROR_INVALID_CONTEXT
;
479 mtx_lock(&drv
->mutex
);
480 context
= handle_table_get(drv
->htab
, context_id
);
482 mtx_unlock(&drv
->mutex
);
483 return VA_STATUS_ERROR_INVALID_CONTEXT
;
486 for (i
= 0; i
< num_buffers
; ++i
) {
487 vlVaBuffer
*buf
= handle_table_get(drv
->htab
, buffers
[i
]);
489 mtx_unlock(&drv
->mutex
);
490 return VA_STATUS_ERROR_INVALID_BUFFER
;
494 case VAPictureParameterBufferType
:
495 vaStatus
= handlePictureParameterBuffer(drv
, context
, buf
);
498 case VAIQMatrixBufferType
:
499 handleIQMatrixBuffer(context
, buf
);
502 case VASliceParameterBufferType
:
503 handleSliceParameterBuffer(context
, buf
);
506 case VASliceDataBufferType
:
507 handleVASliceDataBufferType(context
, buf
);
509 case VAProcPipelineParameterBufferType
:
510 vaStatus
= vlVaHandleVAProcPipelineParameterBufferType(drv
, context
, buf
);
513 case VAEncSequenceParameterBufferType
:
514 vaStatus
= handleVAEncSequenceParameterBufferType(drv
, context
, buf
);
517 case VAEncMiscParameterBufferType
:
518 vaStatus
= handleVAEncMiscParameterBufferType(context
, buf
);
521 case VAEncPictureParameterBufferType
:
522 vaStatus
= handleVAEncPictureParameterBufferType(drv
, context
, buf
);
525 case VAEncSliceParameterBufferType
:
526 vaStatus
= handleVAEncSliceParameterBufferType(drv
, context
, buf
);
529 case VAHuffmanTableBufferType
:
530 vlVaHandleHuffmanTableBufferType(context
, buf
);
537 mtx_unlock(&drv
->mutex
);
543 vlVaEndPicture(VADriverContextP ctx
, VAContextID context_id
)
546 vlVaContext
*context
;
547 vlVaBuffer
*coded_buf
;
550 struct pipe_screen
*screen
;
552 bool realloc
= false;
553 enum pipe_format format
;
556 return VA_STATUS_ERROR_INVALID_CONTEXT
;
558 drv
= VL_VA_DRIVER(ctx
);
560 return VA_STATUS_ERROR_INVALID_CONTEXT
;
562 mtx_lock(&drv
->mutex
);
563 context
= handle_table_get(drv
->htab
, context_id
);
564 mtx_unlock(&drv
->mutex
);
566 return VA_STATUS_ERROR_INVALID_CONTEXT
;
568 if (!context
->decoder
) {
569 if (context
->templat
.profile
!= PIPE_VIDEO_PROFILE_UNKNOWN
)
570 return VA_STATUS_ERROR_INVALID_CONTEXT
;
573 return VA_STATUS_SUCCESS
;
576 mtx_lock(&drv
->mutex
);
577 surf
= handle_table_get(drv
->htab
, context
->target_id
);
578 context
->mpeg4
.frame_num
++;
580 screen
= context
->decoder
->context
->screen
;
581 supported
= screen
->get_video_param(screen
, context
->decoder
->profile
,
582 context
->decoder
->entrypoint
,
583 surf
->buffer
->interlaced
?
584 PIPE_VIDEO_CAP_SUPPORTS_INTERLACED
:
585 PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE
);
588 surf
->templat
.interlaced
= screen
->get_video_param(screen
,
589 context
->decoder
->profile
,
590 context
->decoder
->entrypoint
,
591 PIPE_VIDEO_CAP_PREFERS_INTERLACED
);
595 format
= screen
->get_video_param(screen
, context
->decoder
->profile
,
596 PIPE_VIDEO_ENTRYPOINT_BITSTREAM
,
597 PIPE_VIDEO_CAP_PREFERED_FORMAT
);
599 if (surf
->buffer
->buffer_format
!= format
&&
600 surf
->buffer
->buffer_format
== PIPE_FORMAT_NV12
) {
601 /* check originally as NV12 only */
602 surf
->templat
.buffer_format
= format
;
606 if (u_reduce_video_profile(context
->templat
.profile
) == PIPE_VIDEO_FORMAT_JPEG
&&
607 surf
->buffer
->buffer_format
== PIPE_FORMAT_NV12
) {
608 if (context
->mjpeg
.sampling_factor
== 0x211111 ||
609 context
->mjpeg
.sampling_factor
== 0x221212) {
610 surf
->templat
.buffer_format
= PIPE_FORMAT_YUYV
;
612 } else if (context
->mjpeg
.sampling_factor
!= 0x221111) {
613 /* Not NV12 either */
614 mtx_unlock(&drv
->mutex
);
615 return VA_STATUS_ERROR_INVALID_SURFACE
;
620 struct pipe_video_buffer
*old_buf
= surf
->buffer
;
622 if (vlVaHandleSurfaceAllocate(drv
, surf
, &surf
->templat
) != VA_STATUS_SUCCESS
) {
623 mtx_unlock(&drv
->mutex
);
624 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
627 if (context
->decoder
->entrypoint
== PIPE_VIDEO_ENTRYPOINT_ENCODE
) {
628 if (old_buf
->interlaced
) {
629 struct u_rect src_rect
, dst_rect
;
631 dst_rect
.x0
= src_rect
.x0
= 0;
632 dst_rect
.y0
= src_rect
.y0
= 0;
633 dst_rect
.x1
= src_rect
.x1
= surf
->templat
.width
;
634 dst_rect
.y1
= src_rect
.y1
= surf
->templat
.height
;
635 vl_compositor_yuv_deint_full(&drv
->cstate
, &drv
->compositor
,
636 old_buf
, surf
->buffer
,
637 &src_rect
, &dst_rect
, VL_COMPOSITOR_WEAVE
);
639 /* Can't convert from progressive to interlaced yet */
640 mtx_unlock(&drv
->mutex
);
641 return VA_STATUS_ERROR_INVALID_SURFACE
;
645 old_buf
->destroy(old_buf
);
646 context
->target
= surf
->buffer
;
649 if (context
->decoder
->entrypoint
== PIPE_VIDEO_ENTRYPOINT_ENCODE
) {
650 coded_buf
= context
->coded_buf
;
651 if (u_reduce_video_profile(context
->templat
.profile
) == PIPE_VIDEO_FORMAT_MPEG4_AVC
) {
652 getEncParamPresetH264(context
);
653 context
->desc
.h264enc
.frame_num_cnt
++;
654 } else if (u_reduce_video_profile(context
->templat
.profile
) == PIPE_VIDEO_FORMAT_HEVC
)
655 getEncParamPresetH265(context
);
656 context
->decoder
->begin_frame(context
->decoder
, context
->target
, &context
->desc
.base
);
657 context
->decoder
->encode_bitstream(context
->decoder
, context
->target
,
658 coded_buf
->derived_surface
.resource
, &feedback
);
659 surf
->feedback
= feedback
;
660 surf
->coded_buf
= coded_buf
;
663 context
->decoder
->end_frame(context
->decoder
, context
->target
, &context
->desc
.base
);
664 if (context
->decoder
->entrypoint
== PIPE_VIDEO_ENTRYPOINT_ENCODE
&&
665 u_reduce_video_profile(context
->templat
.profile
) == PIPE_VIDEO_FORMAT_MPEG4_AVC
) {
666 int idr_period
= context
->desc
.h264enc
.gop_size
/ context
->gop_coeff
;
667 int p_remain_in_idr
= idr_period
- context
->desc
.h264enc
.frame_num
;
668 surf
->frame_num_cnt
= context
->desc
.h264enc
.frame_num_cnt
;
669 surf
->force_flushed
= false;
670 if (context
->first_single_submitted
) {
671 context
->decoder
->flush(context
->decoder
);
672 context
->first_single_submitted
= false;
673 surf
->force_flushed
= true;
675 if (p_remain_in_idr
== 1) {
676 if ((context
->desc
.h264enc
.frame_num_cnt
% 2) != 0) {
677 context
->decoder
->flush(context
->decoder
);
678 context
->first_single_submitted
= true;
681 context
->first_single_submitted
= false;
682 surf
->force_flushed
= true;
684 } else if (context
->decoder
->entrypoint
== PIPE_VIDEO_ENTRYPOINT_ENCODE
&&
685 u_reduce_video_profile(context
->templat
.profile
) == PIPE_VIDEO_FORMAT_HEVC
)
686 context
->desc
.h265enc
.frame_num
++;
687 mtx_unlock(&drv
->mutex
);
688 return VA_STATUS_SUCCESS
;