Skip to content

Commit df0a86a

Browse files
melissawengregkh
authored andcommitted
drm/amd/display: update color on atomic commit time
commit 2f9c63883730a0bfecb086e6e59246933f936ca1 upstream. Use `atomic_commit_setup` to change the DC stream state. It's a preparation to remove from `atomic_check` changes in CRTC color components of DC stream state and prevent DC to commit TEST_ONLY changes. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/4444 Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Melissa Wen <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent df96dbe commit df0a86a

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ static int amdgpu_dm_encoder_init(struct drm_device *dev,
243243

244244
static int amdgpu_dm_connector_get_modes(struct drm_connector *connector);
245245

246+
static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state);
246247
static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state);
247248

248249
static int amdgpu_dm_atomic_check(struct drm_device *dev,
@@ -3657,7 +3658,7 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = {
36573658

36583659
static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
36593660
.atomic_commit_tail = amdgpu_dm_atomic_commit_tail,
3660-
.atomic_commit_setup = drm_dp_mst_atomic_setup_commit,
3661+
.atomic_commit_setup = amdgpu_dm_atomic_setup_commit,
36613662
};
36623663

36633664
static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
@@ -10208,6 +10209,39 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
1020810209
drm_writeback_queue_job(wb_conn, new_con_state);
1020910210
}
1021010211

10212+
static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state)
10213+
{
10214+
struct drm_crtc *crtc;
10215+
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
10216+
struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
10217+
int i, ret;
10218+
10219+
ret = drm_dp_mst_atomic_setup_commit(state);
10220+
if (ret)
10221+
return ret;
10222+
10223+
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
10224+
dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
10225+
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
10226+
/*
10227+
* Color management settings. We also update color properties
10228+
* when a modeset is needed, to ensure it gets reprogrammed.
10229+
*/
10230+
if (dm_new_crtc_state->base.active && dm_new_crtc_state->stream &&
10231+
(dm_new_crtc_state->base.color_mgmt_changed ||
10232+
dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf ||
10233+
drm_atomic_crtc_needs_modeset(new_crtc_state))) {
10234+
ret = amdgpu_dm_update_crtc_color_mgmt(dm_new_crtc_state);
10235+
if (ret) {
10236+
drm_dbg_atomic(state->dev, "Failed to update color state\n");
10237+
return ret;
10238+
}
10239+
}
10240+
}
10241+
10242+
return 0;
10243+
}
10244+
1021110245
/**
1021210246
* amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation.
1021310247
* @state: The atomic state to commit

0 commit comments

Comments
 (0)