Files
sway-new-config/scripts/gpu/gpu-performance-mode.sh

60 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Force AMD GPU to high performance mode for gaming/benchmarking
# Find the AMD GPU card (not integrated graphics)
GPU_PATH=""
for card in /sys/class/drm/card[0-9]; do
if [ -f "$card/device/power_dpm_force_performance_level" ]; then
GPU_PATH="$card/device"
break
fi
done
if [ -z "$GPU_PATH" ]; then
echo "ERROR: Could not find AMD GPU!"
exit 1
fi
echo "Found GPU at: $GPU_PATH"
echo "=== AMD GPU Performance Mode Script ==="
echo ""
# Check current state
echo "Current settings:"
echo "Performance Level: $(cat $GPU_PATH/power_dpm_force_performance_level)"
echo ""
echo "Core Clock States:"
cat $GPU_PATH/pp_dpm_sclk
echo ""
echo "Memory Clock States:"
cat $GPU_PATH/pp_dpm_mclk
echo ""
# Force high performance
echo "Forcing high performance mode..."
echo "high" | sudo tee $GPU_PATH/power_dpm_force_performance_level
# Force highest clock states
echo "Forcing maximum clock states..."
echo "2" | sudo tee $GPU_PATH/pp_dpm_sclk
echo "3" | sudo tee $GPU_PATH/pp_dpm_mclk
echo ""
echo "=== New settings ==="
echo "Performance Level: $(cat $GPU_PATH/power_dpm_force_performance_level)"
echo ""
echo "Core Clock States:"
cat $GPU_PATH/pp_dpm_sclk
echo ""
echo "Memory Clock States:"
cat $GPU_PATH/pp_dpm_mclk
echo ""
echo "GPU should now run at maximum performance!"
echo "Run your benchmark now."
echo ""
echo "To revert to auto mode, run:"
echo "echo 'auto' | sudo tee $GPU_PATH/power_dpm_force_performance_level"