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

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_surface_factory.cc

Issue 1128113011: ozone: Introduce ClientPixmap and ClientPixmapFactory for non-GPU processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce ClientPixmap and rename to ClientPixmapManager Created 5 years, 4 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
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/drm/gpu/gbm_surface_factory.h" 5 #include "ui/ozone/platform/drm/gpu/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (!allow_surfaceless_) 100 if (!allow_surfaceless_)
101 return nullptr; 101 return nullptr;
102 102
103 return make_scoped_ptr(new GbmSurfaceless(screen_manager_->GetWindow(widget), 103 return make_scoped_ptr(new GbmSurfaceless(screen_manager_->GetWindow(widget),
104 drm_device_manager_)); 104 drm_device_manager_));
105 } 105 }
106 106
107 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( 107 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
108 gfx::AcceleratedWidget widget, 108 gfx::AcceleratedWidget widget,
109 gfx::Size size, 109 gfx::Size size,
110 BufferFormat format, 110 PixmapFormat format,
111 BufferUsage usage) { 111 PixmapUsage usage) {
112 if (usage == MAP) 112 if (usage == PIXMAP_USAGE_MAP)
113 return nullptr; 113 return nullptr;
114 114
115 scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget); 115 scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget);
116 DCHECK(gbm); 116 DCHECK(gbm);
117 117
118 scoped_refptr<GbmBuffer> buffer = 118 scoped_refptr<GbmBuffer> buffer =
119 GbmBuffer::CreateBuffer(gbm, format, size, true); 119 GbmBuffer::CreateBuffer(gbm, format, size, true);
120 if (!buffer.get()) 120 if (!buffer.get())
121 return nullptr; 121 return nullptr;
122 122
123 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(buffer, screen_manager_)); 123 scoped_refptr<GbmPixmap> pixmap(new GbmPixmap(buffer, screen_manager_));
124 if (!pixmap->Initialize()) 124 if (!pixmap->Initialize())
125 return nullptr; 125 return nullptr;
126 126
127 return pixmap; 127 return pixmap;
128 } 128 }
129 129
130 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { 130 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
131 DCHECK(thread_checker_.CalledOnValidThread()); 131 DCHECK(thread_checker_.CalledOnValidThread());
132 return allow_surfaceless_; 132 return allow_surfaceless_;
133 } 133 }
134 134
135 bool GbmSurfaceFactory::CanCreateNativePixmap(BufferUsage usage) {
136 DCHECK(thread_checker_.CalledOnValidThread());
137 switch (usage) {
138 case MAP:
139 return false;
140 case PERSISTENT_MAP:
141 return false;
142 case SCANOUT:
143 return true;
144 }
145 NOTREACHED();
146 return false;
147 }
148
149 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice( 135 scoped_refptr<GbmDevice> GbmSurfaceFactory::GetGbmDevice(
150 gfx::AcceleratedWidget widget) { 136 gfx::AcceleratedWidget widget) {
151 return static_cast<GbmDevice*>( 137 return static_cast<GbmDevice*>(
152 drm_device_manager_->GetDrmDevice(widget).get()); 138 drm_device_manager_->GetDrmDevice(widget).get());
153 } 139 }
154 140
155 } // namespace ui 141 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698