# radeonkms - sometimes the colors are wrong when the screen unblanks



## tingo (Aug 2, 2019)

I wonder if anyone else has seen this bug: sometimes when the screen unblanks the colors are all wrong.
Examples of wrong colors:


			https://sites.google.com/site/tingox/wrong_colors_1_20190802_104530.jpg
		



			https://sites.google.com/site/tingox/wrong_colors_2_20190802_104539.jpg
		

normal colors for comparison:


			https://sites.google.com/site/tingox/normal_colors_1_20190802_114948.jpg
		



			https://sites.google.com/site/tingox/normal_colors_2_20190802_114959.jpg
		

apologies for the poor quality - pictures where taken with a mobile phone.
Also, they were too big to attach here, and I didn't want to resize them and make them even crappier.

Details - this workstation runs FreeBSD 11.3-release:

```
tingo@kg-core2$ freebsd-version -ku
11.3-RELEASE-p1
11.3-RELEASE-p1
```
kernel

```
tingo@kg-core2$ uname -a
FreeBSD kg-core2.kg4.no 11.3-RELEASE-p1 FreeBSD 11.3-RELEASE-p1 #0: Tue Jul 23 18:21:16 UTC 2019
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
the drm packages are

```
root@kg-core2# pkg info drm*
drm-fbsd11.2-kmod-4.11g20190424
drm-kmod-g20190710
```
the graphics card is a MSI R5 230 2GD3H LP, which is identified like this

```
root@kg-core2# pciconf -lv | grep -B 4 VGA
vgapci0@pci0:7:0:0:    class=0x030000 card=0x80991462 chip=0x677b1002 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Caicos PRO [Radeon HD 7450]'
    class      = display
    subclass   = VGA
```
when the bug appears the screen is unusable (too hard to read text), but if I wait until the screen blanks again and then press a key to unblank it the normal colors are back.
I see this bug on two different machines, connected to two different monitors (the other machine have a MSI Radeon R5 230 1GB DDR3 graphics card) so I don't think it is a hardware bug. It has happened for a while, both on FreeBSD 11.2 and 11.3, with several versions of drm-kmod.
Also:
- no messages related to this in logs
- if I take a screenshot when the wrong colors are showing, the screenshot shows normal colors

I tried looking for bugs related to this, but couldn't find any.


----------



## Phishfry (Aug 2, 2019)

tingo said:


> sometimes when the screen unblanks the colors are all wrong.


Possible Supend States?
Xfce Power Manager settings for system sleep mode??(Hibernate versus Suspend) ie. eliminate Suspend as culprit.

I am using laptops for my desktop env and I have been using stock Intel DRM driver with no issues on Xfce
Recently picked up a HP 8470p with Radeon and it seems fine too. Limited time with it though.


----------



## Phishfry (Aug 2, 2019)

I just checked my Radeon laptop with Suspend and Hibernate and it woke fine.


```
vgapci0@pci0:1:0:0:    class=0x030000 card=0x179d103c chip=0x68411002 rev=0x00 hdr=0x00
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Thames [Radeon HD 7550M/7570M/7650M]'
    class      = display
    subclass   = VGA
```
The Xfce Power Manager is not installed by default sysutils/xfce4-power-manager


----------



## tingo (Aug 3, 2019)

Well, no Xfce Power Manager installed here. These are the xfce4* packages installed

```
root@kg-core2# pkg info xfce4*
xfce4-appfinder-4.12.0_1
xfce4-conf-4.12.1
xfce4-cpugraph-plugin-1.1.0
xfce4-datetime-plugin-0.7.0
xfce4-desktop-4.12.5
xfce4-mixer-4.11.0_4
xfce4-netload-plugin-1.3.1
xfce4-notifyd-0.4.4
xfce4-panel-4.12.2
xfce4-screenshooter-plugin-1.9.5
xfce4-session-4.12.1_6
xfce4-settings-4.12.4_3
xfce4-systemload-plugin-1.2.2_1
xfce4-terminal-0.8.8
xfce4-tumbler-0.2.6
xfce4-weather-plugin-0.9.1
xfce4-wm-4.12.5_1
```
and (for good measure) this is what xset reports

```
tingo@kg-core2$ xset q
Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000002
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    on     02: Scroll Lock: off
    03: Shift Lock:  off    04: Group 2:     off    05: Mouse Keys:  off
  auto repeat delay:  500    repeat rate:  20
  auto repeating keys:  00feffffdffffbbf
                        fadfffffffdfe5ef
                        ffffffffffffffff
                        ffffffffffffffff
  bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
  acceleration:  2/1    threshold:  4
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  600    cycle:  600
Colors:
  default colormap:  0x20    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
  /usr/local/share/fonts/misc/,/usr/local/share/fonts/TTF/,/usr/local/share/fonts/OTF/,/usr/local/share/fonts/100dpi/,/usr/local/share/fonts/75dpi/,built-ins
