Commit 0d6242c9 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

components/arc: GAVDA calls AssignPictureBuffers() in ImportBufferForPicture...

components/arc: GAVDA calls AssignPictureBuffers() in ImportBufferForPicture for the first PictureBuffer

VDA needs to know a frame size adjusted by gralloc in Android side. A frame
size in AssignPictureBuffers() is unknown in secure mode. We can know a frame
size of a real buffer in ImportBufferForPicture(). This CL gets the frame size
in ImportBufferForPicture() and calls AssignPictureBuffers() for the first
PictureBuffer(). Chrome can assume ImportBufferForPicture() is called with
PictureBuffer whose id is zero for the first PictureBuffer.
So the current flow is,
GAVDA::AssignPictureBuffers() (|assign_picture_buffers_called_| <- true)
GAVDA::ImportBufferForPicture()
VDA::AssignPictureBuffers() (|assign_picture_buffers_called_| <- false)
VDA::ImportBufferForPicture()
GAVDA::ImportBufferForPicture()
VDA::ImportBufferForPicture()
...


Bug: 979115
Test: video.ARCDecodeAccel* on kevin
Change-Id: I5eef3638be7f9259e051a0f759f6044ddf099770
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722468Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683896}
parent 45dcd9a7
...@@ -416,15 +416,17 @@ void GpuArcVideoDecodeAccelerator::AssignPictureBuffers(uint32_t count) { ...@@ -416,15 +416,17 @@ void GpuArcVideoDecodeAccelerator::AssignPictureBuffers(uint32_t count) {
mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT); mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT);
return; return;
} }
if (assign_picture_buffers_called_) {
VLOGF(1) << "AssignPictureBuffers is called twice without "
<< "ImportBufferForPicture()";
client_->NotifyError(
mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT);
return;
}
coded_size_ = pending_coded_size_; coded_size_ = pending_coded_size_;
std::vector<media::PictureBuffer> buffers;
for (uint32_t id = 0; id < count; ++id) {
buffers.push_back(
media::PictureBuffer(static_cast<int32_t>(id), coded_size_));
}
output_buffer_count_ = static_cast<size_t>(count); output_buffer_count_ = static_cast<size_t>(count);
vda_->AssignPictureBuffers(buffers); assign_picture_buffers_called_ = true;
} }
void GpuArcVideoDecodeAccelerator::ImportBufferForPicture( void GpuArcVideoDecodeAccelerator::ImportBufferForPicture(
...@@ -514,6 +516,21 @@ void GpuArcVideoDecodeAccelerator::ImportBufferForPicture( ...@@ -514,6 +516,21 @@ void GpuArcVideoDecodeAccelerator::ImportBufferForPicture(
} }
} }
// This is the first time of ImportBufferForPicture() after
// AssignPictureBuffers() is called. Call VDA::AssignPictureBuffers() here.
if (assign_picture_buffers_called_) {
gfx::Size picture_size(gmb_handle.native_pixmap_handle.planes[0].stride,
coded_size_.height());
std::vector<media::PictureBuffer> buffers;
for (size_t id = 0; id < output_buffer_count_; ++id) {
buffers.push_back(
media::PictureBuffer(static_cast<int32_t>(id), picture_size));
}
vda_->AssignPictureBuffers(std::move(buffers));
assign_picture_buffers_called_ = false;
}
vda_->ImportBufferForPicture(picture_buffer_id, pixel_format, vda_->ImportBufferForPicture(picture_buffer_id, pixel_format,
std::move(gmb_handle)); std::move(gmb_handle));
} }
......
...@@ -151,6 +151,7 @@ class GpuArcVideoDecodeAccelerator ...@@ -151,6 +151,7 @@ class GpuArcVideoDecodeAccelerator
bool secure_mode_ = false; bool secure_mode_ = false;
size_t output_buffer_count_ = 0; size_t output_buffer_count_ = 0;
bool assign_picture_buffers_called_ = false;
THREAD_CHECKER(thread_checker_); THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(GpuArcVideoDecodeAccelerator); DISALLOW_COPY_AND_ASSIGN(GpuArcVideoDecodeAccelerator);
......
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