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( ...@@ -497,14 +497,24 @@ std::unique_ptr<SharedImageRepresentationSkia> SharedImageVideo::ProduceSkia(
} }
DCHECK(context_state->GrContextIsGL()); DCHECK(context_state->GrContextIsGL());
auto* texture = stream_texture_sii_->GetTexture(); auto* texture_base = stream_texture_sii_->GetTextureBase();
DCHECK(texture); DCHECK(texture_base);
// In GL mode, create the SharedImageRepresentationGLTextureVideo // In GL mode, create the SharedImageRepresentationGLTexture*Video
// representation to use with SharedImageRepresentationVideoSkiaGL. // representation to use with SharedImageRepresentationVideoSkiaGL.
auto gl_representation = std::unique_ptr<gpu::SharedImageRepresentationGLTextureBase>
gl_representation;
if (texture_base->GetType() == gpu::TextureBase::Type::kValidated) {
gl_representation =
std::make_unique<SharedImageRepresentationGLTextureVideo>( std::make_unique<SharedImageRepresentationGLTextureVideo>(
manager, this, tracker, texture); 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), return SharedImageRepresentationSkiaGL::Create(std::move(gl_representation),
std::move(context_state), std::move(context_state),
manager, this, tracker); manager, this, tracker);
......
...@@ -10,10 +10,7 @@ ...@@ -10,10 +10,7 @@
namespace gpu { namespace gpu {
class TextureOwner; class TextureOwner;
class TextureBase;
namespace gles2 {
class Texture;
} // namespace gles2
// This class is a specialized GLImage that lets SharedImageVideo draw video // This class is a specialized GLImage that lets SharedImageVideo draw video
// frames. // frames.
...@@ -32,7 +29,7 @@ class GPU_GLES2_EXPORT StreamTextureSharedImageInterface ...@@ -32,7 +29,7 @@ class GPU_GLES2_EXPORT StreamTextureSharedImageInterface
// texture. // texture.
virtual void UpdateAndBindTexImage() = 0; virtual void UpdateAndBindTexImage() = 0;
virtual bool HasTextureOwner() const = 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, // Notify the texture of overlay decision, When overlay promotion is true,
// this also sets the bounds of where the overlay is. // this also sets the bounds of where the overlay is.
......
...@@ -159,9 +159,8 @@ bool StreamTexture::HasTextureOwner() const { ...@@ -159,9 +159,8 @@ bool StreamTexture::HasTextureOwner() const {
return !!texture_owner_; return !!texture_owner_;
} }
gles2::Texture* StreamTexture::GetTexture() const { TextureBase* StreamTexture::GetTextureBase() const {
DCHECK(texture_owner_); return texture_owner_->GetTextureBase();
return gles2::Texture::CheckedCast(texture_owner_->GetTextureBase());
} }
void StreamTexture::NotifyOverlayPromotion(bool promotion, void StreamTexture::NotifyOverlayPromotion(bool promotion,
......
...@@ -93,7 +93,7 @@ class StreamTexture : public StreamTextureSharedImageInterface, ...@@ -93,7 +93,7 @@ class StreamTexture : public StreamTextureSharedImageInterface,
bool IsUsingGpuMemory() const override; bool IsUsingGpuMemory() const override;
void UpdateAndBindTexImage() override; void UpdateAndBindTexImage() override;
bool HasTextureOwner() const override; bool HasTextureOwner() const override;
gles2::Texture* GetTexture() const override; TextureBase* GetTextureBase() const override;
void NotifyOverlayPromotion(bool promotion, const gfx::Rect& bounds) override; void NotifyOverlayPromotion(bool promotion, const gfx::Rect& bounds) override;
bool RenderToOverlay() override; bool RenderToOverlay() override;
......
...@@ -234,9 +234,8 @@ bool CodecImage::HasTextureOwner() const { ...@@ -234,9 +234,8 @@ bool CodecImage::HasTextureOwner() const {
return !!texture_owner(); return !!texture_owner();
} }
gpu::gles2::Texture* CodecImage::GetTexture() const { gpu::TextureBase* CodecImage::GetTextureBase() const {
DCHECK(texture_owner()); return texture_owner()->GetTextureBase();
return gpu::gles2::Texture::CheckedCast(texture_owner()->GetTextureBase());
} }
bool CodecImage::RenderToFrontBuffer() { bool CodecImage::RenderToFrontBuffer() {
......
...@@ -115,7 +115,7 @@ class MEDIA_GPU_EXPORT CodecImage ...@@ -115,7 +115,7 @@ class MEDIA_GPU_EXPORT CodecImage
bool IsUsingGpuMemory() const override; bool IsUsingGpuMemory() const override;
void UpdateAndBindTexImage() override; void UpdateAndBindTexImage() override;
bool HasTextureOwner() const 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; void NotifyOverlayPromotion(bool promotion, const gfx::Rect& bounds) override;
// Renders this image to the overlay. Returns true if the buffer is in the // Renders this image to the overlay. Returns true if the buffer is in the
// overlay front buffer. Returns false if the buffer was invalidated. // 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