DPMS (Energy Star):
  Standby: 600    Suspend: 600    Off: 600
  DPMS is Enabled
  Monitor is On
Font cache:
  Server does not have the FontCache Extension
```


----------



## tingo (Sep 6, 2019)

Since this is a workstation, I don't use suspend / hibernate, the only thing that happens is that DPMS turns off the monitor.
Anyway, updated packages, problem remains. Relevant packages

```
root@kg-core2# pkg info drm* gpu*
drm-fbsd11.2-kmod-4.11g20190806
drm-kmod-g20190710
gpu-firmware-kmod-g20190825
```


----------



## Phishfry (Sep 7, 2019)

Sounds similar to these:




__





						98832 – Distorted colours after suspend / resume cycle
					






					bugs.freedesktop.org
				







__





						Bug #1643843 “Distorted colours after suspend / resume cycle” : Bugs : linux-lts-xenial package : Ubuntu
					

When waking up the system from a suspend-resume cycle, the display most times shows distorted colours. As a workaround one can switch to the linux console (VT) and back to fix the display. Alternatively triggering DPMS also fixes the problem (xset dpms force off ; sleep 0.1; xset dpms force on)...




					bugs.launchpad.net
				




Any messages in logs like this:
*ERROR* Could not force DPM to low




__





						76130 – Radeon HD 4570 set dpm state fails after suspend
					






					bugs.freedesktop.org
				




Alot of these problems seem to be based around 'Display Port' monitor connections. What are you using?
UEFI or Legacy BIOS? VT or SC ?




__





						234760 – graphics/drm-fbsd12.0-kmod crash with AMD A10-7890K
					






					bugs.freebsd.org


----------



## tingo (Sep 8, 2019)

- no error messages like the one you have shown in any logs, in fact no  error messages related to DPM at all.
- the machine uses the VGA connector output

```
tingo@kg-core2$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
HDMI-1 disconnected (normal left inverted right x axis y axis)
DVI-D-1 disconnected (normal left inverted right x axis y axis)
VGA-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 298mm
   1920x1080     60.00*+
   1680x1050     59.95
   1400x1050     74.76    59.98
   1600x900      60.00
   1280x1024     75.02    60.02
   1280x960      60.00
   1280x800      59.81
   1152x864      75.00
   1280x720      60.00
   1024x768      75.05    60.04    75.03    70.07    60.00
   960x720       75.00    60.00
   928x696       75.00    60.05
   896x672       75.05    60.01
   832x624       74.55
   800x600       75.00    70.00    65.00    60.00    72.19    75.00    60.32    56.25
   700x525       74.76    59.98
   640x512       75.02    60.02
   640x480       60.00    75.00    72.81    75.00    59.94
   720x400       70.08
   576x432       75.00
   512x384       75.03    70.07    60.00
   416x312       74.66
   400x300       72.19    75.12    60.32    56.34
   320x240       72.81    75.00    60.05
```
- UEFI

```
root@kg-core2# efibootmgr
BootCurrent: 0001
Timeout : 1 seconds
BootOrder : 0001, 0002, 0004
Boot0004* Hard Drive BBS(HD,,0x0)
Boot0002* UEFI OS HD(4,GPT,ca7624c9-6c2a-11e9-9be5-b42e991fc5a7,0x8664028,0x64000)/File(\EFI\BOOT\BOOTX64.EFI)
                      ada0p4:/EFI/BOOT/BOOTX64.EFI (null)
Boot0001* UEFI OS HD(1,GPT,689dead3-5e35-11e9-9582-b42e991fc5a7,0x28,0x64000)/File(\EFI\BOOT\BOOTX64.EFI)
                      ada0p1:/EFI/BOOT/BOOTX64.EFI (null)
