Commit 7304d68c authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

media/gpu/v4l2svda: stream the OUTPUT queue off when changing resolution

The stateless codec API requires us to set the resolution on the OUTPUT
queue. This however can only be done if the queue is streamed off. Do
this when changing resolution so we can conform to the stateless codec
API.

Bug: 968392
Test: Checked that video_VideoSeek.vp8.switchres passed on Minnie.

Change-Id: I44e50fada7472d159b75711cde3fc0c5661e08e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635124Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665819}
parent c7b069a4
......@@ -364,7 +364,7 @@ void V4L2SliceVideoDecodeAccelerator::DestroyTask() {
decoder_input_queue_.pop_front();
// Stop streaming and the device_poll_thread_.
StopDevicePoll(false);
StopDevicePoll();
DestroyInputBuffers();
DestroyOutputs(false);
......@@ -973,7 +973,7 @@ bool V4L2SliceVideoDecodeAccelerator::StartDevicePoll() {
return true;
}
bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) {
bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll() {
DVLOGF(3) << "Stopping device poll";
if (decoder_thread_.IsRunning())
DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread());
......@@ -993,13 +993,11 @@ bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) {
return false;
}
if (!keep_input_state) {
if (input_streamon_) {
__u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMOFF, &type);
}
input_streamon_ = false;
if (input_streamon_) {
__u32 type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_STREAMOFF, &type);
}
input_streamon_ = false;
if (output_streamon_) {
__u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
......@@ -1007,17 +1005,15 @@ bool V4L2SliceVideoDecodeAccelerator::StopDevicePoll(bool keep_input_state) {
}
output_streamon_ = false;
if (!keep_input_state) {
for (size_t i = 0; i < input_buffer_map_.size(); ++i) {
InputRecord& input_record = input_buffer_map_[i];
if (input_record.at_device) {
input_record.at_device = false;
ReuseInputBuffer(i);
input_buffer_queued_count_--;
}
for (size_t i = 0; i < input_buffer_map_.size(); ++i) {
InputRecord& input_record = input_buffer_map_[i];
if (input_record.at_device) {
input_record.at_device = false;
ReuseInputBuffer(i);
input_buffer_queued_count_--;
}
DCHECK_EQ(input_buffer_queued_count_, 0);
}
DCHECK_EQ(input_buffer_queued_count_, 0);
// STREAMOFF makes the driver drop all buffers without decoding and DQBUFing,
// so we mark them all as at_device = false and clear surfaces_at_device_.
......@@ -1209,8 +1205,7 @@ bool V4L2SliceVideoDecodeAccelerator::FinishSurfaceSetChange() {
DCHECK_EQ(free_output_buffers_.size() + surfaces_at_display_.size(),
output_buffer_map_.size());
// Keep input queue running while we switch outputs.
if (!StopDevicePoll(true)) {
if (!StopDevicePoll()) {
NOTIFY_ERROR(PLATFORM_FAILURE);
return false;
}
......
......@@ -295,7 +295,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator
// Attempt to start/stop device_poll_thread_.
bool StartDevicePoll();
bool StopDevicePoll(bool keep_input_state);
bool StopDevicePoll();
// Ran on device_poll_thread_ to wait for device events.
void DevicePollTask(bool poll_device);
......
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