mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 17:36:25 +07:00
drm/amd/display: program default output gamma
program default output gamma if no user specific gamma parameters passed. Signed-off-by: hersen wu <hersenxs.wu@amd.com> Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com> Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
5581192d72
commit
3ae42acde3
@ -126,18 +126,19 @@ int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc)
|
||||
crtc->base.state->dev->dev_private;
|
||||
struct drm_color_lut *lut;
|
||||
uint32_t lut_size;
|
||||
struct dc_gamma *gamma;
|
||||
struct dc_gamma *gamma = NULL;
|
||||
enum dc_transfer_func_type old_type = stream->out_transfer_func->type;
|
||||
|
||||
bool ret;
|
||||
|
||||
if (!blob) {
|
||||
if (!blob && adev->asic_type <= CHIP_RAVEN) {
|
||||
/* By default, use the SRGB predefined curve.*/
|
||||
stream->out_transfer_func->type = TF_TYPE_PREDEFINED;
|
||||
stream->out_transfer_func->tf = TRANSFER_FUNCTION_SRGB;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (blob) {
|
||||
lut = (struct drm_color_lut *)blob->data;
|
||||
lut_size = blob->length / sizeof(struct drm_color_lut);
|
||||
|
||||
@ -158,14 +159,18 @@ int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc)
|
||||
|
||||
/* Convert drm_lut into dc_gamma */
|
||||
__drm_lut_to_dc_gamma(lut, gamma, gamma->type == GAMMA_RGB_256);
|
||||
}
|
||||
|
||||
/* Call color module to translate into something DC understands. Namely
|
||||
* a transfer function.
|
||||
/* predefined gamma ROM only exist for RAVEN and pre-RAVEN ASIC,
|
||||
* set canRomBeUsed accordingly
|
||||
*/
|
||||
stream->out_transfer_func->type = TF_TYPE_DISTRIBUTED_POINTS;
|
||||
ret = mod_color_calculate_regamma_params(stream->out_transfer_func,
|
||||
gamma, true, adev->asic_type <= CHIP_RAVEN, NULL);
|
||||
|
||||
if (gamma)
|
||||
dc_gamma_release(&gamma);
|
||||
|
||||
if (!ret) {
|
||||
stream->out_transfer_func->type = old_type;
|
||||
DRM_ERROR("Out of memory when calculating regamma params\n");
|
||||
|
Loading…
Reference in New Issue
Block a user