Commit bc6a036f authored by Vikas Soni's avatar Vikas Soni Committed by Commit Bot

VideoResourceUpdater:Use gles2 apis meant for shared image mailbox.

Use the gles2 apis which are meant to be used with shared image
mailboxes.

We were using legacy mailbox gles2 apis till now here in
VideoResourceUpdater::CopyHardwarePlane.
It was fine since this code was only used by android video path
which always creates shared image mailboxes and registers it with
a legacy mailbox. Hence it works with both shared image and legacy
gles2 apis.

Updating this code in order to convert everything to shared
images eventually and get rid of legacy mailbox system.

Bug: 900973
Change-Id: I3b9c97f938cd4d15740cd1b6007eaae8f4ef2c2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1978907
Commit-Queue: vikas soni <vikassoni@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727222}
parent 7049534e
...@@ -765,10 +765,16 @@ void VideoResourceUpdater::CopyHardwarePlane( ...@@ -765,10 +765,16 @@ void VideoResourceUpdater::CopyHardwarePlane(
: context_provider_->ContextGL(); : context_provider_->ContextGL();
gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData()); gl->WaitSyncTokenCHROMIUM(mailbox_holder.sync_token.GetConstData());
// TODO(piman): convert to CreateAndTexStorage2DSharedImageCHROMIUM once
// VideoFrame is all converted to SharedImage. // This is only used on Android where all video mailboxes already use shared
// images.
DCHECK(mailbox_holder.mailbox.IsSharedImage());
// TODO(vikassoni): Use raster interface instead of gl interface eventually.
GLuint src_texture_id = GLuint src_texture_id =
gl->CreateAndConsumeTextureCHROMIUM(mailbox_holder.mailbox.name); gl->CreateAndTexStorage2DSharedImageCHROMIUM(mailbox_holder.mailbox.name);
gl->BeginSharedImageAccessDirectCHROMIUM(
src_texture_id, GL_SHARED_IMAGE_ACCESS_MODE_READ_CHROMIUM);
{ {
HardwarePlaneResource::ScopedTexture scope(gl, hardware_resource); HardwarePlaneResource::ScopedTexture scope(gl, hardware_resource);
gl->CopySubTextureCHROMIUM( gl->CopySubTextureCHROMIUM(
...@@ -776,6 +782,7 @@ void VideoResourceUpdater::CopyHardwarePlane( ...@@ -776,6 +782,7 @@ void VideoResourceUpdater::CopyHardwarePlane(
output_plane_resource_size.width(), output_plane_resource_size.height(), output_plane_resource_size.width(), output_plane_resource_size.height(),
false, false, false); false, false, false);
} }
gl->EndSharedImageAccessDirectCHROMIUM(src_texture_id);
gl->DeleteTextures(1, &src_texture_id); gl->DeleteTextures(1, &src_texture_id);
// Pass an empty sync token to force generation of a new sync token. // Pass an empty sync token to force generation of a new sync token.
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "components/viz/test/fake_output_surface.h" #include "components/viz/test/fake_output_surface.h"
#include "components/viz/test/test_gles2_interface.h" #include "components/viz/test/test_gles2_interface.h"
#include "gpu/GLES2/gl2extchromium.h" #include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -177,8 +178,7 @@ class VideoResourceUpdaterTest : public testing::Test { ...@@ -177,8 +178,7 @@ class VideoResourceUpdaterTest : public testing::Test {
const int kDimension = 10; const int kDimension = 10;
gfx::Size size(kDimension, kDimension); gfx::Size size(kDimension, kDimension);
gpu::Mailbox mailbox; auto mailbox = gpu::Mailbox::GenerateForSharedImage();
mailbox.name[0] = 51;
gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes] = { gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes] = {
gpu::MailboxHolder(mailbox, kMailboxSyncToken, target)}; gpu::MailboxHolder(mailbox, kMailboxSyncToken, target)};
......
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