Commit b5b9bfcc authored by apatrick@chromium.org's avatar apatrick@chromium.org

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
parent f011974d
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <stdlib.h> #include <stdlib.h>
#if defined(OS_WIN) #if defined(OS_WIN)
#include <dwmapi.h>
#include <windows.h> #include <windows.h>
#endif #endif
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
#include "ui/gl/gpu_switching_manager.h" #include "ui/gl/gpu_switching_manager.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "base/win/scoped_com_initializer.h" #include "base/win/scoped_com_initializer.h"
#include "content/common/gpu/media/dxva_video_decode_accelerator.h" #include "content/common/gpu/media/dxva_video_decode_accelerator.h"
#include "sandbox/win/src/sandbox.h" #include "sandbox/win/src/sandbox.h"
...@@ -375,6 +377,25 @@ bool WarmUpSandbox(const CommandLine& command_line) { ...@@ -375,6 +377,25 @@ bool WarmUpSandbox(const CommandLine& command_line) {
// Initialize H/W video decoding stuff which fails in the sandbox. // Initialize H/W video decoding stuff which fails in the sandbox.
DXVAVideoDecodeAccelerator::PreSandboxInitialization(); 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 #endif
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment