OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_IPC_TRANSPORT_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_IPC_TRANSPORT_H_ |
| 7 |
| 8 #include "gpu/command_buffer/common/command_buffer.h" |
| 9 #include "media/video/video_decode_accelerator.h" |
| 10 #include "media/video/video_encode_accelerator.h" |
| 11 #include "ui/events/latency_info.h" |
| 12 #include "ui/gfx/swap_result.h" |
| 13 |
| 14 namespace gpu { |
| 15 struct Capabilities; |
| 16 struct Mailbox; |
| 17 struct SyncToken; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 |
| 22 class GpuVideoDecodeAcceleratorHostIPCTransport; |
| 23 class GpuVideoEncodeAcceleratorHostIPCTransport; |
| 24 struct CommandBufferConsoleMessage; |
| 25 struct CreateImageParams; |
| 26 |
| 27 class CommandBufferIPCTransport { |
| 28 public: |
| 29 class Client { |
| 30 public: |
| 31 virtual void OnConsoleMessage( |
| 32 const CommandBufferConsoleMessage& message) = 0; |
| 33 |
| 34 virtual void OnChannelError() = 0; |
| 35 |
| 36 virtual void OnDestroyed(gpu::error::ContextLostReason reason, |
| 37 gpu::error::Error error) = 0; |
| 38 |
| 39 virtual void OnDidHandleMessage() = 0; |
| 40 |
| 41 virtual void OnWillHandleMessage() = 0; |
| 42 |
| 43 virtual void OnSignalAck(uint32_t id) = 0; |
| 44 |
| 45 virtual void OnSwapBuffersCompleted( |
| 46 const std::vector<ui::LatencyInfo>& latency_info, |
| 47 gfx::SwapResult result) = 0; |
| 48 |
| 49 virtual void OnUpdateState(const gpu::CommandBuffer::State& state) = 0; |
| 50 |
| 51 virtual void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 52 base::TimeDelta interval) = 0; |
| 53 |
| 54 protected: |
| 55 virtual ~Client() {} |
| 56 }; |
| 57 |
| 58 virtual ~CommandBufferIPCTransport() {} |
| 59 |
| 60 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; |
| 61 |
| 62 virtual bool CreateImage(const CreateImageParams& params) = 0; |
| 63 |
| 64 virtual bool CreateStreamTexture(uint32_t client_texture_id, |
| 65 int32_t* stream_id, |
| 66 bool* succeeded) = 0; |
| 67 |
| 68 virtual bool CreateVideoDecoder( |
| 69 GpuVideoDecodeAcceleratorHostIPCTransport* transport, |
| 70 const media::VideoDecodeAccelerator::Config& config, |
| 71 bool* succeeded) = 0; |
| 72 |
| 73 virtual bool CreateVideoEncoder( |
| 74 GpuVideoEncodeAcceleratorHostIPCTransport* transport, |
| 75 media::VideoPixelFormat input_format, |
| 76 const gfx::Size& input_visible_size, |
| 77 media::VideoCodecProfile output_profile, |
| 78 uint32_t initial_bitrate, |
| 79 bool* succeeded) = 0; |
| 80 |
| 81 virtual bool DestroyImage(int32_t id) = 0; |
| 82 |
| 83 virtual bool DestroyTransferBuffer(int32_t id) = 0; |
| 84 |
| 85 // TODO(fsamuel): It's unclear whether we really need this here. |
| 86 virtual uint64_t GetCommandBufferID() const = 0; |
| 87 |
| 88 virtual int32_t GetShareGroupID() const = 0; |
| 89 |
| 90 virtual bool Initialize(base::SharedMemoryHandle shared_state_handle, |
| 91 bool* result, |
| 92 gpu::Capabilities* capabilities) = 0; |
| 93 |
| 94 virtual bool ProduceFrontBuffer(const gpu::Mailbox& mailbox) = 0; |
| 95 |
| 96 virtual bool RegisterTransferBuffer(int32_t id, |
| 97 base::SharedMemoryHandle transfer_buffer, |
| 98 uint32_t size) = 0; |
| 99 |
| 100 virtual bool SetGetBuffer(int32_t shm_id) = 0; |
| 101 |
| 102 virtual void SetClient(Client* client) = 0; |
| 103 |
| 104 virtual bool SignalQuery(uint32_t query, uint32_t signal_id) = 0; |
| 105 |
| 106 virtual bool SignalSyncToken(const gpu::SyncToken& sync_token, |
| 107 uint32_t signal_id) = 0; |
| 108 |
| 109 virtual bool WaitForGetOffsetInRange(int32_t start, |
| 110 int32_t end, |
| 111 gpu::CommandBuffer::State* state) = 0; |
| 112 |
| 113 virtual bool WaitForTokenInRange(int32_t start, |
| 114 int32_t end, |
| 115 gpu::CommandBuffer::State* state) = 0; |
| 116 }; |
| 117 |
| 118 } // namespace content |
| 119 |
| 120 #endif // CONTENT_COMMON_GPU_CLIENT_COMMAND_BUFFER_IPC_TRANSPORT_H_ |
OLD | NEW |