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

Unified Diff: gpu/ipc/service/gpu_command_buffer_stub.h

Issue 2555173003: [Do not submit] D3DKMTWaitForVerticalBlankEvent VSync prototype (Closed)
Patch Set: Added command line switch and experiment support Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: gpu/ipc/service/gpu_command_buffer_stub.h
diff --git a/gpu/ipc/service/gpu_command_buffer_stub.h b/gpu/ipc/service/gpu_command_buffer_stub.h
index 91b8dfe1c36ff3978808b7af5933d2ee276e8c31..08357e2f6806a515c33bb6fb70893652b77f0537 100644
--- a/gpu/ipc/service/gpu_command_buffer_stub.h
+++ b/gpu/ipc/service/gpu_command_buffer_stub.h
@@ -16,6 +16,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "gpu/command_buffer/common/command_buffer_id.h"
#include "gpu/command_buffer/common/constants.h"
@@ -50,6 +51,7 @@ namespace gpu {
class GpuChannel;
struct WaitForCommandState;
+class GpuVSyncProvider;
class GPU_EXPORT GpuCommandBufferStub
: public IPC::Listener,
@@ -93,9 +95,18 @@ class GPU_EXPORT GpuCommandBufferStub
void DidSwapBuffersComplete(SwapBuffersCompleteParams params) override;
const gles2::FeatureInfo* GetFeatureInfo() const override;
void SetLatencyInfoCallback(const LatencyInfoCallback& callback) override;
+ // This is called from VSyncProvider to update parameters for generating
+ // timer-based VSync signals on the browser side.
void UpdateVSyncParameters(base::TimeTicks timebase,
base::TimeDelta interval) override;
+ // This is called from GpuVSyncProvider with actual GPU VSync signals.
+ void UpdateGpuVSync(base::TimeTicks timestamp);
+
+ // Send VSync signals or VSync parameters over IPC.
+ void SendUpdatedVSyncParameters(base::TimeTicks timebase,
+ base::TimeDelta interval);
+
gles2::MemoryTracker* GetMemoryTracker() const;
// Whether this command buffer can currently handle IPC messages.
@@ -188,6 +199,7 @@ class GPU_EXPORT GpuCommandBufferStub
void OnCreateStreamTexture(uint32_t texture_id,
int32_t stream_id,
bool* succeeded);
+ void OnEnableVSync(bool enabled);
void OnCommandProcessed();
void OnParseError();
@@ -250,6 +262,21 @@ class GPU_EXPORT GpuCommandBufferStub
std::unique_ptr<WaitForCommandState> wait_for_token_;
std::unique_ptr<WaitForCommandState> wait_for_get_offset_;
+ bool gpu_vsync_signal_supported_;
+ std::unique_ptr<GpuVSyncProvider> vsync_provider_;
+
+#if defined(OS_WIN)
+ // TODO: This isn't ideal, but for now VSync interval is still
+ // provided via UpdateVSyncParameters on the main thread, but
+ // it needs to be passed along with VSync signal when VSync becomes
+ // available on background thread.
+ // The current solution is to temporarily store vsync_interval_.
+ // Perhaps this could be avoided by calculating the interval from
+ // consecutive VSync signals.
+ base::TimeDelta vsync_interval_;
+ base::Lock vsync_lock_;
+#endif // defined(OS_WIN)
+
DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
};

Powered by Google App Engine
This is Rietveld 408576698