Dark's Code Dump

Possibly useful

LG CX OLED ideal sharpness setting


For 4K HDMI resolution: (content resolution and PC mode do not matter):

  • Sharpness: 0
  • Super Resolution: Off

For other HDMI resolutions in PC mode: (NOT valid if you aren't truly in PC mode)

  • PC Mode: on
  • Sharpness: 0
  • Smooth Gradation: Should be greyed out, otherwise you aren't in PC mode
  • Super Resolution: Off

For other HDMI resolutions/refresh rates without PC mode, internal apps below 4K, or tuner below 4K:

  • Sharpness: 12
  • Super Resolution: Medium


The upscaler is not good - the areas that the 'AI' decides should be sharp suffer from moire and aliasing issues in motion. These settings aim to undo that.

0 sharpness passes through the image untouched, which would normally be desirable, but not when the upscaler has produced an image that is far from untouched.

10 sharpness applies an anti-aliasing filter, but does NOT apply any actual sharpening. Counter-intuitively, 10 sharpness is effectively softer than 0 sharpness.

Smooth Gradation set to Low adds additional softening and some debanding, so you may want it set, but I find the loss of noise and detail too unpleasant and instead keep it off.

Super Resolution applies more anti-aliasing and applies an intelligent madVR-like sharpening that, like madVR, even looks good on test patterns and extreme cases. It is one of the better settings to undo the damage from the upscaler - among other things, it picks up on the sharp point-sampled high-contrast areas and either blurs or AI-upsamples them, making the image more stable in motion and eye-pleasing.

The effect of Super Resolution is diminished until sharpness is raised above 10. 12 is a reasonable middle ground to get the super resolution effect without introducing traditional sharpness artifacts that exist in settings above 10.

PC mode applies a sane upscaling algorithm and effectively disables the AI upscaling. When PC mode is engaged (I believe only available for RGB inputs - even YUV444 forces it off), you can set the other settings as if the input were 4K, as the upscaling is already good. You can verify if PC mode is engaged properly as the settings for Noise Reduction and Smooth Gradation should be greyed out.

My target with these settings is to get upscaled inputs looking somewhere between trivial upscaling algorithms and madVR. Even text content being fed to the TV at 1080p/1440p looks better with these settings - they work for all cases.

Raspberry Pi 4 sucks for USB audio

I bought a Raspberry Pi 4 B under the impression that it was great for USB audio. It is sold as having hardware issues from previous versions fixed, relating to overlap between ethernet and USB.

However this couldn't be further from the truth! It has a little-known limit on the number of isochronous USB devices. It can run one, maybe two, 24bit 48khz streams before it falls over. Devices with many ports, such as audio interfaces or USB sound cards (e.g. Creative X-Fi HD USB), randomly fail to initialise properly (missing ports, USB errors in dmesg, etc.). I also was not able to get flawless audio out of a Musical Fidelity V90-DAC no matter what I did. You'd think UAC 1 audio would be impossible to mess up after 23 years...

Stick to x86 and/or proper USB implementations for any serious Linux audio work! I pulled out an old J1800 board (fanless x86), added a Renesas USB 3.0 PCI-e card, and all the intermittent audio issues I had been grappling with for months on ARM SBCs vanished instantly.

Signal backups using Linux headless server

I went deeper down the rabbit hole of Signal's lack of message backups on iOS, and discovered the Signal Desktop app works differently to WhatsApp - it does not require any connection to the phone, instead it syncs directly from the server. Using the desktop app you can achieve proper backups, however it requires near 24/7 uptime if you are a heavy user, as only the 1000 newest messages are cached on the server. Any messages beyond the buffer of 1000 while the desktop client is offline will never sync to it.

If you have a 24/7 non-headless machine with any OS, you have things way easier and you don't need this guide. (Just install Signal as normal and leave it running all the time.) I only have headless Linux servers running 24/7, so if that is you then read on.


My issues with Signal

Signal has taken the world by storm since WhatsApp introduced their latest round of anti-privacy changes. At face value, Signal seems great, but it has flaws that have me seriously considering whether the privacy aspect is worth it:


Disable KVM virtio memory balloon

How to make your VPS provider salty 101:

rmmod virtio_balloon 

Make it permanent with:

echo "blacklist virtio_balloon" > /etc/modprobe.d/balloon.conf

Nvidia driver 460.89 high csrss.exe CPU usage

460.89 drivers cause high CPU usage in csrss.exe (20x higher than before) when animated cursors are in use, as well as system-wide lag - mouse cursor on 120hz display feels like 60hz or less, Firefox scrolling very stuttery, etc. This may or may not only be the case when colour management is in use.

The previous 457.51 drivers (lacking the improved colour management options) do not exhibit the issue. Or if you are less attached to your cursor than I am, you could disable animated cursors.

Finding LVM LV affected by corruption

I have an SSD that is regularly developing bad sectors. (I'd happily buy a Samsung Enterprise sieve.) In this case the bad sectors are occurring on read, rather than on write, and the data contained on them is lost. The system is rock solid with server-grade components, ECC memory and BTRFS, so I have no doubt the issue is with the SSD, and that data is being lost. The easiest method to detect these is a long SMART self test, but that leaves me with an LBA number that is tricky to correlate to actual data, due to LVM abstracting the partition layout.

This article will focus on identifying which LV of an LVM setup is affected by the corruption.


AppArmor profile for TF2 SRCDS servers

With the recent high profile Team Fortress 2 source code leak, I considered it necessary to lock down my TF2 servers as much as possible. Below is the full AppArmor profile I used to protect srcds_linux.

Complications such as SourceMod and auto-update are supported. /YOUR-SRCDS-LOCATION/ should be updated as necessary. To support replays, add whatever folder(s) used for replays using the /** rwk suffix.

Read on for the full profile...

Unreported background battery drain on iPhone SE 2nd Gen

Ran into some strange background battery drain on an iPhone SE 2nd Generation - it was noticeably above room temperature at all times (but not warm/hot to the touch), indicating a lack of deep sleep, and the battery chart showed a continuous decline, even during periods of no notifications or screen use. Additionally I received notifications suspiciously quickly - within a second of the event occurring, rather than the usual 2-5.

I say 'unreported' in the title as there was absolutely no indication that background drain was taking place on the Battery screen, other than in the percentage chart. 'Screen Off' did not exceed 30 minutes per day, and most of that was believably attributed to WhatsApp. This led me to search for system services as a cause, specifically anything I may have done that is out of the ordinary that may cause a system service to go haywire.

Read on for the potential solutions...

Fix iTunes Wi-Fi sync to a libvirt Windows VM

Couldn't get iPhone to appear in iTunes via wi-fi sync on a Windows 10 virtual machine. Tried all the usual steps such as verifying they can ping each other, re-ticking 'sync with this iPhone over wi-fi', rebooting, terminating AppleMobileDeviceHelper, etc.

Read on for solution...