On 2018-04-15 05:37 AM, Môshe van der Sterre wrote:
> Hello Leo Li,
>
> The current mainline has a gamma regression for me, running wayland on a
> Ryzen 5 2400G (integrated gpu). Colors are much too dark after the following
> commit:
> 086247a4b2fb "drm/amd/display: Use 4096 lut entries"
>
> From this commit alone I cannot deduce how to properly address the problem.
> Reverting restores the correct colors. Unfortunately, I have no other amdgpu
> hardware to test if this is specific to the integrated gpu or not.
>
> I'll gladly test possible fixes or debug a little further if you can point me
> in the right direction.
>
Can you give attached patch a spin. We'll probably merge it or a variant of it
soon.
Harry
> Thanks,
> Môshe van der Sterre
>
>
>From 9adc614f258ba021aa70eeed92ecb0613406cf09 Mon Sep 17 00:00:00 2001
From: Harry Wentland
Date: Thu, 12 Apr 2018 16:37:09 -0400
Subject: [PATCH] drm/amd/display: Don't program bypass on linear regamma LUT
Even though this is required for degamma since DCE HW only supports a
couple predefined LUTs we can just program the LUT directly.
This fixes dark screens which occurs when we program regamma to bypass
while degamma is using srgb LUT.
Signed-off-by: Harry Wentland
---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 12 +---
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index ef5fad8c5aac..59e993ad1209 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -133,19 +133,15 @@ int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc)
/* By default, use the SRGB predefined curve.*/
stream->out_transfer_func->type = TF_TYPE_PREDEFINED;
stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB;
+
+ DRM_DEBUG_KMS("Using pre-defined regamma\n");
+
return 0;
}
lut = (struct drm_color_lut *)blob->data;
lut_size = blob->length / sizeof(struct drm_color_lut);
- if (__is_lut_linear(lut, lut_size)) {
- /* Set to bypass if lut is set to linear */
- stream->out_transfer_func->type = TF_TYPE_BYPASS;
- stream->out_transfer_func->tf = TRANSFER_FUNCTION_LINEAR;
- return 0;
- }
-
gamma = dc_create_gamma();
if (!gamma)
return -ENOMEM;
@@ -161,6 +157,8 @@ int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc)
return -EINVAL;
}
+ DRM_DEBUG_KMS("Using regamma with %d entries\n", lut_size);
+
/* Convert drm_lut into dc_gamma */
__drm_lut_to_dc_gamma(lut, gamma, gamma->type == GAMMA_RGB_256);
--
2.17.0
___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx