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 | 5 |
6 #include <fcntl.h> | 6 #include <fcntl.h> |
7 #include <libdrm/drm_fourcc.h> | 7 #include <libdrm/drm_fourcc.h> |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <poll.h> | 9 #include <poll.h> |
10 #include <sys/eventfd.h> | 10 #include <sys/eventfd.h> |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 memset(&expbuf, 0, sizeof(expbuf)); | 152 memset(&expbuf, 0, sizeof(expbuf)); |
153 expbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 153 expbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
154 expbuf.index = buffer_index; | 154 expbuf.index = buffer_index; |
155 expbuf.plane = i; | 155 expbuf.plane = i; |
156 expbuf.flags = O_CLOEXEC; | 156 expbuf.flags = O_CLOEXEC; |
157 if (Ioctl(VIDIOC_EXPBUF, &expbuf) != 0) { | 157 if (Ioctl(VIDIOC_EXPBUF, &expbuf) != 0) { |
158 return EGL_NO_IMAGE_KHR; | 158 return EGL_NO_IMAGE_KHR; |
159 } | 159 } |
160 dmabuf_fds[i].reset(expbuf.fd); | 160 dmabuf_fds[i].reset(expbuf.fd); |
161 } | 161 } |
162 DCHECK_EQ(planes_count, 2); | 162 DCHECK_EQ(planes_count, 2u); |
163 EGLint attrs[] = { | 163 EGLint attrs[] = { |
164 EGL_WIDTH, 0, EGL_HEIGHT, 0, | 164 EGL_WIDTH, 0, EGL_HEIGHT, 0, |
165 EGL_LINUX_DRM_FOURCC_EXT, 0, EGL_DMA_BUF_PLANE0_FD_EXT, 0, | 165 EGL_LINUX_DRM_FOURCC_EXT, 0, EGL_DMA_BUF_PLANE0_FD_EXT, 0, |
166 EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, EGL_DMA_BUF_PLANE0_PITCH_EXT, 0, | 166 EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0, EGL_DMA_BUF_PLANE0_PITCH_EXT, 0, |
167 EGL_DMA_BUF_PLANE1_FD_EXT, 0, EGL_DMA_BUF_PLANE1_OFFSET_EXT, 0, | 167 EGL_DMA_BUF_PLANE1_FD_EXT, 0, EGL_DMA_BUF_PLANE1_OFFSET_EXT, 0, |
168 EGL_DMA_BUF_PLANE1_PITCH_EXT, 0, EGL_NONE, }; | 168 EGL_DMA_BUF_PLANE1_PITCH_EXT, 0, EGL_NONE, }; |
169 attrs[1] = frame_buffer_size.width(); | 169 attrs[1] = frame_buffer_size.width(); |
170 attrs[3] = frame_buffer_size.height(); | 170 attrs[3] = frame_buffer_size.height(); |
171 attrs[5] = DRM_FORMAT_NV12; | 171 attrs[5] = DRM_FORMAT_NV12; |
172 attrs[7] = dmabuf_fds[0].get(); | 172 attrs[7] = dmabuf_fds[0].get(); |
(...skipping 29 matching lines...) Expand all Loading... |
202 } | 202 } |
203 | 203 |
204 uint32 ExynosV4L2Device::PreferredOutputFormat() { | 204 uint32 ExynosV4L2Device::PreferredOutputFormat() { |
205 // TODO(posciak): We should support "dontcare" returns here once we | 205 // TODO(posciak): We should support "dontcare" returns here once we |
206 // implement proper handling (fallback, negotiation) for this in users. | 206 // implement proper handling (fallback, negotiation) for this in users. |
207 CHECK_EQ(type_, kDecoder); | 207 CHECK_EQ(type_, kDecoder); |
208 return V4L2_PIX_FMT_NV12M; | 208 return V4L2_PIX_FMT_NV12M; |
209 } | 209 } |
210 | 210 |
211 } // namespace content | 211 } // namespace content |
OLD | NEW |