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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <linux/videodev2.h> | 7 #include <linux/videodev2.h> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/posix/eintr_wrapper.h" | 10 #include "base/posix/eintr_wrapper.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // being returned. TegraV4L2Device::CreateEGLImage() will ignore the invalid | 182 // being returned. TegraV4L2Device::CreateEGLImage() will ignore the invalid |
183 // descriptors and create images based on V4L2 index passed to it. | 183 // descriptors and create images based on V4L2 index passed to it. |
184 dmabuf_fds.resize(num_planes); | 184 dmabuf_fds.resize(num_planes); |
185 return dmabuf_fds; | 185 return dmabuf_fds; |
186 } | 186 } |
187 | 187 |
188 bool TegraV4L2Device::CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) { | 188 bool TegraV4L2Device::CanCreateEGLImageFrom(uint32_t v4l2_pixfmt) { |
189 return v4l2_pixfmt == V4L2_PIX_FMT_NV12M; | 189 return v4l2_pixfmt == V4L2_PIX_FMT_NV12M; |
190 } | 190 } |
191 | 191 |
192 EGLImageKHR TegraV4L2Device::CreateEGLImage(EGLDisplay egl_display, | 192 EGLImageKHR TegraV4L2Device::CreateEGLImage( |
193 EGLContext egl_context, | 193 EGLDisplay egl_display, |
194 GLuint texture_id, | 194 EGLContext egl_context, |
195 gfx::Size /* frame_buffer_size */, | 195 GLuint texture_id, |
196 unsigned int buffer_index, | 196 const gfx::Size& /* size */, |
197 uint32_t v4l2_pixfmt, | 197 unsigned int buffer_index, |
198 size_t /* num_v4l2_planes */) { | 198 uint32_t v4l2_pixfmt, |
| 199 const std::vector<base::ScopedFD>& /* dmabuf_fds */) { |
199 DVLOG(3) << "CreateEGLImage()"; | 200 DVLOG(3) << "CreateEGLImage()"; |
200 if (!CanCreateEGLImageFrom(v4l2_pixfmt)) { | 201 if (!CanCreateEGLImageFrom(v4l2_pixfmt)) { |
201 LOG(ERROR) << "Unsupported V4L2 pixel format"; | 202 LOG(ERROR) << "Unsupported V4L2 pixel format"; |
202 return EGL_NO_IMAGE_KHR; | 203 return EGL_NO_IMAGE_KHR; |
203 } | 204 } |
204 | 205 |
205 EGLint attr = EGL_NONE; | 206 EGLint attr = EGL_NONE; |
206 EGLImageKHR egl_image = | 207 EGLImageKHR egl_image = |
207 eglCreateImageKHR(egl_display, | 208 eglCreateImageKHR(egl_display, |
208 egl_context, | 209 egl_context, |
(...skipping 20 matching lines...) Expand all Loading... |
229 GLenum TegraV4L2Device::GetTextureTarget() { return GL_TEXTURE_2D; } | 230 GLenum TegraV4L2Device::GetTextureTarget() { return GL_TEXTURE_2D; } |
230 | 231 |
231 uint32_t TegraV4L2Device::PreferredInputFormat() { | 232 uint32_t TegraV4L2Device::PreferredInputFormat() { |
232 // TODO(posciak): We should support "dontcare" returns here once we | 233 // TODO(posciak): We should support "dontcare" returns here once we |
233 // implement proper handling (fallback, negotiation) for this in users. | 234 // implement proper handling (fallback, negotiation) for this in users. |
234 CHECK_EQ(type_, kEncoder); | 235 CHECK_EQ(type_, kEncoder); |
235 return V4L2_PIX_FMT_YUV420M; | 236 return V4L2_PIX_FMT_YUV420M; |
236 } | 237 } |
237 | 238 |
238 } // namespace content | 239 } // namespace content |
OLD | NEW |