Skip to content

Commit

Permalink
drm/amd/display: change global buffer to local buffer
Browse files Browse the repository at this point in the history
[ Upstream commit 8ae5b15 ]

[Why]
Multi-adapter calculate regamma table at the same time.
Two thread used the same global variable cause race
condition.

[How]
Change global buffer to local buffer

Signed-off-by: Lewis Huang <Lewis.Huang@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Lewis Huang authored and gregkh committed Sep 3, 2020
1 parent a539e86 commit ad18857
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 59 deletions.
10 changes: 8 additions & 2 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
Expand Up @@ -195,10 +195,13 @@ static int __set_legacy_tf(struct dc_transfer_func *func,
bool has_rom)
{
struct dc_gamma *gamma = NULL;
struct calculate_buffer cal_buffer = {0};
bool res;

ASSERT(lut && lut_size == MAX_COLOR_LEGACY_LUT_ENTRIES);

cal_buffer.buffer_index = -1;

gamma = dc_create_gamma();
if (!gamma)
return -ENOMEM;
Expand All @@ -208,7 +211,7 @@ static int __set_legacy_tf(struct dc_transfer_func *func,
__drm_lut_to_dc_gamma(lut, gamma, true);

res = mod_color_calculate_regamma_params(func, gamma, true, has_rom,
NULL);
NULL, &cal_buffer);

dc_gamma_release(&gamma);

Expand All @@ -221,10 +224,13 @@ static int __set_output_tf(struct dc_transfer_func *func,
bool has_rom)
{
struct dc_gamma *gamma = NULL;
struct calculate_buffer cal_buffer = {0};
bool res;

ASSERT(lut && lut_size == MAX_COLOR_LUT_ENTRIES);

cal_buffer.buffer_index = -1;

gamma = dc_create_gamma();
if (!gamma)
return -ENOMEM;
Expand All @@ -248,7 +254,7 @@ static int __set_output_tf(struct dc_transfer_func *func,
*/
gamma->type = GAMMA_CS_TFM_1D;
res = mod_color_calculate_regamma_params(func, gamma, false,
has_rom, NULL);
has_rom, NULL, &cal_buffer);
}

dc_gamma_release(&gamma);
Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/drm/amd/display/modules/color/Makefile
Expand Up @@ -25,6 +25,10 @@

MOD_COLOR = color_gamma.o

ifdef CONFIG_DRM_AMD_DC_DCN
MOD_COLOR += color_table.o
endif

AMD_DAL_MOD_COLOR = $(addprefix $(AMDDALPATH)/modules/color/,$(MOD_COLOR))
#$(info ************ DAL COLOR MODULE MAKEFILE ************)

Expand Down

0 comments on commit ad18857

Please sign in to comment.