| 416 | } |
| 417 | |
| 418 | static int decode_reset(AVCodecContext *avctx, FFVulkanDecodeShared *ctx) |
| 419 | { |
| 420 | int err; |
| 421 | FFVulkanContext *s = &ctx->s; |
| 422 | FFVulkanFunctions *vk = &s->vkfn; |
| 423 | |
| 424 | VkVideoBeginCodingInfoKHR decode_start = { |
| 425 | .sType = VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR, |
| 426 | .videoSession = ctx->common.session, |
| 427 | }; |
| 428 | |
| 429 | if (!(ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_2)) { |
| 430 | err = create_empty_session_parameters(avctx, ctx, |
| 431 | &decode_start.videoSessionParameters); |
| 432 | if (err < 0) |
| 433 | return err; |
| 434 | } |
| 435 | |
| 436 | VkVideoCodingControlInfoKHR decode_ctrl = { |
| 437 | .sType = VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR, |
| 438 | .flags = VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR, |
| 439 | }; |
| 440 | VkVideoEndCodingInfoKHR decode_end = { |
| 441 | .sType = VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR, |
| 442 | }; |
| 443 | |
| 444 | FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &ctx->exec_pool); |
| 445 | ff_vk_exec_start(&ctx->s, exec); |
| 446 | |
| 447 | vk->CmdBeginVideoCodingKHR(exec->buf, &decode_start); |
| 448 | vk->CmdControlVideoCodingKHR(exec->buf, &decode_ctrl); |
| 449 | vk->CmdEndVideoCodingKHR(exec->buf, &decode_end); |
| 450 | |
| 451 | err = ff_vk_exec_submit(&ctx->s, exec); |
| 452 | |
| 453 | if (decode_start.videoSessionParameters) { |
| 454 | /* Wait to complete to delete the temporary session parameters */ |
| 455 | if (err >= 0) |
| 456 | ff_vk_exec_wait(&ctx->s, exec); |
| 457 | |
| 458 | vk->DestroyVideoSessionParametersKHR(s->hwctx->act_dev, |
| 459 | decode_start.videoSessionParameters, |
| 460 | s->hwctx->alloc); |
| 461 | } |
| 462 | |
| 463 | if (err < 0) |
| 464 | av_log(avctx, AV_LOG_ERROR, "Unable to reset decoder: %s", |
| 465 | ff_vk_ret2str(err)); |
| 466 | |
| 467 | return err; |
| 468 | } |
| 469 | |
| 470 | int ff_vk_decode_frame(AVCodecContext *avctx, |
| 471 | AVFrame *pic, FFVulkanDecodePicture *vp, |
no test coverage detected