content/test/gpu/gpu_tests/trace_integration_test.py
def _GetVideoExpectations(self, other_args):
    """Helper for creating expectations for CheckVideoPath and CheckOverlayMode.

    Args:
      other_args: The |other_args| arg passed into the test.

    Returns:
      A _VideoExpectations instance with zero_copy, pixel_format, no_overlay,
      and presentation_mode filled in.
    """
    overlay_bot_config = self._GetAndAssertOverlayBotConfig()
    expected = _VideoExpectations()
    expected.zero_copy = other_args.get('zero_copy', None)
    expected.pixel_format = other_args.get('pixel_format', None)
    expected.no_overlay = other_args.get('no_overlay', False)
    video_is_rotated = other_args.get('video_is_rotated', False)
    video_is_not_scaled = other_args.get('full_size', False)

    if overlay_bot_config.get('supports_overlays', False):
      supports_hw_nv12_overlays = overlay_bot_config[
          'nv12_overlay_support'] in ['DIRECT', 'SCALING']
      supports_hw_yuy2_overlays = overlay_bot_config[
          'yuy2_overlay_support'] in ['DIRECT', 'SCALING']
      supports_sw_nv12_overlays = overlay_bot_config[
          'nv12_overlay_support'] == 'SOFTWARE'

      if expected.pixel_format is None:
        if supports_hw_nv12_overlays:
          expected.pixel_format = 'NV12'
        elif supports_hw_yuy2_overlays:
          expected.pixel_format = 'YUY2'
        else:
          assert supports_sw_nv12_overlays
          expected.pixel_format = 'BGRA'
      else:
        if (not supports_hw_nv12_overlays and not supports_hw_yuy2_overlays):
          expected.pixel_format = 'BGRA'

      gpu = self.browser.GetSystemInfo().gpu.devices[0]
      supports_rotated_video_overlays = (
          gpu.vendor_id == 0x1002 and
          gpu.device_id in _SUPPORTED_WIN_AMD_GPUS_WITH_NV12_ROTATED_OVERLAYS)

      supports_downscaled_overlay_promotion = gpu.vendor_id != 0x8086
      no_issue_with_downscaled_overlay_promotion = (
          video_is_not_scaled or supports_downscaled_overlay_promotion)

      if (((supports_hw_nv12_overlays and expected.pixel_format == 'NV12')
           or supports_hw_yuy2_overlays)
          and (not video_is_rotated or supports_rotated_video_overlays)):
        expected.presentation_mode = 'OVERLAY'
      else:
        expected.presentation_mode = 'COMPOSED'

      if expected.zero_copy is None:
        # TODO(sunnyps): Check for overlay scaling support after making the same
        # change in SwapChainPresenter.
        expected.zero_copy = (expected.presentation_mode == 'OVERLAY'
                              and expected.pixel_format == 'NV12'
                              and supports_hw_nv12_overlays
                              and no_issue_with_downscaled_overlay_promotion
                              and not video_is_rotated)

    return expected
Helper for creating expectations for CheckVideoPath and CheckOverlayMode.

    Args:
      other_args: The |other_args| arg passed into the test.

    Returns:
      A _VideoExpectations instance with zero_copy, pixel_format, no_overlay,
      and presentation_mode filled in.
    
Helper for creating expectations for CheckVideoPath and CheckOverlayMode.
Helper for creating expectations for CheckVideoPath and CheckOverlayMode .
def _GetVideoExpectations(self, other_args):
    overlay_bot_config = self._GetAndAssertOverlayBotConfig()
    expected = _VideoExpectations()
    expected.zero_copy = other_args.get('zero_copy', None)
    expected.pixel_format = other_args.get('pixel_format', None)
    expected.no_overlay = other_args.get('no_overlay', False)
    video_is_rotated = other_args.get('video_is_rotated', False)
    video_is_not_scaled = other_args.get('full_size', False)
    if overlay_bot_config.get('supports_overlays', False):
      supports_hw_nv12_overlays = overlay_bot_config[
          'nv12_overlay_support'] in ['DIRECT', 'SCALING']
      supports_hw_yuy2_overlays = overlay_bot_config[
          'yuy2_overlay_support'] in ['DIRECT', 'SCALING']
      supports_sw_nv12_overlays = overlay_bot_config[
          'nv12_overlay_support'] == 'SOFTWARE'
      if expected.pixel_format is None:
        if supports_hw_nv12_overlays:
          expected.pixel_format = 'NV12'
        elif supports_hw_yuy2_overlays:
          expected.pixel_format = 'YUY2'
        else:
          assert supports_sw_nv12_overlays
          expected.pixel_format = 'BGRA'
      else:
        if (not supports_hw_nv12_overlays and not supports_hw_yuy2_overlays):
          expected.pixel_format = 'BGRA'
      gpu = self.browser.GetSystemInfo().gpu.devices[0]
      supports_rotated_video_overlays = (
          gpu.vendor_id == 0x1002 and
          gpu.device_id in _SUPPORTED_WIN_AMD_GPUS_WITH_NV12_ROTATED_OVERLAYS)
      supports_downscaled_overlay_promotion = gpu.vendor_id != 0x8086
      no_issue_with_downscaled_overlay_promotion = (
          video_is_not_scaled or supports_downscaled_overlay_promotion)
      if (((supports_hw_nv12_overlays and expected.pixel_format == 'NV12')
           or supports_hw_yuy2_overlays)
          and (not video_is_rotated or supports_rotated_video_overlays)):
        expected.presentation_mode = 'OVERLAY'
      else:
        expected.presentation_mode = 'COMPOSED'
      if expected.zero_copy is None:
        expected.zero_copy = (expected.presentation_mode == 'OVERLAY'
                              and expected.pixel_format == 'NV12'
                              and supports_hw_nv12_overlays
                              and no_issue_with_downscaled_overlay_promotion
                              and not video_is_rotated)
    return expected
