| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 return true; | 103 return true; |
| 104 } else { | 104 } else { |
| 105 DPLOG(ERROR) << "ClearDevicePollInterrupt(): read() failed"; | 105 DPLOG(ERROR) << "ClearDevicePollInterrupt(): read() failed"; |
| 106 return false; | 106 return false; |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 return true; | 109 return true; |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool ExynosV4L2Device::Initialize() { | 112 bool ExynosV4L2Device::Initialize() { |
| 113 const char* device_path = NULL; | 113 const char* device_path = nullptr; |
| 114 switch (type_) { | 114 switch (type_) { |
| 115 case kDecoder: | 115 case kDecoder: |
| 116 device_path = kDecoderDevice; | 116 device_path = kDecoderDevice; |
| 117 break; | 117 break; |
| 118 case kEncoder: | 118 case kEncoder: |
| 119 device_path = kEncoderDevice; | 119 device_path = kEncoderDevice; |
| 120 break; | 120 break; |
| 121 case kImageProcessor: | 121 case kImageProcessor: |
| 122 device_path = kImageProcessorDevice; | 122 device_path = kImageProcessorDevice; |
| 123 break; | 123 break; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(); |
| 173 attrs[9] = 0; | 173 attrs[9] = 0; |
| 174 attrs[11] = frame_buffer_size.width(); | 174 attrs[11] = frame_buffer_size.width(); |
| 175 attrs[13] = dmabuf_fds[1].get(); | 175 attrs[13] = dmabuf_fds[1].get(); |
| 176 attrs[15] = 0; | 176 attrs[15] = 0; |
| 177 attrs[17] = frame_buffer_size.width(); | 177 attrs[17] = frame_buffer_size.width(); |
| 178 | 178 |
| 179 EGLImageKHR egl_image = eglCreateImageKHR( | 179 EGLImageKHR egl_image = eglCreateImageKHR( |
| 180 egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attrs); | 180 egl_display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, nullptr, attrs); |
| 181 if (egl_image == EGL_NO_IMAGE_KHR) { | 181 if (egl_image == EGL_NO_IMAGE_KHR) { |
| 182 return egl_image; | 182 return egl_image; |
| 183 } | 183 } |
| 184 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); | 184 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_id); |
| 185 glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); | 185 glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, egl_image); |
| 186 | 186 |
| 187 return egl_image; | 187 return egl_image; |
| 188 } | 188 } |
| 189 | 189 |
| 190 EGLBoolean ExynosV4L2Device::DestroyEGLImage(EGLDisplay egl_display, | 190 EGLBoolean ExynosV4L2Device::DestroyEGLImage(EGLDisplay egl_display, |
| (...skipping 11 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 |