diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 20:27:01 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-20 20:27:01 +0000 |
commit | d049874acef2be3c17612d4a06b480f3a45ea6e9 (patch) | |
tree | d39e548c049e2d07b1eff975bdf5968725218d92 /gpu/command_buffer | |
parent | 5664e7d2cfccf7f5b245ac0bc283cc4736a36b9f (diff) | |
download | chromium_src-d049874acef2be3c17612d4a06b480f3a45ea6e9.zip chromium_src-d049874acef2be3c17612d4a06b480f3a45ea6e9.tar.gz chromium_src-d049874acef2be3c17612d4a06b480f3a45ea6e9.tar.bz2 |
Added lots of logging to the GPU code.
This should help us diagnose initialization failures.
TEST=try
BUG=none
Review URL: http://codereview.chromium.org/3380010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r-- | gpu/command_buffer/service/command_buffer_service.cc | 14 | ||||
-rw-r--r-- | gpu/command_buffer/service/context_group.cc | 12 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 40 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_processor.cc | 8 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_processor_linux.cc | 4 | ||||
-rw-r--r-- | gpu/command_buffer/service/gpu_processor_mac.cc | 2 |
6 files changed, 67 insertions, 13 deletions
diff --git a/gpu/command_buffer/service/command_buffer_service.cc b/gpu/command_buffer/service/command_buffer_service.cc index b692701..0b9a87b 100644 --- a/gpu/command_buffer/service/command_buffer_service.cc +++ b/gpu/command_buffer/service/command_buffer_service.cc @@ -28,11 +28,17 @@ CommandBufferService::~CommandBufferService() { bool CommandBufferService::Initialize(int32 size) { // Fail if already initialized. - if (ring_buffer_.get()) + if (ring_buffer_.get()) { + LOG(ERROR) << "CommandBufferService::Initialize " + << "failed because already initialized."; return false; + } - if (size <= 0 || size > kMaxCommandBufferSize) + if (size <= 0 || size > kMaxCommandBufferSize) { + LOG(ERROR) << "CommandBufferService::Initialize " + << "because command buffer size was invalid."; return false; + } num_entries_ = size / sizeof(CommandBufferEntry); @@ -44,6 +50,10 @@ bool CommandBufferService::Initialize(int32 size) { num_entries_ = 0; ring_buffer_.reset(); + + LOG(ERROR) << "CommandBufferService::Initialize failed because ring buffer " + << "could not be created or mapped "; + return false; } diff --git a/gpu/command_buffer/service/context_group.cc b/gpu/command_buffer/service/context_group.cc index a09f041..358e149 100644 --- a/gpu/command_buffer/service/context_group.cc +++ b/gpu/command_buffer/service/context_group.cc @@ -235,13 +235,19 @@ bool ContextGroup::Initialize() { // Lookup GL things we need to know. GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &max_vertex_attribs_); const GLuint kGLES2RequiredMinimumVertexAttribs = 8u; - if (max_vertex_attribs_ < kGLES2RequiredMinimumVertexAttribs) + if (max_vertex_attribs_ < kGLES2RequiredMinimumVertexAttribs) { + LOG(ERROR) << "ContextGroup::Initialize failed because too few " + << "vertex attributes supported."; return false; + } GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &max_texture_units_); const GLuint kGLES2RequiredMinimumTextureUnits = 8u; - if (max_texture_units_ < kGLES2RequiredMinimumTextureUnits) + if (max_texture_units_ < kGLES2RequiredMinimumTextureUnits) { + LOG(ERROR) << "ContextGroup::Initialize failed because too few " + << "texture units supported."; return false; + } GLint max_texture_size; GLint max_cube_map_texture_size; @@ -273,6 +279,8 @@ bool ContextGroup::Initialize() { } if (!texture_manager_->Initialize()) { + LOG(ERROR) << "Context::Group::Initialize failed because texture manager " + << "failed to initialize."; return false; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 9c11bb5..edb0a7f 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -1549,6 +1549,8 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, parent_ = static_cast<GLES2DecoderImpl*>(parent)->AsWeakPtr(); if (!MakeCurrent()) { + LOG(ERROR) << "GLES2DecoderImpl::Initialize failed because " + << "MakeCurrent failed."; Destroy(); return false; } @@ -1556,6 +1558,8 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, CHECK_GL_ERROR(); if (!group_->Initialize()) { + LOG(ERROR) << "GLES2DecoderImpl::Initialize failed becaue " + << "ContextGroup failed to initialize."; Destroy(); return false; } @@ -1565,6 +1569,11 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, // Check supported extensions. depth24_stencil8_oes_supported_ = context_->HasExtension("GL_OES_packed_depth_stencil"); + if (depth24_stencil8_oes_supported_) { + LOG(INFO) << "GL_OES_packed_depth_stencil supported."; + } else { + LOG(INFO) << "GL_OES_packed_depth_stencil not supported."; + } // We have to enable vertex array 0 on OpenGL or it won't render. Note that // OpenGL ES 2.0 does not have this issue. @@ -1622,7 +1631,7 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, // of the frame buffers is okay. pending_offscreen_size_ = size; if (!UpdateOffscreenFrameBufferSize()) { - DLOG(ERROR) << "Could not allocate offscreen buffer storage."; + LOG(ERROR) << "Could not allocate offscreen buffer storage."; Destroy(); return false; } @@ -1660,13 +1669,13 @@ bool GLES2DecoderImpl::Initialize(gfx::GLContext* context, group_->extension_flags().oes_standard_derivatives ? 1 : 0; vertex_translator_.reset(new ShaderTranslator); if (!vertex_translator_->Init(EShLangVertex, &resources)) { - DLOG(ERROR) << "Could not initialize vertex shader translator."; + LOG(ERROR) << "Could not initialize vertex shader translator."; Destroy(); return false; } fragment_translator_.reset(new ShaderTranslator); if (!fragment_translator_->Init(EShLangFragment, &resources)) { - DLOG(ERROR) << "Could not initialize fragment shader translator."; + LOG(ERROR) << "Could not initialize fragment shader translator."; Destroy(); return false; } @@ -1935,6 +1944,8 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { // Reallocate the offscreen target buffers. if (!offscreen_target_color_texture_->AllocateStorage( pending_offscreen_size_)) { + LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " + << "to allocate storage for offscreen target buffer."; return false; } @@ -1946,16 +1957,23 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { !depth24_stencil8_oes_supported_) { if (!offscreen_target_depth_render_buffer_->AllocateStorage( pending_offscreen_size_, GL_DEPTH_COMPONENT16)) { + LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " + << "to allocate storage for offscreen target depth buffer."; return false; } if (!offscreen_target_stencil_render_buffer_->AllocateStorage( pending_offscreen_size_, GL_STENCIL_INDEX8)) { + LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " + << "to allocate storage for offscreen target stencil buffer."; return false; } } else { if (!offscreen_target_depth_render_buffer_->AllocateStorage( pending_offscreen_size_, GL_DEPTH24_STENCIL8)) { + LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " + << "to allocate storage for offscreen target " + << "depth stencil buffer."; return false; } } @@ -1978,6 +1996,8 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { } if (offscreen_target_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { + LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " + << "because offscreen FBO was incomplete."; return false; } @@ -2027,6 +2047,9 @@ bool GLES2DecoderImpl::UpdateOffscreenFrameBufferSize() { offscreen_saved_color_texture_.get()); if (offscreen_target_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { + LOG(ERROR) << "GLES2DecoderImpl::UpdateOffscreenFrameBufferSize failed " + << "because offscreen FBO was incomplete prior ro clearing " + << "offscreen saved texture."; return false; } @@ -3404,7 +3427,7 @@ GLenum GLES2DecoderImpl::GetGLError() { void GLES2DecoderImpl::SetGLError(GLenum error, const char* msg) { if (msg) { last_error_ = msg; - DLOG(ERROR) << last_error_; + LOG(ERROR) << last_error_; } error_bits_ |= GLES2Util::GLErrorToErrorBit(error); } @@ -5294,8 +5317,11 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers( // First check to see if a deferred offscreen render buffer resize is // pending. - if (!UpdateOffscreenFrameBufferSize()) + if (!UpdateOffscreenFrameBufferSize()) { + LOG(ERROR) << "Context lost because reallocation of offscreen FBO " + << "failed."; return error::kLostContext; + } if (parent_) { // Copy the target frame buffer to the saved offscreen texture. @@ -5311,8 +5337,10 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers( glFlush(); } } else { - if (!context_->SwapBuffers()) + if (!context_->SwapBuffers()) { + LOG(ERROR) << "Context lost because SwapBuffers failed."; return error::kLostContext; + } } // TODO(kbr): when the back buffer is multisampled, then at least on Mac diff --git a/gpu/command_buffer/service/gpu_processor.cc b/gpu/command_buffer/service/gpu_processor.cc index 336dafe..f4bc650 100644 --- a/gpu/command_buffer/service/gpu_processor.cc +++ b/gpu/command_buffer/service/gpu_processor.cc @@ -62,6 +62,8 @@ bool GPUProcessor::InitializeCommon(gfx::GLContext* context, size, parent_decoder, parent_texture_id)) { + LOG(ERROR) << "GPUProcessor::InitializeCommon failed because decoder " + << "failed to initialize."; Destroy(); return false; } @@ -88,9 +90,11 @@ void GPUProcessor::ProcessCommands() { return; if (decoder_.get()) { - // TODO(apatrick): need to do more than this on failure. - if (!decoder_->MakeCurrent()) + if (!decoder_->MakeCurrent()) { + LOG(ERROR) << "Context lost because MakeCurrent failed."; + command_buffer_->SetParseError(error::kLostContext); return; + } } parser_->set_put(state.put_offset); diff --git a/gpu/command_buffer/service/gpu_processor_linux.cc b/gpu/command_buffer/service/gpu_processor_linux.cc index f23465f..67168a6 100644 --- a/gpu/command_buffer/service/gpu_processor_linux.cc +++ b/gpu/command_buffer/service/gpu_processor_linux.cc @@ -36,8 +36,10 @@ bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, context.reset(gfx::GLContext::CreateOffscreenGLContext(parent_context)); } - if (!context.get()) + if (!context.get()) { + LOG(ERROR) << "GPUProcessor::Initialize failed"; return false; + } return InitializeCommon(context.release(), size, diff --git a/gpu/command_buffer/service/gpu_processor_mac.cc b/gpu/command_buffer/service/gpu_processor_mac.cc index 7862d76..8bd2fac 100644 --- a/gpu/command_buffer/service/gpu_processor_mac.cc +++ b/gpu/command_buffer/service/gpu_processor_mac.cc @@ -42,6 +42,8 @@ bool GPUProcessor::Initialize(gfx::PluginWindowHandle window, // not hold on to the reference. It simply extracts the underlying GL // context in order to share the namespace with another context. if (!surface_->Initialize(context.get(), false)) { + LOG(ERROR) << "GPUProcessor::Initialize failed to " + << "initialize AcceleratedSurface."; Destroy(); return false; } |