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

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: 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 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, 63 base::ScopedFD fd,
64 const gfx::Size& size, 64 const gfx::Size& size,
65 gfx::BufferFormat format, 65 gfx::BufferFormat format,
66 int stride) { 66 const std::vector<int>& strides,
67 const std::vector<int>& offsets) {
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 handle.native_pixmap_handle.fds.emplace_back(
73 base::FileDescriptor(std::move(fd))); 74 base::FileDescriptor(std::move(fd)));
74 handle.native_pixmap_handle.strides.push_back(stride); 75 handle.native_pixmap_handle.strides = strides;
75 handle.native_pixmap_handle.offsets.push_back(0); 76 handle.native_pixmap_handle.offsets = offsets;
76 77
77 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer = 78 std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
78 aura::Env::GetInstance() 79 aura::Env::GetInstance()
79 ->context_factory() 80 ->context_factory()
80 ->GetGpuMemoryBufferManager() 81 ->GetGpuMemoryBufferManager()
81 ->CreateGpuMemoryBufferFromHandle(handle, size, format); 82 ->CreateGpuMemoryBufferFromHandle(handle, size, format);
82 if (!gpu_memory_buffer) { 83 if (!gpu_memory_buffer) {
83 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle"; 84 LOG(ERROR) << "Failed to create GpuMemoryBuffer from handle";
84 return nullptr; 85 return nullptr;
85 } 86 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 167
167 if (surface->HasSurfaceDelegate()) { 168 if (surface->HasSurfaceDelegate()) {
168 DLOG(ERROR) << "Surface has already been assigned a role"; 169 DLOG(ERROR) << "Surface has already been assigned a role";
169 return nullptr; 170 return nullptr;
170 } 171 }
171 172
172 return base::WrapUnique(new SubSurface(surface, parent)); 173 return base::WrapUnique(new SubSurface(surface, parent));
173 } 174 }
174 175
175 } // namespace exo 176 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698