summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 22:32:28 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 22:32:28 +0000
commitfd00eee5299661677c5af36e6c5285abfaae0ce0 (patch)
tree4da0a3dfb6ed1d7f6698ab332bcd624ca2e4f922 /gpu
parent22a60b85c702d1d8d71d1573705b76df14532328 (diff)
downloadchromium_src-fd00eee5299661677c5af36e6c5285abfaae0ce0.zip
chromium_src-fd00eee5299661677c5af36e6c5285abfaae0ce0.tar.gz
chromium_src-fd00eee5299661677c5af36e6c5285abfaae0ce0.tar.bz2
Windows: Synchronize browser process D3D adapters with GPU process D3D adapters.
Currently both processes use the primary D3D adapter. The primary D3D adapter can change, for example when the primary D3D adapter's monitor is disconnected. When this happens, the browser process can start using devices on a different adapter to the GPU process and texture sharing stops working, resulting in a black window. With this patch, the GPU process reports the LUID for the adapter it is using. Rather than using the primary adapter, the browser process decides which adapter to use by LUID. This depends on this ANGLE patch: https://codereview.appspot.com/9233044/ BUG=170875,236912 TEST=On a windows 7 machine, install an ATI GPU and an nVidia GPU with the nVidia as the primary one. Connect a monitor to each. Launch Chrome and go to a GPU accelerated page. Observe it work. Drag the window to the secondary display and disconnect the monitor from the primary (nVidia) GPU. The window should not turn black. Review URL: https://chromiumcodereview.appspot.com/14455011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/config/gpu_info.cc1
-rw-r--r--gpu/config/gpu_info.h7
-rw-r--r--gpu/config/gpu_info_collector_win.cc11
3 files changed, 19 insertions, 0 deletions
diff --git a/gpu/config/gpu_info.cc b/gpu/config/gpu_info.cc
index b8a9e3c..8c2f9cc 100644
--- a/gpu/config/gpu_info.cc
+++ b/gpu/config/gpu_info.cc
@@ -18,6 +18,7 @@ GPUInfo::GPUInfo()
optimus(false),
amd_switchable(false),
lenovo_dcute(false),
+ adapter_luid(0),
can_lose_context(false),
gpu_accessible(true),
software_rendering(false),
diff --git a/gpu/config/gpu_info.h b/gpu/config/gpu_info.h
index d589591..f8d9b60 100644
--- a/gpu/config/gpu_info.h
+++ b/gpu/config/gpu_info.h
@@ -69,6 +69,13 @@ struct GPU_EXPORT GPUInfo {
// Secondary GPUs, for example, the integrated GPU in a dual GPU machine.
std::vector<GPUDevice> secondary_gpus;
+ // On Windows, the unique identifier of the adapter the GPU process uses.
+ // The default is zero, which makes the browser process create its D3D device
+ // on the primary adapter. Note that the primary adapter can change at any
+ // time so it is better to specify a particular LUID. Note that valid LUIDs
+ // are always non-zero.
+ uint64 adapter_luid;
+
// The vendor of the graphics driver currently installed.
std::string driver_vendor;
diff --git a/gpu/config/gpu_info_collector_win.cc b/gpu/config/gpu_info_collector_win.cc
index 0b4e392..de96450 100644
--- a/gpu/config/gpu_info_collector_win.cc
+++ b/gpu/config/gpu_info_collector_win.cc
@@ -485,6 +485,7 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) {
int vertex_shader_minor_version = 0;
int pixel_shader_major_version = 0;
int pixel_shader_minor_version = 0;
+ gpu_info->adapter_luid = 0;
if (RE2::FullMatch(gpu_info->gl_renderer,
"ANGLE \\(.*\\)") &&
RE2::PartialMatch(gpu_info->gl_renderer,
@@ -508,6 +509,16 @@ bool CollectContextGraphicsInfo(GPUInfo* gpu_info) {
pixel_shader_major_version,
pixel_shader_minor_version);
+ // ANGLE's EGL vendor strings are of the form:
+ // Google, Inc. (adapter LUID: 0123456789ABCDEF)
+ // The LUID is optional and identifies the GPU adapter ANGLE is using.
+ const char* egl_vendor = eglQueryString(
+ gfx::GLSurfaceEGL::GetHardwareDisplay(),
+ EGL_VENDOR);
+ RE2::PartialMatch(egl_vendor,
+ " \\(adapter LUID: ([0-9A-Fa-f]{16})\\)",
+ RE2::Hex(&gpu_info->adapter_luid));
+
// DirectX diagnostics are collected asynchronously because it takes a
// couple of seconds. Do not mark gpu_info as complete until that is done.
gpu_info->finalized = false;