def _VerifyGLBackend(self, gpu_info):
   # Verify that Chrome's GL backend matches if a specific one was requested
   if self._gl_backend:
     if (self._gl_backend == 'angle' and
         gpu_helper.GetANGLERenderer(gpu_info) == 'no_angle'):
       self.fail('requested GL backend (' + self._gl_backend + ')' +
                 ' had no effect on the browser: ' +
                 self._GetGPUInfoErrorString(gpu_info))
       return False
   return True
Exemplo n.º 2
0
    def GetPlatformTags(cls, browser):
        """This function will take a Browser instance as an argument.
    It will call the super classes implementation of GetPlatformTags() to get
    a list of tags. Then it will add the gpu vendor, gpu device id,
    angle renderer, and command line decoder tags to that list before
    returning it.
    """
        tags = super(GpuIntegrationTest, cls).GetPlatformTags(browser)
        system_info = browser.GetSystemInfo()
        if system_info:
            gpu_tags = []
            gpu_info = system_info.gpu
            # On the dual-GPU MacBook Pros, surface the tags of the secondary GPU if
            # it's the discrete GPU, so that test expectations can be written that
            # target the discrete GPU.
            gpu_tags.append(gpu_helper.GetANGLERenderer(gpu_info))
            gpu_tags.append(gpu_helper.GetSwiftShaderGLRenderer(gpu_info))
            gpu_tags.append(gpu_helper.GetCommandDecoder(gpu_info))
            if gpu_info and gpu_info.devices:
                for ii in xrange(0, len(gpu_info.devices)):
                    gpu_vendor = gpu_helper.GetGpuVendorString(gpu_info, ii)
                    gpu_device_id = gpu_helper.GetGpuDeviceId(gpu_info, ii)
                    # The gpu device id tag will contain both the vendor and device id
                    # separated by a '-'.
                    try:
                        # If the device id is an integer then it will be added as
                        # a hexadecimal to the tag
                        gpu_device_tag = '%s-0x%x' % (gpu_vendor,
                                                      gpu_device_id)
                    except TypeError:
                        # if the device id is not an integer it will be added as
                        # a string to the tag.
                        gpu_device_tag = '%s-%s' % (gpu_vendor, gpu_device_id)
                    if ii == 0 or gpu_vendor != 'intel':
                        gpu_tags.extend([gpu_vendor, gpu_device_tag])
            # all spaces and underscores in the tag will be replaced by dashes
            tags.extend([re.sub('[ _]', '-', tag) for tag in gpu_tags])

            # Add tags based on GPU feature status.
            skia_renderer = gpu_helper.GetSkiaRenderer(gpu_info.feature_status)
            tags.append(skia_renderer)
            use_vulkan = gpu_helper.GetVulkan(gpu_info.feature_status)
            tags.append(use_vulkan)

        # If additional options have been set via '--extra-browser-args' check for
        # those which map to expectation tags. The '_browser_backend' attribute may
        # not exist in unit tests.
        if hasattr(browser, 'startup_args'):
            use_gl = gpu_helper.GetGL(browser.startup_args)
            tags.append(use_gl)
            use_skia_dawn = gpu_helper.GetSkiaDawn(browser.startup_args)
            tags.append(use_skia_dawn)
        return tags
