Chromium Code Reviews| 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 "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" |
| 6 | 6 |
| 7 #include <gbm.h> | 7 #include <gbm.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 auto it = widget_to_surface_map_.find(widget); | 47 auto it = widget_to_surface_map_.find(widget); |
| 48 DCHECK(it != widget_to_surface_map_.end()); | 48 DCHECK(it != widget_to_surface_map_.end()); |
| 49 return it->second; | 49 return it->second; |
| 50 } | 50 } |
| 51 | 51 |
| 52 intptr_t GbmSurfaceFactory::GetNativeDisplay() { | 52 intptr_t GbmSurfaceFactory::GetNativeDisplay() { |
| 53 DCHECK(thread_checker_.CalledOnValidThread()); | 53 DCHECK(thread_checker_.CalledOnValidThread()); |
| 54 return EGL_DEFAULT_DISPLAY; | 54 return EGL_DEFAULT_DISPLAY; |
| 55 } | 55 } |
| 56 | 56 |
| 57 const int32_t* GbmSurfaceFactory::GetEGLSurfaceProperties( | |
| 58 const int32_t* desired_list) { | |
| 59 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 60 static const int32_t kConfigAttribs[] = {EGL_BUFFER_SIZE, | |
| 61 32, | |
| 62 EGL_ALPHA_SIZE, | |
| 63 8, | |
| 64 EGL_BLUE_SIZE, | |
| 65 8, | |
| 66 EGL_GREEN_SIZE, | |
| 67 8, | |
| 68 EGL_RED_SIZE, | |
| 69 8, | |
| 70 EGL_RENDERABLE_TYPE, | |
| 71 EGL_OPENGL_ES2_BIT, | |
| 72 EGL_SURFACE_TYPE, | |
| 73 EGL_WINDOW_BIT, | |
|
dnicoara
2016/03/01 18:15:56
This should be EGL_DONT_CARE (marcheu@ updated thi
kylechar
2016/03/03 16:09:23
Done.
| |
| 74 EGL_NONE}; | |
| 75 return kConfigAttribs; | |
| 76 } | |
| 77 | |
| 57 bool GbmSurfaceFactory::LoadEGLGLES2Bindings( | 78 bool GbmSurfaceFactory::LoadEGLGLES2Bindings( |
| 58 AddGLLibraryCallback add_gl_library, | 79 AddGLLibraryCallback add_gl_library, |
| 59 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 80 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
| 60 DCHECK(thread_checker_.CalledOnValidThread()); | 81 DCHECK(thread_checker_.CalledOnValidThread()); |
| 61 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address); | 82 return LoadDefaultEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address); |
| 62 } | 83 } |
| 63 | 84 |
| 64 scoped_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget( | 85 scoped_ptr<SurfaceOzoneCanvas> GbmSurfaceFactory::CreateCanvasForWidget( |
| 65 gfx::AcceleratedWidget widget) { | 86 gfx::AcceleratedWidget widget) { |
| 66 DCHECK(thread_checker_.CalledOnValidThread()); | 87 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 } | 134 } |
| 114 | 135 |
| 115 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( | 136 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmapFromHandle( |
| 116 const gfx::NativePixmapHandle& handle) { | 137 const gfx::NativePixmapHandle& handle) { |
| 117 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this)); | 138 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(this)); |
| 118 pixmap->Initialize(base::ScopedFD(handle.fd.fd), handle.stride); | 139 pixmap->Initialize(base::ScopedFD(handle.fd.fd), handle.stride); |
| 119 return pixmap; | 140 return pixmap; |
| 120 } | 141 } |
| 121 | 142 |
| 122 } // namespace ui | 143 } // namespace ui |
| OLD | NEW |