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

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, 6 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (!base::SharedMemory::IsHandleValid(handle)) 56 if (!base::SharedMemory::IsHandleValid(handle))
57 return nullptr; 57 return nullptr;
58 58
59 return base::WrapUnique(new SharedMemory(handle)); 59 return base::WrapUnique(new SharedMemory(handle));
60 } 60 }
61 61
62 #if defined(USE_OZONE) 62 #if defined(USE_OZONE)
63 std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer( 63 std::unique_ptr<Buffer> Display::CreateLinuxDMABufBuffer(
64 const gfx::Size& size, 64 const gfx::Size& size,
65 gfx::BufferFormat format, 65 gfx::BufferFormat format,
66 const std::vector<int>& strides, 66 const std::vector<gfx::GbmBufferPlane>& planes,
67 const std::vector<int>& offsets,
68 std::vector<base::ScopedFD>&& fds) { 67 std::vector<base::ScopedFD>&& fds) {
69 TRACE_EVENT1("exo", "Display::CreateLinuxDMABufBuffer", "size", 68 TRACE_EVENT1("exo", "Display::CreateLinuxDMABufBuffer", "size",
70 size.ToString()); 69 size.ToString());
71 70
72 gfx::GpuMemoryBufferHandle handle; 71 gfx::GpuMemoryBufferHandle handle;
73 handle.type = gfx::OZONE_NATIVE_PIXMAP; 72 handle.type = gfx::OZONE_NATIVE_PIXMAP;
74 for (auto& fd : fds) 73 for (auto& fd : fds)
75 handle.native_pixmap_handle.fds.emplace_back(std::move(fd)); 74 handle.native_pixmap_handle.fds.emplace_back(std::move(fd));
76 75
77 DCHECK_EQ(strides.size(), offsets.size()); 76 for (auto& plane : planes)
78 for (size_t plane = 0; plane < strides.size(); ++plane) { 77 handle.native_pixmap_handle.planes.push_back(plane);
79 handle.native_pixmap_handle.strides_and_offsets.emplace_back(
80 strides[plane], offsets[plane]);
81 }
82 78
83 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 79 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
84 aura::Env::GetInstance() 80 aura::Env::GetInstance()
85 ->context_factory() 81 ->context_factory()
86 ->GetGpuMemoryBufferManager() 82 ->GetGpuMemoryBufferManager()
87 ->CreateGpuMemoryBufferFromHandle(handle, size, format); 83 ->CreateGpuMemoryBufferFromHandle(handle, size, format);
88 if (!gpu_memory_buffer) { 84 if (!gpu_memory_buffer) {
89 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; 85 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle";
90 return nullptr; 86 return nullptr;
91 } 87 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 175
180 if (surface->HasSurfaceDelegate()) { 176 if (surface->HasSurfaceDelegate()) {
181 DLOG(ERROR) << "Surface has already been assigned a role"; 177 DLOG(ERROR) << "Surface has already been assigned a role";
182 return nullptr; 178 return nullptr;
183 } 179 }
184 180
185 return base::WrapUnique(new SubSurface(surface, parent)); 181 return base::WrapUnique(new SubSurface(surface, parent));
186 } 182 }
187 183
188 } // namespace exo 184 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698