Skip to content

Commit 86e7baf

Browse files
melissawengregkh
authored andcommitted
drm/amd/display: update color on atomic commit time
commit 2f9c638 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 <harry.wentland@amd.com> Signed-off-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1a9dcda commit 86e7baf

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
@@ -235,6 +235,7 @@ static int amdgpu_dm_encoder_init(struct drm_device *dev,
235235

236236
static int amdgpu_dm_connector_get_modes(struct drm_connector *connector);
237237

238+
static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state);
238239
static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state);
239240

240241
static int amdgpu_dm_atomic_check(struct drm_device *dev,
@@ -3509,7 +3510,7 @@ static const struct drm_mode_config_funcs amdgpu_dm_mode_funcs = {
35093510

35103511
static struct drm_mode_config_helper_funcs amdgpu_dm_mode_config_helperfuncs = {
35113512
.atomic_commit_tail = amdgpu_dm_atomic_commit_tail,
3512-
.atomic_commit_setup = drm_dp_mst_atomic_setup_commit,
3513+
.atomic_commit_setup = amdgpu_dm_atomic_setup_commit,
35133514
};
35143515

35153516
static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
@@ -9902,6 +9903,39 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
99029903
drm_writeback_queue_job(wb_conn, new_con_state);
99039904
}
99049905

9906+
static int amdgpu_dm_atomic_setup_commit(struct drm_atomic_state *state)
9907+
{
9908+
struct drm_crtc *crtc;
9909+
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
9910+
struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
9911+
int i, ret;
9912+
9913+
ret = drm_dp_mst_atomic_setup_commit(state);
9914+
if (ret)
9915+
return ret;
9916+
9917+
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
9918+
dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
9919+
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
9920+
/*
9921+
* Color management settings. We also update color properties
9922+
* when a modeset is needed, to ensure it gets reprogrammed.
9923+
*/
9924+
if (dm_new_crtc_state->base.active && dm_new_crtc_state->stream &&
9925+
(dm_new_crtc_state->base.color_mgmt_changed ||
9926+
dm_old_crtc_state->regamma_tf != dm_new_crtc_state->regamma_tf ||
9927+
drm_atomic_crtc_needs_modeset(new_crtc_state))) {
9928+
ret = amdgpu_dm_update_crtc_color_mgmt(dm_new_crtc_state);
9929+
if (ret) {
9930+
drm_dbg_atomic(state->dev, "Failed to update color state\n");
9931+
return ret;
9932+
}
9933+
}
9934+
}
9935+
9936+
return 0;
9937+
}
9938+
99059939
/**
99069940
* amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation.
99079941
* @state: The atomic state to commit

0 commit comments

Comments
 (0)