Skip to content

Instantly share code, notes, and snippets.

@jtl999
Last active December 17, 2022 11:01
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 jtl999/9e30067b1fd3e5bf37366e55a5248803 to your computer and use it in GitHub Desktop.
Save jtl999/9e30067b1fd3e5bf37366e55a5248803 to your computer and use it in GitHub Desktop.
amdgpu driver, question about temporal dithering.
Hello
I'm inquiring about the amdgpu driver and temporal dithering. Let me
give you a quick overview of the relevant parts of my setup.
Monitor: BenQ GW2760HS (27" VA panel, native 8-bit, no FRC) connected
via DVI
GPU: ASUS R9 270X
OS: Debian 8.x Jessie, also use Ubuntu MATE 16.04
It seems when using the above setup, despite the monitor being 8-bit I
notice on dark grey and gradient images that the pixels are unstable and
are "moving" with vertical banding, a telltale sign of dithering in my
experience.
I know there is supposedly a way to disable dithering on the older fglrx
driver. Unfortunately as fglrx doesn't work with the new Xorg ABI which
newer Linux distributions use I am unable to test it.
https://forums.guru3d.com/threads/how-to-disable-dithering-in-linux.387362/
I cloned the kernel source from this repository and edited some of the
dce_* files under drivers/gpu/drm/amd/amdgpu where it appears there are
case statements that control the dithering done by the GPU (just an
educated case), so said case statements do nothing instead of setting
dithering registers and managed to recompile the kernel. Unfortunately
that didn't seem to disable the temporal dithering so either I've
patched the wrong functions for my GPU or something else. Frankly I
wonder if AMD cards dither by default independent of the running
graphics driver as I think I saw the dithering when I was running Ubuntu
MATE on their grey colored boot screen (Plymouth).
I'll try and a get a microscope and/or hand lens to try and see the LCD
subpixels later.
https://i.ytimg.com/vi/fANsyzPcXyM/maxresdefault.jpg
```
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -467,28 +467,6 @@ static void dce_v6_0_program_fmt(struct drm_encoder
*encoder)
switch (bpc) {
- case 6:
- if (dither == AMDGPU_FMT_DITHER_ENABLE)
- /* XXX sort out optimal dither settings */
- tmp |=
(FMT_BIT_DEPTH_CONTROL__FMT_FRAME_RANDOM_ENABLE_MASK |
-
FMT_BIT_DEPTH_CONTROL__FMT_HIGHPASS_RANDOM_ENABLE_MASK |
-
FMT_BIT_DEPTH_CONTROL__FMT_SPATIAL_DITHER_EN_MASK);
- else
- tmp |= FMT_BIT_DEPTH_CONTROL__FMT_TRUNCATE_EN_MASK;
- break;
```
[sic]
```
default:
/* not needed */
break;
```
My next goal is to figure out how to do live kernel debugging with
another physical computer to see what functions are being hit in regards
to dithering and color depth (as I could have edited a function that's
not called in the case of the R9 270X I have).
I'm actually working on a similar project with Macbook Pro's, OSX and
dithering. I have 2x 2015 Macbook Pro's and are working on reverse
engineering the AMD driver KEXT'S to try and disable dithering on OSX as
it almost always happens with an external display. I have live debugging
setup with lldb over a LAN with one computer being the host and another
being the target, seems like that's not trivial to do under Linux.
I know the motherboard inside my desktop has several COM port headers so
I might be able to do kernel debugging of the GPU driver with the serial
port and another computer. Something to look into.
As for why I am doing this. First of all I am a photographer (one of
many hobbies) and like having accurate colors in my workflow, second of
all I used to get bad headaches from certain visual stimuli due to
nervous system issues. To keep a long story short I've largely gotten
that taken care of but I'm working on disabling dithering to ensure it's
not something contributing to eye fatiguing. Third of all, it's been an
interesting challenge for myself.
Many thanks
@shivamparashar165
Copy link

Had you found your solution?

@Karut
Copy link

Karut commented Dec 17, 2022

Any update on this?

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