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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 scoped_ptr<ui::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( | 146 scoped_ptr<ui::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( |
147 gfx::AcceleratedWidget w) { | 147 gfx::AcceleratedWidget w) { |
148 CHECK(state_ == INITIALIZED); | 148 CHECK(state_ == INITIALIZED); |
149 ResetCursor(w); | 149 ResetCursor(w); |
150 | 150 |
151 return scoped_ptr<ui::SurfaceOzoneEGL>( | 151 return scoped_ptr<ui::SurfaceOzoneEGL>( |
152 new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w))); | 152 new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w))); |
153 } | 153 } |
154 | 154 |
155 gfx::NativeBufferOzone GbmSurfaceFactory::CreateNativeBuffer( | 155 ui::NativeBufferOzone GbmSurfaceFactory::CreateNativeBuffer( |
156 gfx::Size size, | 156 gfx::Size size, |
157 BufferFormat format) { | 157 BufferFormat format) { |
158 uint32_t gbm_format = 0; | 158 uint32_t gbm_format = 0; |
159 switch (format) { | 159 switch (format) { |
160 case SurfaceFactoryOzone::UNKNOWN: | 160 case SurfaceFactoryOzone::UNKNOWN: |
161 return 0; | 161 return 0; |
162 // TODO(alexst): Setting this to XRGB for now to allow presentation | 162 // TODO(alexst): Setting this to XRGB for now to allow presentation |
163 // as a primary plane but disallowing overlay transparency. Address this | 163 // as a primary plane but disallowing overlay transparency. Address this |
164 // to allow both use cases. | 164 // to allow both use cases. |
165 case SurfaceFactoryOzone::RGBA_8888: | 165 case SurfaceFactoryOzone::RGBA_8888: |
166 gbm_format = GBM_FORMAT_XRGB8888; | 166 gbm_format = GBM_FORMAT_XRGB8888; |
167 break; | 167 break; |
168 case SurfaceFactoryOzone::RGB_888: | 168 case SurfaceFactoryOzone::RGB_888: |
169 gbm_format = GBM_FORMAT_RGB888; | 169 gbm_format = GBM_FORMAT_RGB888; |
170 break; | 170 break; |
171 } | 171 } |
172 gbm_bo* buffer_object = | 172 gbm_bo* buffer_object = |
173 gbm_bo_create(device_, | 173 gbm_bo_create(device_, |
174 size.width(), | 174 size.width(), |
175 size.height(), | 175 size.height(), |
176 gbm_format, | 176 gbm_format, |
177 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); | 177 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); |
178 if (!buffer_object) | 178 if (!buffer_object) |
179 return 0; | 179 return 0; |
180 | 180 |
181 BufferData* data = BufferData::CreateData(drm_, buffer_object); | 181 BufferData* data = BufferData::CreateData(drm_, buffer_object); |
182 DCHECK(data) << "Failed to associate the buffer with the controller"; | 182 DCHECK(data) << "Failed to associate the buffer with the controller"; |
183 | 183 |
184 return reinterpret_cast<gfx::NativeBufferOzone>(buffer_object); | 184 return reinterpret_cast<ui::NativeBufferOzone>(buffer_object); |
185 } | 185 } |
186 | 186 |
187 } // namespace ui | 187 } // namespace ui |
OLD | NEW |