Exemplo n.º 3
0
    def GetPlatformTags(cls, browser):
        """This function will take a Browser instance as an argument.
    It will call the super classes implementation of GetPlatformTags() to get
    a list of tags. Then it will add the gpu vendor, gpu device id,
    angle renderer, and command line decoder tags to that list before
    returning it.
    """
        tags = super(GpuIntegrationTest, cls).GetPlatformTags(browser)
        system_info = browser.GetSystemInfo()
        if system_info:
            gpu_tags = []
            gpu_info = system_info.gpu
            # On the dual-GPU MacBook Pros, surface the tags of the secondary GPU if
            # it's the discrete GPU, so that test expectations can be written that
            # target the discrete GPU.
            gpu_tags.append(gpu_helper.GetANGLERenderer(gpu_info))
            gpu_tags.append(gpu_helper.GetSwiftShaderGLRenderer(gpu_info))
            gpu_tags.append(gpu_helper.GetCommandDecoder(gpu_info))
            gpu_tags.append(
                gpu_helper.GetOOPCanvasStatus(gpu_info.feature_status))
            if gpu_info and gpu_info.devices:
                for ii in range(0, len(gpu_info.devices)):
                    gpu_vendor = gpu_helper.GetGpuVendorString(gpu_info, ii)
                    gpu_device_id = gpu_helper.GetGpuDeviceId(gpu_info, ii)
                    # The gpu device id tag will contain both the vendor and device id
                    # separated by a '-'.
                    try:
                        # If the device id is an integer then it will be added as
                        # a hexadecimal to the tag
                        gpu_device_tag = '%s-0x%x' % (gpu_vendor,
                                                      gpu_device_id)
                    except TypeError:
                        # if the device id is not an integer it will be added as
                        # a string to the tag.
                        gpu_device_tag = '%s-%s' % (gpu_vendor, gpu_device_id)
                    if ii == 0 or gpu_vendor != 'intel':
                        gpu_tags.extend([gpu_vendor, gpu_device_tag])
            # all spaces and underscores in the tag will be replaced by dashes
            tags.extend([re.sub('[ _]', '-', tag) for tag in gpu_tags])

            # Add tags based on GPU feature status.
            startup_args = getattr(browser, 'startup_args', None)
            skia_renderer = gpu_helper.GetSkiaRenderer(gpu_info.feature_status,
                                                       startup_args)
            tags.append(skia_renderer)
        display_server = gpu_helper.GetDisplayServer(browser.browser_type)
        if display_server:
            tags.append(display_server)
        return tags
 def GetPlatformTags(cls, browser):
     """This function will take a Browser instance as an argument.
 It will call the super classes implementation of GetPlatformTags() to get
 a list of tags. Then it will add the gpu vendor, gpu device id,
 angle renderer, and command line decoder tags to that list before
 returning it.
 """
     tags = super(GpuIntegrationTest, cls).GetPlatformTags(browser)
     system_info = browser.GetSystemInfo()
     if system_info:
         gpu_info = system_info.gpu
         gpu_vendor = gpu_helper.GetGpuVendorString(gpu_info)
         gpu_device_id = gpu_helper.GetGpuDeviceId(gpu_info)
         # The gpu device id tag will contain both the vendor and device id
         # separated by a '-'.
         try:
             # If the device id is an integer then it will be added as
             # a hexadecimal to the tag
             gpu_device_tag = '%s-0x%x' % (gpu_vendor, gpu_device_id)
         except TypeError:
             # if the device id is not an integer it will be added as
             # a string to the tag.
             gpu_device_tag = '%s-%s' % (gpu_vendor, gpu_device_id)
         angle_renderer = gpu_helper.GetANGLERenderer(gpu_info)
         cmd_decoder = gpu_helper.GetCommandDecoder(gpu_info)
         # all spaces and underscores in the tag will be replaced by dashes
         tags.extend([
             re.sub('[ _]', '-', tag) for tag in
             [gpu_vendor, gpu_device_tag, angle_renderer, cmd_decoder]
         ])
     # If additional options have been set via '--extra-browser-args' check for
     # those which map to expectation tags. The '_browser_backend' attribute may
     # not exist in unit tests.
     if (hasattr(browser, '_browser_backend') and
             browser._browser_backend.browser_options.extra_browser_args):
         skia_renderer = gpu_helper.GetSkiaRenderer(\
             browser._browser_backend.browser_options.extra_browser_args)
         tags.extend([skia_renderer])
         use_gl = gpu_helper.GetGL(\
             browser._browser_backend.browser_options.extra_browser_args)
         tags.extend([use_gl])
         use_vulkan = gpu_helper.GetVulkan(\
             browser._browser_backend.browser_options.extra_browser_args)
         tags.extend([use_vulkan])
     return tags
Exemplo n.º 5
0
 def _VerifyANGLEBackend(self, gpu_info):
     if self._angle_backend:
         # GPU exepections use slightly different names for the angle backends
         # than the Chrome flags
         known_backend_flag_map = {
             'd3d11': 'd3d11',
             'd3d9': 'd3d9',
             'opengl': 'gl',
             'opengles': 'gles',
             'vulkan': 'vulkan',
         }
         current_angle_backend = gpu_helper.GetANGLERenderer(gpu_info)
         if (current_angle_backend not in known_backend_flag_map or
             known_backend_flag_map[current_angle_backend] != \
             self._angle_backend):
             self.fail('requested ANGLE backend (' + self._angle_backend +
                       ')' + ' had no effect on the browser: ' +
                       self._GetGPUInfoErrorString(gpu_info))
             return False
     return True
Exemplo n.º 6
0
 def _VerifyANGLEBackend(self, gpu_info):
     if self._angle_backend:
         # GPU exepections use slightly different names for the angle backends
         # than the Chrome flags
         known_backend_flag_map = {
             'd3d11': ['d3d11'],
             'd3d9': ['d3d9'],
             'opengl': ['gl'],
             'opengles': ['gles'],
             'vulkan': ['vulkan'],
             # Support setting VK_ICD_FILENAMES for swiftshader when requesting
             # the 'vulkan' backend.
             'swiftshader': ['swiftshader', 'vulkan'],
         }
         current_angle_backend = gpu_helper.GetANGLERenderer(gpu_info)
         if (current_angle_backend not in known_backend_flag_map or
             self._angle_backend not in \
               known_backend_flag_map[current_angle_backend]):
             self.fail('requested ANGLE backend (' + self._angle_backend +
                       ')' + ' had no effect on the browser: ' +
                       _GetGPUInfoErrorString(gpu_info))
             return False
     return True