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
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