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/dri/gbm_surface_factory.h" | 5 #include "ui/ozone/platform/dri/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 "third_party/khronos/EGL/egl.h" | 10 #include "third_party/khronos/EGL/egl.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 add_gl_library.Run(gles_library); | 90 add_gl_library.Run(gles_library); |
91 | 91 |
92 return true; | 92 return true; |
93 } | 93 } |
94 | 94 |
95 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( | 95 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( |
96 gfx::AcceleratedWidget widget) { | 96 gfx::AcceleratedWidget widget) { |
97 DCHECK(state_ == INITIALIZED); | 97 DCHECK(state_ == INITIALIZED); |
98 ResetCursor(widget); | 98 ResetCursor(widget); |
99 | 99 |
100 if (allow_surfaceless_) { | 100 scoped_ptr<GbmSurface> surface(new GbmSurface( |
101 return scoped_ptr<SurfaceOzoneEGL>( | 101 screen_manager_->GetDisplayController(widget), device_, drm_)); |
102 new GbmSurfaceless(screen_manager_->GetDisplayController(widget))); | 102 if (!surface->Initialize()) |
103 } else { | 103 return scoped_ptr<SurfaceOzoneEGL>(); |
104 scoped_ptr<GbmSurface> surface( | |
105 new GbmSurface(screen_manager_->GetDisplayController(widget), | |
106 device_, | |
107 drm_)); | |
108 if (!surface->Initialize()) | |
109 return scoped_ptr<SurfaceOzoneEGL>(); | |
110 | 104 |
111 return surface.PassAs<SurfaceOzoneEGL>(); | 105 return surface.PassAs<SurfaceOzoneEGL>(); |
112 } | 106 } |
| 107 |
| 108 scoped_ptr<SurfaceOzoneEGL> |
| 109 GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget( |
| 110 gfx::AcceleratedWidget widget) { |
| 111 if (!allow_surfaceless_) |
| 112 return scoped_ptr<SurfaceOzoneEGL>(); |
| 113 return scoped_ptr<SurfaceOzoneEGL>( |
| 114 new GbmSurfaceless(screen_manager_->GetDisplayController(widget))); |
113 } | 115 } |
114 | 116 |
115 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( | 117 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
116 gfx::Size size, | 118 gfx::Size size, |
117 BufferFormat format) { | 119 BufferFormat format) { |
118 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( | 120 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( |
119 drm_, device_, format, size, true); | 121 drm_, device_, format, size, true); |
120 if (!buffer) | 122 if (!buffer) |
121 return NULL; | 123 return NULL; |
122 | 124 |
(...skipping 22 matching lines...) Expand all Loading... |
145 display_bounds, | 147 display_bounds, |
146 crop_rect)); | 148 crop_rect)); |
147 return true; | 149 return true; |
148 } | 150 } |
149 | 151 |
150 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { | 152 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { |
151 return allow_surfaceless_; | 153 return allow_surfaceless_; |
152 } | 154 } |
153 | 155 |
154 } // namespace ui | 156 } // namespace ui |
OLD | NEW |