| 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/common/shell_window_ids.h" | 10 #include "ash/common/shell_window_ids.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 if (!base::SharedMemory::IsHandleValid(handle)) | 55 if (!base::SharedMemory::IsHandleValid(handle)) |
| 56 return nullptr; | 56 return nullptr; |
| 57 | 57 |
| 58 return base::WrapUnique(new SharedMemory(handle)); | 58 return base::WrapUnique(new SharedMemory(handle)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 #if defined(USE_OZONE) | 61 #if defined(USE_OZONE) |
| 62 std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer( | 62 std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer( |
| 63 const gfx::Size& size, | 63 const gfx::Size& size, |
| 64 gfx::BufferFormat format, | 64 gfx::BufferFormat format, |
| 65 const std::vector<gfx::NativePixmapPlane>& planes, | 65 const std::vector<int>& strides, |
| 66 const std::vector<int>& offsets, |
| 66 std::vector<base::ScopedFD>&& fds) { | 67 std::vector<base::ScopedFD>&& fds) { |
| 67 TRACE_EVENT1("exo", "Display::CreateLinuxDMABufBuffer", "size", | 68 TRACE_EVENT1("exo", "Display::CreateLinuxDMABufBuffer", "size", |
| 68 size.ToString()); | 69 size.ToString()); |
| 69 | 70 |
| 70 gfx::GpuMemoryBufferHandle handle; | 71 gfx::GpuMemoryBufferHandle handle; |
| 71 handle.type = gfx::OZONE_NATIVE_PIXMAP; | 72 handle.type = gfx::OZONE_NATIVE_PIXMAP; |
| 72 for (auto& fd : fds) | 73 for (auto& fd : fds) |
| 73 handle.native_pixmap_handle.fds.emplace_back(std::move(fd)); | 74 handle.native_pixmap_handle.fds.emplace_back(std::move(fd)); |
| 74 | 75 |
| 75 for (auto& plane : planes) | 76 DCHECK_EQ(strides.size(), offsets.size()); |
| 76 handle.native_pixmap_handle.planes.push_back(plane); | 77 for (size_t plane = 0; plane < strides.size(); ++plane) { |
| 78 handle.native_pixmap_handle.strides_and_offsets.emplace_back( |
| 79 strides[plane], offsets[plane]); |
| 80 } |
| 77 | 81 |
| 78 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = | 82 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = |
| 79 aura::Env::GetInstance() | 83 aura::Env::GetInstance() |
| 80 ->context_factory() | 84 ->context_factory() |
| 81 ->GetGpuMemoryBufferManager() | 85 ->GetGpuMemoryBufferManager() |
| 82 ->CreateGpuMemoryBufferFromHandle(handle, size, format); | 86 ->CreateGpuMemoryBufferFromHandle(handle, size, format); |
| 83 if (!gpu_memory_buffer) { | 87 if (!gpu_memory_buffer) { |
| 84 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; | 88 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; |
| 85 return nullptr; | 89 return nullptr; |
| 86 } | 90 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 notification_surface_manager_->GetSurface(notification_id)) { | 194 notification_surface_manager_->GetSurface(notification_id)) { |
| 191 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; | 195 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; |
| 192 return nullptr; | 196 return nullptr; |
| 193 } | 197 } |
| 194 | 198 |
| 195 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, | 199 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, |
| 196 surface, notification_id); | 200 surface, notification_id); |
| 197 } | 201 } |
| 198 | 202 |
| 199 } // namespace exo | 203 } // namespace exo |
| OLD | NEW |