Ejemplo n.º 1
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_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 in the tag will be replaced by '-', and all letters will
         # be converted to its lower case form.
         tags.extend([
             tag.lower().replace(' ', '-') for tag in
             [gpu_vendor, gpu_device_tag, angle_renderer, cmd_decoder]
         ])
     return tags
Ejemplo 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
Ejemplo 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 _VerifyCommandDecoder(self, gpu_info):
   if self._command_decoder:
     # GPU exepections use slightly different names for the command decoders
     # than the Chrome flags
     known_command_decoder_flag_map = {
         'passthrough': 'passthrough',
         'no_passthrough': 'validating',
     }
     current_command_decoder = gpu_helper.GetCommandDecoder(gpu_info)
     if (current_command_decoder not in known_command_decoder_flag_map or
         known_command_decoder_flag_map[current_command_decoder] != \
         self._command_decoder):
       self.fail('requested command decoder (' + self._command_decoder + ')' +
                 ' had no effect on the browser: ' +
                 _GetGPUInfoErrorString(gpu_info))
       return False
   return True
Ejemplo n.º 5
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_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