| OLD | NEW |
| 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/service/gpu_channel.h" | 5 #include "gpu/ipc/service/gpu_channel.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "ui/gl/gl_context.h" | 44 #include "ui/gl/gl_context.h" |
| 45 #include "ui/gl/gl_fence.h" | 45 #include "ui/gl/gl_fence.h" |
| 46 #include "ui/gl/gl_fence_shared_event.h" | 46 #include "ui/gl/gl_fence_shared_event.h" |
| 47 #include "ui/gl/gl_image_shared_memory.h" | 47 #include "ui/gl/gl_image_shared_memory.h" |
| 48 #include "ui/gl/gl_surface.h" | 48 #include "ui/gl/gl_surface.h" |
| 49 | 49 |
| 50 #if defined(OS_POSIX) | 50 #if defined(OS_POSIX) |
| 51 #include "ipc/ipc_channel_posix.h" | 51 #include "ipc/ipc_channel_posix.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #if defined(OS_LINUX) |
| 55 #include "ui/gl/gl_fence_libsync.h" |
| 56 #endif |
| 57 |
| 54 namespace gpu { | 58 namespace gpu { |
| 55 namespace { | 59 namespace { |
| 56 | 60 |
| 57 // Number of milliseconds between successive vsync. Many GL commands block | 61 // Number of milliseconds between successive vsync. Many GL commands block |
| 58 // on vsync, so thresholds for preemption should be multiples of this. | 62 // on vsync, so thresholds for preemption should be multiples of this. |
| 59 const int64_t kVsyncIntervalMs = 17; | 63 const int64_t kVsyncIntervalMs = 17; |
| 60 | 64 |
| 61 // Amount of time that we will wait for an IPC to be processed before | 65 // Amount of time that we will wait for an IPC to be processed before |
| 62 // preempting. After a preemption, we must wait this long before triggering | 66 // preempting. After a preemption, we must wait this long before triggering |
| 63 // another preemption. | 67 // another preemption. |
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 return manager->gpu_memory_buffer_factory() | 1069 return manager->gpu_memory_buffer_factory() |
| 1066 ->AsImageFactory() | 1070 ->AsImageFactory() |
| 1067 ->CreateImageForGpuMemoryBuffer(handle, size, format, internalformat, | 1071 ->CreateImageForGpuMemoryBuffer(handle, size, format, internalformat, |
| 1068 client_id_, surface_handle); | 1072 client_id_, surface_handle); |
| 1069 } | 1073 } |
| 1070 } | 1074 } |
| 1071 } | 1075 } |
| 1072 | 1076 |
| 1073 std::unique_ptr<gl::GLFence> GpuChannel::CreateFenceForGpuFence( | 1077 std::unique_ptr<gl::GLFence> GpuChannel::CreateFenceForGpuFence( |
| 1074 const gfx::GpuFenceHandle& handle) { | 1078 const gfx::GpuFenceHandle& handle) { |
| 1079 #if defined(OS_LINUX) |
| 1080 base::ScopedFD libsync_fd(handle.fd.fd); |
| 1081 if (libsync_fd.is_valid()) |
| 1082 return base::MakeUnique<gl::GLFenceLibsync>(std::move(libsync_fd)); |
| 1083 #endif |
| 1084 |
| 1075 return base::MakeUnique<gl::GLFenceSharedEvent>(handle.shared_event_handle); | 1085 return base::MakeUnique<gl::GLFenceSharedEvent>(handle.shared_event_handle); |
| 1076 } | 1086 } |
| 1077 | 1087 |
| 1078 } // namespace gpu | 1088 } // namespace gpu |
| OLD | NEW |