Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/gpu/arc_video_accelerator.h

Issue 2513973002: Use mojo typemap to simplify the code using DmabufPlane (Closed)
Patch Set: Addressed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/gpu/arc_gpu_video_decode_accelerator.cc ('k') | chrome/gpu/gpu_arc_video_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
11 #include "components/arc/video_accelerator/video_accelerator.h"
11 12
12 namespace chromeos { 13 namespace chromeos {
13 namespace arc { 14 namespace arc {
14 15
15 enum HalPixelFormatExtension { 16 enum HalPixelFormatExtension {
16 // The pixel formats defined in Android but are used here. They are defined 17 // The pixel formats defined in Android but are used here. They are defined
17 // in "system/core/include/system/graphics.h" 18 // in "system/core/include/system/graphics.h"
18 HAL_PIXEL_FORMAT_BGRA_8888 = 5, 19 HAL_PIXEL_FORMAT_BGRA_8888 = 5,
19 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, 20 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23,
20 21
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 DEVICE_DECODER = 1, 75 DEVICE_DECODER = 1,
75 }; 76 };
76 77
77 DeviceType device_type = DEVICE_DECODER; 78 DeviceType device_type = DEVICE_DECODER;
78 size_t num_input_buffers = 0; 79 size_t num_input_buffers = 0;
79 uint32_t input_pixel_format = 0; 80 uint32_t input_pixel_format = 0;
80 // TODO(owenlin): Add output_pixel_format. For now only the native pixel 81 // TODO(owenlin): Add output_pixel_format. For now only the native pixel
81 // format of each VDA on Chromium is supported. 82 // format of each VDA on Chromium is supported.
82 }; 83 };
83 84
84 struct DmabufPlane {
85 DmabufPlane(int32_t offset, int32_t stride)
86 : offset(offset), stride(stride) {}
87 int32_t offset; // in bytes
88 int32_t stride; // in bytes
89 };
90
91 // The callbacks of the ArcVideoAccelerator. The user of this class should 85 // The callbacks of the ArcVideoAccelerator. The user of this class should
92 // implement this interface. 86 // implement this interface.
93 class Client { 87 class Client {
94 public: 88 public:
95 virtual ~Client() {} 89 virtual ~Client() {}
96 90
97 // Called when an asynchronous error happens. The errors in Initialize() 91 // Called when an asynchronous error happens. The errors in Initialize()
98 // will not be reported here, but will be indicated by a return value 92 // will not be reported here, but will be indicated by a return value
99 // there. 93 // there.
100 virtual void OnError(Result error) = 0; 94 virtual void OnError(Result error) = 0;
(...skipping 29 matching lines...) Expand all
130 virtual void BindSharedMemory(PortType port, 124 virtual void BindSharedMemory(PortType port,
131 uint32_t index, 125 uint32_t index,
132 base::ScopedFD ashmem_fd, 126 base::ScopedFD ashmem_fd,
133 off_t offset, 127 off_t offset,
134 size_t length) = 0; 128 size_t length) = 0;
135 129
136 // Assigns a buffer to be used for the accelerator at the specified 130 // Assigns a buffer to be used for the accelerator at the specified
137 // port and index. A buffer must be successfully bound before it can be 131 // port and index. A buffer must be successfully bound before it can be
138 // passed to the accelerator via UseBuffer(). Already bound buffers may be 132 // passed to the accelerator via UseBuffer(). Already bound buffers may be
139 // reused multiple times without additional bindings. 133 // reused multiple times without additional bindings.
140 virtual void BindDmabuf(PortType port, 134 virtual void BindDmabuf(
141 uint32_t index, 135 PortType port,
142 base::ScopedFD dmabuf_fd, 136 uint32_t index,
143 const std::vector<DmabufPlane>& dmabuf_planes) = 0; 137 base::ScopedFD dmabuf_fd,
138 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>&
139 dmabuf_planes) = 0;
144 140
145 // Passes a buffer to the accelerator. For input buffer, the accelerator 141 // Passes a buffer to the accelerator. For input buffer, the accelerator
146 // will process it. For output buffer, the accelerator will output content 142 // will process it. For output buffer, the accelerator will output content
147 // to it. 143 // to it.
148 virtual void UseBuffer(PortType port, 144 virtual void UseBuffer(PortType port,
149 uint32_t index, 145 uint32_t index,
150 const BufferMetadata& metadata) = 0; 146 const BufferMetadata& metadata) = 0;
151 147
152 // Sets the number of output buffers. When it fails, Client::OnError() will 148 // Sets the number of output buffers. When it fails, Client::OnError() will
153 // be called. 149 // be called.
154 virtual void SetNumberOfOutputBuffers(size_t number) = 0; 150 virtual void SetNumberOfOutputBuffers(size_t number) = 0;
155 151
156 // Resets the accelerator. When it is done, Client::OnResetDone() will 152 // Resets the accelerator. When it is done, Client::OnResetDone() will
157 // be called. Afterwards, all buffers won't be accessed by the accelerator 153 // be called. Afterwards, all buffers won't be accessed by the accelerator
158 // and there won't be more callbacks. 154 // and there won't be more callbacks.
159 virtual void Reset() = 0; 155 virtual void Reset() = 0;
160 156
161 // Flushes the accelerator. After all the output buffers pending decode have 157 // Flushes the accelerator. After all the output buffers pending decode have
162 // been returned to client by OnBufferDone(), Client::OnFlushDone() will be 158 // been returned to client by OnBufferDone(), Client::OnFlushDone() will be
163 // called. 159 // called.
164 virtual void Flush() = 0; 160 virtual void Flush() = 0;
165 161
166 virtual ~ArcVideoAccelerator() {} 162 virtual ~ArcVideoAccelerator() {}
167 }; 163 };
168 164
169 } // namespace arc 165 } // namespace arc
170 } // namespace chromeos 166 } // namespace chromeos
171 167
172 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_ 168 #endif // CHROME_GPU_ARC_VIDEO_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « chrome/gpu/arc_gpu_video_decode_accelerator.cc ('k') | chrome/gpu/gpu_arc_video_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698