예제 #1
0
    def verify_graphics_dvfs(self):
        """ On systems which support DVFS, check that we get into the lowest
        clock frequency; idle before doing so, and retry every second for 20
        seconds."""
        logging.info('Running verify_graphics_dvfs')
        if self._gpu_type == 'mali':
            if self._cpu_type == 'exynos5':
                node = '/sys/devices/11800000.mali/'
                enable_node = 'dvfs'
                enable_value = 'on'
            elif self._cpu_type == 'rockchip':
                node = '/sys/devices/ffa30000.gpu/'
                enable_node = 'dvfs_enable'
                enable_value = '1'
            else:
                logging.error('Error: Unknown CPU type (%s) for mali GPU.',
                              self._cpu_type)
                return 'Unknown CPU type for mali GPU. '

            clock_path = utils.locate_file('clock', node)
            enable_path = utils.locate_file(enable_node, node)
            freqs_path = utils.locate_file('available_frequencies', node)

            enable = utils.read_one_line(enable_path)
            logging.info('DVFS enable = %s', enable)
            if not enable == enable_value:
                logging.error('Error: DVFS is not enabled')
                return 'DVFS is not enabled. '

            # available_frequencies are always sorted in ascending order
            lowest_freq = int(utils.read_one_line(freqs_path))

            # daisy_* (exynos5250) boards set idle frequency to 266000000
            # See: crbug.com/467401 and crosbug.com/p/19710
            if self._board.startswith('daisy'):
                lowest_freq = 266000000

            logging.info('Expecting idle DVFS clock = %u', lowest_freq)

            tries = 0
            found = False
            while not found and tries < 80:
                time.sleep(0.25)
                clock = int(utils.read_one_line(clock_path))
                if clock <= lowest_freq:
                    logging.info('Found idle DVFS clock = %u', clock)
                    found = True
                    break

                tries += 1

            if not found:
                utils.log_process_activity()
                logging.error('Error: DVFS clock (%u) > min (%u)', clock,
                              lowest_freq)
                return 'Did not see the min DVFS clock. '

        return ''
예제 #2
0
    def verify_graphics_dvfs(self):
        """ On systems which support DVFS, check that we get into the lowest
        clock frequency; idle before doing so, and retry every second for 20
        seconds."""
        logging.info('Running verify_graphics_dvfs')

        exynos_node = '/sys/devices/11800000.mali/'
        rk3288_node = '/sys/devices/ffa30000.gpu/'
        rk3399_node = '/sys/devices/platform/ff9a0000.gpu/devfreq/ff9a0000.gpu/'
        mt8173_node = ('/sys/devices/soc/13000000.mfgsys-gpu/devfreq/'
                       '13000000.mfgsys-gpu/')

        if self._cpu_type == 'exynos5':
            if os.path.isdir(exynos_node):
                node = exynos_node
                use_devfreq = False
                enable_node = 'dvfs'
                enable_value = 'on'
            else:
                logging.error('Error: unknown exynos SoC.')
                return self.handle_error('Unknown exynos SoC.')
        elif self._cpu_type.startswith('rockchip'):
            if os.path.isdir(rk3288_node):
                node = rk3288_node
                use_devfreq = False
                enable_node = 'dvfs_enable'
                enable_value = '1'
            elif os.path.isdir(rk3399_node):
                node = rk3399_node
                use_devfreq = True
            else:
                logging.error('Error: unknown rockchip SoC.')
                return self.handle_error('Unknown rockchip SoC.')
        elif self._cpu_type == 'mediatek':
            if os.path.isdir(mt8173_node):
                node = mt8173_node
                use_devfreq = True
            else:
                logging.error('Error: unknown mediatek SoC.')
                return self.handle_error('Unknown mediatek SoC.')
        else:
            return ''

        if use_devfreq:
            governor_path = utils.locate_file('governor', node)
            clock_path = utils.locate_file('cur_freq', node)

            governor = utils.read_one_line(governor_path)
            logging.info('DVFS governor = %s', governor)
            if not governor == 'simple_ondemand':
                logging.error('Error: DVFS governor is not simple_ondemand.')
                return self.handle_error('Governor is wrong.')
        else:
            clock_path = utils.locate_file('clock', node)
            enable_path = utils.locate_file(enable_node, node)

            enable = utils.read_one_line(enable_path)
            logging.info('DVFS enable = %s', enable)
            if not enable == enable_value:
                return self.handle_error('DVFS is not enabled. ')

        freqs_path = utils.locate_file('available_frequencies', node)

        # available_frequencies are always sorted in ascending order
        # each line may contain one or multiple integers separated by spaces
        min_freq = int(utils.read_one_line(freqs_path).split()[0])

        # daisy_* (exynos5250) boards set idle frequency to 266000000
        # See: crbug.com/467401 and crosbug.com/p/19710
        if self._board.startswith('daisy'):
            min_freq = 266000000

        logging.info('Expecting idle DVFS clock = %u', min_freq)
        tries = 0
        found = False
        while not found and tries < 80:
            time.sleep(0.25)
            clock = int(utils.read_one_line(clock_path))
            if clock <= min_freq:
                logging.info('Found idle DVFS clock = %u', clock)
                found = True
                break

            tries += 1
        if not found:
            logging.error('Error: DVFS clock (%u) > min (%u)', clock, min_freq)
            return self.handle_error('Did not see the min DVFS clock. ',
                                     clock_path)
        return ''