관리-도구
편집 파일: plugin_video.cpython-39.pyc
a ����,�g�����������������������@���s`���d�dl�mZ�d�dlT�ddlZddlmZ�ddlZddlZddl Z ej ���ZG�dd��dej �ZdS�)����)�base)�*�����N)�commandsc�����������������������s����e�Zd�ZdZ��fdd�Zdd��Zdd��Zedd ���Zd d��Z dd ��Z dd��Zddd�Ze ddd�dd���Zed�d dd��Ze ddd�dd���Zed�d!dd��Z���ZS�)"�VideoPluginaf�� Sets various power saving features on video cards. Radeon cards are supported. The powersave level can be specified by using the [option]`radeon_powersave` option. Supported values are: * `default` * `auto` * `low` * `mid` * `high` * `dynpm` * `dpm-battery` * `dpm-balanced` * `dpm-perfomance` For additional detail, see link:https://www.x.org/wiki/RadeonFeature/#kmspowermanagementoptions[KMS Power Management Options]. NOTE: This plug-in is experimental and the option might change in future releases. .Setting powersave level for the Radeon video card to high ==== ---- [video] radeon_powersave=high ---- ==== Mobile hardware with amdgpu driven eDP panels can be configured with the [option]`panel_power_savings` option. This accepts a value range from 0 to 4, where 4 is the highest power savings but will trade off color accuracy. c��������������������s���t�t|��j|i�|���d�S��N)�superr����__init__)�self�args�kwargs�� __class__���>/usr/lib/python3.9/site-packages/tuned/plugins/plugin_video.pyr ���/���s����zVideoPlugin.__init__c�����������������C���sn���d|�_�t��|�_t��|�_|�j�d��d�D�]8}|��|j�}|D�]"}t j �||��r<|�j�|j��q<q(t ��|�_d�S�)NT�drmzcard*-*)Z_devices_supported�setZ _free_devicesZ_assigned_devices�_hardware_inventoryZget_devicesZmatch_sys_name�_filesZsys_name�os�path�exists�addr����_cmd)r ����device�attrs�attrr���r���r���� _init_devices2���s����zVideoPlugin._init_devicesc��������������������s�����fdd�|D��S�)Nc��������������������s���g�|�]}��j��d�|��qS�)r���)r���Z get_device)�.0�x�r ���r���r���� <listcomp>@��������z3VideoPlugin._get_device_objects.<locals>.<listcomp>r���)r ���Zdevicesr���r ���r����_get_device_objects?���s����zVideoPlugin._get_device_objectsc�����������������C���s ���d�d�d�S�)N)�radeon_powersave�panel_power_savingsr���r ���r���r���r����_get_config_optionsB���s�����zVideoPlugin._get_config_optionsc�����������������C���s���d|_�d|_d�S�)NFT)Z_has_dynamic_tuningZ_has_static_tuning�r ����instancer���r���r����_instance_initI���s����zVideoPlugin._instance_initc�����������������C���s���d�S�r���r���r'���r���r���r����_instance_cleanupM���s����zVideoPlugin._instance_cleanupc�����������������C���s���d|�d|�d|�d|�d�S�)Nz%/sys/class/drm/%s/device/power_methodz&/sys/class/drm/%s/device/power_profilez(/sys/class/drm/%s/device/power_dpm_statez,/sys/class/drm/%s/amdgpu/panel_power_savings)�method�profile� dpm_stater%���r���)r ���r���r���r���r���r���P���s �����zVideoPlugin._filesFc�����������������C���s~���t�j�|��|�d��sdS�t|��||��}||krHt�d||f���|S�t�d||f���|sv|�j� |��|�d�|�rz|S�dS�)zTApply the target value to the panel_power_savings file if it doesn't already have itr%���Nz%panel_power_savings for %s already %sz%s panel_power_savings -> %s) r���r���r���r����int�_get_panel_power_savings�log�infor���� write_to_file)r ���r����targetr(����sim�currentr���r���r����apply_panel_power_saving_targetX���s���� �z+VideoPlugin.apply_panel_power_saving_targetr$���T)Z per_devicec����������� ������C���sr��|���|�}tt�dd|�����}tj�|d��sF|sFt� d|���d�S�|D��] }|dv�r�|s�|�j j|d�d|rvtj gndd�r�|�j j|d�||r�tj gndd�r�|��S�qJ|d kr�|s�|�j j|d�d |r�tj gndd�r��d S�qJ|d v��rV|�sl|td�d���} |�j j|d�d|�rtj gndd��rl|�j j|d �| |�rBtj gndd��rl|��S�qJ|�sft�d���d�S�qJd�S�)Nz#(\s*:\s*)|(\s+)|(\s*;\s*)|(\s*,\s*)� r+����)radeon_powersave is not supported on '%s')�default�autoZlowZmidZhighr,���F�Zno_error�dynpm)zdpm-batteryzdpm-balancedzdpm-performance�dpm-�dpmr-���z$Invalid option for radeon_powersave.)r����str�re�sub�splitr���r���r���r0����debugr���r2����errno�ENOENT�len�warning) r ����valuer���r(���r4����remove� sys_files�va�v�stater���r���r����_set_radeon_powersavem���sL���� ��� � ��� z!VideoPlugin._set_radeon_powersavec�����������������C���s����|���|�}tj�|d��s,t�d|���d�S�|�jj|d�|d����}|dkr`|�j�|d�����S�|dkrl|S�|dkr�d|�j�|d������S�d�S�d�S�) Nr+���r8���r;���r,���r<���r>���r=���r-���) r���r���r���r���r0���rC���r���� read_file�strip)r ���r���r(����ignore_missingrJ���r+���r���r���r����_get_radeon_powersave����s���� z!VideoPlugin._get_radeon_powersaver%���c�����������������C���sb���zt�|d�}W�n"�ty0���t�d|���Y�dS�0�|tdd�v�rP|��||||�S�t�d|���dS�)z!Set the panel_power_savings value� ���z(Invalid value %s for panel_power_savingsNr�������)r.���� ValueErrorr0���rG����ranger6���)r ���rH���r���r(���r4���rI���r���r���r����_set_panel_power_savings����s����z$VideoPlugin._set_panel_power_savingsc�����������������C���sJ���t�j�|��|�d��s(t�d|���dS�|��|�d�}|�jj||d����S�)z)Get the current panel_power_savings valuer%���z,panel_power_savings is not supported on '%s'Nr;���) r���r���r���r���r0���rC���r���rO���rP���)r ���r���r(���rQ����fnamer���r���r���r/�������s ����z$VideoPlugin._get_panel_power_savings)F)F)F)�__name__� __module__�__qualname__�__doc__r ���r���r#����classmethodr&���r)���r*���r���r6���Zcommand_setrN���Zcommand_getrR���rW���r/���� __classcell__r���r���r ���r���r������s$���# # r���)��r���Z decoratorsZ tuned.logsZtunedZtuned.utils.commandsr���r���rD���r@���Zlogs�getr0���ZPluginr���r���r���r���r����<module>���s���