Skip to content

KMS: incorrect gamma / overly bright image with 2 monitors #4676

@HiassofT

Description

@HiassofT

Describe the bug
When running kernel 5.10.76 on RPi4 with KMS and two HDMI monitors connected the gamma values seem to be completely off and the displayed image is overly bright and has wrong colors.

This doesn't happen with just a single HDMI monitor connected or when using kernel 5.10.75 or earlier.

To reproduce

  • boot RPiOS lite on RPi4 with 2 HDMI monitors connected
  • run modetest -s ... eg modetest -s 32:1920x1200-60

Expected behaviour
The test pattern is shown with correct colors:
single

Actual behaviour
The test pattern is shown with wrong colors:
dual

System
RPi4, initially reported and reproduced on LibreELEC but the same happens on RPi-OS, too. eg with current rpi-update kernel:

Linux raspberrypi 5.10.76-v7l+ #1477 SMP Tue Nov 2 13:20:53 GMT 2021 armv7l GNU/Linux
Nov  2 2021 13:22:15 
Copyright (c) 2012 Broadcom
version e50fe24ee2b6974f3ba6615ba0f1d8f45c485f69 (clean) (release) (start)

rpi-update kernel 992de83e0ea01a9765196349abb386c5c8ea8944 has this issue, too

Linux raspberrypi 5.10.76-v7l+ #1474 SMP Thu Oct 28 13:42:00 BST 2021 armv7l GNU/Linux
Oct 28 2021 14:14:14 
Copyright (c) 2012 Broadcom
version bcdfe55d56b75b4be52c10d73bdb4a60e2b49f75 (clean) (release) (start)

but c59a637736f579733dfed9c62235c180471bbcba is OK

Linux raspberrypi 5.10.75-v7l+ #1473 SMP Mon Oct 25 15:18:06 BST 2021 armv7l GNU/Linux
Oct 25 2021 14:59:11
Copyright (c) 2012 Broadcom
version f1b25b0ca39fec42e8590287ad12c23f821ad7fd (clean) (release) (start)

Additional context
With a single monitor connected hvs_gamma in debugfs looks OK:

HVS channel 0:
  red:
  00000000 00000100 - x 0, c 0, grad 256
  10001000 00000100 - x 256, c 4096, grad 256
  20002000 00000100 - x 512, c 8192, grad 256
  30003000 00000100 - x 768, c 12288, grad 256
  40004000 00000100 - x 1024, c 16384, grad 256
  50005000 00000100 - x 1280, c 20480, grad 256
  60006000 00000100 - x 1536, c 24576, grad 256
  70007000 00000100 - x 1792, c 28672, grad 256
  80008000 00000100 - x 2048, c 32768, grad 256
  90009000 00000100 - x 2304, c 36864, grad 256
  a000a000 00000100 - x 2560, c 40960, grad 256
  b000b000 00000100 - x 2816, c 45056, grad 256
  c000c000 00000100 - x 3072, c 49152, grad 256
  d000d000 00000100 - x 3328, c 53248, grad 256
  e000e000 00000100 - x 3584, c 57344, grad 256
  f000f000 00000100 - x 3840, c 61440, grad 256
  green:
  00000000 00000100 - x 0, c 0, grad 256
  10001000 00000100 - x 256, c 4096, grad 256
  20002000 00000100 - x 512, c 8192, grad 256
  30003000 00000100 - x 768, c 12288, grad 256
  40004000 00000100 - x 1024, c 16384, grad 256
  50005000 00000100 - x 1280, c 20480, grad 256
  60006000 00000100 - x 1536, c 24576, grad 256
  70007000 00000100 - x 1792, c 28672, grad 256
  80008000 00000100 - x 2048, c 32768, grad 256
  90009000 00000100 - x 2304, c 36864, grad 256
  a000a000 00000100 - x 2560, c 40960, grad 256
  b000b000 00000100 - x 2816, c 45056, grad 256
  c000c000 00000100 - x 3072, c 49152, grad 256
  d000d000 00000100 - x 3328, c 53248, grad 256
  e000e000 00000100 - x 3584, c 57344, grad 256
  f000f000 00000100 - x 3840, c 61440, grad 256
  blue:
  00000000 00000100 - x 0, c 0, grad 256
  10001000 00000100 - x 256, c 4096, grad 256
  20002000 00000100 - x 512, c 8192, grad 256
  30003000 00000100 - x 768, c 12288, grad 256
  40004000 00000100 - x 1024, c 16384, grad 256
  50005000 00000100 - x 1280, c 20480, grad 256
  60006000 00000100 - x 1536, c 24576, grad 256
  70007000 00000100 - x 1792, c 28672, grad 256
  80008000 00000100 - x 2048, c 32768, grad 256
  90009000 00000100 - x 2304, c 36864, grad 256
  a000a000 00000100 - x 2560, c 40960, grad 256
  b000b000 00000100 - x 2816, c 45056, grad 256
  c000c000 00000100 - x 3072, c 49152, grad 256
  d000d000 00000100 - x 3328, c 53248, grad 256
  e000e000 00000100 - x 3584, c 57344, grad 256
  f000f000 00000100 - x 3840, c 61440, grad 256
