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

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

Issue 2039813002: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add format modifier IDs for EGL_EXT_image_dma_buf_import extension Created 4 years, 5 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
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/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
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<int>& strides, 65 const std::vector<gfx::GbmBufferPlane>& planes,
66 const std::vector<int>& offsets,
67 std::vector<base::ScopedFD>&& fds) { 66 std::vector<base::ScopedFD>&& fds) {
68 TRACE_EVENT1("exo", "Display::CreateLinuxDMABufBuffer", "size", 67 TRACE_EVENT1("exo", "Display::CreateLinuxDMABufBuffer", "size",
69 size.ToString()); 68 size.ToString());
70 69
71 gfx::GpuMemoryBufferHandle handle; 70 gfx::GpuMemoryBufferHandle handle;
72 handle.type = gfx::OZONE_NATIVE_PIXMAP; 71 handle.type = gfx::OZONE_NATIVE_PIXMAP;
73 for (auto& fd : fds) 72 for (auto& fd : fds)
74 handle.native_pixmap_handle.fds.emplace_back(std::move(fd)); 73 handle.native_pixmap_handle.fds.emplace_back(std::move(fd));
75 74
76 DCHECK_EQ(strides.size(), offsets.size()); 75 for (auto& plane : planes)
77 for (size_t plane = 0; plane < strides.size(); ++plane) { 76 handle.native_pixmap_handle.planes.push_back(plane);
78 handle.native_pixmap_handle.strides_and_offsets.emplace_back(
79 strides[plane], offsets[plane]);
80 }
81 77
82 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 78 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
83 aura::Env::GetInstance() 79 aura::Env::GetInstance()
84 ->context_factory() 80 ->context_factory()
85 ->GetGpuMemoryBufferManager() 81 ->GetGpuMemoryBufferManager()
86 ->CreateGpuMemoryBufferFromHandle(handle, size, format); 82 ->CreateGpuMemoryBufferFromHandle(handle, size, format);
87 if (!gpu_memory_buffer) { 83 if (!gpu_memory_buffer) {
88 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; 84 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle";
89 return nullptr; 85 return nullptr;
90 } 86 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 notification_surface_manager_->GetSurface(notification_id)) { 190 notification_surface_manager_->GetSurface(notification_id)) {
195 DLOG(ERROR) << "Invalid notification id, id=" << notification_id; 191 DLOG(ERROR) << "Invalid notification id, id=" << notification_id;
196 return nullptr; 192 return nullptr;
197 } 193 }
198 194
199 return base::MakeUnique<NotificationSurface>(notification_surface_manager_, 195 return base::MakeUnique<NotificationSurface>(notification_surface_manager_,
200 surface, notification_id); 196 surface, notification_id);
201 } 197 }
202 198
203 } // namespace exo 199 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698