| 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 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h" | 5 #include "chrome/gpu/arc_gpu_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/numerics/safe_math.h" | 9 #include "base/numerics/safe_math.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 InputBufferInfo* input_info = &input_buffer_info_[index]; | 181 InputBufferInfo* input_info = &input_buffer_info_[index]; |
| 182 input_info->handle = std::move(ashmem_fd); | 182 input_info->handle = std::move(ashmem_fd); |
| 183 input_info->offset = offset; | 183 input_info->offset = offset; |
| 184 input_info->length = length; | 184 input_info->length = length; |
| 185 } | 185 } |
| 186 | 186 |
| 187 bool ArcGpuVideoDecodeAccelerator::VerifyDmabuf( | 187 bool ArcGpuVideoDecodeAccelerator::VerifyDmabuf( |
| 188 const base::ScopedFD& dmabuf_fd, | 188 const base::ScopedFD& dmabuf_fd, |
| 189 const std::vector<DmabufPlane>& dmabuf_planes) const { | 189 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>& dmabuf_planes) |
| 190 const { |
| 190 size_t num_planes = media::VideoFrame::NumPlanes(output_pixel_format_); | 191 size_t num_planes = media::VideoFrame::NumPlanes(output_pixel_format_); |
| 191 if (dmabuf_planes.size() != num_planes) { | 192 if (dmabuf_planes.size() != num_planes) { |
| 192 DLOG(ERROR) << "Invalid number of dmabuf planes passed: " | 193 DLOG(ERROR) << "Invalid number of dmabuf planes passed: " |
| 193 << dmabuf_planes.size() << ", expected: " << num_planes; | 194 << dmabuf_planes.size() << ", expected: " << num_planes; |
| 194 return false; | 195 return false; |
| 195 } | 196 } |
| 196 | 197 |
| 197 off_t size = lseek(dmabuf_fd.get(), 0, SEEK_END); | 198 off_t size = lseek(dmabuf_fd.get(), 0, SEEK_END); |
| 198 lseek(dmabuf_fd.get(), 0, SEEK_SET); | 199 lseek(dmabuf_fd.get(), 0, SEEK_SET); |
| 199 if (size < 0) { | 200 if (size < 0) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 219 ++i; | 220 ++i; |
| 220 } | 221 } |
| 221 | 222 |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 void ArcGpuVideoDecodeAccelerator::BindDmabuf( | 226 void ArcGpuVideoDecodeAccelerator::BindDmabuf( |
| 226 PortType port, | 227 PortType port, |
| 227 uint32_t index, | 228 uint32_t index, |
| 228 base::ScopedFD dmabuf_fd, | 229 base::ScopedFD dmabuf_fd, |
| 229 const std::vector<DmabufPlane>& dmabuf_planes) { | 230 const std::vector<::arc::ArcVideoAcceleratorDmabufPlane>& dmabuf_planes) { |
| 230 DCHECK(thread_checker_.CalledOnValidThread()); | 231 DCHECK(thread_checker_.CalledOnValidThread()); |
| 231 | 232 |
| 232 if (!vda_) { | 233 if (!vda_) { |
| 233 DLOG(ERROR) << "VDA not initialized"; | 234 DLOG(ERROR) << "VDA not initialized"; |
| 234 return; | 235 return; |
| 235 } | 236 } |
| 236 | 237 |
| 237 if (port != PORT_OUTPUT) { | 238 if (port != PORT_OUTPUT) { |
| 238 DLOG(ERROR) << "Dmabuf is only supported for input"; | 239 DLOG(ERROR) << "Dmabuf is only supported for input"; |
| 239 arc_client_->OnError(INVALID_ARGUMENT); | 240 arc_client_->OnError(INVALID_ARGUMENT); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 510 } |
| 510 return true; | 511 return true; |
| 511 default: | 512 default: |
| 512 DLOG(ERROR) << "Invalid port: " << port; | 513 DLOG(ERROR) << "Invalid port: " << port; |
| 513 return false; | 514 return false; |
| 514 } | 515 } |
| 515 } | 516 } |
| 516 | 517 |
| 517 } // namespace arc | 518 } // namespace arc |
| 518 } // namespace chromeos | 519 } // namespace chromeos |
| OLD | NEW |