Commit 85fb8bb9 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher
Browse files

drm/amd/display: Run full global validation in dc_commit_state



[Why]
Dynamic link encoder assignment expects that it can modify DC
current_state and the links associated with the incoming state when
performing full validation.

This does not align with our actual synchronization constraints
in DM's atomic_check.

[How]
Since link encoder assignment only happens as part of full validation
we can just use fast validation as part of atomic_check instead.

This satisfy's DC interface requirements and skips the DML calculations
needed for pipe programming - hopefully speeding up things a little bit
to offset the cost of double validation during stream modification.

We already do this as part of dc_commit_updates_for_stream()
with validate_bandwidth(), so extend this to dc_commit_state() as
well.

Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Acked-by: default avatarQingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f8fb5cd4
Loading
Loading
Loading
Loading
+1 −18
Original line number Diff line number Diff line
@@ -2307,14 +2307,6 @@ static enum dc_status amdgpu_dm_commit_zero_streams(struct dc *dc)
			goto fail;
	}


	res = dc_validate_global_state(dc, context, false);

	if (res != DC_OK) {
		DRM_ERROR("%s:resource validation failed, dc_status:%d\n", __func__, res);
		goto fail;
	}

	res = dc_commit_state(dc, context);

fail:
@@ -2583,15 +2575,6 @@ static int dm_resume(void *handle)
					= 0xffffffff;
			}
		}
#if defined(CONFIG_DRM_AMD_DC_DCN)
		/*
		 * Resource allocation happens for link encoders for newer ASIC in
		 * dc_validate_global_state, so we need to revalidate it.
		 *
		 * This shouldn't fail (it passed once before), so warn if it does.
		 */
		WARN_ON(dc_validate_global_state(dm->dc, dc_state, false) != DC_OK);
#endif

		WARN_ON(!dc_commit_state(dm->dc, dc_state));

@@ -11130,7 +11113,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
			DRM_DEBUG_DRIVER("drm_dp_mst_atomic_check() failed\n");
			goto fail;
		}
		status = dc_validate_global_state(dc, dm_state->context, false);
		status = dc_validate_global_state(dc, dm_state->context, true);
		if (status != DC_OK) {
			DRM_DEBUG_DRIVER("DC global validation failure: %s (%d)",
				       dc_status_to_str(status), status);
+13 −0
Original line number Diff line number Diff line
@@ -1827,6 +1827,19 @@ bool dc_commit_state(struct dc *dc, struct dc_state *context)
		dc_stream_log(dc, stream);
	}

	/*
	 * Previous validation was perfomred with fast_validation = true and
	 * the full DML state required for hardware programming was skipped.
	 *
	 * Re-validate here to calculate these parameters / watermarks.
	 */
	result = dc_validate_global_state(dc, context, false);
	if (result != DC_OK) {
		DC_LOG_ERROR("DC commit global validation failure: %s (%d)",
			     dc_status_to_str(result), result);
		return result;
	}

	result = dc_commit_state_no_check(dc, context);

	return (result == DC_OK);