drm/i915: Program LUT before intel_color_commit() if LUT was not previously set v2
Subsystems (3)
PATCH 1/1 drm/i915: Program LUT before intel_color_commit() if LUT was not previously set v2
Since commit 051a6d8d3ca0 ("drm/i915: Move LUT programming to happen after vblank waits"), I am seeing an ugly colored flash of the first few display lines on 2 Cherry Trail devices when the gamma table gets set for the first time. A blue flash on a GPD win and a yellow flash on an Asus T100HA.
The problem is that since this change, the LUT is programmed after the write *and latching* of the double-buffered register which causes the LUT to be used starting at the next frame. This means that the old LUT is still used for the first couple of lines of the display. If no LUT was in use before then the LUT registers may contain bogus values. This leads to messed up colors until the new LUT values are written. At least on CHT DSI panels this causes messed up colors on the first few lines.
This commit fixes this by adding a load_lut_before_commit boolean, modifying commit_pipe_config() to load the luts earlier if this is set. and setting this from intel_color_check when enabling gamma (rather then updating an existing gamma table).
Changes in v2:
-Simply check for setting load_lut_before_commit to:
if (!old_crtc_state->gamma_enable && new_crtc_state->gamma_enable)
--- drivers/gpu/drm/i915/display/intel_color.c | 14 ++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 6 +++++- drivers/gpu/drm/i915/display/intel_display_types.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_color.c +14 -0
@@ -1063,6 +1063,8 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state)intel_atomic_get_old_crtc_state (state, crtc);struct intel_plane *plane; + new_crtc_state->load_lut_before_commit = false; +if (!new_crtc_state->base.active ||drm_atomic_crtc_needs_modeset (&new_crtc_state->base))return 0 ;
@@ -1071,6 +1073,18 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state) new_crtc_state->csc_enable == old_crtc_state->csc_enable)return 0 ; +/* +* Normally we load the LUTs after vblank / after the double-buffer +* registers written by commit have been latched, this avoids a +* gamma change mid-way the screen. This does mean that the first +* few lines of the display will (sometimes) still use the old +* table. This is fine when changing an existing LUT, but if this +* is the first time the LUT gets loaded, then the hw may contain +* random values, causing the first lines to have funky colors. +*/ +if (!old_crtc_state->gamma_enable && new_crtc_state->gamma_enable) + new_crtc_state->load_lut_before_commit = true; +for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) {struct intel_plane_state *plane_state;
drivers/gpu/drm/i915/display/intel_display.c +5 -1
@@ -14168,8 +14168,11 @@ static void commit_pipe_config(struct intel_atomic_state *state,*/ if (!modeset) {if (new_crtc_state->base.color_mgmt_changed || - new_crtc_state->update_pipe) + new_crtc_state->update_pipe) { +if (new_crtc_state->load_lut_before_commit) +intel_color_load_luts (new_crtc_state);intel_color_commit (new_crtc_state); + }if (INTEL_GEN (dev_priv) >=9 )skl_detach_scalers (new_crtc_state);
@@ -14717,6 +14720,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) {if (new_crtc_state->base.active && !needs_modeset (new_crtc_state) && + !new_crtc_state->load_lut_before_commit && (new_crtc_state->base.color_mgmt_changed || new_crtc_state->update_pipe))intel_color_load_luts (new_crtc_state);
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
@@ -990,6 +990,9 @@ struct intel_crtc_state {/* enable pipe csc? */ bool csc_enable; +/* load luts before color settings commit */ +bool load_lut_before_commit; +/* Display Stream compression state */ struct {bool compression_enable;
Signature · 6 lines
2.23.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915: Program LUT before intel_color_commit() if LUT was not previously set (rev2)
== Series Details ==
== Series Details ==
Series: drm/i915: Program LUT before intel_color_commit() if LUT was not previously set (rev2)
URL : https://patchwork.freedesktop.org/series/68278/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7205 -> Patchwork_15032
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_15032 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_15032, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_15032:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live_blt:
- fi-kbl-soraka: [PASS][1] -> [TIMEOUT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-kbl-soraka/igt@i915_selftest@live_blt.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-kbl-soraka/igt@i915_selftest@live_blt.html
- fi-kbl-8809g: [PASS][3] -> [TIMEOUT][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-kbl-8809g/igt@i915_selftest@live_blt.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-kbl-8809g/igt@i915_selftest@live_blt.html
- fi-apl-guc: [PASS][5] -> [TIMEOUT][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-apl-guc/igt@i915_selftest@live_blt.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-apl-guc/igt@i915_selftest@live_blt.html
- fi-skl-6770hq: [PASS][7] -> [TIMEOUT][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-skl-6770hq/igt@i915_selftest@live_blt.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-skl-6770hq/igt@i915_selftest@live_blt.html
- fi-cfl-8109u: [PASS][9] -> [TIMEOUT][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-cfl-8109u/igt@i915_selftest@live_blt.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-cfl-8109u/igt@i915_selftest@live_blt.html
- fi-skl-guc: [PASS][11] -> [TIMEOUT][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-skl-guc/igt@i915_selftest@live_blt.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-skl-guc/igt@i915_selftest@live_blt.html
- fi-cfl-guc: [PASS][13] -> [TIMEOUT][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-cfl-guc/igt@i915_selftest@live_blt.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-cfl-guc/igt@i915_selftest@live_blt.html
* igt@runner@aborted:
- fi-cfl-8109u: NOTRUN -> [FAIL][15]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-cfl-8109u/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [FAIL][16]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-kbl-soraka/igt@[email protected]
- fi-kbl-8809g: NOTRUN -> [FAIL][17]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-kbl-8809g/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_15032 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_switch@legacy-render:
- fi-icl-u2: [PASS][18] -> [INCOMPLETE][19] ([fdo#107713] / [fdo#111381])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-icl-u2/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-icl-u2/igt@[email protected]
* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: [PASS][20] -> [DMESG-WARN][21] ([fdo#102614])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-hsw-peppy/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-hsw-peppy/igt@[email protected]
* igt@vgem_basic@setversion:
- fi-icl-u3: [PASS][22] -> [DMESG-WARN][23] ([fdo#107724]) +1 similar issue
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-icl-u3/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-icl-u3/igt@[email protected]
#### Possible fixes ####
* igt@gem_ctx_switch@legacy-render:
- fi-bxt-dsi: [INCOMPLETE][24] ([fdo#103927] / [fdo#111381]) -> [PASS][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-bxt-dsi/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-bxt-dsi/igt@[email protected]
* igt@gem_exec_reloc@basic-gtt-read:
- fi-icl-u3: [DMESG-WARN][26] ([fdo#107724]) -> [PASS][27] +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-icl-u3/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-icl-u3/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-glk-dsi: [TIMEOUT][28] -> [PASS][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-glk-dsi/igt@i915_selftest@live_blt.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-glk-dsi/igt@i915_selftest@live_blt.html
- fi-skl-iommu: [TIMEOUT][30] -> [PASS][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7205/fi-skl-iommu/igt@i915_selftest@live_blt.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/fi-skl-iommu/igt@i915_selftest@live_blt.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#111381]: https://bugs.freedesktop.org/show_bug.cgi?id=111381
Participating hosts (49 -> 43)
------------------------------
Additional (1): fi-kbl-r
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-icl-y fi-tgl-y fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7205 -> Patchwork_15032
CI-20190529: 20190529
CI_DRM_7205: b584710d3ea551d555a6de8470cb6da8cab6fd6f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5248: 81e55f1f97d73e48f00caa7e4fb98295023c5afa @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_15032: 7535083f5be8723c36f5a7b6bb0003563aec4434 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
7535083f5be8 drm/i915: Program LUT before intel_color_commit() if LUT was not previously set v2
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15032/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 48 lines · Hans de Goede
Since commit
051a6d8d3ca0("drm/i915: Move LUT programming to happen after vblank waits"), I am seeing an ugly colored flash of the first few display lines on 2 Cherry Trail devices when the gamma table gets set for the first time. A blue flash on a GPD win and a yellow flash on an Asus T100HA.The problem is that since this change, the LUT is programmed after the write *and latching* of the double-buffered register which causes the LUT to be used starting at the next frame. This means that the old LUT is still used for the first couple of lines of the display. If no LUT was in use before then the LUT registers may contain bogus values. This leads to messed up colors until the new LUT values are written. At least on CHT DSI panels this causes messed up colors on the first few lines.
This commit fixes this by adding a
load_lut_before_commitboolean, modifyingcommit_pipe_config()to load the luts earlier if this is set. and setting this fromintel_color_checkwhen enabling gamma (rather then updating an existing gamma table).Changes in v2:
-Simply check for settingload_lut_before_committo:
if (!old_crtc_state->gamma_enable &&new_crtc_state->gamma_enable)Fixes 051a6d8d3ca0 ("drm/i915: Move LUT programming to happen after vblank waits")Signed-off-by Hans de Goede <[email protected]>--- drivers/gpu/drm/i915/display/intel_color.c | 14 ++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 6 +++++- drivers/gpu/drm/i915/display/intel_display_types.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/display/intel_color.c +3
-0@@ -1063,6 +1063,8 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state)intel_atomic_get_old_crtc_state (state, crtc);struct intel_plane *plane; + new_crtc_state->load_lut_before_commit = false; +if (!new_crtc_state->base.active ||drm_atomic_crtc_needs_modeset (&new_crtc_state->base))return 0 ;@@ -1071,6 +1073,18 @@ intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state) new_crtc_state->csc_enable == old_crtc_state->csc_enable)return 0 ; +/*
drivers/gpu/drm/i915/display/intel_color.c intel_color_add_affected_planes(struct intel_crtc_state *new_crtc_state) · line 1086
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_color.c +10
-0+* Normally we load the LUTs after vblank / after the double-buffer +* registers written by commit have been latched, this avoids a +* gamma change mid-way the screen. This does mean that the first +* few lines of the display will (sometimes) still use the old +* table. This is fine when changing an existing LUT, but if this +* is the first time the LUT gets loaded, then the hw may contain +* random values, causing the first lines to have funky colors. +*/ +if (!old_crtc_state->gamma_enable && new_crtc_state->gamma_enable) + new_crtc_state->load_lut_before_commit = true;
Unfortunately gamma_enable is not abstract enough to cover all platforms.
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_color.c +1
-0+for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) {struct intel_plane_state *plane_state;drivers/gpu/drm/i915/display/intel_display.c +0
-0
drivers/gpu/drm/i915/display/intel_display.c static void commit_pipe_config(struct intel_atomic_state *state, · line 14173
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_display.c +3
-1@@ -14168,8 +14168,11 @@ static void commit_pipe_config(struct intel_atomic_state *state,*/ if (!modeset) {if (new_crtc_state->base.color_mgmt_changed || - new_crtc_state->update_pipe) + new_crtc_state->update_pipe) { +if (new_crtc_state->load_lut_before_commit) +intel_color_load_luts (new_crtc_state);
We don't want to do this from within the vblank evade critical section, so needs to be moved earlier.
Lemme try to cook up something...
Quoted 29 lines
drivers/gpu/drm/i915/display/intel_display.c +2
-0intel_color_commit (new_crtc_state); + }if (INTEL_GEN (dev_priv) >=9 )skl_detach_scalers (new_crtc_state);@@ -14717,6 +14720,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) {if (new_crtc_state->base.active && !needs_modeset (new_crtc_state) && + !new_crtc_state->load_lut_before_commit && (new_crtc_state->base.color_mgmt_changed || new_crtc_state->update_pipe))intel_color_load_luts (new_crtc_state);drivers/gpu/drm/i915/display/intel_display_types.h +3
-0@@ -990,6 +990,9 @@ struct intel_crtc_state {/* enable pipe csc? */ bool csc_enable; +/* load luts before color settings commit */ +bool load_lut_before_commit; +/* Display Stream compression state */ struct {bool compression_enable;Signature · 1 line
2.23.0
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx