Skip to content

Commit

Permalink
GpuFence implementation
Browse files Browse the repository at this point in the history
Implement a command buffer interface for native file descriptor backed
cross-context GpuFence objects. See CHROMIUM_gpu_fence.txt for the GLES
API description and docs/design/gpu_synchronization.md for background
information including usage examples.

gl::GLFenceAndroidNativeSyncPoint - low-level wrapper for underlying GL
calls.

gfx::GpuFenceHandle - IPC-transportable wrapper for the sync file
descriptor.

gfx::GpuFence aka ClientGpuFence - owning container for a GpuFenceHandle,
and convertible to/from a ClientGpuFence for use with GL calls.

gpu::gles2::GpuFenceManager tracks GpuFenceEntry objects by client-assigned
ID number. Each entry stores a gl::GLFence as currently implemented
by the gl::GLFenceAndroidNativeSyncPoint subclass.

BUG=761432

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ibae5c377528db9a9382b64a2648ac56a5a0f53f6
Reviewed-on: https://chromium-review.googlesource.com/680135
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: David Reveman <reveman@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523001}
  • Loading branch information
klausw authored and Commit Bot committed Dec 9, 2017
1 parent 410ede8 commit e66cc7d
Show file tree
Hide file tree
Showing 74 changed files with 2,048 additions and 12 deletions.
4 changes: 4 additions & 0 deletions cc/test/test_context_support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ void TestContextSupport::SignalQuery(uint32_t query,
weak_ptr_factory_.GetWeakPtr()));
}

void TestContextSupport::GetGpuFence(
uint32_t gpu_fence_id,
base::OnceCallback<void(std::unique_ptr<gfx::GpuFence>)> callback) {}

void TestContextSupport::SetAggressivelyFreeResources(
bool aggressively_free_resources) {}

Expand Down
4 changes: 4 additions & 0 deletions cc/test/test_context_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "gpu/command_buffer/client/context_support.h"

namespace gfx {
class GpuFence;
class Rect;
class RectF;
}
Expand All @@ -32,6 +33,9 @@ class TestContextSupport : public gpu::ContextSupport {
base::OnceClosure callback) override;
bool IsSyncTokenSignaled(const gpu::SyncToken& sync_token) override;
void SignalQuery(uint32_t query, base::OnceClosure callback) override;
void GetGpuFence(uint32_t gpu_fence_id,
base::OnceCallback<void(std::unique_ptr<gfx::GpuFence>)>
callback) override;
void SetAggressivelyFreeResources(bool aggressively_free_resources) override;
void Swap() override;
void SwapWithBounds(const std::vector<gfx::Rect>& rects) override;
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/android/vr_shell/vr_shell_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@ void VrShellGl::DrawIntoAcquiredFrame(int16_t frame_index,
if (ShouldDrawWebVr() && surfaceless_rendering_) {
// Continue with submit once a GL fence signals that current drawing
// operations have completed.
std::unique_ptr<gl::GLFenceEGL> fence = base::MakeUnique<gl::GLFenceEGL>();
std::unique_ptr<gl::GLFenceEGL> fence = gl::GLFenceEGL::Create();
DCHECK(fence);
webvr_delayed_frame_submit_.Reset(base::Bind(
&VrShellGl::DrawFrameSubmitWhenReady, base::Unretained(this)));
task_runner_->PostTask(
Expand Down
2 changes: 2 additions & 0 deletions docs/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ As of this writing, the vast majority of docs have not been imported yet.
platforms.
* [Threading](threading.md) - Preferred ways to use threading, and library
support for concurrency.
* [GPU Synchronization](gpu_synchronization.md) - Mechanisms for sequencing
GPU drawing operations across contexts or processes.
Loading

0 comments on commit e66cc7d

Please sign in to comment.