Commit 4f467f1a authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Support passthrough texture with SharedImageVideo

Bug: 1019787
Change-Id: Ib78e2b969d9fe27ec63895e7ecb8f8ea755d0309
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087423Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Jonathan Backer <backer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746861}
parent 0c896f6a
......@@ -497,14 +497,24 @@ std::unique_ptr<SharedImageRepresentationSkia> SharedImageVideo::ProduceSkia(
}
DCHECK(context_state->GrContextIsGL());
auto* texture = stream_texture_sii_->GetTexture();
DCHECK(texture);
auto* texture_base = stream_texture_sii_->GetTextureBase();
DCHECK(texture_base);
// In GL mode, create the SharedImageRepresentationGLTextureVideo
// In GL mode, create the SharedImageRepresentationGLTexture*Video
// representation to use with SharedImageRepresentationVideoSkiaGL.
auto gl_representation =
std::make_unique<SharedImageRepresentationGLTextureVideo>(
manager, this, tracker, texture);
std::unique_ptr<gpu::SharedImageRepresentationGLTextureBase>
gl_representation;
if (texture_base->GetType() == gpu::TextureBase::Type::kValidated) {
gl_representation =
std::make_unique<SharedImageRepresentationGLTextureVideo>(
manager, this, tracker, gles2::Texture::CheckedCast(texture_base));
} else {
gl_representation =
std::make_unique<SharedImageRepresentationGLTexturePassthroughVideo>(
manager, this, tracker,
gles2::TexturePassthrough::CheckedCast(texture_base));
}
return SharedImageRepresentationSkiaGL::Create(std::move(gl_representation),
std::move(context_state),
manager, this, tracker);
......
......@@ -10,10 +10,7 @@
namespace gpu {
class TextureOwner;
namespace gles2 {
class Texture;
} // namespace gles2
class TextureBase;
// This class is a specialized GLImage that lets SharedImageVideo draw video
// frames.
......@@ -32,7 +29,7 @@ class GPU_GLES2_EXPORT StreamTextureSharedImageInterface
// texture.
virtual void UpdateAndBindTexImage() = 0;
virtual bool HasTextureOwner() const = 0;
virtual gles2::Texture* GetTexture() const = 0;
virtual TextureBase* GetTextureBase() const = 0;
// Notify the texture of overlay decision, When overlay promotion is true,
// this also sets the bounds of where the overlay is.
......
......@@ -159,9 +159,8 @@ bool StreamTexture::HasTextureOwner() const {
return !!texture_owner_;
}
gles2::Texture* StreamTexture::GetTexture() const {
DCHECK(texture_owner_);
return gles2::Texture::CheckedCast(texture_owner_->GetTextureBase());
TextureBase* StreamTexture::GetTextureBase() const {
return texture_owner_->GetTextureBase();
}
void StreamTexture::NotifyOverlayPromotion(bool promotion,
......
......@@ -93,7 +93,7 @@ class StreamTexture : public StreamTextureSharedImageInterface,
bool IsUsingGpuMemory() const override;
void UpdateAndBindTexImage() override;
bool HasTextureOwner() const override;
gles2::Texture* GetTexture() const override;
TextureBase* GetTextureBase() const override;
void NotifyOverlayPromotion(bool promotion, const gfx::Rect& bounds) override;
bool RenderToOverlay() override;
......
......@@ -234,9 +234,8 @@ bool CodecImage::HasTextureOwner() const {
return !!texture_owner();
}
gpu::gles2::Texture* CodecImage::GetTexture() const {
DCHECK(texture_owner());
return gpu::gles2::Texture::CheckedCast(texture_owner()->GetTextureBase());
gpu::TextureBase* CodecImage::GetTextureBase() const {
return texture_owner()->GetTextureBase();
}
bool CodecImage::RenderToFrontBuffer() {
......
......@@ -115,7 +115,7 @@ class MEDIA_GPU_EXPORT CodecImage
bool IsUsingGpuMemory() const override;
void UpdateAndBindTexImage() override;
bool HasTextureOwner() const override;
gpu::gles2::Texture* GetTexture() const override;
gpu::TextureBase* GetTextureBase() const override;
void NotifyOverlayPromotion(bool promotion, const gfx::Rect& bounds) override;
// Renders this image to the overlay. Returns true if the buffer is in the
// overlay front buffer. Returns false if the buffer was invalidated.
......
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