Commit b63fa295 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

VideoToolbox/SharedImage: Plumb SharedImageStub

Add a method through which VTVideoDecodeAccelerator will be able to
access a SharedImageStub. In this case we've hung it off of
VdaVideoDecoder's implementation of the VideoDecodeAccelerator::Client
implementation. An alternative could be the GpuVideoDecodeGLClient, but
that's a GL thing and after this change, VTVideoDecodeAccelerator won't
use any GL things.

Bug: 1108909
Change-Id: I46e7e92eaa90e7fb89c4582e53d985c3ae1d8d4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333304
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795706}
parent cb637d28
...@@ -62,6 +62,12 @@ class CommandBufferHelperImpl ...@@ -62,6 +62,12 @@ class CommandBufferHelperImpl
return decoder_helper_->GetGLContext(); return decoder_helper_->GetGLContext();
} }
gpu::SharedImageStub* GetSharedImageStub() override {
if (!stub_)
return nullptr;
return stub_->channel()->shared_image_stub();
}
bool HasStub() override { bool HasStub() override {
DVLOG(4) << __func__; DVLOG(4) << __func__;
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
......
...@@ -20,6 +20,7 @@ namespace gpu { ...@@ -20,6 +20,7 @@ namespace gpu {
class CommandBufferStub; class CommandBufferStub;
class SharedImageBacking; class SharedImageBacking;
class SharedImageRepresentationFactoryRef; class SharedImageRepresentationFactoryRef;
class SharedImageStub;
class TextureBase; class TextureBase;
} // namespace gpu } // namespace gpu
...@@ -52,6 +53,9 @@ class MEDIA_GPU_EXPORT CommandBufferHelper ...@@ -52,6 +53,9 @@ class MEDIA_GPU_EXPORT CommandBufferHelper
// EGLImages. New clients should use more specialized accessors instead. // EGLImages. New clients should use more specialized accessors instead.
virtual gl::GLContext* GetGLContext() = 0; virtual gl::GLContext* GetGLContext() = 0;
// Retrieve the interface through which to create shared images.
virtual gpu::SharedImageStub* GetSharedImageStub() = 0;
// Checks whether the stub has been destroyed. // Checks whether the stub has been destroyed.
virtual bool HasStub() = 0; virtual bool HasStub() = 0;
......
...@@ -757,6 +757,10 @@ void VdaVideoDecoder::NotifyError(VideoDecodeAccelerator::Error error) { ...@@ -757,6 +757,10 @@ void VdaVideoDecoder::NotifyError(VideoDecodeAccelerator::Error error) {
parent_weak_this_, error)); parent_weak_this_, error));
} }
gpu::SharedImageStub* VdaVideoDecoder::GetSharedImageStub() const {
return command_buffer_helper_->GetSharedImageStub();
}
void VdaVideoDecoder::NotifyErrorOnParentThread( void VdaVideoDecoder::NotifyErrorOnParentThread(
VideoDecodeAccelerator::Error error) { VideoDecodeAccelerator::Error error) {
DVLOG(1) << __func__ << "(" << error << ")"; DVLOG(1) << __func__ << "(" << error << ")";
......
...@@ -128,6 +128,7 @@ class VdaVideoDecoder : public VideoDecoder, ...@@ -128,6 +128,7 @@ class VdaVideoDecoder : public VideoDecoder,
void NotifyFlushDone() override; void NotifyFlushDone() override;
void NotifyResetDone() override; void NotifyResetDone() override;
void NotifyError(VideoDecodeAccelerator::Error error) override; void NotifyError(VideoDecodeAccelerator::Error error) override;
gpu::SharedImageStub* GetSharedImageStub() const override;
// Tasks and thread hopping. // Tasks and thread hopping.
static void CleanupOnGpuThread(std::unique_ptr<VdaVideoDecoder>); static void CleanupOnGpuThread(std::unique_ptr<VdaVideoDecoder>);
......
...@@ -66,6 +66,10 @@ gl::GLContext* FakeCommandBufferHelper::GetGLContext() { ...@@ -66,6 +66,10 @@ gl::GLContext* FakeCommandBufferHelper::GetGLContext() {
return nullptr; return nullptr;
} }
gpu::SharedImageStub* FakeCommandBufferHelper::GetSharedImageStub() {
return nullptr;
}
bool FakeCommandBufferHelper::HasStub() { bool FakeCommandBufferHelper::HasStub() {
return has_stub_; return has_stub_;
} }
......
...@@ -39,6 +39,7 @@ class FakeCommandBufferHelper : public CommandBufferHelper { ...@@ -39,6 +39,7 @@ class FakeCommandBufferHelper : public CommandBufferHelper {
// CommandBufferHelper implementation. // CommandBufferHelper implementation.
gl::GLContext* GetGLContext() override; gl::GLContext* GetGLContext() override;
gpu::SharedImageStub* GetSharedImageStub() override;
bool HasStub() override; bool HasStub() override;
bool MakeContextCurrent() override; bool MakeContextCurrent() override;
std::unique_ptr<gpu::SharedImageRepresentationFactoryRef> Register( std::unique_ptr<gpu::SharedImageRepresentationFactoryRef> Register(
......
...@@ -66,6 +66,11 @@ void VideoDecodeAccelerator::Client::ProvidePictureBuffersWithVisibleRect( ...@@ -66,6 +66,11 @@ void VideoDecodeAccelerator::Client::ProvidePictureBuffersWithVisibleRect(
} }
} }
gpu::SharedImageStub* VideoDecodeAccelerator::Client::GetSharedImageStub()
const {
return nullptr;
}
VideoDecodeAccelerator::~VideoDecodeAccelerator() = default; VideoDecodeAccelerator::~VideoDecodeAccelerator() = default;
void VideoDecodeAccelerator::Decode(scoped_refptr<DecoderBuffer> buffer, void VideoDecodeAccelerator::Decode(scoped_refptr<DecoderBuffer> buffer,
......
...@@ -32,6 +32,10 @@ namespace base { ...@@ -32,6 +32,10 @@ namespace base {
class SingleThreadTaskRunner; class SingleThreadTaskRunner;
} }
namespace gpu {
class SharedImageStub;
}
namespace media { namespace media {
// Video decoder interface. // Video decoder interface.
...@@ -254,6 +258,10 @@ class MEDIA_EXPORT VideoDecodeAccelerator { ...@@ -254,6 +258,10 @@ class MEDIA_EXPORT VideoDecodeAccelerator {
// a false return value there. // a false return value there.
virtual void NotifyError(Error error) = 0; virtual void NotifyError(Error error) = 0;
// Return the SharedImageStub through which SharedImages may be created.
// Default implementation returns nullptr.
virtual gpu::SharedImageStub* GetSharedImageStub() const;
protected: protected:
virtual ~Client() {} virtual ~Client() {}
}; };
......
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