Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: ui/ozone/platform/dri/gbm_surface_factory.cc

Issue 341603002: Create scanout buffer in GbmSurfaceFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
9 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
10 #include "ui/gfx/ozone/surface_ozone_egl.h" 11 #include "ui/gfx/ozone/surface_ozone_egl.h"
12 #include "ui/ozone/platform/dri/buffer_data.h"
11 #include "ui/ozone/platform/dri/dri_vsync_provider.h" 13 #include "ui/ozone/platform/dri/dri_vsync_provider.h"
12 #include "ui/ozone/platform/dri/gbm_surface.h" 14 #include "ui/ozone/platform/dri/gbm_surface.h"
13 #include "ui/ozone/platform/dri/hardware_display_controller.h" 15 #include "ui/ozone/platform/dri/hardware_display_controller.h"
14 #include "ui/ozone/platform/dri/scanout_surface.h" 16 #include "ui/ozone/platform/dri/scanout_surface.h"
15 #include "ui/ozone/platform/dri/screen_manager.h" 17 #include "ui/ozone/platform/dri/screen_manager.h"
16 18
17 namespace ui { 19 namespace ui {
18 20
19 namespace { 21 namespace {
20 22
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 145
144 scoped_ptr<gfx::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget( 146 scoped_ptr<gfx::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
145 gfx::AcceleratedWidget w) { 147 gfx::AcceleratedWidget w) {
146 CHECK(state_ == INITIALIZED); 148 CHECK(state_ == INITIALIZED);
147 ResetCursor(w); 149 ResetCursor(w);
148 150
149 return scoped_ptr<gfx::SurfaceOzoneEGL>( 151 return scoped_ptr<gfx::SurfaceOzoneEGL>(
150 new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w))); 152 new GbmSurfaceAdapter(screen_manager_->GetDisplayController(w)));
151 } 153 }
152 154
155 gfx::NativeBufferOzone GbmSurfaceFactory::CreateNativeBuffer(
156 gfx::Size size,
157 BufferFormat format) {
158 uint32_t gbm_format = 0;
159 switch (format) {
160 case SurfaceFactoryOzone::UNKNOWN:
161 return 0;
162 // TODO(alexst): Setting this to XRGB for now to allow presentation
163 // as a primary plane but disallowing overlay transparency. Address this
164 // to allow both use cases.
165 case SurfaceFactoryOzone::RGBA_8888:
166 gbm_format = GBM_FORMAT_XRGB8888;
167 break;
168 case SurfaceFactoryOzone::RGB_888:
169 gbm_format = GBM_FORMAT_RGB888;
170 break;
171 }
172 gbm_bo* buffer_object =
173 gbm_bo_create(device_,
174 size.width(),
175 size.height(),
176 gbm_format,
177 GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
178 if (!buffer_object)
179 return 0;
180
181 BufferData* data = BufferData::CreateData(drm_, buffer_object);
182 DCHECK(data) << "Failed to associate the buffer with the controller";
183
184 return reinterpret_cast<gfx::NativeBufferOzone>(buffer_object);
185 }
186
153 } // namespace ui 187 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698