Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Last active January 19, 2020 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brainiarc7/ba998de74aec480c25dd16f064a6d413 to your computer and use it in GitHub Desktop.
Save Brainiarc7/ba998de74aec480c25dd16f064a6d413 to your computer and use it in GitHub Desktop.
Clevo P751DM2-G tuning for Ubuntu 16.04LTS+

Persistent configuration file entries for the Clevo P751DM2-G Linux environment:

Kernel options:

cat /proc/cmdline

BOOT_IMAGE=/boot/vmlinuz-4.16.12 root=UUID=fd81e4e1-0053-4f9b-bcd7-9cb9b5a5db16 ro nvidia-drm.modeset=1 elevator=deadline drm.debug=0xe psmouse.synaptics_intertouch=1 acpi_enforce_resources=lax iommu=pt intel_iommu=on acpi_osi=! acpi_osi=Windows 2009 quiet splash vt.handoff=7

Bash aliases:

less ~/.bash_aliases

alias nvGamingMode='nvidia-settings --assign "CurrentMetaMode=DPY-4: 2560x1080_200 @2560x1080 +0+0 {ViewPortIn=2560x1080, ViewPortOut=2560x1080+0+0}"'
alias nvDefaultDisplay='nvidia-settings --assign "CurrentMetaMode=DPY-1: 1920x1080_120 @1920x1080 +0+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}"'
alias nvProductionMode='nvidia-settings --assign "CurrentMetaMode=DPY-1: 1920x1080_120 @1920x1080 +2560+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0}, DPY-0: 3840x2160_60 @3840x2160 +4480+0 {ViewPortIn=3840x2160, ViewPortOut=3840x2160+0+0}, DPY-4: 2560x1080_200 @2560x1080 +0+0 {ViewPortIn=2560x1080, ViewPortOut=2560x1080+0+0}"'

Notes:

There are three bash aliases defined, with the following settings:

  1. nvGamingMode: This disables the laptop's inbuilt display and enables the Acer Z35-P's panel at full resolution (2560x1080), selecting a 200Hz refresh rate. This is needed because the display's EDID reports back 60Hz by default, and xrandr applies that. When gaming, its' best to override that artificial restriction.

  2. nvProductionMode: This allows the displays, namely the Acer Z35-P, the 4k Samsung 7000-series HDR+ panel, and the laptop's inbuilt display to operate simultaneously, while applying the correct refresh rates for all displays. The Z35-P is set as the primary display whereas the 4k Samsung 7000-series panel is used for monitoring dashboards only.

  3. nvDefaultDisplay: This is a fall-back to the laptop's primary display, needed when only the internal display is required. Selecting this activates a metamode which disables all connected displays, and activates the inbuilt panel ONLY at its' native refresh rate (120Hz).

Extraneous:

(a). Audio setup:

Ensure that /etc/pulse/daemon.conf is modified with the given preferences (with your preferred text editor):

(a). For 5.1 channel sound, set: default-sample-channels = 6

(b). Ensure that enable-lfe-remixing is set to yes.

(c ). The default channel map option for 5.1 audio should be set as:

front-left,front-right,lfe,front-center,rear-left,rear-right

Then create an audio firmware override file /lib/firmware/audio-jack-retask.fw populated as such:

[codec]
0x10ec0899 0x15587504 0

[pincfg]
0x11 0x4004d000
0x12 0x90a60140
0x14 0x90170110
0x15 0x411111f0
0x16 0x411111f0
0x17 0x01014010
0x18 0x01014011
0x19 0x411111f0
0x1a 0x01014012
0x1b 0x411111f0
0x1c 0x411111f0
0x1d 0x40350d29
0x1e 0x01441120
0x1f 0x411111f0

Create a module file that loads the audio firmware with the name /etc/modprobe.d/audio-jack-retask.conf file after setup populated as shown:

# Use this to override jack retasking
options snd-hda-intel patch=audio-jack-retask.fw

Extras:

To get the headphone jack to work, assuming you don't intend to use the surround sound option at all, create a new audio firmware override under /lib/firmware/headset-patch.fw with the content:

[codec]
0x10ec0899 0x15587504 0

[pincfg]
0x1b 0x01111060
0x19 0x23A11040

[verb]
0x1b 0x707 0x0004

Then create a module file that loads the audio firmware with the name /etc/modprobe.d/headset-patch.conf file after setup populated as shown:

# Use this to override jack retasking
options snd-hda-intel patch=headset-patch.fw

Then reboot the system. Confirming the successful override by running grep on dmesg on boot:

dmesg | grep audio-

Output:

[    5.183912] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'audio-jack-retask.fw'
[    5.184524] snd_hda_intel 0000:01:00.1: Applying patch firmware 'audio-jack-retask.fw'

Warning: Use only one override at a time. You can't have both :-)

Extra troubleshooting hints:

You can view sound card pin configurations by running:

sudo cat /sys/devices/pci0000:00/0000:00:1f.3/sound/card0/hwC0D0/init_pin_configs

You can use that to confirm that your desired pin configuration has been applied.

.Dealing with audio crackling(especially on high load):

The newer implementation of the PulseAudio sound server uses timer-based audio scheduling instead of the traditional, interrupt-driven approach.

Timer-based scheduling may expose issues in some ALSA drivers. On the other hand, other drivers might be glitchy without it on, so check to see what works on your system.

To turn timer-based scheduling off add tsched=0 in /etc/pulse/default.pa:

/etc/pulse/default.pa

load-module module-udev-detect tsched=0

Then restart the PulseAudio server:

 pulseaudio -k
 pulseaudio --start

Do the reverse to enable timer-based scheduling, if not already enabled by default.

If you are using Intel's IOMMU and experience glitches and/or skips, add intel_iommu=igfx_off to your kernel command line.

Default audio sink setting:

Run:

pacmd list-cards

To display the index of your cards. For example, my pci sound card is at index 2. The sound profile in my case is: "output:analog-surround-51+input:analog-stereo".

Add the following to /etc/pulse/default.pa :

##Set default audio sink:
set-card-profile 2 output:analog-surround-51+input:analog-stereo
set-default-sink 2

And reboot. This will apply the change permanently.

(b). Tuning that CPU in the BIOS:

Set all core clocks to 45x. Set AVX offset to 0 Set the rest to defaults, but enable Race To Halt. Offset voltage 110 Energy Efficient Turbo should be ON. PL1 is set to 110W PL2 is set to 150W Current limit is set to 8191

@cybik
Copy link

cybik commented May 30, 2019

Is your iommu config nuking the intel iGPU, or just allowing its forwarding straight into virtual machines? Just curious.

@Brainiarc7
Copy link
Author

@cybik this particular Clevo chassis ships with the IGP disabled, and only the NVIDIA GPU (with G-SYNC) is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment