Commit ab2541b6 authored by Aric Cyr's avatar Aric Cyr Committed by Alex Deucher
Browse files

drm/amd/display: Remove dc_target object



dc_target does not fit well into DRM framework so removed it.
This will prevent the driver from leveraging the pipe-split
code for tiled displays, so will have to be handled at a higher
level.  Most places that used dc_target now directly use dc_stream
instead.

Signed-off-by: default avatarAric Cyr <aric.cyr@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 624d7c47
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -428,8 +428,8 @@ struct amdgpu_crtc {

	int otg_inst;
	uint32_t flip_flags;
	/* After Set Mode target will be non-NULL */
	struct dc_target *target;
	/* After Set Mode stream will be non-NULL */
	const struct dc_stream *stream;
};

struct amdgpu_encoder_atom_dig {
@@ -550,7 +550,7 @@ struct amdgpu_connector {
	const struct dc_sink *dc_sink;
	const struct dc_link *dc_link;
	const struct dc_sink *dc_em_sink;
	const struct dc_target *target;
	const struct dc_stream *stream;
	void *con_priv;
	bool dac_load_detect;
	bool detected_by_load; /* if the connection status was determined by load */
+22 −25
Original line number Diff line number Diff line
@@ -68,12 +68,12 @@ static u32 dm_vblank_get_counter(struct amdgpu_device *adev, int crtc)
	else {
		struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc];

		if (NULL == acrtc->target) {
			DRM_ERROR("dc_target is NULL for crtc '%d'!\n", crtc);
		if (NULL == acrtc->stream) {
			DRM_ERROR("dc_stream is NULL for crtc '%d'!\n", crtc);
			return 0;
		}

		return dc_target_get_vblank_counter(acrtc->target);
		return dc_stream_get_vblank_counter(acrtc->stream);
	}
}

@@ -85,12 +85,12 @@ static int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc,
	else {
		struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc];

		if (NULL == acrtc->target) {
			DRM_ERROR("dc_target is NULL for crtc '%d'!\n", crtc);
		if (NULL == acrtc->stream) {
			DRM_ERROR("dc_stream is NULL for crtc '%d'!\n", crtc);
			return 0;
		}

		return dc_target_get_scanoutpos(acrtc->target, vbl, position);
		return dc_stream_get_scanoutpos(acrtc->stream, vbl, position);
	}

	return 0;
@@ -461,7 +461,7 @@ static int dm_suspend(void *handle)
	drm_modeset_lock_all(adev->ddev);
	list_for_each_entry(crtc, &adev->ddev->mode_config.crtc_list, head) {
		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
		if (acrtc->target)
		if (acrtc->stream)
				drm_crtc_vblank_off(crtc);
	}
	drm_modeset_unlock_all(adev->ddev);
@@ -655,7 +655,7 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev )
	drm_modeset_lock_all(ddev);
	list_for_each_entry(crtc, &ddev->mode_config.crtc_list, head) {
		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
		if (acrtc->target)
		if (acrtc->stream)
				drm_crtc_vblank_on(crtc);
	}
	drm_modeset_unlock_all(ddev);