```
- and VT

```
root@kg-core2# dmesg | grep vga
VT(vga): resolution 640x480
vtvga0: <VT VGA driver> on motherboard
vgapci0: <VGA-compatible display> port 0xe000-0xe0ff mem 0xe0000000-0xefffffff,0xfce20000-0xfce3ffff irq 54 at device 0.0 on pci7
vgapci0: Boot video device
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
VT: Replacing driver "vga" with new "fb".
VT(vga): resolution 640x480
vtvga0: <VT VGA driver> on motherboard
vgapci0: <VGA-compatible display> port 0xe000-0xe0ff mem 0xe0000000-0xefffffff,0xfce20000-0xfce3ffff irq 54 at device 0.0 on pci7
vgapci0: Boot video device
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
VT: Replacing driver "vga" with new "fb".
```
I'll try that xset force off trick next time


----------



## tingo (Sep 11, 2019)

Colors were wrong again this morning. Luckily, I had prepared a terminal window (when colors are wrong text in terminal windows is unreadable too). This workaround

```
tingo@kg-core2$  xset dpms force off ; sleep 0.1; xset dpms force on
tingo@kg-core2$  xset dpms force off ; sleep 0.1; xset dpms force on
```
got the colors back - no need to wait for automatic DPMS to kick in.


----------



## tingo (Dec 4, 2019)

I haven't seen this bug for a while, but this evening it happened again (and was fixed in the usual way).
Packages

```
root@kg-core2# pkg info drm* gpu*
drm-fbsd11.2-kmod-4.11g20190906
drm-kmod-g20190710
gpu-firmware-kmod-g20191015
```
OS version

```
root@kg-core2# uname -a
FreeBSD kg-core2.kg4.no 11.3-RELEASE-p3 FreeBSD 11.3-RELEASE-p3 #0: Mon Aug 19 21:08:43 UTC 2019     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
nothing more to say.


----------



## userxbw (Dec 5, 2019)

I got 12.1 p1 on this laptop and noticed this strange imaging . I am in Linux right now so I got no means to mess with it, but def posting to get back to this to see if it has something I an use to fix it.

Graphics Card [AMD/ATI] Seymour [Radeon HD 6400M/7400M Series]


----------



## tingo (Mar 28, 2020)

I installed the latest drm* packages yesterday,

```
drm-fbsd11.2-kmod-4.11g20200320
drm-kmod-g20190710
drm_info-2.2.0
gpu-firmware-kmod-g20200130
xorg-server-1.20.7_2,1
```
I also did a freebsd-update, and rebooted the machine. Now it is running:

```
root@kg-core2# freebsd-version -ku
11.3-RELEASE-p7
11.3-RELEASE-p7
root@kg-core2# uname -a
FreeBSD kg-core2.kg4.no 11.3-RELEASE-p7 FreeBSD 11.3-RELEASE-p7 #0: Tue Mar 17 08:32:23 UTC 2020     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```
The machine hasn't been up for 24 hours yet, and I've seen several "wrong colors" incidents already. That's unusual. But there is more, this time I also have error messages in /var/log/messages:

```
Mar 27 23:36:38 kg-core2 kernel: [drm:btc_dpm_set_power_state] rv770_restrict_performance_levels_before_switch failed
Mar 28 03:53:02 kg-core2 kernel: [drm:btc_dpm_set_power_state] rv770_restrict_performance_levels_before_switch failed
Mar 28 10:13:22 kg-core2 syslogd: last message repeated 1 times
Mar 28 10:50:42 kg-core2 syslogd: last message repeated 1 times
```
That's new.


----------



## tingo (Jun 20, 2020)

yesterday, the machine got upgraded to

```
root@kg-core2# freebsd-version -ku
11.3-RELEASE-p10
11.3-RELEASE-p10
```
relevant packages are

```
root@kg-core2# pkg info xorg-s*
xorg-server-1.20.8_2,1
root@kg-core2# pkg info drm-f* drm-k*
drm-fbsd11.2-kmod-4.11g20200420
drm-kmod-g20190710
```
So far one "wrong color" incident - nothing in logs.


----------

