Skip to content

Commit

Permalink
Merge M90: "Restore support for GpuMemoryBuffer frames to VideoFrameI…
Browse files Browse the repository at this point in the history
…mageUtil."

Now that multiple clients can Map() GpuMemoryBuffer backed frames,
we should use that functionality to avoid round trips when writing
to unaccelerated resource providers.

(cherry picked from commit 962a729)

Bug: 1183572
Test: Restored test which was broken.
Change-Id: I18f4c4216713a8045904cc5f8de00600949d5433
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2730307
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dan Sanders <sandersd@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#859480}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2740758
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4430@{#199}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
dalecurtis authored and Chromium LUCI CQ committed Mar 6, 2021
1 parent 77b7584 commit eca4449
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ bool DrawVideoFrameIntoResourceProvider(
video_renderer = local_video_renderer.get();
}

// TODO(crbug.com/1183572): It'd be nice to Map() GpuMemoryBuffer backed
// frames into CPU backed ones when we're using a non-accelerated provider.
// If the provider isn't accelerated, avoid GPU round trips to upload frame
// data from GpuMemoryBuffer backed frames which aren't mappable.
if (frame->HasGpuMemoryBuffer() && !frame->IsMappable() &&
!resource_provider->IsAccelerated()) {
frame = media::ConvertToMemoryMappedFrame(std::move(frame));
}

video_renderer->Paint(
frame.get(), resource_provider->Canvas(), gfx::RectF(dest_rect),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ TEST(VideoFrameImageUtilTest, CreateImageFromVideoFrameSoftwareFrame) {
task_environment_.RunUntilIdle();
}

// TODO(crbug.com/1183572): Re-enable this test once we can map GpuMemoryBuffers
// again.
TEST(VideoFrameImageUtilTest,
DISABLED_CreateImageFromVideoFrameGpuMemoryBufferFrame) {
TEST(VideoFrameImageUtilTest, CreateImageFromVideoFrameGpuMemoryBufferFrame) {
base::test::SingleThreadTaskEnvironment task_environment_;
auto cpu_frame = CreateTestFrame(kTestSize, gfx::Rect(kTestSize), kTestSize,
media::VideoFrame::STORAGE_GPU_MEMORY_BUFFER,
Expand Down

0 comments on commit eca4449

Please sign in to comment.