summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2015-06-08 17:45:27 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-09 00:46:50 +0000
commitb7c7364c8783728bf33dc3edbef59cdce4aefb40 (patch)
tree43ab188b2e9f419418b0b2a29e06d8a016127c61 /gpu
parentcd3fad6bed38209a5c09e78e5f0fc703d583fc7f (diff)
downloadchromium_src-b7c7364c8783728bf33dc3edbef59cdce4aefb40.zip
chromium_src-b7c7364c8783728bf33dc3edbef59cdce4aefb40.tar.gz
chromium_src-b7c7364c8783728bf33dc3edbef59cdce4aefb40.tar.bz2
DCHECK if shader compilation fails that it's due to context loss.
Add GetGraphicsResetStatusKHR() to GLES2Interface so GLHelper code can verify this. Adds IsGpuChannelLost() to GpuControl to tell if the GpuChannelHost has lost its connection to the GPU process, which is implemented in CommandBufferProxyImpl. Uses this along with the GetLastState() on the CommandBuffer (via CommandBufferHelper::IsContextLost()) to tell if the context is lost from GLES2Implementation. R=piman@chromium.org TBR=sky BUG=492447 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1160863007 Cr-Commit-Position: refs/heads/master@{#333404}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/GLES2/gl2chromium_autogen.h1
-rwxr-xr-xgpu/command_buffer/build_gles2_cmd_buffer.py6
-rw-r--r--gpu/command_buffer/client/client_test_helper.h1
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h7
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc15
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h2
-rw-r--r--gpu/command_buffer/client/gles2_interface_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h3
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_autogen.h1
-rw-r--r--gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h5
-rw-r--r--gpu/command_buffer/client/gpu_control.h4
-rw-r--r--gpu/command_buffer/cmd_buffer_functions.txt3
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.cc6
-rw-r--r--gpu/command_buffer/service/in_process_command_buffer.h1
-rw-r--r--gpu/command_buffer/tests/gl_manager.cc5
-rw-r--r--gpu/command_buffer/tests/gl_manager.h1
-rw-r--r--gpu/gles2_conform_support/egl/display.cc5
-rw-r--r--gpu/gles2_conform_support/egl/display.h1
19 files changed, 69 insertions, 0 deletions
diff --git a/gpu/GLES2/gl2chromium_autogen.h b/gpu/GLES2/gl2chromium_autogen.h
index 9dbe95d..391df10 100644
--- a/gpu/GLES2/gl2chromium_autogen.h
+++ b/gpu/GLES2/gl2chromium_autogen.h
@@ -330,6 +330,7 @@
#define glSwapInterval GLES2_GET_FUN(SwapInterval)
#define glMatrixLoadfCHROMIUM GLES2_GET_FUN(MatrixLoadfCHROMIUM)
#define glMatrixLoadIdentityCHROMIUM GLES2_GET_FUN(MatrixLoadIdentityCHROMIUM)
+#define glGetGraphicsResetStatusKHR GLES2_GET_FUN(GetGraphicsResetStatusKHR)
#define glBlendBarrierKHR GLES2_GET_FUN(BlendBarrierKHR)
#endif // GPU_GLES2_GL2CHROMIUM_AUTOGEN_H_
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index ab60f0d..af622ce 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -2699,6 +2699,12 @@ _FUNCTION_INFO = {
'gl_test_func': 'glGetFramebufferAttachmentParameterivEXT',
'result': ['SizedResult<GLint>'],
},
+ 'GetGraphicsResetStatusKHR': {
+ 'extension': True,
+ 'client_test': False,
+ 'gen_cmd': False,
+ 'trace_level': 1,
+ },
'GetInteger64v': {
'type': 'GETn',
'result': ['SizedResult<GLint64>'],
diff --git a/gpu/command_buffer/client/client_test_helper.h b/gpu/command_buffer/client/client_test_helper.h
index 10dd75c..07234c7 100644
--- a/gpu/command_buffer/client/client_test_helper.h
+++ b/gpu/command_buffer/client/client_test_helper.h
@@ -111,6 +111,7 @@ class MockClientGpuControl : public GpuControl {
MOCK_METHOD1(SetSurfaceVisible, void(bool visible));
MOCK_METHOD1(CreateStreamTexture, uint32(uint32));
MOCK_METHOD1(SetLock, void(base::Lock*));
+ MOCK_METHOD0(IsGpuChannelLost, bool());
private:
DISALLOW_COPY_AND_ASSIGN(MockClientGpuControl);
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 7eb7a0e..591df8a 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -1393,6 +1393,9 @@ void GLES2MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) {
void GLES2MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
gles2::GetGLContext()->MatrixLoadIdentityCHROMIUM(matrixMode);
}
+GLenum GLES2GetGraphicsResetStatusKHR() {
+ return gles2::GetGLContext()->GetGraphicsResetStatusKHR();
+}
void GLES2BlendBarrierKHR() {
gles2::GetGLContext()->BlendBarrierKHR();
}
@@ -2620,6 +2623,10 @@ extern const NameToFunc g_gles2_function_table[] = {
reinterpret_cast<GLES2FunctionPointer>(glMatrixLoadIdentityCHROMIUM),
},
{
+ "glGetGraphicsResetStatusKHR",
+ reinterpret_cast<GLES2FunctionPointer>(glGetGraphicsResetStatusKHR),
+ },
+ {
"glBlendBarrierKHR",
reinterpret_cast<GLES2FunctionPointer>(glBlendBarrierKHR),
},
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index e859299..8f75e7f 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -4103,6 +4103,21 @@ void GLES2Implementation::GetVertexAttribIuiv(
CheckGLError();
}
+GLenum GLES2Implementation::GetGraphicsResetStatusKHR() {
+ GPU_CLIENT_SINGLE_THREAD_CHECK();
+ GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glGetGraphicsResetStatusKHR()");
+ // If we can't make command buffers then the context is lost.
+ if (gpu_control_->IsGpuChannelLost())
+ return GL_UNKNOWN_CONTEXT_RESET_KHR;
+ // Otherwise, check the command buffer if it is lost.
+ if (helper_->IsContextLost()) {
+ // TODO(danakj): We could GetLastState() off the CommandBuffer and return
+ // the actual reason here if we cared to.
+ return GL_UNKNOWN_CONTEXT_RESET_KHR;
+ }
+ return GL_NO_ERROR;
+}
+
void GLES2Implementation::Swap() {
SwapBuffers();
}
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index b89f8d6..b4b9e98 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -1041,6 +1041,8 @@ void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
+GLenum GetGraphicsResetStatusKHR() override;
+
void BlendBarrierKHR() override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_autogen.h b/gpu/command_buffer/client/gles2_interface_autogen.h
index 6b30a53..ae93c08 100644
--- a/gpu/command_buffer/client/gles2_interface_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_autogen.h
@@ -769,5 +769,6 @@ virtual void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order,
virtual void SwapInterval(GLint interval) = 0;
virtual void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) = 0;
virtual void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) = 0;
+virtual GLenum GetGraphicsResetStatusKHR() = 0;
virtual void BlendBarrierKHR() = 0;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_stub_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
index 3471376..290bc28 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_autogen.h
@@ -749,5 +749,6 @@ void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order,
void SwapInterval(GLint interval) override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
+GLenum GetGraphicsResetStatusKHR() override;
void BlendBarrierKHR() override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
index 1a462d7..aa07a67 100644
--- a/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_interface_stub_impl_autogen.h
@@ -1274,6 +1274,9 @@ void GLES2InterfaceStub::MatrixLoadfCHROMIUM(GLenum /* matrixMode */,
}
void GLES2InterfaceStub::MatrixLoadIdentityCHROMIUM(GLenum /* matrixMode */) {
}
+GLenum GLES2InterfaceStub::GetGraphicsResetStatusKHR() {
+ return 0;
+}
void GLES2InterfaceStub::BlendBarrierKHR() {
}
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_INTERFACE_STUB_IMPL_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
index d5f0ed9..b017be2 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_autogen.h
@@ -749,5 +749,6 @@ void ScheduleOverlayPlaneCHROMIUM(GLint plane_z_order,
void SwapInterval(GLint interval) override;
void MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat* m) override;
void MatrixLoadIdentityCHROMIUM(GLenum matrixMode) override;
+GLenum GetGraphicsResetStatusKHR() override;
void BlendBarrierKHR() override;
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_TRACE_IMPLEMENTATION_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
index be4a030..34b0743 100644
--- a/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
+++ b/gpu/command_buffer/client/gles2_trace_implementation_impl_autogen.h
@@ -2181,6 +2181,11 @@ void GLES2TraceImplementation::MatrixLoadIdentityCHROMIUM(GLenum matrixMode) {
gl_->MatrixLoadIdentityCHROMIUM(matrixMode);
}
+GLenum GLES2TraceImplementation::GetGraphicsResetStatusKHR() {
+ TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::GetGraphicsResetStatusKHR");
+ return gl_->GetGraphicsResetStatusKHR();
+}
+
void GLES2TraceImplementation::BlendBarrierKHR() {
TRACE_EVENT_BINARY_EFFICIENT0("gpu", "GLES2Trace::BlendBarrierKHR");
gl_->BlendBarrierKHR();
diff --git a/gpu/command_buffer/client/gpu_control.h b/gpu/command_buffer/client/gpu_control.h
index 2b303b3..75bd082 100644
--- a/gpu/command_buffer/client/gpu_control.h
+++ b/gpu/command_buffer/client/gpu_control.h
@@ -85,6 +85,10 @@ class GPU_EXPORT GpuControl {
// may not be supported with all implementations.
virtual void SetLock(base::Lock*) = 0;
+ // Returns true if the channel to the Gpu is lost. When true, all contexts
+ // should be considered as lost.
+ virtual bool IsGpuChannelLost() = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(GpuControl);
};
diff --git a/gpu/command_buffer/cmd_buffer_functions.txt b/gpu/command_buffer/cmd_buffer_functions.txt
index f154161..3613d8a 100644
--- a/gpu/command_buffer/cmd_buffer_functions.txt
+++ b/gpu/command_buffer/cmd_buffer_functions.txt
@@ -313,5 +313,8 @@ GL_APICALL void GL_APIENTRY glSwapInterval (GLint interval);
GL_APICALL void GL_APIENTRY glMatrixLoadfCHROMIUM (GLenumMatrixMode matrixMode, const GLfloat* m);
GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUM (GLenumMatrixMode matrixMode);
+// Extension KHR_robustness
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void);
+
// Extension KHR_blend_equation_advanced
GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 5b325ab..5140da6 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -912,6 +912,12 @@ uint32 InProcessCommandBuffer::CreateStreamTexture(uint32 texture_id) {
void InProcessCommandBuffer::SetLock(base::Lock*) {
}
+bool InProcessCommandBuffer::IsGpuChannelLost() {
+ // There is no such channel to lose for in-process contexts. This only
+ // makes sense for out-of-process command buffers.
+ return false;
+}
+
uint32 InProcessCommandBuffer::CreateStreamTextureOnGpuThread(
uint32 client_texture_id) {
#if defined(OS_ANDROID)
diff --git a/gpu/command_buffer/service/in_process_command_buffer.h b/gpu/command_buffer/service/in_process_command_buffer.h
index b3f6eb8..c6c4f2c 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.h
+++ b/gpu/command_buffer/service/in_process_command_buffer.h
@@ -121,6 +121,7 @@ class GPU_EXPORT InProcessCommandBuffer : public CommandBuffer,
void SetSurfaceVisible(bool visible) override;
uint32 CreateStreamTexture(uint32 texture_id) override;
void SetLock(base::Lock*) override;
+ bool IsGpuChannelLost() override;
// The serializer interface to the GPU service (i.e. thread).
class Service {
diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc
index d527203..10136c0 100644
--- a/gpu/command_buffer/tests/gl_manager.cc
+++ b/gpu/command_buffer/tests/gl_manager.cc
@@ -516,4 +516,9 @@ void GLManager::SetLock(base::Lock*) {
NOTIMPLEMENTED();
}
+bool GLManager::IsGpuChannelLost() {
+ NOTIMPLEMENTED();
+ return false;
+}
+
} // namespace gpu
diff --git a/gpu/command_buffer/tests/gl_manager.h b/gpu/command_buffer/tests/gl_manager.h
index c163ac0..e06387e 100644
--- a/gpu/command_buffer/tests/gl_manager.h
+++ b/gpu/command_buffer/tests/gl_manager.h
@@ -120,6 +120,7 @@ class GLManager : private GpuControl {
void SetSurfaceVisible(bool visible) override;
uint32 CreateStreamTexture(uint32 texture_id) override;
void SetLock(base::Lock*) override;
+ bool IsGpuChannelLost() override;
private:
void PumpCommands();
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
index bd17250..d65e589 100644
--- a/gpu/gles2_conform_support/egl/display.cc
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -339,4 +339,9 @@ void Display::SetLock(base::Lock*) {
NOTIMPLEMENTED();
}
+bool Display::IsGpuChannelLost() {
+ NOTIMPLEMENTED();
+ return false;
+}
+
} // namespace egl
diff --git a/gpu/gles2_conform_support/egl/display.h b/gpu/gles2_conform_support/egl/display.h
index 9b349bd..0566da6 100644
--- a/gpu/gles2_conform_support/egl/display.h
+++ b/gpu/gles2_conform_support/egl/display.h
@@ -93,6 +93,7 @@ class Display : private gpu::GpuControl {
void SetSurfaceVisible(bool visible) override;
uint32 CreateStreamTexture(uint32 texture_id) override;
void SetLock(base::Lock*) override;
+ bool IsGpuChannelLost() override;
private:
EGLNativeDisplayType display_id_;