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

Unified Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 1384233003: Improve usefulness of webglcontextcreationerror statusMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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: content/renderer/renderer_blink_platform_impl.cc
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index 9da0779e3e3309e6ce6441910692dfea95ee39d8..0112acb63e10750e4061b8e86d43bcfaa32f2d6d 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -976,43 +976,70 @@ RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D(
return createOffscreenGraphicsContext3D(attributes, share_context, NULL);
}
+static void collectGpuInformationOnFailure(
+ GpuChannelHost* host,
+ blink::WebGraphicsContext3D* share_context,
+ blink::WebGraphicsContext3D::WebGraphicsContext3DInfo* gl_info) {
+ if (!gl_info)
+ return;
+ std::string errorMessage("OffscreenContext Creation failed, ");
+ if (!host) {
+ errorMessage.append("GpuChannelHost creation failed");
+ gl_info->errorMessage = WebString::fromUTF8(errorMessage);
+ return;
+ }
+ if (!share_context) {
+ errorMessage.append("WebGraphicsContext3D shared context is NULL");
+ gl_info->errorMessage = WebString::fromUTF8(errorMessage);
+ }
+ const gpu::GPUInfo& gpu_info = host->gpu_info();
+ gl_info->vendorId = gpu_info.gpu.vendor_id;
+ gl_info->deviceId = gpu_info.gpu.device_id;
+ switch (gpu_info.context_info_state) {
+ case gpu::kCollectInfoSuccess:
+ case gpu::kCollectInfoNonFatalFailure:
+ gl_info->rendererInfo = WebString::fromUTF8(gpu_info.gl_renderer);
+ gl_info->vendorInfo = WebString::fromUTF8(gpu_info.gl_vendor);
+ gl_info->driverVersion = WebString::fromUTF8(gpu_info.driver_version);
+ gl_info->resetNotificationStrategy =
+ gpu_info.gl_reset_notification_strategy;
+ gl_info->sandboxed = gpu_info.sandboxed;
+ gl_info->processCrashCount = gpu_info.process_crash_count;
+ if (gpu_info.display_link_version.IsValid())
+ gl_info->displayLinkVersion =
+ WebString::fromUTF8(gpu_info.display_link_version.GetString());
+ gl_info->lenovoDcute = gpu_info.lenovo_dcute;
+ gl_info->amdSwitchable = gpu_info.amd_switchable;
+ gl_info->optimus = gpu_info.optimus;
+ break;
+ case gpu::kCollectInfoFatalFailure:
+ case gpu::kCollectInfoNone:
+ errorMessage.append(
+ "Failed to collect gpu information, GLSurface or GLContext "
+ "creation "
+ "failed");
Ken Russell (switch to Gerrit) 2015/10/12 23:52:42 Please combine this and the previous line.
sivag 2015/10/15 17:16:38 Done.
+ gl_info->errorMessage = WebString::fromUTF8(errorMessage);
+ break;
+ default:
+ NOTREACHED();
+ }
+}
+
blink::WebGraphicsContext3D*
RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D(
const blink::WebGraphicsContext3D::Attributes& attributes,
blink::WebGraphicsContext3D* share_context,
- blink::WebGLInfo* gl_info) {
- if (!RenderThreadImpl::current())
+ blink::WebGraphicsContext3D::WebGraphicsContext3DInfo* gl_info) {
+ if (!RenderThreadImpl::current()) {
+ std::string errorMessage("Failed to run in Current RenderThreadImpl");
+ gl_info->errorMessage = WebString::fromUTF8(errorMessage);
return NULL;
+ }
scoped_refptr<GpuChannelHost> gpu_channel_host(
RenderThreadImpl::current()->EstablishGpuChannelSync(
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE));
- if (gpu_channel_host.get() && gl_info) {
- const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info();
- switch (gpu_info.context_info_state) {
- case gpu::kCollectInfoSuccess:
- case gpu::kCollectInfoNonFatalFailure:
- gl_info->vendorInfo.assign(
- blink::WebString::fromUTF8(gpu_info.gl_vendor));
- gl_info->rendererInfo.assign(
- blink::WebString::fromUTF8(gpu_info.gl_renderer));
- gl_info->driverVersion.assign(
- blink::WebString::fromUTF8(gpu_info.driver_version));
- gl_info->vendorId = gpu_info.gpu.vendor_id;
- gl_info->deviceId = gpu_info.gpu.device_id;
- break;
- case gpu::kCollectInfoFatalFailure:
- case gpu::kCollectInfoNone:
- gl_info->contextInfoCollectionFailure.assign(blink::WebString::fromUTF8(
- "GPUInfoCollectionFailure: GPU initialization Failed. GPU "
- "Info not Collected."));
- break;
- default:
- NOTREACHED();
- }
- }
-
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
bool lose_context_when_out_of_memory = false;
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
@@ -1026,8 +1053,12 @@ RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D(
// Most likely the GPU process exited and the attempt to reconnect to it
// failed. Need to try to restore the context again later.
- if (!context || !context->InitializeOnCurrentThread())
- return NULL;
+ if (!context || !context->InitializeOnCurrentThread() ||
+ gl_info->testFailContext) {
+ collectGpuInformationOnFailure(gpu_channel_host.get(), share_context,
+ gl_info);
+ return NULL;
+ }
return context.release();
}

Powered by Google App Engine
This is Rietveld 408576698