Skip to content

Commit 012cfac

Browse files
committed
Merge branch 'drm-fixes-4.17' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
Two last minute DC fixes for 4.17. A fix for underscan on fiji and a fix for gamma settings getting after dpms. * 'drm-fixes-4.17' of git://people.freedesktop.org/~agd5f/linux: drm/amd/display: Update color props when modeset is required drm/amd/display: Make atomic-check validate underscan changes
2 parents 0e33375 + bc13f2f commit 012cfac

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4555,8 +4555,8 @@ static int dm_update_crtcs_state(struct dc *dc,
45554555
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
45564556
struct amdgpu_crtc *acrtc = NULL;
45574557
struct amdgpu_dm_connector *aconnector = NULL;
4558-
struct drm_connector_state *new_con_state = NULL;
4559-
struct dm_connector_state *dm_conn_state = NULL;
4558+
struct drm_connector_state *drm_new_conn_state = NULL, *drm_old_conn_state = NULL;
4559+
struct dm_connector_state *dm_new_conn_state = NULL, *dm_old_conn_state = NULL;
45604560
struct drm_plane_state *new_plane_state = NULL;
45614561

45624562
new_stream = NULL;
@@ -4577,19 +4577,23 @@ static int dm_update_crtcs_state(struct dc *dc,
45774577
/* TODO This hack should go away */
45784578
if (aconnector && enable) {
45794579
// Make sure fake sink is created in plug-in scenario
4580-
new_con_state = drm_atomic_get_connector_state(state,
4580+
drm_new_conn_state = drm_atomic_get_new_connector_state(state,
45814581
&aconnector->base);
4582+
drm_old_conn_state = drm_atomic_get_old_connector_state(state,
4583+
&aconnector->base);
45824584

4583-
if (IS_ERR(new_con_state)) {
4584-
ret = PTR_ERR_OR_ZERO(new_con_state);
4585+
4586+
if (IS_ERR(drm_new_conn_state)) {
4587+
ret = PTR_ERR_OR_ZERO(drm_new_conn_state);
45854588
break;
45864589
}
45874590

4588-
dm_conn_state = to_dm_connector_state(new_con_state);
4591+
dm_new_conn_state = to_dm_connector_state(drm_new_conn_state);
4592+
dm_old_conn_state = to_dm_connector_state(drm_old_conn_state);
45894593

45904594
new_stream = create_stream_for_sink(aconnector,
45914595
&new_crtc_state->mode,
4592-
dm_conn_state);
4596+
dm_new_conn_state);
45934597

45944598
/*
45954599
* we can have no stream on ACTION_SET if a display
@@ -4708,8 +4712,17 @@ static int dm_update_crtcs_state(struct dc *dc,
47084712
*/
47094713
BUG_ON(dm_new_crtc_state->stream == NULL);
47104714

4711-
/* Color managment settings */
4712-
if (dm_new_crtc_state->base.color_mgmt_changed) {
4715+
/* Scaling or underscan settings */
4716+
if (is_scaling_state_different(dm_old_conn_state, dm_new_conn_state))
4717+
update_stream_scaling_settings(
4718+
&new_crtc_state->mode, dm_new_conn_state, dm_new_crtc_state->stream);
4719+
4720+
/*
4721+
* Color management settings. We also update color properties
4722+
* when a modeset is needed, to ensure it gets reprogrammed.
4723+
*/
4724+
if (dm_new_crtc_state->base.color_mgmt_changed ||
4725+
drm_atomic_crtc_needs_modeset(new_crtc_state)) {
47134726
ret = amdgpu_dm_set_regamma_lut(dm_new_crtc_state);
47144727
if (ret)
47154728
goto fail;

0 commit comments

Comments
 (0)