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 <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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); | 168 DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget); |
169 return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate)); | 169 return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate)); |
170 } | 170 } |
171 | 171 |
172 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( | 172 scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
173 gfx::Size size, | 173 gfx::Size size, |
174 BufferFormat format) { | 174 BufferFormat format) { |
175 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( | 175 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( |
176 drm_, device_, format, size, true); | 176 drm_, device_, format, size, true); |
177 if (!buffer) | 177 if (!buffer.get()) |
178 return NULL; | 178 return NULL; |
179 | 179 |
180 return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer)); | 180 return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer)); |
181 } | 181 } |
182 | 182 |
183 OverlayCandidatesOzone* GbmSurfaceFactory::GetOverlayCandidates( | 183 OverlayCandidatesOzone* GbmSurfaceFactory::GetOverlayCandidates( |
184 gfx::AcceleratedWidget w) { | 184 gfx::AcceleratedWidget w) { |
185 if (CommandLine::ForCurrentProcess()->HasSwitch( | 185 if (CommandLine::ForCurrentProcess()->HasSwitch( |
186 switches::kOzoneTestSingleOverlaySupport)) | 186 switches::kOzoneTestSingleOverlaySupport)) |
187 return new SingleOverlay(); | 187 return new SingleOverlay(); |
188 return NULL; | 188 return NULL; |
189 } | 189 } |
190 | 190 |
191 bool GbmSurfaceFactory::ScheduleOverlayPlane( | 191 bool GbmSurfaceFactory::ScheduleOverlayPlane( |
192 gfx::AcceleratedWidget widget, | 192 gfx::AcceleratedWidget widget, |
193 int plane_z_order, | 193 int plane_z_order, |
194 gfx::OverlayTransform plane_transform, | 194 gfx::OverlayTransform plane_transform, |
195 scoped_refptr<NativePixmap> buffer, | 195 scoped_refptr<NativePixmap> buffer, |
196 const gfx::Rect& display_bounds, | 196 const gfx::Rect& display_bounds, |
197 const gfx::RectF& crop_rect) { | 197 const gfx::RectF& crop_rect) { |
198 scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get()); | 198 scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get()); |
199 if (!pixmap) { | 199 if (!pixmap.get()) { |
200 LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer."; | 200 LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer."; |
201 return false; | 201 return false; |
202 } | 202 } |
203 HardwareDisplayController* hdc = | 203 HardwareDisplayController* hdc = |
204 window_manager_->GetWindowDelegate(widget)->GetController(); | 204 window_manager_->GetWindowDelegate(widget)->GetController(); |
205 if (!hdc) | 205 if (!hdc) |
206 return true; | 206 return true; |
207 | 207 |
208 hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(), | 208 hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(), |
209 plane_z_order, | 209 plane_z_order, |
(...skipping 13 matching lines...) Expand all Loading... |
223 scoped_ptr<DriWindowDelegate> delegate( | 223 scoped_ptr<DriWindowDelegate> delegate( |
224 new DriWindowDelegateImpl(widget, screen_manager_)); | 224 new DriWindowDelegateImpl(widget, screen_manager_)); |
225 delegate->Initialize(); | 225 delegate->Initialize(); |
226 window_manager_->AddWindowDelegate(widget, delegate.Pass()); | 226 window_manager_->AddWindowDelegate(widget, delegate.Pass()); |
227 } | 227 } |
228 | 228 |
229 return window_manager_->GetWindowDelegate(widget); | 229 return window_manager_->GetWindowDelegate(widget); |
230 } | 230 } |
231 | 231 |
232 } // namespace ui | 232 } // namespace ui |
OLD | NEW |