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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <linux/videodev2.h> | 6 #include <linux/videodev2.h> |
7 #include <poll.h> | 7 #include <poll.h> |
8 #include <sys/eventfd.h> | 8 #include <sys/eventfd.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
11 | 11 |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/posix/eintr_wrapper.h" | 13 #include "base/posix/eintr_wrapper.h" |
14 #include "content/common/gpu/media/exynos_v4l2_video_device.h" | 14 #include "content/common/gpu/media/exynos_v4l2_video_device.h" |
| 15 #include "ui/gl/gl_bindings.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 namespace { | 19 namespace { |
19 const char kDevice[] = "/dev/mfc-dec"; | 20 const char kDevice[] = "/dev/mfc-dec"; |
20 } | 21 } |
21 | 22 |
22 ExynosV4L2Device::ExynosV4L2Device() | 23 ExynosV4L2Device::ExynosV4L2Device() |
23 : device_fd_(-1), device_poll_interrupt_fd_(-1) {} | 24 : device_fd_(-1), device_poll_interrupt_fd_(-1) {} |
24 | 25 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (device_fd_ == -1) { | 108 if (device_fd_ == -1) { |
108 return false; | 109 return false; |
109 } | 110 } |
110 | 111 |
111 device_poll_interrupt_fd_ = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); | 112 device_poll_interrupt_fd_ = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); |
112 if (device_poll_interrupt_fd_ == -1) { | 113 if (device_poll_interrupt_fd_ == -1) { |
113 return false; | 114 return false; |
114 } | 115 } |
115 return true; | 116 return true; |
116 } | 117 } |
| 118 |
| 119 EGLImageKHR ExynosV4L2Device::CreateEGLImage(EGLDisplay egl_display, |
| 120 EGLint attrib[], |
| 121 unsigned int texture_id, |
| 122 unsigned int /*buffer_index*/) { |
| 123 EGLImageKHR egl_image = eglCreateImageKHR( |
| 124 egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attrib); |
| 125 if (egl_image == EGL_NO_IMAGE_KHR) { |
| 126 return egl_image; |
| 127 } |
| 128 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); |
| 129 glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); |
| 130 return egl_image; |
| 131 } |
| 132 |
| 133 unsigned int ExynosV4L2Device::GetTextureTarget() { |
| 134 return GL_TEXTURE_EXTERNAL_OES; |
| 135 } |
| 136 |
117 } // namespace content | 137 } // namespace content |
OLD | NEW |