def run_once(self):
     if utils.get_board() not in ['samus', 'gandof']:
         raise error.TestNAError(
             'Trying to run PSR tests on unsupported board.')
     psr_enabled = self._is_psr_enabled()
     if (not psr_enabled
             and graphics_utils.call_xrandr('--output eDP1 --set psr on')):
         error.TestFail('Unable to enable PSR via xrandr.')
     # Start chrome in full screen mode so that there is no blinking cursor
     # or ticking clock on the screen.
     with chrome.Chrome(logged_in=False, extra_browser_args=['--kiosk']):
         # Sample the PSR performance count from debugfs and wait for 20s.
         # At the end of 20s, re-sample the PSR performance count. The time
         # spent in PSR should be close to (20s - <vblankoffdelay>).
         sleep_time_milliseconds = 20 * 1000
         min_occupancy = 0.9 * (sleep_time_milliseconds -
                                self._get_vblank_timeout())
         perf_count_old = self._get_perf_count()
         time.sleep(sleep_time_milliseconds / 1000)
         perf_count_new = self._get_perf_count()
         occupancy_time = perf_count_new - perf_count_old
         if occupancy_time < min_occupancy:
             raise error.TestFail(
                 'PSR occupancy time %dms less than expected.' %
                 occupancy_time)
         # Disable PSR if it was not enabled to begin with.
         if (not psr_enabled and
                 graphics_utils.call_xrandr('--output eDP1 --set psr off')):
             raise error.TestWarn('Unable to disable PSR via xrandr.')
Пример #2
0
    def run_x(self):
        xrandr_output = graphics_utils.call_xrandr().split('\n')

        res = self.get_current_res(xrandr_output)
        if not res or not re.match(r'\d+x\d+$', res):
            raise error.TestFail('%s is not a valid resolution' % res)

        if self.is_lvds_res(res, xrandr_output) and \
           res not in _SUPPORTED_LVDS_RESOLUTIONS:
            raise error.TestFail(_LVDS_UNSUPPORTED_MESSAGE % res)
Пример #3
0
    def get_output_rect(self, output):
        """Gets the size and position of the given output on the screen buffer.

        @param output: The output name as a string.

        @return A tuple of the rectangle (width, height, fb_offset_x,
                fb_offset_y) of ints.
        """
        regexp = re.compile(
            r'^([-A-Za-z0-9]+)\s+connected\s+(\d+)x(\d+)\+(\d+)\+(\d+)', re.M)
        match = regexp.findall(graphics_utils.call_xrandr())
        for m in match:
            if m[0] == output:
                return (int(m[1]), int(m[2]), int(m[3]), int(m[4]))
        return (0, 0, 0, 0)