OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/gpu/v4l2_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_video_decode_accelerator.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <linux/videodev2.h> | 10 #include <linux/videodev2.h> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 // We need the context to be initialized to query extensions. | 241 // We need the context to be initialized to query extensions. |
242 if (!make_context_current_cb_.Run()) { | 242 if (!make_context_current_cb_.Run()) { |
243 LOG(ERROR) << "Initialize(): could not make context current"; | 243 LOG(ERROR) << "Initialize(): could not make context current"; |
244 return false; | 244 return false; |
245 } | 245 } |
246 | 246 |
247 // TODO(posciak): crbug.com/450898. | 247 // TODO(posciak): crbug.com/450898. |
248 #if defined(ARCH_CPU_ARMEL) | 248 #if defined(ARCH_CPU_ARMEL) |
249 if (!gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) { | 249 if (!gl::g_driver_egl.ext.b_EGL_KHR_fence_sync) { |
250 LOG(ERROR) << "Initialize(): context does not have EGL_KHR_fence_sync"; | 250 LOG(ERROR) << "Initialize(): context does not have EGL_KHR_fence_sync"; |
251 return false; | 251 return false; |
252 } | 252 } |
253 #endif | 253 #endif |
254 | 254 |
255 // Capabilities check. | 255 // Capabilities check. |
256 struct v4l2_capability caps; | 256 struct v4l2_capability caps; |
257 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; | 257 const __u32 kCapsRequired = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING; |
258 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); | 258 IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps); |
259 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { | 259 if ((caps.capabilities & kCapsRequired) != kCapsRequired) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 output_dpb_size_ + kDpbOutputBufferExtraCount; | 324 output_dpb_size_ + kDpbOutputBufferExtraCount; |
325 | 325 |
326 if (buffers.size() < req_buffer_count) { | 326 if (buffers.size() < req_buffer_count) { |
327 LOG(ERROR) << "AssignPictureBuffers(): Failed to provide requested picture" | 327 LOG(ERROR) << "AssignPictureBuffers(): Failed to provide requested picture" |
328 << " buffers. (Got " << buffers.size() | 328 << " buffers. (Got " << buffers.size() |
329 << ", requested " << req_buffer_count << ")"; | 329 << ", requested " << req_buffer_count << ")"; |
330 NOTIFY_ERROR(INVALID_ARGUMENT); | 330 NOTIFY_ERROR(INVALID_ARGUMENT); |
331 return; | 331 return; |
332 } | 332 } |
333 | 333 |
334 gfx::GLContext* gl_context = get_gl_context_cb_.Run(); | 334 gl::GLContext* gl_context = get_gl_context_cb_.Run(); |
335 if (!gl_context || !make_context_current_cb_.Run()) { | 335 if (!gl_context || !make_context_current_cb_.Run()) { |
336 LOG(ERROR) << "AssignPictureBuffers(): could not make context current"; | 336 LOG(ERROR) << "AssignPictureBuffers(): could not make context current"; |
337 NOTIFY_ERROR(PLATFORM_FAILURE); | 337 NOTIFY_ERROR(PLATFORM_FAILURE); |
338 return; | 338 return; |
339 } | 339 } |
340 | 340 |
341 gfx::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); | 341 gl::ScopedTextureBinder bind_restore(GL_TEXTURE_EXTERNAL_OES, 0); |
342 | 342 |
343 // It's safe to manipulate all the buffer state here, because the decoder | 343 // It's safe to manipulate all the buffer state here, because the decoder |
344 // thread is waiting on pictures_assigned_. | 344 // thread is waiting on pictures_assigned_. |
345 | 345 |
346 // Allocate the output buffers. | 346 // Allocate the output buffers. |
347 struct v4l2_requestbuffers reqbufs; | 347 struct v4l2_requestbuffers reqbufs; |
348 memset(&reqbufs, 0, sizeof(reqbufs)); | 348 memset(&reqbufs, 0, sizeof(reqbufs)); |
349 reqbufs.count = buffers.size(); | 349 reqbufs.count = buffers.size(); |
350 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 350 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
351 reqbufs.memory = V4L2_MEMORY_MMAP; | 351 reqbufs.memory = V4L2_MEMORY_MMAP; |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 Enqueue(); | 2243 Enqueue(); |
2244 } | 2244 } |
2245 } | 2245 } |
2246 | 2246 |
2247 void V4L2VideoDecodeAccelerator::ImageProcessorError() { | 2247 void V4L2VideoDecodeAccelerator::ImageProcessorError() { |
2248 LOG(ERROR) << "Image processor error"; | 2248 LOG(ERROR) << "Image processor error"; |
2249 NOTIFY_ERROR(PLATFORM_FAILURE); | 2249 NOTIFY_ERROR(PLATFORM_FAILURE); |
2250 } | 2250 } |
2251 | 2251 |
2252 } // namespace media | 2252 } // namespace media |
OLD | NEW |