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

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

Issue 1837703002: gpu: Export/import buffers created by Ozone GMB factory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move dup() to ShareGpuMemoryBufferToGpuProcess 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 | « no previous file | gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_channel_host.h" 5 #include "gpu/ipc/client/gpu_channel_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 switch (source_handle.type) { 235 switch (source_handle.type) {
236 case gfx::SHARED_MEMORY_BUFFER: { 236 case gfx::SHARED_MEMORY_BUFFER: {
237 gfx::GpuMemoryBufferHandle handle; 237 gfx::GpuMemoryBufferHandle handle;
238 handle.type = gfx::SHARED_MEMORY_BUFFER; 238 handle.type = gfx::SHARED_MEMORY_BUFFER;
239 handle.handle = ShareToGpuProcess(source_handle.handle); 239 handle.handle = ShareToGpuProcess(source_handle.handle);
240 handle.offset = source_handle.offset; 240 handle.offset = source_handle.offset;
241 handle.stride = source_handle.stride; 241 handle.stride = source_handle.stride;
242 *requires_sync_point = false; 242 *requires_sync_point = false;
243 return handle; 243 return handle;
244 } 244 }
245 #if defined(USE_OZONE)
246 case gfx::OZONE_NATIVE_PIXMAP: {
247 std::vector<base::ScopedFD> scoped_fds;
248 for (auto& fd : source_handle.native_pixmap_handle.fds) {
249 base::ScopedFD scoped_fd(HANDLE_EINTR(dup(fd.fd)));
250 if (!scoped_fd.is_valid()) {
251 PLOG(ERROR) << "dup";
252 return gfx::GpuMemoryBufferHandle();
253 }
254 scoped_fds.emplace_back(std::move(scoped_fd));
255 }
256 gfx::GpuMemoryBufferHandle handle;
257 handle.type = gfx::OZONE_NATIVE_PIXMAP;
258 handle.id = source_handle.id;
259 for (auto& scoped_fd : scoped_fds) {
260 handle.native_pixmap_handle.fds.emplace_back(scoped_fd.release(),
261 true /* auto_close */);
262 }
263 handle.native_pixmap_handle.strides_and_offsets =
264 source_handle.native_pixmap_handle.strides_and_offsets;
265 *requires_sync_point = false;
266 return handle;
267 }
268 #endif
245 case gfx::IO_SURFACE_BUFFER: 269 case gfx::IO_SURFACE_BUFFER:
246 case gfx::SURFACE_TEXTURE_BUFFER: 270 case gfx::SURFACE_TEXTURE_BUFFER:
247 case gfx::OZONE_NATIVE_PIXMAP:
248 *requires_sync_point = true; 271 *requires_sync_point = true;
249 return source_handle; 272 return source_handle;
250 default: 273 default:
251 NOTREACHED(); 274 NOTREACHED();
252 return gfx::GpuMemoryBufferHandle(); 275 return gfx::GpuMemoryBufferHandle();
253 } 276 }
254 } 277 }
255 278
256 int32_t GpuChannelHost::ReserveImageId() { 279 int32_t GpuChannelHost::ReserveImageId() {
257 return next_image_id_.GetNext(); 280 return next_image_id_.GetNext();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 420
398 listeners_.clear(); 421 listeners_.clear();
399 } 422 }
400 423
401 bool GpuChannelHost::MessageFilter::IsLost() const { 424 bool GpuChannelHost::MessageFilter::IsLost() const {
402 AutoLock lock(lock_); 425 AutoLock lock(lock_);
403 return lost_; 426 return lost_;
404 } 427 }
405 428
406 } // namespace gpu 429 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698