HVS channel 1: Channel disabled
HVS channel 2: Channel disabled

with two monitors the values in hvs_gamma look very odd

HVS channel 0:
  red:
  00000000 00000c23 - x 0, c 0, grad 3107
  01500fee 000006d7 - x 21, c 4078, grad 1751
  03a01fbf 0000042f - x 58, c 8127, grad 1071
  07802ff6 000002e8 - x 120, c 12278, grad 744
  0d003ff0 0000022e - x 208, c 16368, grad 558
  14504fe2 000001b8 - x 325, c 20450, grad 440
  1db05ffb 00000166 - x 475, c 24571, grad 358
  29206ffd 0000012c - x 658, c 28669, grad 300
  36c07ff4 00000100 - x 876, c 32756, grad 256
  46c08ff7 000000de - x 1132, c 36855, grad 222
  59309ffa 000000c3 - x 1427, c 40954, grad 195
  6e20aff6 000000ae - x 1762, c 45046, grad 174
  85c0bffd 0000009c - x 2140, c 49149, grad 156
  a000cff7 0000008d - x 2560, c 53239, grad 141
  bd20dffd 00000080 - x 3026, c 57341, grad 128
  dd10effb 00000075 - x 3537, c 61435, grad 117
  green:
  00000000 00000c23 - x 0, c 0, grad 3107
  01500fee 000006d7 - x 21, c 4078, grad 1751
  03a01fbf 0000042f - x 58, c 8127, grad 1071
  07802ff6 000002e8 - x 120, c 12278, grad 744
  0d003ff0 0000022e - x 208, c 16368, grad 558
  14504fe2 000001b8 - x 325, c 20450, grad 440
  1db05ffb 00000166 - x 475, c 24571, grad 358
  29206ffd 0000012c - x 658, c 28669, grad 300
  36c07ff4 00000100 - x 876, c 32756, grad 256
  46c08ff7 000000de - x 1132, c 36855, grad 222
  59309ffa 000000c3 - x 1427, c 40954, grad 195
  6e20aff6 000000ae - x 1762, c 45046, grad 174
  85c0bffd 0000009c - x 2140, c 49149, grad 156
  a000cff7 0000008d - x 2560, c 53239, grad 141
  bd20dffd 00000080 - x 3026, c 57341, grad 128
  dd10effb 00000075 - x 3537, c 61435, grad 117
  blue:
  00000000 00000c23 - x 0, c 0, grad 3107
  01500fee 000006d7 - x 21, c 4078, grad 1751
  03a01fbf 0000042f - x 58, c 8127, grad 1071
  07802ff6 000002e8 - x 120, c 12278, grad 744
  0d003ff0 0000022e - x 208, c 16368, grad 558
  14504fe2 000001b8 - x 325, c 20450, grad 440
  1db05ffb 00000166 - x 475, c 24571, grad 358
  29206ffd 0000012c - x 658, c 28669, grad 300
  36c07ff4 00000100 - x 876, c 32756, grad 256
  46c08ff7 000000de - x 1132, c 36855, grad 222
  59309ffa 000000c3 - x 1427, c 40954, grad 195
  6e20aff6 000000ae - x 1762, c 45046, grad 174
  85c0bffd 0000009c - x 2140, c 49149, grad 156
  a000cff7 0000008d - x 2560, c 53239, grad 141
  bd20dffd 00000080 - x 3026, c 57341, grad 128
  dd10effb 00000075 - x 3537, c 61435, grad 117
