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

Side by Side Diff: components/exo/wayland/clients/client_base.cc

Issue 2750173006: exo: Explicitly initialize Ozone in wayland clients. (Closed)
Patch Set: Add client base ozone dep. Created 3 years, 9 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 | « components/exo/wayland/BUILD.gn ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "components/exo/wayland/clients/client_base.h" 5 #include "components/exo/wayland/clients/client_base.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <linux-dmabuf-unstable-v1-client-protocol.h> 8 #include <linux-dmabuf-unstable-v1-client-protocol.h>
9 #include <presentation-time-client-protocol.h> 9 #include <presentation-time-client-protocol.h>
10 #include <wayland-client-core.h> 10 #include <wayland-client-core.h>
(...skipping 15 matching lines...) Expand all
26 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 26 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
27 #include "ui/gl/gl_bindings.h" 27 #include "ui/gl/gl_bindings.h"
28 #include "ui/gl/gl_enums.h" 28 #include "ui/gl/gl_enums.h"
29 #include "ui/gl/gl_surface_egl.h" 29 #include "ui/gl/gl_surface_egl.h"
30 #include "ui/gl/init/gl_factory.h" 30 #include "ui/gl/init/gl_factory.h"
31 31
32 #if defined(OZONE_PLATFORM_GBM) 32 #if defined(OZONE_PLATFORM_GBM)
33 #include <drm_fourcc.h> 33 #include <drm_fourcc.h>
34 #include <gbm.h> 34 #include <gbm.h>
35 #include <xf86drm.h> 35 #include <xf86drm.h>
36
37 #include "ui/ozone/public/ozone_platform.h"
36 #endif 38 #endif
37 39
38 namespace exo { 40 namespace exo {
39 namespace wayland { 41 namespace wayland {
40 namespace clients { 42 namespace clients {
41 namespace switches { 43 namespace switches {
42 44
43 // Specifies the client buffer size. 45 // Specifies the client buffer size.
44 const char kSize[] = "size"; 46 const char kSize[] = "size";
45 47
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 LOG_IF(ERROR, !params.use_drm) << "Can't find drm device"; 268 LOG_IF(ERROR, !params.use_drm) << "Can't find drm device";
267 return false; 269 return false;
268 } 270 }
269 271
270 device_.reset(gbm_create_device(drm_fd_.get())); 272 device_.reset(gbm_create_device(drm_fd_.get()));
271 if (!device_) { 273 if (!device_) {
272 LOG(ERROR) << "Can't create gbm device"; 274 LOG(ERROR) << "Can't create gbm device";
273 return false; 275 return false;
274 } 276 }
275 277
278 ui::OzonePlatform::InitParams params;
279 params.single_process = true;
280 ui::OzonePlatform::InitializeForGPU(params);
276 bool gl_initialized = gl::init::InitializeGLOneOff(); 281 bool gl_initialized = gl::init::InitializeGLOneOff();
277 DCHECK(gl_initialized); 282 DCHECK(gl_initialized);
278 gl_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); 283 gl_surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size());
279 gl_context_ = 284 gl_context_ =
280 gl::init::CreateGLContext(nullptr, // share_group 285 gl::init::CreateGLContext(nullptr, // share_group
281 gl_surface_.get(), gl::GLContextAttribs()); 286 gl_surface_.get(), gl::GLContextAttribs());
282 287
283 make_current_.reset( 288 make_current_.reset(
284 new ui::ScopedMakeCurrent(gl_context_.get(), gl_surface_.get())); 289 new ui::ScopedMakeCurrent(gl_context_.get(), gl_surface_.get()));
285 290
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 buffer->sk_surface = SkSurface::MakeRasterDirect( 464 buffer->sk_surface = SkSurface::MakeRasterDirect(
460 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType), 465 SkImageInfo::Make(width_, height_, kColorType, kOpaque_SkAlphaType),
461 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride); 466 static_cast<uint8_t*>(buffer->shared_memory->memory()), stride);
462 DCHECK(buffer->sk_surface); 467 DCHECK(buffer->sk_surface);
463 return buffer; 468 return buffer;
464 } 469 }
465 470
466 } // namespace clients 471 } // namespace clients
467 } // namespace wayland 472 } // namespace wayland
468 } // namespace exo 473 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/wayland/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698