Commit f00bb721 authored by Zhenyao Mo's avatar Zhenyao Mo Committed by Commit Bot

Add trace test for DirectCompositionForceFullDamage enabled/disabled

BUG=1117185
TEST=added tests
R=sunnyps@chromium.org

Change-Id: I88464603eff831c991100ca7ee37cc7c555bb553
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368487
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801669}
parent 6012d7b2
<!DOCTYPE HTML>
<!-- READ BEFORE UPDATING:
If this test is updated make sure to increment the "revision" value of the
associated test in content/test/gpu/page_sets/pixel_tests.py. This will ensure
that the baseline images are regenerated on the next run.
-->
<html>
<head>
<meta name="viewport" content="initial-scale=1">
<title></title>
<style type="text/css">
.nomargin {
margin: 0px auto;
}
</style>
<script>
var g_swaps_before_success = 5
function waitForSwapsToComplete() {
g_swaps_before_success--;
if (g_swaps_before_success > 0) {
window.requestAnimationFrame(waitForSwapsToComplete);
} else {
domAutomationController.send("SUCCESS");
}
}
function main() {
window.requestAnimationFrame(waitForSwapsToComplete);
}
</script>
</head>
<body onload="main()">
</body>
</html>
...@@ -10,6 +10,8 @@ DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS =\ ...@@ -10,6 +10,8 @@ DISABLE_DEVICE_DISCOVERY_NOTIFICATIONS =\
'--disable-device-discovery-notifications' '--disable-device-discovery-notifications'
DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS = '--disable-domain-blocking-for-3d-apis' DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS = '--disable-domain-blocking-for-3d-apis'
DISABLE_FEATURES_D3D11_VIDEO_DECODER = '--disable-features=D3D11VideoDecoder' DISABLE_FEATURES_D3D11_VIDEO_DECODER = '--disable-features=D3D11VideoDecoder'
DISABLE_FORCE_FULL_DAMAGE =\
'--disable-features=DirectCompositionForceFullDamage'
DISABLE_GPU = '--disable-gpu' DISABLE_GPU = '--disable-gpu'
DISABLE_GPU_COMPOSITING = '--disable-gpu-compositing' DISABLE_GPU_COMPOSITING = '--disable-gpu-compositing'
DISABLE_GPU_PROCESS_CRASH_LIMIT = '--disable-gpu-process-crash-limit' DISABLE_GPU_PROCESS_CRASH_LIMIT = '--disable-gpu-process-crash-limit'
...@@ -19,6 +21,7 @@ DISABLE_SOFTWARE_RASTERIZER = '--disable-software-rasterizer' ...@@ -19,6 +21,7 @@ DISABLE_SOFTWARE_RASTERIZER = '--disable-software-rasterizer'
DISABLE_VP_SCALING = '--disable_vp_scaling=1' DISABLE_VP_SCALING = '--disable_vp_scaling=1'
ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES =\ ENABLE_EXPERIMENTAL_WEB_PLATFORM_FEATURES =\
'--enable-experimental-web-platform-features' '--enable-experimental-web-platform-features'
ENABLE_FORCE_FULL_DAMAGE = "--direct-composition-force-full-damage-for-testing"
ENABLE_GPU_BENCHMARKING = '--enable-gpu-benchmarking' ENABLE_GPU_BENCHMARKING = '--enable-gpu-benchmarking'
ENSURE_FORCED_COLOR_PROFILE = '--ensure-forced-color-profile' ENSURE_FORCED_COLOR_PROFILE = '--ensure-forced-color-profile'
FORCE_COLOR_PROFILE_SRGB = '--force-color-profile=srgb' FORCE_COLOR_PROFILE_SRGB = '--force-color-profile=srgb'
......
...@@ -799,3 +799,18 @@ class PixelTestPages(object): ...@@ -799,3 +799,18 @@ class PixelTestPages(object):
test_rect=[0, 0, 300, 300], test_rect=[0, 0, 300, 300],
browser_args=['--force-color-profile=hdr10']), browser_args=['--force-color-profile=hdr10']),
] ]
@staticmethod
def ForceFullDamagePages(base_name):
return [
PixelTestPage('wait_for_compositing.html',
base_name + '_ForceFullDamage',
test_rect=[0, 0, 0, 0],
other_args={'full_damage': True},
browser_args=[cba.ENABLE_FORCE_FULL_DAMAGE]),
PixelTestPage('wait_for_compositing.html',
base_name + '_ForcePartialDamage',
test_rect=[0, 0, 0, 0],
other_args={'full_damage': False},
browser_args=[cba.DISABLE_FORCE_FULL_DAMAGE]),
]
...@@ -85,6 +85,8 @@ _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED = -1 ...@@ -85,6 +85,8 @@ _SWAP_CHAIN_GET_FRAME_STATISTICS_MEDIA_FAILED = -1
_GET_STATISTICS_EVENT_NAME = 'GetFrameStatisticsMedia' _GET_STATISTICS_EVENT_NAME = 'GetFrameStatisticsMedia'
_SWAP_CHAIN_PRESENT_EVENT_NAME = 'SwapChain::Present' _SWAP_CHAIN_PRESENT_EVENT_NAME = 'SwapChain::Present'
_PRESENT_TO_SWAP_CHAIN_EVENT_NAME = 'SwapChainPresenter::PresentToSwapChain' _PRESENT_TO_SWAP_CHAIN_EVENT_NAME = 'SwapChainPresenter::PresentToSwapChain'
_PRESENT_MAIN_SWAP_CHAIN_EVENT_NAME =\
'DirectCompositionChildSurfaceWin::PresentSwapChain'
class _TraceTestArguments(object): class _TraceTestArguments(object):
...@@ -168,6 +170,15 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -168,6 +170,15 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
finish_js_condition='domAutomationController._finished', finish_js_condition='domAutomationController._finished',
success_eval_func='CheckOverlayMode', success_eval_func='CheckOverlayMode',
other_args=p.other_args)) other_args=p.other_args))
for p in namespace.ForceFullDamagePages('SwapChainTraceTest'):
yield (p.name, gpu_relative_path + p.url,
_TraceTestArguments(
browser_args=p.browser_args,
category='gpu',
test_harness_script=basic_test_harness_script,
finish_js_condition='domAutomationController._finished',
success_eval_func='CheckMainSwapChainPath',
other_args=p.other_args))
def RunActualGpuTest(self, test_path, *args): def RunActualGpuTest(self, test_path, *args):
test_params = args[0] test_params = args[0]
...@@ -445,8 +456,45 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest): ...@@ -445,8 +456,45 @@ class TraceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
if presentation_mode == 'swap chain': if presentation_mode == 'swap chain':
break break
else: else:
self.fail( self.fail('Events with name %s were not found' %
'Events with name %s were not found' % _SWAP_CHAIN_PRESENT_EVENT_NAME) _PRESENT_TO_SWAP_CHAIN_EVENT_NAME)
def _EvaluateSuccess_CheckMainSwapChainPath(self, category, event_iterator,
other_args):
"""Verified that Chrome's main swap chain is presented with full damage."""
os_name = self.browser.platform.GetOSName()
assert os_name and os_name.lower() == 'win'
overlay_bot_config = self.GetOverlayBotConfig()
if overlay_bot_config is None:
self.fail('Overlay bot config can not be determined')
assert overlay_bot_config.get('direct_composition', False)
expect_full_damage = other_args and other_args.get('full_damage', False)
partial_damage_encountered = False
full_damage_encountered = False
# Verify expectations through captured trace events.
for event in event_iterator:
if event.category != category:
continue
if event.name != _PRESENT_MAIN_SWAP_CHAIN_EVENT_NAME:
continue
dirty_rect = event.args.get('dirty_rect', None)
if dirty_rect is None:
continue
if dirty_rect == 'full_damage':
full_damage_encountered = True
else:
partial_damage_encountered = True
# Today Chrome either run with full damage or partial damage, but not both.
# This may change in the future.
if (expect_full_damage != full_damage_encountered
or expect_full_damage == partial_damage_encountered):
self.fail('Expected events with name %s of %s, got others' %
(_PRESENT_MAIN_SWAP_CHAIN_EVENT_NAME,
'full damage' if expect_full_damage else 'partial damage'))
@classmethod @classmethod
def ExpectationsFiles(cls): def ExpectationsFiles(cls):
......
...@@ -147,6 +147,11 @@ const char kDisableDirectCompositionVideoOverlays[] = ...@@ -147,6 +147,11 @@ const char kDisableDirectCompositionVideoOverlays[] =
// only used on Windows, as LUID is a Windows specific structure. // only used on Windows, as LUID is a Windows specific structure.
const char kUseAdapterLuid[] = "use-adapter-luid"; const char kUseAdapterLuid[] = "use-adapter-luid";
// Enable kDirectCompositionForceFullDamage feature regardless of overlay
// support.
const char kDirectCompositionForceFullDamageForTesting[] =
"direct-composition-force-full-damage-for-testing";
// This is the list of switches passed from this file that are passed from the // This is the list of switches passed from this file that are passed from the
// GpuProcessHost to the GPU Process. Add your switch to this list if you need // GpuProcessHost to the GPU Process. Add your switch to this list if you need
// to read it in the GPU process, else don't add it. // to read it in the GPU process, else don't add it.
...@@ -167,6 +172,7 @@ const char* const kGLSwitchesCopiedFromGpuProcessHost[] = { ...@@ -167,6 +172,7 @@ const char* const kGLSwitchesCopiedFromGpuProcessHost[] = {
kDisableDirectComposition, kDisableDirectComposition,
kEnableDirectCompositionVideoOverlays, kEnableDirectCompositionVideoOverlays,
kDisableDirectCompositionVideoOverlays, kDisableDirectCompositionVideoOverlays,
kDirectCompositionForceFullDamageForTesting,
}; };
const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches = const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches =
base::size(kGLSwitchesCopiedFromGpuProcessHost); base::size(kGLSwitchesCopiedFromGpuProcessHost);
......
...@@ -73,6 +73,8 @@ GL_EXPORT extern const char kEnableDirectCompositionVideoOverlays[]; ...@@ -73,6 +73,8 @@ GL_EXPORT extern const char kEnableDirectCompositionVideoOverlays[];
GL_EXPORT extern const char kDisableDirectCompositionVideoOverlays[]; GL_EXPORT extern const char kDisableDirectCompositionVideoOverlays[];
GL_EXPORT extern const char kUseAdapterLuid[]; GL_EXPORT extern const char kUseAdapterLuid[];
GL_EXPORT extern const char kDirectCompositionForceFullDamageForTesting[];
// These flags are used by the test harness code, not passed in by users. // These flags are used by the test harness code, not passed in by users.
GL_EXPORT extern const char kDisableGLDrawingForTests[]; GL_EXPORT extern const char kDisableGLDrawingForTests[];
GL_EXPORT extern const char kOverrideUseSoftwareGLForTests[]; GL_EXPORT extern const char kOverrideUseSoftwareGLForTests[];
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "ui/gl/gl_utils.h" #include "ui/gl/gl_utils.h"
#include "base/command_line.h"
#include "base/debug/alias.h" #include "base/debug/alias.h"
#include "base/logging.h" #include "base/logging.h"
#include "ui/gl/gl_bindings.h" #include "ui/gl/gl_bindings.h"
...@@ -119,6 +120,11 @@ UINT GetOverlaySupportFlags(DXGI_FORMAT format) { ...@@ -119,6 +120,11 @@ UINT GetOverlaySupportFlags(DXGI_FORMAT format) {
bool ShouldForceDirectCompositionRootSurfaceFullDamage() { bool ShouldForceDirectCompositionRootSurfaceFullDamage() {
static bool should_force = []() { static bool should_force = []() {
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (cmd_line->HasSwitch(
switches::kDirectCompositionForceFullDamageForTesting)) {
return true;
}
if (!base::FeatureList::IsEnabled( if (!base::FeatureList::IsEnabled(
features::kDirectCompositionForceFullDamage)) { features::kDirectCompositionForceFullDamage)) {
return false; return false;
......
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