@@ -740,7 +740,7 @@ void amdgpu_dm_update_connector_after_detect(
	if (aconnector->base.force != DRM_FORCE_UNSPECIFIED
			&& aconnector->dc_em_sink) {

		/* For S3 resume with headless use eml_sink to fake target
		/* For S3 resume with headless use eml_sink to fake stream
		 * because on resume connecotr->sink is set ti NULL
		 */
		mutex_lock(&dev->mode_config.mutex);
@@ -1184,7 +1184,7 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
		return -1;
	}

	for (i = 0; i < dm->dc->caps.max_targets; i++) {
	for (i = 0; i < dm->dc->caps.max_streams; i++) {
		acrtc = kzalloc(sizeof(struct amdgpu_crtc), GFP_KERNEL);
		if (!acrtc)
			goto fail;
@@ -1199,7 +1199,7 @@ int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
		}
	}

	dm->display_indexes_num = dm->dc->caps.max_targets;
	dm->display_indexes_num = dm->dc->caps.max_streams;

	/* loops over all connectors on the board */
	for (i = 0; i < link_cnt; i++) {
@@ -1318,7 +1318,7 @@ static void dm_page_flip(struct amdgpu_device *adev,
			 int crtc_id, u64 crtc_base, bool async)
{
	struct amdgpu_crtc *acrtc;
	struct dc_target *target;
	const struct dc_stream *stream;
	struct dc_flip_addrs addr = { {0} };

	/*
@@ -1336,7 +1336,7 @@ static void dm_page_flip(struct amdgpu_device *adev,
	 * a little longer to lock up all cores.
	 *
	 * The reason we should lock on dal_mutex is so that we can be sure
	 * nobody messes with acrtc->target after we read and check its value.
	 * nobody messes with acrtc->stream after we read and check its value.
	 *
	 * We might be able to fix our concurrency issues with a work queue
	 * where we schedule all work items (mode_set, page_flip, etc.) and
@@ -1345,14 +1345,14 @@ static void dm_page_flip(struct amdgpu_device *adev,
	 */

	acrtc = adev->mode_info.crtcs[crtc_id];
	target = acrtc->target;
	stream = acrtc->stream;

	/*
	 * Received a page flip call after the display has been reset.
	 * Just return in this case. Everything should be clean-up on reset.
	 */

	if (!target) {
	if (!stream) {
		WARN_ON(1);
		return;
	}
@@ -1368,7 +1368,7 @@ static void dm_page_flip(struct amdgpu_device *adev,

	dc_flip_surface_addrs(
			adev->dm.dc,
			dc_target_get_status(target)->surfaces,
			dc_stream_get_status(stream)->surfaces,
			&addr, 1);
}

@@ -1376,25 +1376,22 @@ static int amdgpu_notify_freesync(struct drm_device *dev, void *data,
				struct drm_file *filp)
{
	struct mod_freesync_params freesync_params;
	uint8_t num_targets;
	uint8_t num_streams;
	uint8_t i;
	struct dc_target *target;

	struct amdgpu_device *adev = dev->dev_private;
	int r = 0;

	/* Get freesync enable flag from DRM */

	num_targets = dc_get_current_target_count(adev->dm.dc);
	num_streams = dc_get_current_stream_count(adev->dm.dc);

	for (i = 0; i < num_targets; i++) {

		target = dc_get_target_at_index(adev->dm.dc, i);
	for (i = 0; i < num_streams; i++) {
		const struct dc_stream *stream;
		stream = dc_get_stream_at_index(adev->dm.dc, i);

		mod_freesync_update_state(adev->dm.freesync_module,
						target->streams,
						target->stream_count,
						&freesync_params);
					  &stream, 1, &freesync_params);
	}

	return r;
+151 −198

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ int amdgpu_dm_atomic_commit(
int amdgpu_dm_atomic_check(struct drm_device *dev,
				struct drm_atomic_state *state);

int dm_create_validation_set_for_target(
int dm_create_validation_set_for_stream(
	struct drm_connector *connector,
	struct drm_display_mode *mode,
	struct dc_validation_set *val_set);
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ AMD_DC = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/dc/,$(DC_LI

include $(AMD_DC)

DISPLAY_CORE = dc.o dc_link.o dc_resource.o dc_hw_sequencer.o dc_target.o dc_sink.o \
DISPLAY_CORE = dc.o dc_link.o dc_resource.o dc_hw_sequencer.o dc_sink.o \
dc_surface.o dc_link_hwss.o dc_link_dp.o dc_link_ddc.o dc_debug.o dc_stream.o

AMD_DISPLAY_CORE = $(addprefix $(AMDDALPATH)/dc/core/,$(DISPLAY_CORE))
Loading