virtio: video: remove suspicious code

When outputting a picture there is a bit of code that updates the size
of each output plane to the size of the visible rect. This looks wrong
on several accounts:

1) The plane size should already have been computed when we received the
   buffers,
2) With this code each plane is assigned the same size, which is
   obviously wrong with formats such as NV12,
3) The size in bytes of a plane depends on the coded size, not the
   visible size.

Looking at the git history it appears that this code has been here since
the initial revision of the decoder, and then moved around. Maybe it was
just here to make things work in the beginning and slipped under the
radar. In any case, removing that code does not seem to hurt.

BUG=b:161774071
BUG=b:169295147
TEST=Android Youtube plays properly on Hatch.

Change-Id: I6c8949c49c070daaa3540b757dd35469b571c43c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3026344
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Alexandre Courbot 2021-06-24 22:03:27 +09:00 committed by Commit Bot
parent cc03cdbecc
commit c5dad3fdee

View file

@ -163,7 +163,6 @@ enum PendingResponse {
PictureReady {
picture_buffer_id: i32,
bitstream_id: i32,
visible_rect: Rect,
},
FlushCompleted,
}
@ -220,16 +219,7 @@ impl<S: DecoderSession> Context<S> {
PendingResponse::PictureReady {
picture_buffer_id,
bitstream_id,
visible_rect,
} => {
let plane_size = ((visible_rect.right - visible_rect.left)
* (visible_rect.bottom - visible_rect.top))
as u32;
for fmt in self.out_params.plane_formats.iter_mut() {
fmt.plane_size = plane_size;
// We don't need to set `plane_formats[i].stride` for the decoder.
}
let resource_id = self
.out_res
.dequeue_frame_buffer(*picture_buffer_id, self.stream_id)?;
@ -1005,7 +995,7 @@ impl<D: DecoderBackend> Device for Decoder<D> {
DecoderEvent::PictureReady {
picture_buffer_id, // FrameBufferId
bitstream_id, // timestamp in second
visible_rect,
..
} => {
if ctx.is_resetting {
vec![]
@ -1014,7 +1004,6 @@ impl<D: DecoderBackend> Device for Decoder<D> {
.push_back(PendingResponse::PictureReady {
picture_buffer_id,
bitstream_id,
visible_rect,
});
ctx.output_pending_responses()
}