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_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <queue> | 10 #include <queue> |
(...skipping 24 matching lines...) Expand all Loading... | |
35 bool Initialize(const Config& config, | 35 bool Initialize(const Config& config, |
36 ArcVideoAccelerator::Client* client) override; | 36 ArcVideoAccelerator::Client* client) override; |
37 void SetNumberOfOutputBuffers(size_t number) override; | 37 void SetNumberOfOutputBuffers(size_t number) override; |
38 void BindSharedMemory(PortType port, | 38 void BindSharedMemory(PortType port, |
39 uint32_t index, | 39 uint32_t index, |
40 base::ScopedFD ashmem_fd, | 40 base::ScopedFD ashmem_fd, |
41 off_t offset, | 41 off_t offset, |
42 size_t length) override; | 42 size_t length) override; |
43 void BindDmabuf(PortType port, | 43 void BindDmabuf(PortType port, |
44 uint32_t index, | 44 uint32_t index, |
45 base::ScopedFD dmabuf_fd) override; | 45 base::ScopedFD dmabuf_fd, |
46 int32_t stride) override; | |
46 void UseBuffer(PortType port, | 47 void UseBuffer(PortType port, |
47 uint32_t index, | 48 uint32_t index, |
48 const BufferMetadata& metadata) override; | 49 const BufferMetadata& metadata) override; |
49 void Reset() override; | 50 void Reset() override; |
50 | 51 |
51 // Implementation of the VideoDecodeAccelerator::Client interface. | 52 // Implementation of the VideoDecodeAccelerator::Client interface. |
52 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, | 53 void ProvidePictureBuffers(uint32_t requested_num_of_buffers, |
53 uint32_t textures_per_buffer, | 54 uint32_t textures_per_buffer, |
54 const gfx::Size& dimensions, | 55 const gfx::Size& dimensions, |
55 uint32_t texture_target) override; | 56 uint32_t texture_target) override; |
(...skipping 15 matching lines...) Expand all Loading... | |
71 InputRecord(int32_t bitstream_buffer_id, | 72 InputRecord(int32_t bitstream_buffer_id, |
72 uint32_t buffer_index, | 73 uint32_t buffer_index, |
73 int64_t timestamp); | 74 int64_t timestamp); |
74 }; | 75 }; |
75 | 76 |
76 // The information about the shared memory used as an input buffer. | 77 // The information about the shared memory used as an input buffer. |
77 struct InputBufferInfo { | 78 struct InputBufferInfo { |
78 // The file handle to access the buffer. It is owned by this class and | 79 // The file handle to access the buffer. It is owned by this class and |
79 // should be closed after use. | 80 // should be closed after use. |
80 base::ScopedFD handle; | 81 base::ScopedFD handle; |
81 off_t offset; | 82 off_t offset = 0; |
82 size_t length; | 83 size_t length = 0; |
83 | 84 |
84 InputBufferInfo(); | 85 InputBufferInfo() = default; |
kcwu
2016/05/05 10:10:04
IIUC, please put these "= default" lines in .cpp i
Owen Lin
2016/05/06 05:38:34
Done.
| |
85 InputBufferInfo(InputBufferInfo&& other); | 86 InputBufferInfo(InputBufferInfo&& other) = default; |
86 ~InputBufferInfo(); | 87 ~InputBufferInfo() = default; |
88 }; | |
89 | |
90 // The information about the Dmabuf used as an output buffer. | |
91 struct OutputBufferInfo { | |
92 base::ScopedFD handle; | |
93 int32_t stride; | |
kcwu
2016/05/05 10:10:05
= 0
Owen Lin
2016/05/06 05:38:34
Done.
| |
94 | |
95 OutputBufferInfo() = default; | |
96 OutputBufferInfo(OutputBufferInfo&& other) = default; | |
97 ~OutputBufferInfo() = default; | |
87 }; | 98 }; |
88 | 99 |
89 // Helper function to Send the end-of-stream output buffer if | 100 // Helper function to Send the end-of-stream output buffer if |
90 // |pending_eos_output_buffer_| is true, or reuse the picture in ArcVDA. | 101 // |pending_eos_output_buffer_| is true, or reuse the picture in ArcVDA. |
91 void SendEosIfNeededOrReusePicture(uint32_t index); | 102 void SendEosIfNeededOrReusePicture(uint32_t index); |
92 | 103 |
93 // Helper function to validate |port| and |index|. | 104 // Helper function to validate |port| and |index|. |
94 bool ValidatePortAndIndex(PortType port, uint32_t index); | 105 bool ValidatePortAndIndex(PortType port, uint32_t index); |
95 | 106 |
96 // Creates an InputRecord for the given |bitstream_buffer_id|. The | 107 // Creates an InputRecord for the given |bitstream_buffer_id|. The |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 // A list of most recent |kMaxNumberOfInputRecord| InputRecords. | 140 // A list of most recent |kMaxNumberOfInputRecord| InputRecords. |
130 // |kMaxNumberOfInputRecord| is defined in the cc file. | 141 // |kMaxNumberOfInputRecord| is defined in the cc file. |
131 std::list<InputRecord> input_records_; | 142 std::list<InputRecord> input_records_; |
132 | 143 |
133 // The details of the shared memory of each input buffers. | 144 // The details of the shared memory of each input buffers. |
134 std::vector<InputBufferInfo> input_buffer_info_; | 145 std::vector<InputBufferInfo> input_buffer_info_; |
135 | 146 |
136 // To keep those output buffers which have been bound by bindDmabuf() but not | 147 // To keep those output buffers which have been bound by bindDmabuf() but not |
137 // be used yet. Will call VDA::ImportBufferForPicture() when those buffers are | 148 // be used yet. Will call VDA::ImportBufferForPicture() when those buffers are |
138 // used for the first time. | 149 // used for the first time. |
139 std::vector<base::ScopedFD> buffers_pending_import_; | 150 std::vector<OutputBufferInfo> buffers_pending_import_; |
140 | 151 |
141 base::ThreadChecker thread_checker_; | 152 base::ThreadChecker thread_checker_; |
142 size_t output_buffer_size_; | 153 size_t output_buffer_size_; |
143 | 154 |
144 gpu::GpuPreferences gpu_preferences_; | 155 gpu::GpuPreferences gpu_preferences_; |
145 | 156 |
146 DISALLOW_COPY_AND_ASSIGN(ArcGpuVideoDecodeAccelerator); | 157 DISALLOW_COPY_AND_ASSIGN(ArcGpuVideoDecodeAccelerator); |
147 }; | 158 }; |
148 | 159 |
149 } // namespace arc | 160 } // namespace arc |
150 } // namespace chromeos | 161 } // namespace chromeos |
151 | 162 |
152 #endif // CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 163 #endif // CHROME_GPU_ARC_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |