| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 5 #ifndef CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
| 6 #define CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 6 #define CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include "base/files/scoped_file.h" |
| 9 |
| 8 namespace chromeos { | 10 namespace chromeos { |
| 9 namespace arc { | 11 namespace arc { |
| 10 | 12 |
| 11 // The pixel formats defined in Android but are used here. They are defined in | 13 // The pixel formats defined in Android but are used here. They are defined in |
| 12 // "system/core/include/system/graphics.h" | 14 // "system/core/include/system/graphics.h" |
| 13 enum { | 15 enum { |
| 14 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, | 16 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, |
| 15 }; | 17 }; |
| 16 | 18 |
| 17 // The extension to the Android HAL_PIXEL_FORMAT for input pixel formats. | 19 // The extension to the Android HAL_PIXEL_FORMAT for input pixel formats. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // must be called before any other methods. This call is synchronous and | 108 // must be called before any other methods. This call is synchronous and |
| 107 // returns true iff initialization is successful. | 109 // returns true iff initialization is successful. |
| 108 virtual bool Initialize(const Config& config, Client* client) = 0; | 110 virtual bool Initialize(const Config& config, Client* client) = 0; |
| 109 | 111 |
| 110 // Assigns a shared memory to be used for the accelerator at the specified | 112 // Assigns a shared memory to be used for the accelerator at the specified |
| 111 // port and index. A buffer must be successfully bound before it can be passed | 113 // port and index. A buffer must be successfully bound before it can be passed |
| 112 // to the accelerator via UseBuffer(). Already bound buffers may be reused | 114 // to the accelerator via UseBuffer(). Already bound buffers may be reused |
| 113 // multiple times without additional bindings. | 115 // multiple times without additional bindings. |
| 114 virtual void BindSharedMemory(PortType port, | 116 virtual void BindSharedMemory(PortType port, |
| 115 uint32_t index, | 117 uint32_t index, |
| 116 int ashmem_fd, | 118 base::ScopedFD ashmem_fd, |
| 117 off_t offset, | 119 off_t offset, |
| 118 size_t length) = 0; | 120 size_t length) = 0; |
| 119 | 121 |
| 120 // Assigns a buffer to be used for the accelerator at the specified | 122 // Assigns a buffer to be used for the accelerator at the specified |
| 121 // port and index. A buffer must be successfully bound before it can be | 123 // port and index. A buffer must be successfully bound before it can be |
| 122 // passed to the accelerator via UseBuffer(). Already bound buffers may be | 124 // passed to the accelerator via UseBuffer(). Already bound buffers may be |
| 123 // reused multiple times without additional bindings. | 125 // reused multiple times without additional bindings. |
| 124 virtual void BindDmabuf(PortType port, uint32_t index, int dmabuf_fd) = 0; | 126 virtual void BindDmabuf(PortType port, |
| 127 uint32_t index, |
| 128 base::ScopedFD dmabuf_fd) = 0; |
| 125 | 129 |
| 126 // Passes a buffer to the accelerator. For input buffer, the accelerator | 130 // Passes a buffer to the accelerator. For input buffer, the accelerator |
| 127 // will process it. For output buffer, the accelerator will output content | 131 // will process it. For output buffer, the accelerator will output content |
| 128 // to it. | 132 // to it. |
| 129 virtual void UseBuffer(PortType port, | 133 virtual void UseBuffer(PortType port, |
| 130 uint32_t index, | 134 uint32_t index, |
| 131 const BufferMetadata& metadata) = 0; | 135 const BufferMetadata& metadata) = 0; |
| 132 | 136 |
| 133 // Sets the number of output buffers. When it fails, Client::OnError() will | 137 // Sets the number of output buffers. When it fails, Client::OnError() will |
| 134 // be called. | 138 // be called. |
| 135 virtual void SetNumberOfOutputBuffers(size_t number) = 0; | 139 virtual void SetNumberOfOutputBuffers(size_t number) = 0; |
| 136 | 140 |
| 137 // Resets the accelerator. When it is done, Client::OnResetDone() will | 141 // Resets the accelerator. When it is done, Client::OnResetDone() will |
| 138 // be called. Afterwards, all buffers won't be accessed by the accelerator | 142 // be called. Afterwards, all buffers won't be accessed by the accelerator |
| 139 // and there won't be more callbacks. | 143 // and there won't be more callbacks. |
| 140 virtual void Reset() = 0; | 144 virtual void Reset() = 0; |
| 141 | 145 |
| 142 virtual ~ArcVideoAccelerator() {} | 146 virtual ~ArcVideoAccelerator() {} |
| 143 }; | 147 }; |
| 144 | 148 |
| 145 } // namespace arc | 149 } // namespace arc |
| 146 } // namespace chromeos | 150 } // namespace chromeos |
| 147 | 151 |
| 148 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ | 152 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ |
| OLD | NEW |