Commit f405a5e6 authored by Peng Huang's avatar Peng Huang Committed by Chromium LUCI CQ

SharedImageBackingEglImage: support passthrough decoder.

Bug: 1168584
Change-Id: I7eb840feafb2ba0c734713f88d48bcd822004472
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640933
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: default avatarVasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845410}
parent e6584c33
......@@ -25,7 +25,6 @@ struct Mailbox;
namespace gles2 {
class NativeImageBuffer;
class Texture;
} // namespace gles2
// Implementation of SharedImageBacking that is used to create EGLImage targets
......@@ -47,7 +46,8 @@ class SharedImageBackingEglImage : public ClearTrackingSharedImageBacking {
GLuint gl_format,
GLuint gl_type,
SharedImageBatchAccessManager* batch_access_manager,
const GpuDriverBugWorkarounds& workarounds);
const GpuDriverBugWorkarounds& workarounds,
bool use_passthrough);
~SharedImageBackingEglImage() override;
......@@ -55,16 +55,15 @@ class SharedImageBackingEglImage : public ClearTrackingSharedImageBacking {
bool ProduceLegacyMailbox(MailboxManager* mailbox_manager) override;
void MarkForDestruction() override;
bool BeginWrite();
void EndWrite();
bool BeginRead(const SharedImageRepresentation* reader);
void EndRead(const SharedImageRepresentation* reader);
protected:
std::unique_ptr<SharedImageRepresentationGLTexture> ProduceGLTexture(
SharedImageManager* manager,
MemoryTypeTracker* tracker) override;
std::unique_ptr<SharedImageRepresentationGLTexturePassthrough>
ProduceGLTexturePassthrough(SharedImageManager* manager,
MemoryTypeTracker* tracker) override;
std::unique_ptr<SharedImageRepresentationSkia> ProduceSkia(
SharedImageManager* manager,
MemoryTypeTracker* tracker,
......@@ -72,11 +71,22 @@ class SharedImageBackingEglImage : public ClearTrackingSharedImageBacking {
private:
friend class SharedImageBatchAccessManager;
friend class SharedImageRepresentationEglImageGLTexture;
class TextureHolder;
class RepresentationGLShared;
class RepresentationGLTexture;
class RepresentationGLTexturePassthrough;
template <class T>
std::unique_ptr<T> ProduceGLTextureInternal(SharedImageManager* manager,
MemoryTypeTracker* tracker);
bool BeginWrite();
void EndWrite();
bool BeginRead(const RepresentationGLShared* reader);
void EndRead(const RepresentationGLShared* reader);
// Use to create EGLImage texture target from the same EGLImage object.
gles2::Texture* GenEGLImageSibling();
scoped_refptr<TextureHolder> GenEGLImageSibling();
void SetEndReadFence(scoped_refptr<gl::SharedGLFenceEGL> shared_egl_fence);
......@@ -101,10 +111,12 @@ class SharedImageBackingEglImage : public ClearTrackingSharedImageBacking {
// signalled.
base::flat_map<gl::GLApi*, scoped_refptr<gl::SharedGLFenceEGL>> read_fences_
GUARDED_BY(lock_);
base::flat_set<const SharedImageRepresentation*> active_readers_
base::flat_set<const RepresentationGLShared*> active_readers_
GUARDED_BY(lock_);
SharedImageBatchAccessManager* batch_access_manager_ = nullptr;
const bool use_passthrough_;
DISALLOW_COPY_AND_ASSIGN(SharedImageBackingEglImage);
};
......
......@@ -398,7 +398,7 @@ SharedImageBackingFactoryGLTexture::MakeEglImageBacking(
return std::make_unique<SharedImageBackingEglImage>(
mailbox, format, size, color_space, surface_origin, alpha_type, usage,
estimated_size, format_info.gl_format, format_info.gl_type,
batch_access_manager_, workarounds_);
batch_access_manager_, workarounds_, use_passthrough_);
#else
return nullptr;
#endif
......
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