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

Side by Side Diff: gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.cc

Issue 2761533002: ozone: Import multi-planar GBMs. (Closed)
Patch Set: LE not LT. Created 3 years, 9 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 | « no previous file | ui/ozone/platform/drm/common/drm_util.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" 5 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 10 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
(...skipping 29 matching lines...) Expand all
40 GpuMemoryBufferImplOzoneNativePixmap::~GpuMemoryBufferImplOzoneNativePixmap() {} 40 GpuMemoryBufferImplOzoneNativePixmap::~GpuMemoryBufferImplOzoneNativePixmap() {}
41 41
42 // static 42 // static
43 std::unique_ptr<GpuMemoryBufferImplOzoneNativePixmap> 43 std::unique_ptr<GpuMemoryBufferImplOzoneNativePixmap>
44 GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( 44 GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle(
45 const gfx::GpuMemoryBufferHandle& handle, 45 const gfx::GpuMemoryBufferHandle& handle,
46 const gfx::Size& size, 46 const gfx::Size& size,
47 gfx::BufferFormat format, 47 gfx::BufferFormat format,
48 gfx::BufferUsage usage, 48 gfx::BufferUsage usage,
49 const DestructionCallback& callback) { 49 const DestructionCallback& callback) {
50 DCHECK_LE(handle.native_pixmap_handle.fds.size(), 1u);
51 50
52 // GpuMemoryBufferImpl needs the FD to implement GetHandle() but 51 // GpuMemoryBufferImpl needs the FD to implement GetHandle() but
53 // ui::ClientNativePixmapFactory::ImportFromHandle is expected to take 52 // ui::ClientNativePixmapFactory::ImportFromHandle is expected to take
54 // ownership of the FD passed in the handle so we have to dup it here in 53 // ownership of the FD passed in the handle so we have to dup it here in
55 // order to pass a valid FD to the GpuMemoryBufferImpl ctor. 54 // order to pass a valid FD to the GpuMemoryBufferImpl ctor.
56 base::ScopedFD scoped_fd; 55 base::ScopedFD scoped_fd;
57 if (!handle.native_pixmap_handle.fds.empty()) { 56 if (!handle.native_pixmap_handle.fds.empty()) {
58 scoped_fd.reset(HANDLE_EINTR(dup(handle.native_pixmap_handle.fds[0].fd))); 57 scoped_fd.reset(HANDLE_EINTR(dup(handle.native_pixmap_handle.fds[0].fd)));
59 if (!scoped_fd.is_valid()) { 58 if (!scoped_fd.is_valid()) {
60 PLOG(ERROR) << "dup"; 59 PLOG(ERROR) << "dup";
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 handle.id = id_; 130 handle.id = id_;
132 if (fd_.is_valid()) { 131 if (fd_.is_valid()) {
133 handle.native_pixmap_handle.fds.emplace_back(fd_.get(), 132 handle.native_pixmap_handle.fds.emplace_back(fd_.get(),
134 false /* auto_close */); 133 false /* auto_close */);
135 } 134 }
136 handle.native_pixmap_handle.planes = planes_; 135 handle.native_pixmap_handle.planes = planes_;
137 return handle; 136 return handle;
138 } 137 }
139 138
140 } // namespace gpu 139 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/drm/common/drm_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698