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

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

Issue 706273002: Add ability to query and allocate zero copy buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month 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') | ui/ozone/public/surface_factory_ozone.h » ('j') | 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 <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 gfx::AcceleratedWidget widget) { 162 gfx::AcceleratedWidget widget) {
163 if (!allow_surfaceless_) 163 if (!allow_surfaceless_)
164 return scoped_ptr<SurfaceOzoneEGL>(); 164 return scoped_ptr<SurfaceOzoneEGL>();
165 165
166 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); 166 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget);
167 return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate)); 167 return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate));
168 } 168 }
169 169
170 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( 170 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
171 gfx::Size size, 171 gfx::Size size,
172 BufferFormat format) { 172 BufferFormat format,
173 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( 173 BufferUsage usage) {
174 drm_, device_, format, size, true); 174 if (usage == MAP)
175 return NULL;
176
177 scoped_refptr<GbmBuffer> buffer =
178 GbmBuffer::CreateBuffer(drm_, device_, format, size, true);
175 if (!buffer.get()) 179 if (!buffer.get())
176 return NULL; 180 return NULL;
177 181
178 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(buffer)); 182 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(buffer));
179 if (!pixmap->Initialize(drm_)) 183 if (!pixmap->Initialize(drm_))
180 return NULL; 184 return NULL;
181 185
182 return pixmap; 186 return pixmap;
183 } 187 }
184 188
(...skipping 27 matching lines...) Expand all
212 plane_transform, 216 plane_transform,
213 display_bounds, 217 display_bounds,
214 crop_rect)); 218 crop_rect));
215 return true; 219 return true;
216 } 220 }
217 221
218 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { 222 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
219 return allow_surfaceless_; 223 return allow_surfaceless_;
220 } 224 }
221 225
226 bool GbmSurfaceFactory::CanCreateNativePixmap(BufferUsage usage) {
227 switch (usage) {
228 case MAP:
229 return false;
230 case SCANOUT:
231 return true;
232 }
233 NOTREACHED();
234 return false;
235 }
236
222 DriWindowDelegate* GbmSurfaceFactory::GetOrCreateWindowDelegate( 237 DriWindowDelegate* GbmSurfaceFactory::GetOrCreateWindowDelegate(
223 gfx::AcceleratedWidget widget) { 238 gfx::AcceleratedWidget widget) {
224 if (!window_manager_->HasWindowDelegate(widget)) { 239 if (!window_manager_->HasWindowDelegate(widget)) {
225 scoped_ptr<DriWindowDelegate> delegate( 240 scoped_ptr<DriWindowDelegate> delegate(
226 new DriWindowDelegateImpl(widget, screen_manager_)); 241 new DriWindowDelegateImpl(widget, screen_manager_));
227 delegate->Initialize(); 242 delegate->Initialize();
228 window_manager_->AddWindowDelegate(widget, delegate.Pass()); 243 window_manager_->AddWindowDelegate(widget, delegate.Pass());
229 } 244 }
230 245
231 return window_manager_->GetWindowDelegate(widget); 246 return window_manager_->GetWindowDelegate(widget);
232 } 247 }
233 248
234 } // namespace ui 249 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | ui/ozone/public/surface_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698