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

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

Issue 2384243003: ui: Add libsync GLFence implementation.
Patch Set: rebase Created 4 years, 1 month 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 | « gpu/ipc/client/gpu_fence_impl.h ('k') | gpu/ipc/client/gpu_fence_impl_libsync.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_fence_impl.h" 5 #include "gpu/ipc/client/gpu_fence_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "base/memory/ptr_util.h"
9 #include "gpu/ipc/client/gpu_fence_impl_shared_event.h"
10 #include "ui/gfx/shared_event.h"
11
12 #if defined(OS_LINUX)
13 #include "gpu/ipc/client/gpu_fence_impl_libsync.h"
14 #endif
9 15
10 namespace gpu { 16 namespace gpu {
11 17
12 GpuFenceImpl::GpuFenceImpl() {} 18 GpuFenceImpl::GpuFenceImpl() {}
13 19
14 GpuFenceImpl::GpuFenceImpl(const gfx::GpuFenceHandle& handle)
15 : shared_event_(handle.shared_event_handle) {}
16
17 GpuFenceImpl::~GpuFenceImpl() {} 20 GpuFenceImpl::~GpuFenceImpl() {}
18 21
19 // static 22 // static
20 gfx::GpuFenceHandle GpuFenceImpl::CreateForChildProcess( 23 gfx::GpuFenceHandle GpuFenceImpl::CreateForChildProcess(
21 base::ProcessHandle child_process) { 24 base::ProcessHandle child_process) {
22 gfx::GpuFenceHandle handle; 25 gfx::GpuFenceHandle handle;
23 handle.shared_event_handle = 26 handle.shared_event_handle =
24 gfx::SharedEvent::CreateForProcess(child_process); 27 gfx::SharedEvent::CreateForProcess(child_process);
25 return handle; 28 return handle;
26 } 29 }
27 30
28 // static 31 // static
32 std::unique_ptr<GpuFenceImpl> GpuFenceImpl::CreateFromHandle(
33 const gfx::GpuFenceHandle& handle) {
34 if (gfx::SharedEvent::IsHandleValid(handle.shared_event_handle)) {
35 return base::MakeUnique<GpuFenceImplSharedEvent>(
36 handle.shared_event_handle);
37 }
38 #if defined(OS_LINUX)
39 if (handle.fd.fd >= 0)
40 return base::MakeUnique<GpuFenceImplLibsync>(handle.fd);
41 #endif
42 return nullptr;
43 }
44
45 // static
29 GpuFenceImpl* GpuFenceImpl::FromClientFence(ClientFence fence) { 46 GpuFenceImpl* GpuFenceImpl::FromClientFence(ClientFence fence) {
30 return reinterpret_cast<GpuFenceImpl*>(fence); 47 return reinterpret_cast<GpuFenceImpl*>(fence);
31 } 48 }
32 49
33 bool GpuFenceImpl::IsSignaled() { 50 bool GpuFenceImpl::IsSignaled() {
34 return shared_event_.IsSignaled(); 51 NOTIMPLEMENTED();
52 return false;
35 } 53 }
36 54
37 bool GpuFenceImpl::Wait(const base::TimeDelta& max_time) { 55 bool GpuFenceImpl::Wait(const base::TimeDelta& max_time) {
38 return shared_event_.Wait(max_time); 56 NOTIMPLEMENTED();
57 return false;
39 } 58 }
40 59
41 void GpuFenceImpl::Reset() { 60 void GpuFenceImpl::Reset() {
42 return shared_event_.Reset(); 61 NOTIMPLEMENTED();
43 }
44
45 gfx::GpuFenceHandle GpuFenceImpl::GetHandle() const {
46 gfx::GpuFenceHandle handle;
47 handle.shared_event_handle = shared_event_.GetHandle();
48 return handle;
49 } 62 }
50 63
51 ClientFence GpuFenceImpl::AsClientFence() { 64 ClientFence GpuFenceImpl::AsClientFence() {
52 return reinterpret_cast<ClientFence>(this); 65 return reinterpret_cast<ClientFence>(this);
53 } 66 }
54 67
55 } // namespace gpu 68 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/client/gpu_fence_impl.h ('k') | gpu/ipc/client/gpu_fence_impl_libsync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698