diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-07 02:09:07 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-07 02:09:07 +0000 |
commit | b5b9bfcc29a5f74fc940e7130fb57358b8dce876 (patch) | |
tree | d46d7a0c020a57a29106189cae2840d71542109f /content/gpu | |
parent | f011974db73540fd1c9713007ca60035fbf5990b (diff) | |
download | chromium_src-b5b9bfcc29a5f74fc940e7130fb57358b8dce876.zip chromium_src-b5b9bfcc29a5f74fc940e7130fb57358b8dce876.tar.gz chromium_src-b5b9bfcc29a5f74fc940e7130fb57358b8dce876.tar.bz2 |
Warm up DWM prior to lowering token.
DWM was introduced with Windows Vista. DwmFlush seems to be sufficient to warm it up before lowering the token. DWM is required to present to a window with Vista and later and this allows us to do so with the GPU process sandbox enabled.
Enabling the sandbox for this case is not in this patch. Other things are required, such as making the sandbox broker allow certain event objects to be opened from the GPU process.
Review URL: https://chromiumcodereview.appspot.com/23992006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221859 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/gpu')
-rw-r--r-- | content/gpu/gpu_main.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc index eeaa11b..da063d8 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc @@ -5,6 +5,7 @@ #include <stdlib.h> #if defined(OS_WIN) +#include <dwmapi.h> #include <windows.h> #endif @@ -35,6 +36,7 @@ #include "ui/gl/gpu_switching_manager.h" #if defined(OS_WIN) +#include "base/win/windows_version.h" #include "base/win/scoped_com_initializer.h" #include "content/common/gpu/media/dxva_video_decode_accelerator.h" #include "sandbox/win/src/sandbox.h" @@ -375,6 +377,25 @@ bool WarmUpSandbox(const CommandLine& command_line) { // Initialize H/W video decoding stuff which fails in the sandbox. DXVAVideoDecodeAccelerator::PreSandboxInitialization(); } + + { + TRACE_EVENT0("gpu", "Warm up DWM"); + + // DWM was introduced with Windows Vista. DwmFlush seems to be sufficient + // to warm it up before lowering the token. DWM is required to present to + // a window with Vista and later and this allows us to do so with the + // GPU process sandbox enabled. + if (base::win::GetVersion() >= base::win::VERSION_VISTA) { + HMODULE module = LoadLibrary(L"dwmapi.dll"); + if (module) { + typedef HRESULT (WINAPI *DwmFlushFunc)(); + DwmFlushFunc dwm_flush = reinterpret_cast<DwmFlushFunc>( + GetProcAddress(module, "DwmFlush")); + if (dwm_flush) + dwm_flush(); + } + } + } #endif return true; } |