def _GetVideoExpectations ( self , other_args ) : overlay_bot_config = self . _GetAndAssertOverlayBotConfig ( ) expected = _VideoExpectations ( ) expected . zero_copy = other_args . get ( 'zero_copy' , None ) expected . pixel_format = other_args . get ( 'pixel_format' , None ) expected . no_overlay = other_args . get ( 'no_overlay' , False ) video_is_rotated = other_args . get ( 'video_is_rotated' , False ) video_is_not_scaled = other_args . get ( 'full_size' , False ) if overlay_bot_config . get ( 'supports_overlays' , False ) : supports_hw_nv12_overlays = overlay_bot_config [ 'nv12_overlay_support' ] in [ 'DIRECT' , 'SCALING' ] supports_hw_yuy2_overlays = overlay_bot_config [ 'yuy2_overlay_support' ] in [ 'DIRECT' , 'SCALING' ] supports_sw_nv12_overlays = overlay_bot_config [ 'nv12_overlay_support' ] == 'SOFTWARE' if expected . pixel_format is None : if supports_hw_nv12_overlays : expected . pixel_format = 'NV12' elif supports_hw_yuy2_overlays : expected . pixel_format = 'YUY2' else : assert supports_sw_nv12_overlays expected . pixel_format = 'BGRA' else : if ( not supports_hw_nv12_overlays and not supports_hw_yuy2_overlays ) : expected . pixel_format = 'BGRA' gpu = self . browser . GetSystemInfo ( ) . gpu . devices [ 0 ] supports_rotated_video_overlays = ( gpu . vendor_id == 0x1002 and gpu . device_id in _SUPPORTED_WIN_AMD_GPUS_WITH_NV12_ROTATED_OVERLAYS ) supports_downscaled_overlay_promotion = gpu . vendor_id != 0x8086 no_issue_with_downscaled_overlay_promotion = ( video_is_not_scaled or supports_downscaled_overlay_promotion ) if ( ( ( supports_hw_nv12_overlays and expected . pixel_format == 'NV12' ) or supports_hw_yuy2_overlays ) and ( not video_is_rotated or supports_rotated_video_overlays ) ) : expected . presentation_mode = 'OVERLAY' else : expected . presentation_mode = 'COMPOSED' if expected . zero_copy is None : expected . zero_copy = ( expected . presentation_mode == 'OVERLAY' and expected . pixel_format == 'NV12' and supports_hw_nv12_overlays and no_issue_with_downscaled_overlay_promotion and not video_is_rotated ) return expected
Helper for creating expectations for CheckVideoPath and CheckOverlayMode.
Helper for creating expectations for CheckVideoPath and CheckOverlayMode .
"""Helper for creating expectations for CheckVideoPath and CheckOverlayMode.

    Args:
      other_args: The |other_args| arg passed into the test.

    Returns:
      A _VideoExpectations instance with zero_copy, pixel_format, no_overlay,
      and presentation_mode filled in.
    """ # TODO(sunnyps): Check for overlay scaling support after making the same # change in SwapChainPresenter.
A _VideoExpectations instance with zero_copy, pixel_format, no_overlay,
and presentation_mode filled in.
A _VideoExpectations instance with zero_copy pixel_format no_overlay and presentation_mode filled in .
self
other_args
The |other_args| arg passed into the test.
The |other_args| arg passed into the test .