OLD | NEW |
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 #include "ui/wm/core/coordinate_conversion.h" | 22 #include "ui/wm/core/coordinate_conversion.h" |
23 | 23 |
24 #if defined(USE_OZONE) | 24 #if defined(USE_OZONE) |
25 #include <GLES2/gl2extchromium.h> | 25 #include <GLES2/gl2extchromium.h> |
26 #include "components/exo/buffer.h" | 26 #include "components/exo/buffer.h" |
27 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" | 27 #include "gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.h" |
28 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
29 #include "third_party/khronos/GLES2/gl2ext.h" | 29 #include "third_party/khronos/GLES2/gl2ext.h" |
30 #include "ui/ozone/public/ozone_switches.h" | 30 #include "ui/ozone/public/ozone_switches.h" |
31 #endif | 31 #endif |
32 | 32 |
33 namespace exo { | 33 namespace exo { |
34 namespace { | 34 namespace { |
35 #if defined(USE_OZONE) | 35 #if defined(USE_OZONE) |
36 // TODO(dcastagna): The following formats should be determined at runtime | 36 // TODO(dcastagna): The following formats should be determined at runtime |
37 // querying kms (via ozone). | 37 // querying kms (via ozone). |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 gfx::GpuMemoryBufferHandle handle; | 103 gfx::GpuMemoryBufferHandle handle; |
104 handle.type = gfx::NATIVE_PIXMAP; | 104 handle.type = gfx::NATIVE_PIXMAP; |
105 for (auto& fd : fds) | 105 for (auto& fd : fds) |
106 handle.native_pixmap_handle.fds.emplace_back(std::move(fd)); | 106 handle.native_pixmap_handle.fds.emplace_back(std::move(fd)); |
107 | 107 |
108 for (auto& plane : planes) | 108 for (auto& plane : planes) |
109 handle.native_pixmap_handle.planes.push_back(plane); | 109 handle.native_pixmap_handle.planes.push_back(plane); |
110 | 110 |
111 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = | 111 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = |
112 gpu::GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( | 112 gpu::GpuMemoryBufferImplNativePixmap::CreateFromHandle( |
113 handle, size, format, gfx::BufferUsage::GPU_READ, | 113 handle, size, format, gfx::BufferUsage::GPU_READ, |
114 gpu::GpuMemoryBufferImpl::DestructionCallback()); | 114 gpu::GpuMemoryBufferImpl::DestructionCallback()); |
115 if (!gpu_memory_buffer) { | 115 if (!gpu_memory_buffer) { |
116 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; | 116 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; |
117 return nullptr; | 117 return nullptr; |
118 } | 118 } |
119 | 119 |
120 // Using zero-copy for optimal performance. | 120 // Using zero-copy for optimal performance. |
121 bool use_zero_copy = true; | 121 bool use_zero_copy = true; |
122 | 122 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 notification_surface_manager_->GetSurface(notification_id)) { | 224 notification_surface_manager_->GetSurface(notification_id)) { |
225 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; | 225 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; |
226 return nullptr; | 226 return nullptr; |
227 } | 227 } |
228 | 228 |
229 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, | 229 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, |
230 surface, notification_id); | 230 surface, notification_id); |
231 } | 231 } |
232 | 232 |
233 } // namespace exo | 233 } // namespace exo |
OLD | NEW |