Commit b512bba7 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

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

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

This is verified via chrome:tracing and codepen.io/full/qzYXba that
plays 4 1280x572 VP8 videos at the same time. Tracing is captured for
a few seconds, basically the SubmitBuffers() call takes ~0.312ms/call
versus the individual SubmitBuffer() calls ~0.072ms -- which gives
an aggregate of 0.360ms, or savings of about ~20%. Since decoding
itself takes about the same as SubmitBuffers on my BSW device (reks),
batching gives ~10% reduction in decode time.

Bug: b/166646505
Change-Id: I11c5570bea1c049fe0e9af75239bd60ac906a843
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401512
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805556}
parent 3cddc841
......@@ -226,16 +226,10 @@ bool FillVP8DataStructures(VaapiWrapper* vaapi_wrapper,
#undef CLAMP_Q
}
if (!vaapi_wrapper->SubmitBuffer(VAIQMatrixBufferType, &iq_matrix_buf))
return false;
const Vp8EntropyHeader& entr_hdr = frame_header.entropy_hdr;
VAProbabilityDataBufferVP8 prob_buf{};
CheckedMemcpy(prob_buf.dct_coeff_probs, entr_hdr.coeff_probs);
if (!vaapi_wrapper->SubmitBuffer(VAProbabilityBufferType, &prob_buf))
return false;
VAPictureParameterBufferVP8 pic_param{};
pic_param.frame_width = frame_header.width;
pic_param.frame_height = frame_header.height;
......@@ -335,9 +329,6 @@ bool FillVP8DataStructures(VaapiWrapper* vaapi_wrapper,
pic_param.bool_coder_ctx.value = frame_header.bool_dec_value;
pic_param.bool_coder_ctx.count = frame_header.bool_dec_count;
if (!vaapi_wrapper->SubmitBuffer(VAPictureParameterBufferType, &pic_param))
return false;
VASliceParameterBufferVP8 slice_param{};
slice_param.slice_data_size = frame_header.frame_size;
slice_param.slice_data_offset = frame_header.first_part_offset;
......@@ -355,10 +346,11 @@ bool FillVP8DataStructures(VaapiWrapper* vaapi_wrapper,
for (size_t i = 0; i < frame_header.num_of_dct_partitions; ++i)
slice_param.partition_size[i + 1] = frame_header.dct_partition_sizes[i];
if (!vaapi_wrapper->SubmitBuffer(VASliceParameterBufferType, &slice_param))
return false;
return vaapi_wrapper->SubmitBuffer(
VASliceDataBufferType, frame_header.frame_size, frame_header.data);
return vaapi_wrapper->SubmitBuffers(
{{VAIQMatrixBufferType, sizeof(iq_matrix_buf), &iq_matrix_buf},
{VAProbabilityBufferType, sizeof(prob_buf), &prob_buf},
{VAPictureParameterBufferType, sizeof(pic_param), &pic_param},
{VASliceParameterBufferType, sizeof(slice_param), &slice_param},
{VASliceDataBufferType, frame_header.frame_size, frame_header.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