Chromium Code Reviews| Index: media/gpu/command_buffer_helper.h |
| diff --git a/media/gpu/command_buffer_helper.h b/media/gpu/command_buffer_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0c49536973b6d0b0721fb619d61795c23e553e32 |
| --- /dev/null |
| +++ b/media/gpu/command_buffer_helper.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_GPU_COMMAND_BUFFER_HELPER_H_ |
| +#define MEDIA_GPU_COMMAND_BUFFER_HELPER_H_ |
| + |
| +#include <stdint.h> |
| + |
| +#include <memory> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/optional.h" |
| +#include "media/gpu/media_gpu_export.h" |
| +#include "ui/gl/gl_bindings.h" |
| + |
| +namespace gpu { |
| +class GpuCommandBufferStub; |
| +struct Mailbox; |
| +struct SyncToken; |
| +namespace gles2 { |
| +class TextureRef; |
| +} // namespace gles2 |
| +} // namespace gpu |
| + |
| +namespace media { |
| + |
| +// Utility methods to simplify working with a gpu::GpuCommandBufferStub from |
| +// inside VDAs. |
| +class MEDIA_GPU_EXPORT CommandBufferHelper { |
| + public: |
| + static std::unique_ptr<CommandBufferHelper> Create( |
| + gpu::GpuCommandBufferStub* stub); |
| + |
| + virtual ~CommandBufferHelper() {} |
| + |
| + // TODO(sandersd): Provide scoped version? |
| + virtual bool MakeContextCurrent() = 0; |
| + |
| + // Creates a texture and configures it as a video frame (linear filtering, |
| + // clamp to edge, no mipmaps). The context must be current. |
| + // |
| + // See glTexImage2D() for parameter definitions. |
| + // |
| + // Returns nullptr on failure. |
| + virtual scoped_refptr<gpu::gles2::TextureRef> CreateTexture( |
| + GLenum target, |
| + GLenum internal_format, |
| + GLsizei width, |
| + GLsizei height, |
| + GLenum format, |
| + GLenum type) = 0; |
| + |
| + // Creates a sync token that has already been released. |
| + virtual base::Optional<gpu::SyncToken> CreateSyncToken() = 0; |
| + |
| + // Creates a malbox for a texture. |
|
watk
2017/06/14 00:01:38
mailbox
sandersd (OOO until July 31)
2017/06/16 22:31:38
Done.
|
| + virtual base::Optional<gpu::Mailbox> CreateMailbox( |
| + gpu::gles2::TextureRef* texture_ref) = 0; |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_GPU_COMMAND_BUFFER_HELPER_H_ |