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

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

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/amd/display/dc/core/dc_state.c
Extension
.c
Size
29708 bytes
Lines
1114
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

if (state->phantom_streams[i] == phantom_stream) {
			state->phantom_streams[i] = NULL;
			res = true;
			break;
		}
	}

	/* failed to find stream in state */
	if (!res)
		return res;

	/* trim back phantom streams */
	state->phantom_stream_count--;
	for (; i < state->phantom_stream_count; i++)
		state->phantom_streams[i] = state->phantom_streams[i + 1];

	return res;
}

static bool dc_state_is_phantom_stream_tracked(struct dc_state *state, struct dc_stream_state *phantom_stream)
{
	int i;

	for (i = 0; i < state->phantom_stream_count; i++) {
		if (state->phantom_streams[i] == phantom_stream)
			return true;
	}

	return false;
}

static bool dc_state_track_phantom_plane(struct dc_state *state,
		struct dc_plane_state *phantom_plane)
{
	if (state->phantom_plane_count >= MAX_PHANTOM_PIPES)
		return false;

	state->phantom_planes[state->phantom_plane_count++] = phantom_plane;

	return true;
}

static bool dc_state_untrack_phantom_plane(struct dc_state *state, struct dc_plane_state *phantom_plane)
{
	bool res = false;
	int i;

	/* first find phantom plane in the dc_state */
	for (i = 0; i < state->phantom_plane_count; i++) {
		if (state->phantom_planes[i] == phantom_plane) {
			state->phantom_planes[i] = NULL;
			res = true;
			break;
		}
	}

	/* failed to find plane in state */
	if (!res)
		return res;

	/* trim back phantom planes */
	state->phantom_plane_count--;
	for (; i < state->phantom_plane_count; i++)
		state->phantom_planes[i] = state->phantom_planes[i + 1];

	return res;
}

static bool dc_state_is_phantom_plane_tracked(struct dc_state *state, struct dc_plane_state *phantom_plane)
{
	int i;

	for (i = 0; i < state->phantom_plane_count; i++) {
		if (state->phantom_planes[i] == phantom_plane)
			return true;
	}

	return false;
}

static void dc_state_copy_internal(struct dc_state *dst_state, struct dc_state *src_state)
{
	int i, j;

	memcpy(dst_state, src_state, sizeof(struct dc_state));

	for (i = 0; i < MAX_PIPES; i++) {
		struct pipe_ctx *cur_pipe = &dst_state->res_ctx.pipe_ctx[i];

		if (cur_pipe->top_pipe)

Annotation

Implementation Notes