Commit 4579d553 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

media/gpu/vaapi: batch submitting VABufferIDs for H264 decoding

This CL follows crrev.com/c/2393629 by batching up SubmitBuffer
calls in the H264 decode accelerator.

This is verified via chrome:tracing and codepen.io/miguelao/full/MMxGJw
that plays 4 1280x546 H.264 videos at the same time. Tracing is captured
for a few seconds, basically with this patch we have 2 SubmitBuffers()
calls adding up to ~0.461ms/frame versus ToT individual SubmitBuffer()
calls (4 of them) ~0.504ms in  total -- which gives an aggregate of
about ~40us improvement, or savings of about ~10%. Since decoding itself
takes about the 0.390ms/frame, savings are OKish, so let's take them.
This is all on my BSW device (reks),

Improvements are of course extremely small, the advantages of this CL
are in reducing lock/unlock churn and associated contention. This
benefit grows with the amount of decodes (e.g. Meet grid scenarios).

Bug: b/166646505
Change-Id: Id51bb6db39e4f7b9d67760f86b8f8963f20c2b2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405586Reviewed-by: default avatarJeffrey Kardatzke <jkardatzke@google.com>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806264}
parent 07caa42f
......@@ -139,9 +139,6 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitFrameMetadata(
pic_param.num_ref_frames = sps->max_num_ref_frames;
if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, &pic_param))
return DecodeStatus::kFail;
VAIQMatrixBufferH264 iq_matrix_buf;
memset(&iq_matrix_buf, 0, sizeof(iq_matrix_buf));
......@@ -171,9 +168,10 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitFrameMetadata(
}
}
return vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType, &iq_matrix_buf)
? DecodeStatus::kOk
: DecodeStatus::kFail;
const bool success = vaapi_wrapper_->SubmitBuffers(
{{VAPictureParameterBufferType, sizeof(pic_param), &pic_param},
{VAIQMatrixBufferType, sizeof(iq_matrix_buf), &iq_matrix_buf}});
return success ? DecodeStatus::kOk : DecodeStatus::kFail;
}
DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
......@@ -275,12 +273,10 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
FillVAPicture(&slice_param.RefPicList1[i], ref_pic_list1[i]);
}
if (!vaapi_wrapper_->SubmitBuffer(VASliceParameterBufferType, &slice_param))
return DecodeStatus::kFail;
return vaapi_wrapper_->SubmitBuffer(VASliceDataBufferType, size, data)
? DecodeStatus::kOk
: DecodeStatus::kFail;
const bool success = vaapi_wrapper_->SubmitBuffers(
{{VASliceParameterBufferType, sizeof(slice_param), &slice_param},
{VASliceDataBufferType, size, data}});
return success ? DecodeStatus::kOk : DecodeStatus::kFail;
}
DecodeStatus H264VaapiVideoDecoderDelegate::SubmitDecode(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment