OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gfx/buffer_format_util.h" | 5 #include "ui/gfx/buffer_format_util.h" |
6 #include "ui/gl/gl_fence.h" | |
6 #include "ui/gl/gl_image_ozone_native_pixmap.h" | 7 #include "ui/gl/gl_image_ozone_native_pixmap.h" |
7 #include "ui/gl/gl_surface_egl.h" | 8 #include "ui/gl/gl_surface_egl.h" |
8 | 9 |
9 #define FOURCC(a, b, c, d) \ | 10 #define FOURCC(a, b, c, d) \ |
10 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ | 11 ((static_cast<uint32_t>(a)) | (static_cast<uint32_t>(b) << 8) | \ |
11 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) | 12 (static_cast<uint32_t>(c) << 16) | (static_cast<uint32_t>(d) << 24)) |
12 | 13 |
13 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') | 14 #define DRM_FORMAT_R8 FOURCC('R', '8', ' ', ' ') |
14 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6') | 15 #define DRM_FORMAT_RGB565 FOURCC('R', 'G', '1', '6') |
15 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') | 16 #define DRM_FORMAT_ARGB8888 FOURCC('A', 'R', '2', '4') |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 return GLImageEGL::CopyTexImage(target); | 198 return GLImageEGL::CopyTexImage(target); |
198 } | 199 } |
199 | 200 |
200 bool GLImageOzoneNativePixmap::ScheduleOverlayPlane( | 201 bool GLImageOzoneNativePixmap::ScheduleOverlayPlane( |
201 gfx::AcceleratedWidget widget, | 202 gfx::AcceleratedWidget widget, |
202 int z_order, | 203 int z_order, |
203 gfx::OverlayTransform transform, | 204 gfx::OverlayTransform transform, |
204 const gfx::Rect& bounds_rect, | 205 const gfx::Rect& bounds_rect, |
205 const gfx::RectF& crop_rect) { | 206 const gfx::RectF& crop_rect) { |
206 DCHECK(pixmap_); | 207 DCHECK(pixmap_); |
208 | |
reveman
2016/07/11 18:59:06
nit: no need to add this blank line
| |
207 return pixmap_->ScheduleOverlayPlane(widget, z_order, transform, bounds_rect, | 209 return pixmap_->ScheduleOverlayPlane(widget, z_order, transform, bounds_rect, |
208 crop_rect); | 210 crop_rect); |
209 } | 211 } |
210 | 212 |
211 void GLImageOzoneNativePixmap::OnMemoryDump( | 213 void GLImageOzoneNativePixmap::OnMemoryDump( |
212 base::trace_event::ProcessMemoryDump* pmd, | 214 base::trace_event::ProcessMemoryDump* pmd, |
213 uint64_t process_tracing_id, | 215 uint64_t process_tracing_id, |
214 const std::string& dump_name) { | 216 const std::string& dump_name) { |
215 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 | 217 // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914 |
216 } | 218 } |
(...skipping 23 matching lines...) Expand all Loading... | |
240 case gfx::BufferFormat::YUV_420_BIPLANAR: | 242 case gfx::BufferFormat::YUV_420_BIPLANAR: |
241 case gfx::BufferFormat::UYVY_422: | 243 case gfx::BufferFormat::UYVY_422: |
242 NOTREACHED(); | 244 NOTREACHED(); |
243 return GL_NONE; | 245 return GL_NONE; |
244 } | 246 } |
245 | 247 |
246 NOTREACHED(); | 248 NOTREACHED(); |
247 return GL_NONE; | 249 return GL_NONE; |
248 } | 250 } |
249 | 251 |
252 void GLImageOzoneNativePixmap::Flush() { | |
reveman
2016/07/11 18:59:06
nit: move below ScheduleOverlayPlane
| |
253 if (GLSurfaceEGL::HasEGLExtension("EGL_EXT_image_flush_external")) { | |
piman
2016/07/11 16:06:26
nit: parsing strings on every frame seems a bit un
| |
254 EGLDisplay display = GLSurfaceEGL::GetHardwareDisplay(); | |
255 const EGLAttrib attribs[] = { | |
256 EGL_NONE, | |
257 }; | |
258 if (!eglImageFlushExternalEXT(display, egl_image_, attribs)) { | |
259 LOG(ERROR) << "Failed to flush rendering"; | |
260 return; | |
261 } | |
262 } | |
263 | |
264 return; | |
reveman
2016/07/11 18:59:06
nit: remove unnecessary return statement
| |
265 } | |
266 | |
250 } // namespace gl | 267 } // namespace gl |
OLD | NEW |