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 <EGL/egl.h> | 7 #include <EGL/egl.h> |
8 #include <gbm.h> | 8 #include <gbm.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.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( |
101 return scoped_ptr<SurfaceOzoneEGL>( | 101 new GbmSurface(screen_manager_->GetDisplayController(widget), |
102 new GbmSurfaceless(screen_manager_->GetDisplayController(widget))); | 102 device_, |
103 } else { | 103 drm_)); |
104 scoped_ptr<GbmSurface> surface( | 104 if (!surface->Initialize()) |
105 new GbmSurface(screen_manager_->GetDisplayController(widget), | 105 return scoped_ptr<SurfaceOzoneEGL>(); |
106 device_, | |
107 drm_)); | |
108 if (!surface->Initialize()) | |
109 return scoped_ptr<SurfaceOzoneEGL>(); | |
110 | 106 |
111 return surface.PassAs<SurfaceOzoneEGL>(); | 107 return surface.PassAs<SurfaceOzoneEGL>(); |
112 } | 108 } |
| 109 |
| 110 scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEmptyEGLSurfaceForWidget( |
| 111 gfx::AcceleratedWidget widget) { |
| 112 if (!allow_surfaceless_) |
| 113 return scoped_ptr<SurfaceOzoneEGL>(); |
| 114 return scoped_ptr<SurfaceOzoneEGL>( |
| 115 new GbmSurfaceless(screen_manager_->GetDisplayController(widget))); |
113 } | 116 } |
114 | 117 |
115 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( | 118 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
116 gfx::Size size, | 119 gfx::Size size, |
117 BufferFormat format) { | 120 BufferFormat format) { |
118 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( | 121 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( |
119 drm_, device_, format, size, true); | 122 drm_, device_, format, size, true); |
120 if (!buffer) | 123 if (!buffer) |
121 return NULL; | 124 return NULL; |
122 | 125 |
123 return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer)); | 126 return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer)); |
124 } | 127 } |
125 | 128 |
126 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { | 129 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { |
127 return allow_surfaceless_; | 130 return allow_surfaceless_; |
128 } | 131 } |
129 | 132 |
130 } // namespace ui | 133 } // namespace ui |
OLD | NEW |