drivers/gpu/drm/amd/display/dc/core/dc.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/core/dc.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/dc/core/dc.c
Extension
.c
Size
266686 bytes
Lines
8233
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pipe_split_policy_backup {
	bool dynamic_odm_policy;
	bool subvp_policy;
	enum pipe_split_policy mpc_policy;
	char force_odm[MAX_PIPES];
};

static void backup_and_set_minimal_pipe_split_policy(struct dc *dc,
		struct dc_state *context,
		struct pipe_split_policy_backup *policy)
{
	int i;

	if (!dc->config.is_vmin_only_asic) {
		policy->mpc_policy = dc->debug.pipe_split_policy;
		dc->debug.pipe_split_policy = MPC_SPLIT_AVOID;
	}
	policy->dynamic_odm_policy = dc->debug.enable_single_display_2to1_odm_policy;
	dc->debug.enable_single_display_2to1_odm_policy = false;
	policy->subvp_policy = dc->debug.force_disable_subvp;
	dc->debug.force_disable_subvp = true;
	for (i = 0; i < context->stream_count; i++) {
		policy->force_odm[i] = context->streams[i]->debug.force_odm_combine_segments;
		if (context->streams[i]->debug.allow_transition_for_forced_odm)
			context->streams[i]->debug.force_odm_combine_segments = 0;
	}
}

static void restore_minimal_pipe_split_policy(struct dc *dc,
		struct dc_state *context,
		struct pipe_split_policy_backup *policy)
{
	uint8_t i;

	if (!dc->config.is_vmin_only_asic)
		dc->debug.pipe_split_policy = policy->mpc_policy;
	dc->debug.enable_single_display_2to1_odm_policy =
			policy->dynamic_odm_policy;
	dc->debug.force_disable_subvp = policy->subvp_policy;
	for (i = 0; i < context->stream_count; i++)
		context->streams[i]->debug.force_odm_combine_segments = policy->force_odm[i];
}

/**
 * update_planes_and_stream_state() - The function takes planes and stream
 * updates as inputs and determines the appropriate update type. If update type
 * is FULL, the function allocates a new context, populates and validates it.
 * Otherwise, it updates current dc context. The function will return both
 * new_context and new_update_type back to the caller. The function also backs
 * up both current and new contexts into corresponding dc state scratch memory.
 * TODO: The function does too many things, and even conditionally allocates dc
 * context memory implicitly. We should consider to break it down.
 *
 * @dc: Current DC state
 * @srf_updates: an array of surface updates
 * @surface_count: surface update count
 * @stream: Corresponding stream to be updated
 * @stream_update: stream update
 * @update_descriptor: describes what plane and stream changes to apply
 * @new_update_type: [out] determined update type by the function
 * @new_context: [out] new context allocated and validated if update type is
 * FULL, reference to current context if update type is less than FULL.
 *
 * Return: true if a valid update is populated into new_context, false
 * otherwise.
 */
static bool update_planes_and_stream_state(struct dc *dc,
		struct dc_surface_update *srf_updates, int surface_count,
		struct dc_stream_state *stream,
		struct dc_stream_update *stream_update,
		enum surface_update_type *new_update_type,
		struct dc_state **new_context)
{
	struct dc_state *context;
	int i;
	unsigned int j;
	enum surface_update_type update_type;
	const struct dc_stream_status *stream_status;
	struct dc_context *dc_ctx = dc->ctx;

	stream_status = dc_stream_get_status(stream);

	if (!stream_status) {
		if (surface_count) /* Only an error condition if surf_count non-zero*/
			ASSERT(false);

		return false; /* Cannot commit surface to stream that is not committed */
	}

	context = dc->current_state;

Annotation

Implementation Notes