summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/client/client_test_helper.h1
-rw-r--r--gpu/command_buffer/client/context_support.h7
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc26
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h16
-rw-r--r--gpu/command_buffer/common/gpu_control.h3
-rw-r--r--gpu/command_buffer/service/feature_info.cc3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.h2
-rw-r--r--gpu/command_buffer/service/gpu_control_service.cc4
-rw-r--r--gpu/command_buffer/service/gpu_control_service.h4
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.cc5
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.h1
11 files changed, 64 insertions, 8 deletions
diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h
index 6f0bc6d..e071f5a 100644
--- a/gpu/command_buffer/client/client_test_helper.h
+++ b/gpu/command_buffer/client/client_test_helper.h
@@ -99,6 +99,7 @@ class MockClientGpuControl : public GpuControl {
MOCK_METHOD0(InsertSyncPoint, uint32());
MOCK_METHOD2(SignalSyncPoint, void(uint32 id,
const base::Closure& callback));
+ MOCK_METHOD1(Echo, void(const base::Closure& callback));
MOCK_METHOD2(SignalQuery, void(uint32 query, const base::Closure& callback));
MOCK_METHOD1(SetSurfaceVisible, void(bool visible));
diff --git a/gpu/command_buffer/client/context_support.h b/gpu/command_buffer/client/context_support.h
index dcb0842..6a897208 100644
--- a/gpu/command_buffer/client/context_support.h
+++ b/gpu/command_buffer/client/context_support.h
@@ -6,6 +6,7 @@
#define GPU_COMMAND_BUFFER_CLIENT_CONTEXT_SUPPORT_H_
#include "base/callback.h"
+#include "ui/gfx/rect.h"
namespace gpu {
struct ManagedMemoryStats;
@@ -26,6 +27,12 @@ class ContextSupport {
virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0;
+ virtual void Swap() = 0;
+ virtual void PartialSwapBuffers(gfx::Rect sub_buffer) = 0;
+
+ virtual void SetSwapBuffersCompleteCallback(
+ const base::Closure& callback) = 0;
+
protected:
ContextSupport() {}
virtual ~ContextSupport() {}
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 62fc6d2..b0efc37 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -2775,6 +2775,32 @@ void GLES2Implementation::GetVertexAttribiv(
CheckGLError();
}
+void GLES2Implementation::Swap() {
+ SwapBuffers();
+ gpu_control_->Echo(
+ base::Bind(&GLES2Implementation::OnSwapBuffersComplete,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void GLES2Implementation::PartialSwapBuffers(gfx::Rect sub_buffer) {
+ PostSubBufferCHROMIUM(sub_buffer.x(),
+ sub_buffer.y(),
+ sub_buffer.width(),
+ sub_buffer.height());
+ gpu_control_->Echo(base::Bind(&GLES2Implementation::OnSwapBuffersComplete,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void GLES2Implementation::SetSwapBuffersCompleteCallback(
+ const base::Closure& swap_buffers_complete_callback) {
+ swap_buffers_complete_callback_ = swap_buffers_complete_callback;
+}
+
+void GLES2Implementation::OnSwapBuffersComplete() {
+ if (!swap_buffers_complete_callback_.is_null())
+ swap_buffers_complete_callback_.Run();
+}
+
GLboolean GLES2Implementation::EnableFeatureCHROMIUM(
const char* feature) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index 66b33d9..6b6877f 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -215,6 +215,13 @@ class GLES2_IMPL_EXPORT GLES2Implementation
virtual void GetVertexAttribiv(
GLuint index, GLenum pname, GLint* params) OVERRIDE;
+ // ContextSupport implementation.
+ virtual void Swap() OVERRIDE;
+ virtual void PartialSwapBuffers(gfx::Rect sub_buffer) OVERRIDE;
+ virtual void SetSwapBuffersCompleteCallback(
+ const base::Closure& swap_buffers_complete_callback)
+ OVERRIDE;
+
void GetProgramInfoCHROMIUMHelper(GLuint program, std::vector<int8>* result);
GLint GetAttribLocationHelper(GLuint program, const char* name);
GLint GetUniformLocationHelper(GLuint program, const char* name);
@@ -249,6 +256,10 @@ class GLES2_IMPL_EXPORT GLES2Implementation
return capabilities_;
}
+ GpuControl* gpu_control() {
+ return gpu_control_;
+ }
+
private:
friend class GLES2ImplementationTest;
friend class VertexArrayObjectManager;
@@ -578,6 +589,8 @@ class GLES2_IMPL_EXPORT GLES2Implementation
void RunIfContextNotLost(const base::Closure& callback);
+ void OnSwapBuffersComplete();
+
bool GetBoundPixelTransferBuffer(
GLenum target, const char* function_name, GLuint* buffer_id);
BufferTracker::Buffer* GetBoundPixelUnpackTransferBufferIfValid(
@@ -702,6 +715,9 @@ class GLES2_IMPL_EXPORT GLES2Implementation
Capabilities capabilities_;
+ bool use_echo_for_swap_ack_;
+ base::Closure swap_buffers_complete_callback_;
+
base::WeakPtrFactory<GLES2Implementation> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(GLES2Implementation);
diff --git a/gpu/command_buffer/common/gpu_control.h b/gpu/command_buffer/common/gpu_control.h
index 1331a25..d971972 100644
--- a/gpu/command_buffer/common/gpu_control.h
+++ b/gpu/command_buffer/common/gpu_control.h
@@ -60,6 +60,9 @@ class GPU_EXPORT GpuControl {
virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats) = 0;
+ // Invokes the callback once the context has been flushed.
+ virtual void Echo(const base::Closure& callback) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(GpuControl);
};
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc
index c9f0733..cbcf968 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -694,9 +694,6 @@ void FeatureInfo::InitializeFeatures() {
feature_flags_.ext_frag_depth = true;
}
- if (!disallowed_features_.swap_buffer_complete_callback)
- AddExtensionString("GL_CHROMIUM_swapbuffers_complete_callback");
-
bool ui_gl_fence_works = extensions.Contains("GL_NV_fence") ||
extensions.Contains("GL_ARB_sync") ||
extensions.Contains("EGL_KHR_fence_sync");
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index ce65f7e..87c9335 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -43,12 +43,10 @@ class VertexArrayManager;
struct DisallowedFeatures {
DisallowedFeatures()
: multisampling(false),
- swap_buffer_complete_callback(false),
gpu_memory_manager(false) {
}
bool multisampling;
- bool swap_buffer_complete_callback;
bool gpu_memory_manager;
};
diff --git a/gpu/command_buffer/service/gpu_control_service.cc b/gpu/command_buffer/service/gpu_control_service.cc
index abb8e91..7c0eb8c 100644
--- a/gpu/command_buffer/service/gpu_control_service.cc
+++ b/gpu/command_buffer/service/gpu_control_service.cc
@@ -101,6 +101,10 @@ void GpuControlService::SendManagedMemoryStats(
NOTREACHED();
}
+void GpuControlService::Echo(const base::Closure& callback) {
+ NOTREACHED();
+}
+
bool GpuControlService::RegisterGpuMemoryBuffer(
int32 id,
gfx::GpuMemoryBufferHandle buffer,
diff --git a/gpu/command_buffer/service/gpu_control_service.h b/gpu/command_buffer/service/gpu_control_service.h
index 13bb3c0..3764ad4 100644
--- a/gpu/command_buffer/service/gpu_control_service.h
+++ b/gpu/command_buffer/service/gpu_control_service.h
@@ -29,10 +29,9 @@ class GPU_EXPORT GpuControlService : public GpuControl {
const gpu::Capabilities& decoder_capabilities);
virtual ~GpuControlService();
- // Overridden from GpuControl:
+ // GpuControl implementation.
virtual gpu::Capabilities GetCapabilities() OVERRIDE;
-
virtual gfx::GpuMemoryBuffer* CreateGpuMemoryBuffer(
size_t width,
size_t height,
@@ -49,6 +48,7 @@ class GPU_EXPORT GpuControlService : public GpuControl {
virtual void SetSurfaceVisible(bool visible) OVERRIDE;
virtual void SendManagedMemoryStats(const ManagedMemoryStats& stats)
OVERRIDE;
+ virtual void Echo(const base::Closure& callback) OVERRIDE;
// Register an existing gpu memory buffer and get an ID that can be used
// to identify it in the command buffer.
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 4de4531..af14778 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -464,7 +464,6 @@ bool InProcessCommandBuffer::InitializeOnGpuThread(
}
gles2::DisallowedFeatures disallowed_features;
- disallowed_features.swap_buffer_complete_callback = true;
disallowed_features.gpu_memory_manager = true;
if (!decoder_->Initialize(surface_,
context_,
@@ -735,6 +734,10 @@ void InProcessCommandBuffer::SendManagedMemoryStats(
const gpu::ManagedMemoryStats& stats) {
}
+void InProcessCommandBuffer::Echo(const base::Closure& callback) {
+ QueueTask(WrapCallback(callback));
+}
+
gpu::error::Error InProcessCommandBuffer::GetLastError() {
CheckSequencedThread();
return last_state_.error;
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index 6665b9f..b00f25b 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -125,6 +125,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
virtual void SetSurfaceVisible(bool visible) OVERRIDE;
virtual void SendManagedMemoryStats(const gpu::ManagedMemoryStats& stats)
OVERRIDE;
+ virtual void Echo(const base::Closure& callback) OVERRIDE;
// The serializer interface to the GPU service (i.e. thread).
class SchedulerClient {