ó ±2öYc@svddlZddlTddlZddlmZddlZddlZejj ƒZ dej fd„ƒYZ dS(iÿÿÿÿN(t*(tcommandst VideoPlugincBs}eZdZd„Zd„Zed„ƒZd„Zd„Zd„Z e dde ƒd „ƒZ e dƒed „ƒZRS( s? Plugin for tuning powersave options for some graphic cards. cCsvt|_tƒ|_tƒ|_xB|jjdƒjdƒjddƒD]}|jj |j ƒqIWt ƒ|_ dS(Ntdrmscard*tDEVTYPEt drm_minor( tTruet_devices_supportedtsett _free_devicest_assigned_devicest_hardware_inventoryt get_devicestmatch_sys_nametmatch_propertytaddtsys_nameRt_cmd(tselftdevice((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt _init_devicess    .cst‡fd†|ƒS(Ncsˆjjd|ƒS(NR(R t get_device(tx(R(s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyts(tmap(Rtdevices((Rs>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_get_device_objectsscCs idd6S(Ntradeon_powersave(tNone(R((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_get_config_optionsscCst|_t|_dS(N(tFalset_has_dynamic_tuningRt_has_static_tuning(Rtinstance((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_instance_init#s cCsdS(N((RR!((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_instance_cleanup'scCs%id|d6d|d6d|d6S(Ns%/sys/class/drm/%s/device/power_methodtmethods&/sys/class/drm/%s/device/power_profiletprofiles(/sys/class/drm/%s/device/power_dpm_statet dpm_state((RR((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_radeon_powersave_files*s  Rt per_devicecCst|j|ƒ}ttjdd|ƒƒjƒ}tjj|dƒsd|sdtj d|ƒdSnx |D]}|dkr¿|sl|j j |dd ƒr¼|j j |d |ƒr¼|Sqlqk|d krô|sl|j j |dd ƒrñd Sqlqk|dkrR|sl|t dƒ}|j j |ddƒrO|j j |d|ƒrO|Sqlqk|shtj dƒndSqkWdS(Ns#(\s*:\s*)|(\s+)|(\s*;\s*)|(\s*,\s*)t R$s)radeon_powersave is not supported on '%s'tdefaulttautotlowtmidthighR%tdynpms dpm-batterys dpm-balancedsdpm-performancesdpm-tdpmR&s$Invalid option for radeon_powersave.(sdefaultR+R,R-R.(s dpm-batterys dpm-balancedsdpm-performance(R'tstrtretsubtsplittostpathtexiststlogtwarnRRt write_to_filetlen(RtvalueRtsimt sys_filestvatvtstate((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_set_radeon_powersave1s4!       cCs™|j|ƒ}|jj|dd|ƒjƒ}|dkrW|jj|dƒjƒS|dkrg|S|dkr‘d|jj|dƒjƒSdSdS(NR$tno_errorR%R/R0sdpm-R&(R'Rt read_filetstripR(RRtignore_missingR>R$((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyt_get_radeon_powersavePs"   (t__name__t __module__t__doc__RRt classmethodRR"R#R't command_setRRBt command_getRRG(((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyR s     ( tbaset decoratorst tuned.logsttunedttuned.utils.commandsRR5R2tlogstgetR8tPluginR(((s>/usr/lib/python2.7/site-packages/tuned/plugins/plugin_video.pyts