Commit 8680afd3 authored by Sunny Sachanandani's avatar Sunny Sachanandani Committed by Commit Bot

gpu: Make --disable-gpu-vsync work with direct composition

This broke because the direct composition path doesn't use swap interval
set by eglSwapInterval in ANGLE. Since we only care about disabling via
command line, it's ok to just handle that instead of SetSwapInterval.

This will still not work when we use a direct composition surface
instead of swap chain but that only happens when we use overlays. There
may be no way to make this case work since the swap chain is not
controlled by Chrome.

Tested with vsynctester.com on my home desktop.

R=kbr,piman
BUG=480361,787485

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ife5804b4e9bcede41bb29cd01e54e81f0d278b62
Reviewed-on: https://chromium-review.googlesource.com/954020Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541687}
parent cc9e1343
......@@ -19,6 +19,7 @@
#include "ui/gl/gl_angle_util_win.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/scoped_make_current.h"
#ifndef EGL_ANGLE_flexible_surface_compatibility
......@@ -49,7 +50,9 @@ DirectCompositionChildSurfaceWin::DirectCompositionChildSurfaceWin(
size_(size),
is_hdr_(is_hdr),
has_alpha_(has_alpha),
enable_dc_layers_(enable_dc_layers) {}
enable_dc_layers_(enable_dc_layers),
disable_vsync_(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableGpuVsync)) {}
DirectCompositionChildSurfaceWin::~DirectCompositionChildSurfaceWin() {
Destroy();
......@@ -151,7 +154,7 @@ void DirectCompositionChildSurfaceWin::ReleaseDrawTexture(bool will_discard) {
base::debug::Alias(&surface_size);
params.DirtyRectsCount = 1;
params.pDirtyRects = &dirty_rect;
swap_chain_->Present1(first_swap_ ? 0 : 1, 0, &params);
swap_chain_->Present1(first_swap_ || disable_vsync_ ? 0 : 1, 0, &params);
if (first_swap_) {
// Wait for the GPU to finish executing its commands before
// committing the DirectComposition tree, or else the swapchain
......
......@@ -71,6 +71,7 @@ class GPU_IPC_SERVICE_EXPORT DirectCompositionChildSurfaceWin
const bool is_hdr_;
const bool has_alpha_;
const bool enable_dc_layers_;
const bool disable_vsync_;
gfx::Rect swap_rect_;
gfx::Vector2d draw_offset_;
......
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