Commit 405ed4ac authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

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

This CL follows crrev.com/c/2393629 by batching up SubmitBuffer
calls in the JPEG decode accelerator, used e.g. for MJPEG camera
stream decoding.

This was verified via chrome:tracing while capturing HD on kohaku
and reks (Braswell) in the link [1]. Similarly to what is seen in
the previous CL, the combination of SubmitBuffer() calls on ToT
is ~10% slower than the batched SubmitBuffers(). A key difference
is that since JPEG is way simpler than e.g. VP9, the submitting
time is comparable to the ExecuteBuffers_Locked(), so this CL
has some minor overall decode-time savings. But still the target
here is to reduce contention on the lock and libva for video
conferencing cases with multiple remote participants a la Meet.

[1] webrtc.github.io/samples/src/content/getusermedia/resolution/

Cq-Depend: chromium:2393629
Bug: b/166646505
Change-Id: I183cc151de24d8fdbdc62e0172be296dacbf26f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2393525
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805557}
parent b512bba7
......@@ -349,45 +349,27 @@ bool VaapiJpegDecoder::SubmitBuffers(const JpegParseResult& parse_result) {
// Set picture parameters.
VAPictureParameterBufferJPEGBaseline pic_param{};
FillPictureParameters(parse_result.frame_header, &pic_param);
if (!vaapi_wrapper_->SubmitBuffer(VAPictureParameterBufferType, &pic_param)) {
VLOGF(1) << "Could not submit VAPictureParameterBufferType";
return false;
}
// Set quantization table.
VAIQMatrixBufferJPEGBaseline iq_matrix{};
FillIQMatrix(parse_result.q_table, &iq_matrix);
if (!vaapi_wrapper_->SubmitBuffer(VAIQMatrixBufferType, &iq_matrix)) {
VLOGF(1) << "Could not submit VAIQMatrixBufferType";
return false;
}
// Set huffman table.
VAHuffmanTableBufferJPEGBaseline huffman_table{};
FillHuffmanTable(parse_result.dc_table, parse_result.ac_table,
&huffman_table);
if (!vaapi_wrapper_->SubmitBuffer(VAHuffmanTableBufferType, &huffman_table)) {
VLOGF(1) << "Could not submit VAHuffmanTableBufferType";
return false;
}
// Set slice parameters.
VASliceParameterBufferJPEGBaseline slice_param{};
FillSliceParameters(parse_result, &slice_param);
if (!vaapi_wrapper_->SubmitBuffer(VASliceParameterBufferType, &slice_param)) {
VLOGF(1) << "Could not submit VASliceParameterBufferType";
return false;
}
// Set scan data.
if (!vaapi_wrapper_->SubmitBuffer(VASliceDataBufferType,
parse_result.data_size,
const_cast<char*>(parse_result.data))) {
VLOGF(1) << "Could not submit VASliceDataBufferType";
return false;
}
return true;
return vaapi_wrapper_->SubmitBuffers(
{{VAPictureParameterBufferType, sizeof(pic_param), &pic_param},
{VAIQMatrixBufferType, sizeof(iq_matrix), &iq_matrix},
{VAHuffmanTableBufferType, sizeof(huffman_table), &huffman_table},
{VASliceParameterBufferType, sizeof(slice_param), &slice_param},
{VASliceDataBufferType, parse_result.data_size,
const_cast<char*>(parse_result.data)}});
}
} // namespace media
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