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

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

Issue 2046743002: exo: Add support for importing YVU_420 buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yv12-test
Patch Set: Avoid vector aggregate initialization in exo test. 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
« 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/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 TRACE_EVENT1("exo", "Display::CreateSharedMemory", "size", size); 53 TRACE_EVENT1("exo", "Display::CreateSharedMemory", "size", size);
54 54
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 base::ScopedFD fd,
64 const gfx::Size& size, 63 const gfx::Size& size,
65 gfx::BufferFormat format, 64 gfx::BufferFormat format,
66 int stride) { 65 const std::vector<int>& strides,
66 const std::vector<int>& offsets,
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 handle.native_pixmap_handle.fds.emplace_back( 73 for (auto& fd : fds)
73 base::FileDescriptor(std::move(fd))); 74 handle.native_pixmap_handle.fds.emplace_back(std::move(fd));
74 handle.native_pixmap_handle.strides_and_offsets.emplace_back(stride, 0); 75
76 DCHECK_EQ(strides.size(), offsets.size());
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 }
75 81
76 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 82 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
77 aura::Env::GetInstance() 83 aura::Env::GetInstance()
78 ->context_factory() 84 ->context_factory()
79 ->GetGpuMemoryBufferManager() 85 ->GetGpuMemoryBufferManager()
80 ->CreateGpuMemoryBufferFromHandle(handle, size, format); 86 ->CreateGpuMemoryBufferFromHandle(handle, size, format);
81 if (!gpu_memory_buffer) { 87 if (!gpu_memory_buffer) {
82 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; 88 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle";
83 return nullptr; 89 return nullptr;
84 } 90 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 178
173 if (surface->HasSurfaceDelegate()) { 179 if (surface->HasSurfaceDelegate()) {
174 DLOG(ERROR) << "Surface has already been assigned a role"; 180 DLOG(ERROR) << "Surface has already been assigned a role";
175 return nullptr; 181 return nullptr;
176 } 182 }
177 183
178 return base::WrapUnique(new SubSurface(surface, parent)); 184 return base::WrapUnique(new SubSurface(surface, parent));
179 } 185 }
180 186
181 } // namespace exo 187 } // 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