HVS channel 1:
  red:
  00000000 00000c23 - x 0, c 0, grad 3107
  01500fee 000006d7 - x 21, c 4078, grad 1751
  03a01fbf 0000042f - x 58, c 8127, grad 1071
  07802ff6 000002e8 - x 120, c 12278, grad 744
  0d003ff0 0000022e - x 208, c 16368, grad 558
  14504fe2 000001b8 - x 325, c 20450, grad 440
  1db05ffb 00000166 - x 475, c 24571, grad 358
  29206ffd 0000012c - x 658, c 28669, grad 300
  36c07ff4 00000100 - x 876, c 32756, grad 256
  46c08ff7 000000de - x 1132, c 36855, grad 222
  59309ffa 000000c3 - x 1427, c 40954, grad 195
  6e20aff6 000000ae - x 1762, c 45046, grad 174
  85c0bffd 0000009c - x 2140, c 49149, grad 156
  a000cff7 0000008d - x 2560, c 53239, grad 141
  bd20dffd 00000080 - x 3026, c 57341, grad 128
  dd10effb 00000075 - x 3537, c 61435, grad 117
  green:
  00000000 00000c23 - x 0, c 0, grad 3107
  01500fee 000006d7 - x 21, c 4078, grad 1751
  03a01fbf 0000042f - x 58, c 8127, grad 1071
  07802ff6 000002e8 - x 120, c 12278, grad 744
  0d003ff0 0000022e - x 208, c 16368, grad 558
  14504fe2 000001b8 - x 325, c 20450, grad 440
  1db05ffb 00000166 - x 475, c 24571, grad 358
  29206ffd 0000012c - x 658, c 28669, grad 300
  36c07ff4 00000100 - x 876, c 32756, grad 256
  46c08ff7 000000de - x 1132, c 36855, grad 222
  59309ffa 000000c3 - x 1427, c 40954, grad 195
  6e20aff6 000000ae - x 1762, c 45046, grad 174
  85c0bffd 0000009c - x 2140, c 49149, grad 156
  a000cff7 0000008d - x 2560, c 53239, grad 141
  bd20dffd 00000080 - x 3026, c 57341, grad 128
  dd10effb 00000075 - x 3537, c 61435, grad 117
  blue:
  00000000 00000c23 - x 0, c 0, grad 3107
  01500fee 000006d7 - x 21, c 4078, grad 1751
  03a01fbf 0000042f - x 58, c 8127, grad 1071
  07802ff6 000002e8 - x 120, c 12278, grad 744
  0d003ff0 0000022e - x 208, c 16368, grad 558
  14504fe2 000001b8 - x 325, c 20450, grad 440
  1db05ffb 00000166 - x 475, c 24571, grad 358
  29206ffd 0000012c - x 658, c 28669, grad 300
  36c07ff4 00000100 - x 876, c 32756, grad 256
  46c08ff7 000000de - x 1132, c 36855, grad 222
  59309ffa 000000c3 - x 1427, c 40954, grad 195
  6e20aff6 000000ae - x 1762, c 45046, grad 174
  85c0bffd 0000009c - x 2140, c 49149, grad 156
  a000cff7 0000008d - x 2560, c 53239, grad 141
  bd20dffd 00000080 - x 3026, c 57341, grad 128
  dd10effb 00000075 - x 3537, c 61435, grad 117
HVS channel 2: Channel disabled

ping @6by9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions