File: //lib/python3.12/site-packages/tuned/plugins/__pycache__/plugin_video.cpython-312.pyc
�
�]�i� � � � d dl mZ d dl� ddlZddlmZ ddlZddlZddl Z ej j � Z G d� dej � Zy)� )�base)�*� N)�commandsc �� � � e Zd ZdZ� fd�Zd� Zd� Zed� � Zd� Z d� Z
d� Zdd �Z e
d
d�� d
� � Z ed
� dd�� Z e
dd�� d� � Z ed� dd�� Z� xZS )�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 �, �� t t | �
|i |�� y �N)�superr �__init__)�self�args�kwargs� __class__s ��?/usr/lib/python3.12/site-packages/tuned/plugins/plugin_video.pyr zVideoPlugin.__init__/ s �� ���T�#�T�4�V�4� c � � d| _ t � | _ t � | _ | j j d� j
d� D ]l }| j |j � }|D ]J }t j j || � s�&| j j |j � �L �n t � | _ y )NT�drmzcard*-*)�_devices_supported�set�
_free_devices�_assigned_devices�_hardware_inventory�get_devices�match_sys_name�_files�sys_name�os�path�exists�addr �_cmd)r
�device�attrs�attrs r �
_init_deviceszVideoPlugin._init_devices2 s� � � �$���u�$���5�$�� �(�(�4�4�U�;�J�J�9�U�f��;�;�v���'�5��t� �w�w�~�~�e�D�k�"� �����F�O�O�,� � V�
�j�$�)r c �` � |D �cg c] }| j j d|� �� c}S c c}w )Nr )r �
get_device)r
�devices�xs r �_get_device_objectszVideoPlugin._get_device_objects? s- � �AH� I��A�$�
"�
"�
-�
-�e�Q�
7�� I�I�� Is �#+c � � d d d�S )N)�radeon_powersave�panel_power_savings� )r
s r �_get_config_optionszVideoPlugin._get_config_optionsB s � � ��
� r c � � d|_ d|_ y )NFT)�_has_dynamic_tuning�_has_static_tuning�r
�instances r �_instance_initzVideoPlugin._instance_initI s � �!&�(�� $�(�r c � � y r
r/ r4 s r �_instance_cleanupzVideoPlugin._instance_cleanupM s � �r c �( � d|z d|z d|z d|z 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# s r r zVideoPlugin._filesP s, � �5��>�6��?�:�V�C�H�6�Q�
� r c �z � t j j | j |� d � syt | j ||� � }||k( rt j d|�d|��� |S t j |�d|��� |s.| j j | j |� d |� r|S y)zTApply the target value to the panel_power_savings file if it doesn't already have itr. Nzpanel_power_savings for z already z panel_power_savings -> )
r r r r �int�_get_panel_power_savings�log�infor"