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 /app | |
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 'app')
-rw-r--r-- | app/gfx/gl/gl_context.cc | 8 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_egl.cc | 18 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_linux.cc | 9 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_mac.cc | 15 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_osmesa.cc | 6 | ||||
-rw-r--r-- | app/gfx/gl/gl_context_win.cc | 33 | ||||
-rw-r--r-- | app/gfx/gl/gl_implementation_linux.cc | 10 | ||||
-rw-r--r-- | app/gfx/gl/gl_implementation_mac.cc | 8 | ||||
-rw-r--r-- | app/gfx/gl/gl_implementation_win.cc | 8 |
9 files changed, 81 insertions, 34 deletions
diff --git a/app/gfx/gl/gl_context.cc b/app/gfx/gl/gl_context.cc index 1d79072..7e58027 100644 --- a/app/gfx/gl/gl_context.cc +++ b/app/gfx/gl/gl_context.cc @@ -25,12 +25,16 @@ bool GLContext::HasExtension(const char* name) { } bool GLContext::InitializeCommon() { - if (!MakeCurrent()) + if (!MakeCurrent()) { + LOG(ERROR) << "MakeCurrent failed."; return false; + } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - if (glGetError() != GL_NO_ERROR) + if (glGetError() != GL_NO_ERROR) { + LOG(ERROR) << "glClear failed."; return false; + } return true; } diff --git a/app/gfx/gl/gl_context_egl.cc b/app/gfx/gl/gl_context_egl.cc index 47131c7..d264384 100644 --- a/app/gfx/gl/gl_context_egl.cc +++ b/app/gfx/gl/gl_context_egl.cc @@ -35,11 +35,15 @@ bool BaseEGLContext::InitializeOneOff() { EGLNativeDisplayType native_display = EGL_DEFAULT_DISPLAY; #endif g_display = eglGetDisplay(native_display); - if (!g_display) + if (!g_display) { + LOG(ERROR) << "eglGetDisplay failed."; return false; + } - if (!eglInitialize(g_display, NULL, NULL) == EGL_TRUE) + if (!eglInitialize(g_display, NULL, NULL)) { + LOG(ERROR) << "eglInitialize failed."; return false; + } // Choose an EGL configuration. static const EGLint kConfigAttribs[] = { @@ -64,11 +68,14 @@ bool BaseEGLContext::InitializeOneOff() { NULL, 0, &num_configs)) { + LOG(ERROR) << "eglChooseConfig failed."; return false; } - if (num_configs == 0) + if (num_configs == 0) { + LOG(ERROR) << "No suitable EGL configs found."; return false; + } scoped_array<EGLConfig> configs(new EGLConfig[num_configs]); if (!eglChooseConfig(g_display, @@ -76,6 +83,7 @@ bool BaseEGLContext::InitializeOneOff() { configs.get(), num_configs, &num_configs)) { + LOG(ERROR) << "eglChooseConfig failed."; return false; } @@ -108,6 +116,7 @@ bool NativeViewEGLContext::Initialize() { surface_ = eglCreateWindowSurface(g_display, g_config, native_window, NULL); if (!surface_) { + LOG(ERROR) << "eglCreateWindowSurface failed."; Destroy(); return false; } @@ -115,16 +124,19 @@ bool NativeViewEGLContext::Initialize() { // Create a context. context_ = eglCreateContext(g_display, g_config, NULL, NULL); if (!context_) { + LOG(ERROR) << "eglCreateContext failed."; Destroy(); return false; } if (!MakeCurrent()) { + LOG(ERROR) << "MakeCurrent failed."; Destroy(); return false; } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } diff --git a/app/gfx/gl/gl_context_linux.cc b/app/gfx/gl/gl_context_linux.cc index b99f2d5..878a5fb 100644 --- a/app/gfx/gl/gl_context_linux.cc +++ b/app/gfx/gl/gl_context_linux.cc @@ -166,6 +166,7 @@ bool GLContext::InitializeOneOff() { if (!InitializeBestGLBindings( kAllowedGLImplementations, kAllowedGLImplementations + arraysize(kAllowedGLImplementations))) { + LOG(ERROR) << "InitializeBestGLBindings failed."; return false; } @@ -223,6 +224,7 @@ bool ViewGLContext::Initialize(bool multisampled) { } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitlializeCommon failed."; Destroy(); return false; } @@ -288,6 +290,7 @@ void* ViewGLContext::GetHandle() { bool OSMesaViewGLContext::Initialize() { if (!osmesa_context_.Initialize(OSMESA_BGRA, NULL)) { + LOG(ERROR) << "OSMesaGLContext::Initialize failed."; Destroy(); return false; } @@ -347,8 +350,10 @@ bool OSMesaViewGLContext::IsOffscreen() { bool OSMesaViewGLContext::SwapBuffers() { // Update the size before blitting so that the blit size is exactly the same // as the window. - if (!UpdateSize()) + if (!UpdateSize()) { + LOG(ERROR) << "Failed to update size of OSMesaGLContext."; return false; + } gfx::Size size = osmesa_context_.GetSize(); @@ -529,6 +534,7 @@ bool PbufferGLContext::Initialize(GLContext* shared_context) { } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } @@ -641,6 +647,7 @@ bool PixmapGLContext::Initialize(GLContext* shared_context) { } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } diff --git a/app/gfx/gl/gl_context_mac.cc b/app/gfx/gl/gl_context_mac.cc index 29b73be..36fc089 100644 --- a/app/gfx/gl/gl_context_mac.cc +++ b/app/gfx/gl/gl_context_mac.cc @@ -63,6 +63,7 @@ bool GLContext::InitializeOneOff() { if (!InitializeBestGLBindings( kAllowedGLImplementations, kAllowedGLImplementations + arraysize(kAllowedGLImplementations))) { + LOG(ERROR) << "InitializeBestGLBindings failed."; return false; } @@ -81,11 +82,12 @@ bool PbufferGLContext::Initialize(GLContext* shared_context) { if (CGLChoosePixelFormat(attribs, &pixel_format, &num_pixel_formats) != kCGLNoError) { - DLOG(ERROR) << "Error choosing pixel format."; + LOG(ERROR) << "Error choosing pixel format."; Destroy(); return false; } if (!pixel_format) { + LOG(ERROR) << "pixel_format == 0."; return false; } @@ -96,30 +98,31 @@ bool PbufferGLContext::Initialize(GLContext* shared_context) { CGLError res = CGLCreateContext(pixel_format, shared_handle, &context_); CGLDestroyPixelFormat(pixel_format); if (res != kCGLNoError) { - DLOG(ERROR) << "Error creating context."; + LOG(ERROR) << "Error creating context."; Destroy(); return false; } if (CGLCreatePBuffer(1, 1, GL_TEXTURE_2D, GL_RGBA, 0, &pbuffer_) != kCGLNoError) { - DLOG(ERROR) << "Error creating pbuffer."; + LOG(ERROR) << "Error creating pbuffer."; Destroy(); return false; } if (CGLSetPBuffer(context_, pbuffer_, 0, 0, 0) != kCGLNoError) { - DLOG(ERROR) << "Error attaching pbuffer to context."; + LOG(ERROR) << "Error attaching pbuffer to context."; Destroy(); return false; } if (!MakeCurrent()) { Destroy(); - DLOG(ERROR) << "Couldn't make context current for initialization."; + LOG(ERROR) << "Couldn't make context current for initialization."; return false; } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } @@ -142,7 +145,7 @@ void PbufferGLContext::Destroy() { bool PbufferGLContext::MakeCurrent() { if (!IsCurrent()) { if (CGLSetCurrentContext(context_) != kCGLNoError) { - DLOG(ERROR) << "Unable to make gl context current."; + LOG(ERROR) << "Unable to make gl context current."; return false; } } diff --git a/app/gfx/gl/gl_context_osmesa.cc b/app/gfx/gl/gl_context_osmesa.cc index 9b73195..9eb5549 100644 --- a/app/gfx/gl/gl_context_osmesa.cc +++ b/app/gfx/gl/gl_context_osmesa.cc @@ -34,10 +34,13 @@ bool OSMesaGLContext::Initialize(GLuint format, GLContext* shared_context) { 8, // stencil bits 0, // accum bits shared_handle); - if (!context_) + if (!context_) { + LOG(ERROR) << "OSMesaCreateContextExt failed."; return false; + } if (!MakeCurrent()) { + LOG(ERROR) << "MakeCurrent failed."; Destroy(); return false; } @@ -46,6 +49,7 @@ bool OSMesaGLContext::Initialize(GLuint format, GLContext* shared_context) { OSMesaPixelStore(OSMESA_Y_UP, 0); if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } diff --git a/app/gfx/gl/gl_context_win.cc b/app/gfx/gl/gl_context_win.cc index b625343..508355f 100644 --- a/app/gfx/gl/gl_context_win.cc +++ b/app/gfx/gl/gl_context_win.cc @@ -166,6 +166,7 @@ bool GLContext::InitializeOneOff() { if (!InitializeBestGLBindings( kAllowedGLImplementations, kAllowedGLImplementations + arraysize(kAllowedGLImplementations))) { + LOG(ERROR) << "InitializeBestGLBinding failed."; return false; } @@ -177,6 +178,7 @@ bool GLContext::InitializeOneOff() { GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast<wchar_t*>(IntermediateWindowProc), &module_handle)) { + LOG(ERROR) << "GetModuleHandleEx failed."; return false; } @@ -194,6 +196,7 @@ bool GLContext::InitializeOneOff() { ATOM class_registration = ::RegisterClass(&intermediate_class); if (!class_registration) { + LOG(ERROR) << "RegisterClass failed."; return false; } @@ -211,6 +214,7 @@ bool GLContext::InitializeOneOff() { if (!g_window) { ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), module_handle); + LOG(ERROR) << "CreateWindow failed."; return false; } @@ -221,7 +225,7 @@ bool GLContext::InitializeOneOff() { g_regular_pixel_format = ::ChoosePixelFormat(intermediate_dc, &kPixelFormatDescriptor); if (g_regular_pixel_format == 0) { - DLOG(ERROR) << "Unable to get the pixel format for GL context."; + LOG(ERROR) << "Unable to get the pixel format for GL context."; ::ReleaseDC(g_window, intermediate_dc); ::DestroyWindow(g_window); ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), @@ -230,7 +234,7 @@ bool GLContext::InitializeOneOff() { } if (!::SetPixelFormat(intermediate_dc, g_regular_pixel_format, &kPixelFormatDescriptor)) { - DLOG(ERROR) << "Unable to set the pixel format for GL context."; + LOG(ERROR) << "Unable to set the pixel format for GL context."; ::ReleaseDC(g_window, intermediate_dc); ::DestroyWindow(g_window); ::UnregisterClass(reinterpret_cast<wchar_t*>(class_registration), @@ -295,8 +299,10 @@ bool GLContext::InitializeOneOff() { break; } case kGLImplementationEGLGLES2: - if (!BaseEGLContext::InitializeOneOff()) + if (!BaseEGLContext::InitializeOneOff()) { + LOG(ERROR) << "BaseEGLContext::InitializeOneOff failed."; return false; + } break; } @@ -313,24 +319,26 @@ bool NativeViewGLContext::Initialize(bool multisampled) { if (!SetPixelFormat(device_context_, pixel_format, &kPixelFormatDescriptor)) { - DLOG(ERROR) << "Unable to set the pixel format for GL context."; + LOG(ERROR) << "Unable to set the pixel format for GL context."; Destroy(); return false; } context_ = wglCreateContext(device_context_); if (!context_) { - DLOG(ERROR) << "Failed to create GL context."; + LOG(ERROR) << "Failed to create GL context."; Destroy(); return false; } if (!MakeCurrent()) { + LOG(ERROR) << "MakeCurrent failed."; Destroy(); return false; } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } @@ -356,7 +364,7 @@ bool NativeViewGLContext::MakeCurrent() { return true; } if (!wglMakeCurrent(device_context_, context_)) { - DLOG(ERROR) << "Unable to make gl context current."; + LOG(ERROR) << "Unable to make gl context current."; return false; } @@ -392,6 +400,7 @@ bool OSMesaViewGLContext::Initialize() { device_context_ = GetDC(window_); if (!osmesa_context_.Initialize(OSMESA_RGBA, NULL)) { + LOG(ERROR) << "OSMesaGLContext::Initialize failed."; Destroy(); return false; } @@ -524,21 +533,21 @@ bool PbufferGLContext::Initialize(GLContext* shared_context) { kNoAttributes); ::DeleteDC(display_device_context); if (!pbuffer_) { - DLOG(ERROR) << "Unable to create pbuffer."; + LOG(ERROR) << "Unable to create pbuffer."; Destroy(); return false; } device_context_ = wglGetPbufferDCARB(pbuffer_); if (!device_context_) { - DLOG(ERROR) << "Unable to get pbuffer device context."; + LOG(ERROR) << "Unable to get pbuffer device context."; Destroy(); return false; } context_ = wglCreateContext(device_context_); if (!context_) { - DLOG(ERROR) << "Failed to create GL context."; + LOG(ERROR) << "Failed to create GL context."; Destroy(); return false; } @@ -546,18 +555,20 @@ bool PbufferGLContext::Initialize(GLContext* shared_context) { if (shared_context) { if (!wglShareLists( static_cast<GLContextHandle>(shared_context->GetHandle()), context_)) { - DLOG(ERROR) << "Could not share GL contexts."; + LOG(ERROR) << "Could not share GL contexts."; Destroy(); return false; } } if (!MakeCurrent()) { + LOG(ERROR) << "MakeCurrent failed."; Destroy(); return false; } if (!InitializeCommon()) { + LOG(ERROR) << "GLContext::InitializeCommon failed."; Destroy(); return false; } @@ -587,7 +598,7 @@ bool PbufferGLContext::MakeCurrent() { return true; } if (!wglMakeCurrent(device_context_, context_)) { - DLOG(ERROR) << "Unable to make gl context current."; + LOG(ERROR) << "Unable to make gl context current."; return false; } diff --git a/app/gfx/gl/gl_implementation_linux.cc b/app/gfx/gl/gl_implementation_linux.cc index 765ed8a0..ddcecd8 100644 --- a/app/gfx/gl/gl_implementation_linux.cc +++ b/app/gfx/gl/gl_implementation_linux.cc @@ -40,8 +40,10 @@ bool InitializeGLBindings(GLImplementation implementation) { switch (implementation) { case kGLImplementationOSMesaGL: { FilePath module_path; - if (!PathService::Get(base::DIR_MODULE, &module_path)) + if (!PathService::Get(base::DIR_MODULE, &module_path)) { + LOG(ERROR) << "PathService::Get failed."; return false; + } base::NativeLibrary library = base::LoadNativeLibrary( module_path.Append("libosmesa.so")); @@ -67,7 +69,7 @@ bool InitializeGLBindings(GLImplementation implementation) { base::NativeLibrary library = base::LoadNativeLibrary( FilePath("libGL.so.1")); if (!library) { - DLOG(INFO) << "libGL.so.1 not found."; + LOG(ERROR) << "libGL.so.1 not found."; return false; } @@ -88,7 +90,7 @@ bool InitializeGLBindings(GLImplementation implementation) { base::NativeLibrary egl_library = base::LoadNativeLibrary( FilePath("libEGL.so")); if (!egl_library) { - DLOG(INFO) << "libEGL.so not found"; + DLOG(ERROR) << "libEGL.so not found"; return false; } @@ -101,7 +103,7 @@ bool InitializeGLBindings(GLImplementation implementation) { FilePath("libGLESv2.so")); if (!gles_library) { base::UnloadNativeLibrary(egl_library); - DLOG(INFO) << "libGLESv2.so not found"; + DLOG(ERROR) << "libGLESv2.so not found"; return false; } diff --git a/app/gfx/gl/gl_implementation_mac.cc b/app/gfx/gl/gl_implementation_mac.cc index 8776ab0..877ca38 100644 --- a/app/gfx/gl/gl_implementation_mac.cc +++ b/app/gfx/gl/gl_implementation_mac.cc @@ -26,14 +26,16 @@ bool InitializeGLBindings(GLImplementation implementation) { switch (implementation) { case kGLImplementationOSMesaGL: { FilePath module_path; - if (!PathService::Get(base::DIR_MODULE, &module_path)) + if (!PathService::Get(base::DIR_MODULE, &module_path)) { + LOG(ERROR) << "PathService::Get failed."; return false; + } // When using OSMesa, just use OSMesaGetProcAddress to find entry points. base::NativeLibrary library = base::LoadNativeLibrary( module_path.Append("libosmesa.dylib")); if (!library) { - LOG(INFO) << "libosmesa.so not found"; + DLOG(INFO) << "libosmesa.so not found"; return false; } @@ -54,7 +56,7 @@ bool InitializeGLBindings(GLImplementation implementation) { base::NativeLibrary library = base::LoadNativeLibrary( FilePath(kOpenGLFrameworkPath)); if (!library) { - LOG(INFO) << "OpenGL framework not found"; + LOG(ERROR) << "OpenGL framework not found"; return false; } diff --git a/app/gfx/gl/gl_implementation_win.cc b/app/gfx/gl/gl_implementation_win.cc index fee088b..ccc671c 100644 --- a/app/gfx/gl/gl_implementation_win.cc +++ b/app/gfx/gl/gl_implementation_win.cc @@ -37,13 +37,15 @@ bool InitializeGLBindings(GLImplementation implementation) { switch (implementation) { case kGLImplementationOSMesaGL: { FilePath module_path; - if (!PathService::Get(base::DIR_MODULE, &module_path)) + if (!PathService::Get(base::DIR_MODULE, &module_path)) { + LOG(ERROR) << "PathService::Get failed."; return false; + } base::NativeLibrary library = base::LoadNativeLibrary( module_path.Append(L"osmesa.dll")); if (!library) { - LOG(INFO) << "osmesa.dll not found"; + DLOG(INFO) << "osmesa.dll not found"; return false; } @@ -70,7 +72,7 @@ bool InitializeGLBindings(GLImplementation implementation) { base::NativeLibrary egl_library = base::LoadNativeLibrary( module_path.Append(L"libegl.dll")); if (!egl_library) { - LOG(INFO) << "libegl.dll not found."; + LOG(ERROR) << "libegl.dll not found."; return false; } |