[PATCH 04/33] drm/amd/display: Use 4096 lut entries

Michel Dänzer michel at daenzer.net
Tue Feb 27 10:34:22 UTC 2018


On 2018-02-26 09:15 PM, Harry Wentland wrote:
> From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>
> 
> Non-legacy LUT size should reflect hw capability. Change size from 256
> to 4096.
> 
> However, X doesn't seem to play with legacy LUTs of such size.
> Therefore, check for legacy lut when updating DC states, and update
> accordingly.
> 
> v2: Use a macro for the maximum drm LUT value.
> 
> Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
> Reviewed-by: Harry Wentland <Harry.Wentland at amd.com>
> ---
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |  4 +-
>  .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c    | 77 ++++++++++++++++------
>  3 files changed, 61 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index bb9405daa087..f782518fc424 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -3228,7 +3228,7 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
>  	dm->adev->mode_info.crtcs[crtc_index] = acrtc;
>  	drm_crtc_enable_color_mgmt(&acrtc->base, MAX_COLOR_LUT_ENTRIES,
>  				   true, MAX_COLOR_LUT_ENTRIES);
> -	drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LUT_ENTRIES);
> +	drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LEGACY_LUT_ENTRIES);

This means userspace can't set gamma ramps with more than 256 entries,
since drm_mode_gamma_set_ioctl returns an error if the sizes don't
match. We should just fix userspace which tries to use the wrong size.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list