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

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

Issue 2919193002: ArcBridge: Rename VideoAcceleratorService to VideoDecodeAccelerator. (Closed)
Patch Set: Address review comments Created 3 years, 6 months 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
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_GPU_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CHROME_GPU_CHROME_ARC_VIDEO_DECODE_ACCELERATOR_H_
6 #define CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CHROME_GPU_CHROME_ARC_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 #include <queue> 10 #include <queue>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "chrome/gpu/arc_video_accelerator.h" 15 #include "chrome/gpu/arc_video_decode_accelerator.h"
16 #include "gpu/command_buffer/service/gpu_preferences.h" 16 #include "gpu/command_buffer/service/gpu_preferences.h"
17 #include "media/video/video_decode_accelerator.h" 17 #include "media/video/video_decode_accelerator.h"
18 18
19 namespace chromeos { 19 namespace chromeos {
20 namespace arc { 20 namespace arc {
21 21
22 // This class is executed in the GPU process. It takes decoding requests from 22 // This class is executed in the GPU process. It takes decoding requests from
23 // ARC via IPC channels and translates and sends those requests to an 23 // ARC via IPC channels and translates and sends those requests to an
24 // implementation of media::VideoDecodeAccelerator. It also returns the decoded 24 // implementation of media::VideoDecodeAccelerator. It also returns the decoded
25 // frames back to the ARC side. 25 // frames back to the ARC side.
26 class ArcGpuVideoDecodeAccelerator 26 class ChromeArcVideoDecodeAccelerator
27 : public ArcVideoAccelerator, 27 : public ArcVideoDecodeAccelerator,
28 public media::VideoDecodeAccelerator::Client, 28 public media::VideoDecodeAccelerator::Client,
29 public base::SupportsWeakPtr<ArcGpuVideoDecodeAccelerator> { 29 public base::SupportsWeakPtr<ChromeArcVideoDecodeAccelerator> {
30 public: 30 public:
31 explicit ArcGpuVideoDecodeAccelerator( 31 explicit ChromeArcVideoDecodeAccelerator(
32 const gpu::GpuPreferences& gpu_preferences); 32 const gpu::GpuPreferences& gpu_preferences);
33 ~ArcGpuVideoDecodeAccelerator() override; 33 ~ChromeArcVideoDecodeAccelerator() override;
34 34
35 // Implementation of the ArcVideoAccelerator interface. 35 // Implementation of the ArcVideoDecodeAccelerator interface.
36 ArcVideoAccelerator::Result Initialize( 36 ArcVideoDecodeAccelerator::Result Initialize(
37 const Config& config, 37 const Config& config,
38 ArcVideoAccelerator::Client* client) override; 38 ArcVideoDecodeAccelerator::Client* client) override;
39 void SetNumberOfOutputBuffers(size_t number) override; 39 void SetNumberOfOutputBuffers(size_t number) override;
40 void BindSharedMemory(PortType port, 40 void BindSharedMemory(PortType port,
41 uint32_t index, 41 uint32_t index,
42 base::ScopedFD ashmem_fd, 42 base::ScopedFD ashmem_fd,
43 off_t offset, 43 off_t offset,
44 size_t length) override; 44 size_t length) override;
45 void BindDmabuf(PortType port, 45 void BindDmabuf(PortType port,
46 uint32_t index, 46 uint32_t index,
47 base::ScopedFD dmabuf_fd, 47 base::ScopedFD dmabuf_fd,
48 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>& 48 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>&
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 struct OutputBufferInfo { 100 struct OutputBufferInfo {
101 base::ScopedFD handle; 101 base::ScopedFD handle;
102 std::vector<::arc::ArcVideoAcceleratorDmabufPlane> planes; 102 std::vector<::arc::ArcVideoAcceleratorDmabufPlane> planes;
103 103
104 OutputBufferInfo(); 104 OutputBufferInfo();
105 OutputBufferInfo(OutputBufferInfo&& other); 105 OutputBufferInfo(OutputBufferInfo&& other);
106 ~OutputBufferInfo(); 106 ~OutputBufferInfo();
107 }; 107 };
108 108
109 // The helper method to simplify reporting of the status returned to UMA. 109 // The helper method to simplify reporting of the status returned to UMA.
110 ArcVideoAccelerator::Result InitializeTask( 110 ArcVideoDecodeAccelerator::Result InitializeTask(
111 const Config& config, 111 const Config& config,
112 ArcVideoAccelerator::Client* client); 112 ArcVideoDecodeAccelerator::Client* client);
113 113
114 // Helper function to validate |port| and |index|. 114 // Helper function to validate |port| and |index|.
115 bool ValidatePortAndIndex(PortType port, uint32_t index) const; 115 bool ValidatePortAndIndex(PortType port, uint32_t index) const;
116 116
117 // Return true if |dmabuf_planes| is valid for a dmabuf |fd|. 117 // Return true if |dmabuf_planes| is valid for a dmabuf |fd|.
118 bool VerifyDmabuf(const base::ScopedFD& fd, 118 bool VerifyDmabuf(const base::ScopedFD& fd,
119 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>& 119 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>&
120 dmabuf_planes) const; 120 dmabuf_planes) const;
121 121
122 // Creates an InputRecord for the given |bitstream_buffer_id|. The 122 // Creates an InputRecord for the given |bitstream_buffer_id|. The
(...skipping 12 matching lines...) Expand all
135 135
136 // Global counter that keeps track the number of active clients (i.e., how 136 // Global counter that keeps track the number of active clients (i.e., how
137 // many VDAs in use by this class). 137 // many VDAs in use by this class).
138 // Since this class only works on the same thread, it's safe to access 138 // Since this class only works on the same thread, it's safe to access
139 // |client_count_| without lock. 139 // |client_count_| without lock.
140 static int client_count_; 140 static int client_count_;
141 141
142 std::unique_ptr<media::VideoDecodeAccelerator> vda_; 142 std::unique_ptr<media::VideoDecodeAccelerator> vda_;
143 143
144 // It's safe to use the pointer here, the life cycle of the |arc_client_| 144 // It's safe to use the pointer here, the life cycle of the |arc_client_|
145 // is longer than this ArcGpuVideoDecodeAccelerator. 145 // is longer than this ChromeArcVideoDecodeAccelerator.
146 ArcVideoAccelerator::Client* arc_client_; 146 ArcVideoDecodeAccelerator::Client* arc_client_;
147 147
148 // The next ID for the bitstream buffer, started from 0. 148 // The next ID for the bitstream buffer, started from 0.
149 int32_t next_bitstream_buffer_id_; 149 int32_t next_bitstream_buffer_id_;
150 150
151 gfx::Size coded_size_; 151 gfx::Size coded_size_;
152 gfx::Rect visible_rect_; 152 gfx::Rect visible_rect_;
153 media::VideoPixelFormat output_pixel_format_; 153 media::VideoPixelFormat output_pixel_format_;
154 154
155 // A list of most recent |kMaxNumberOfInputRecord| InputRecords. 155 // A list of most recent |kMaxNumberOfInputRecord| InputRecords.
156 // |kMaxNumberOfInputRecord| is defined in the cc file. 156 // |kMaxNumberOfInputRecord| is defined in the cc file.
157 std::list<InputRecord> input_records_; 157 std::list<InputRecord> input_records_;
158 158
159 // The details of the shared memory of each input buffers. 159 // The details of the shared memory of each input buffers.
160 std::vector<InputBufferInfo> input_buffer_info_; 160 std::vector<InputBufferInfo> input_buffer_info_;
161 161
162 // To keep those output buffers which have been bound by bindDmabuf() but 162 // To keep those output buffers which have been bound by bindDmabuf() but
163 // haven't been passed to VDA yet. Will call VDA::ImportBufferForPicture() 163 // haven't been passed to VDA yet. Will call VDA::ImportBufferForPicture()
164 // when those buffers are used for the first time. 164 // when those buffers are used for the first time.
165 std::vector<OutputBufferInfo> buffers_pending_import_; 165 std::vector<OutputBufferInfo> buffers_pending_import_;
166 166
167 base::ThreadChecker thread_checker_; 167 THREAD_CHECKER(thread_checker_);
168 size_t output_buffer_size_; 168 size_t output_buffer_size_;
169 169
170 // The minimal number of requested output buffers. 170 // The minimal number of requested output buffers.
171 uint32_t requested_num_of_output_buffers_; 171 uint32_t requested_num_of_output_buffers_;
172 172
173 gpu::GpuPreferences gpu_preferences_; 173 gpu::GpuPreferences gpu_preferences_;
174 174
175 DISALLOW_COPY_AND_ASSIGN(ArcGpuVideoDecodeAccelerator); 175 DISALLOW_COPY_AND_ASSIGN(ChromeArcVideoDecodeAccelerator);
176 }; 176 };
177 177
178 } // namespace arc 178 } // namespace arc
179 } // namespace chromeos 179 } // namespace chromeos
180 180
181 #endif // CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ 181 #endif // CHROME_GPU_CHROME_ARC_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « chrome/gpu/arc_video_decode_accelerator.h ('k') | chrome/gpu/chrome_arc_video_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698