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

Side by Side Diff: components/exo/display.cc

Issue 2404513002: exo: Implement zcr_linux_explicit_synchronization_v1
Patch Set: rebase, pull in cl 2443823002 Created 4 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 | « components/exo/display.h ('k') | components/exo/display_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/display.h" 5 #include "components/exo/display.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
14 #include "base/trace_event/trace_event_argument.h" 14 #include "base/trace_event/trace_event_argument.h"
15 #include "components/exo/notification_surface.h" 15 #include "components/exo/notification_surface.h"
16 #include "components/exo/notification_surface_manager.h" 16 #include "components/exo/notification_surface_manager.h"
17 #include "components/exo/shared_memory.h" 17 #include "components/exo/shared_memory.h"
18 #include "components/exo/shell_surface.h" 18 #include "components/exo/shell_surface.h"
19 #include "components/exo/sub_surface.h" 19 #include "components/exo/sub_surface.h"
20 #include "components/exo/surface.h" 20 #include "components/exo/surface.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 #if defined(OS_LINUX)
24 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
25 #include "ui/aura/env.h"
26 #endif
27
23 #if defined(USE_OZONE) 28 #if defined(USE_OZONE)
24 #include <GLES2/gl2extchromium.h> 29 #include <GLES2/gl2extchromium.h>
25 #include "components/exo/buffer.h" 30 #include "components/exo/buffer.h"
26 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
27 #include "third_party/khronos/GLES2/gl2.h" 31 #include "third_party/khronos/GLES2/gl2.h"
28 #include "third_party/khronos/GLES2/gl2ext.h" 32 #include "third_party/khronos/GLES2/gl2ext.h"
29 #include "ui/aura/env.h"
30 #endif 33 #endif
31 34
32 namespace exo { 35 namespace exo {
33 36
34 //////////////////////////////////////////////////////////////////////////////// 37 ////////////////////////////////////////////////////////////////////////////////
35 // Display, public: 38 // Display, public:
36 39
37 Display::Display() : notification_surface_manager_(nullptr) {} 40 Display::Display() : notification_surface_manager_(nullptr) {}
38 41
39 Display::Display(NotificationSurfaceManager* notification_surface_manager) 42 Display::Display(NotificationSurfaceManager* notification_surface_manager)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 gfx::BufferFormat::RGBX_8888}; 97 gfx::BufferFormat::RGBX_8888};
95 bool is_overlay_candidate = 98 bool is_overlay_candidate =
96 std::find(std::begin(kOverlayFormats), std::end(kOverlayFormats), 99 std::find(std::begin(kOverlayFormats), std::end(kOverlayFormats),
97 format) != std::end(kOverlayFormats); 100 format) != std::end(kOverlayFormats);
98 101
99 return base::MakeUnique<Buffer>( 102 return base::MakeUnique<Buffer>(
100 std::move(gpu_memory_buffer), GL_TEXTURE_EXTERNAL_OES, 103 std::move(gpu_memory_buffer), GL_TEXTURE_EXTERNAL_OES,
101 // COMMANDS_COMPLETED queries are required by native pixmaps. 104 // COMMANDS_COMPLETED queries are required by native pixmaps.
102 GL_COMMANDS_COMPLETED_CHROMIUM, use_zero_copy, is_overlay_candidate); 105 GL_COMMANDS_COMPLETED_CHROMIUM, use_zero_copy, is_overlay_candidate);
103 } 106 }
104 #endif 107 #endif // defined(USE_OZONE)
108
109 #if defined(OS_LINUX)
110 std::unique_ptr<gfx::GpuFence> Display::CreateLinuxFence(base::ScopedFD fd) {
111 TRACE_EVENT1("exo", "Display::CreateLinuxFence", "fd", fd.get());
112
113 gfx::GpuFenceHandle handle;
114
115 handle.fd.fd = fd.release();
116
117 return aura::Env::GetInstance()
118 ->context_factory()
119 ->GetGpuMemoryBufferManager()
120 ->CreateGpuFenceFromHandle(handle);
121 }
122 #endif // defined(OS_LINUX)
105 123
106 std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) { 124 std::unique_ptr<ShellSurface> Display::CreateShellSurface(Surface* surface) {
107 TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface", 125 TRACE_EVENT1("exo", "Display::CreateShellSurface", "surface",
108 surface->AsTracedValue()); 126 surface->AsTracedValue());
109 127
110 if (surface->HasSurfaceDelegate()) { 128 if (surface->HasSurfaceDelegate()) {
111 DLOG(ERROR) << "Surface has already been assigned a role"; 129 DLOG(ERROR) << "Surface has already been assigned a role";
112 return nullptr; 130 return nullptr;
113 } 131 }
114 132
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 notification_surface_manager_->GetSurface(notification_id)) { 209 notification_surface_manager_->GetSurface(notification_id)) {
192 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; 210 DLOG(ERROR) << "Invalid notification id, id=" << notification_id;
193 return nullptr; 211 return nullptr;
194 } 212 }
195 213
196 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, 214 return base::MakeUnique<NotificationSurface>(notification_surface_manager_,
197 surface, notification_id); 215 surface, notification_id);
198 } 216 }
199 217
200 } // namespace exo 218 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/display.h ('k') | components/exo/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698