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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dc_types.hcore_types.hcore_status.hdc_state.hdc_state_priv.hdc_stream_priv.hdc_plane_priv.hdm_services.hresource.hlink_enc_cfg.hdml2_0/dml2_wrapper.hdml2_0/dml2_internal_types.h
Detected Declarations
function filesfunction dc_state_untrack_phantom_streamfunction dc_state_is_phantom_stream_trackedfunction dc_state_track_phantom_planefunction dc_state_untrack_phantom_planefunction dc_state_is_phantom_plane_trackedfunction dc_state_copy_internalfunction init_statefunction dc_state_copyfunction dc_state_copy_currentfunction dc_state_constructfunction dc_state_destructfunction dc_state_retainfunction dc_state_freefunction dc_state_releasefunction dc_state_add_streamfunction dc_state_remove_streamfunction remove_mpc_combine_for_streamfunction dc_state_add_planefunction dc_state_remove_planefunction dc_state_rem_all_planes_for_streamfunction dc_state_add_all_planes_for_streamfunction dc_state_get_pipe_subvp_typefunction dc_state_get_stream_subvp_typefunction dc_state_release_phantom_streamfunction dc_state_release_phantom_planefunction dc_state_add_phantom_streamfunction dc_state_remove_phantom_streamfunction dc_state_add_phantom_planefunction dc_state_remove_phantom_planefunction dc_state_rem_all_phantom_planes_for_streamfunction dc_state_add_all_phantom_planes_for_streamfunction dc_state_remove_phantom_streams_and_planesfunction dc_state_release_phantom_streams_and_planesfunction dc_state_is_fams2_in_usefunction dc_state_set_stream_subvp_cursor_limitfunction dc_state_get_stream_subvp_cursor_limitfunction dc_state_set_stream_cursor_subvp_limitfunction dc_state_get_stream_cursor_subvp_limitfunction dc_state_can_clear_stream_cursor_subvp_limitfunction dc_state_is_subvp_in_use
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
- Immediate include surface: `dc_types.h`, `core_types.h`, `core_status.h`, `dc_state.h`, `dc_state_priv.h`, `dc_stream_priv.h`, `dc_plane_priv.h`, `dm_services.h`.
- Detected declarations: `function files`, `function dc_state_untrack_phantom_stream`, `function dc_state_is_phantom_stream_tracked`, `function dc_state_track_phantom_plane`, `function dc_state_untrack_phantom_plane`, `function dc_state_is_phantom_plane_tracked`, `function dc_state_copy_internal`, `function init_state`, `function dc_state_copy`, `function dc_state_copy_current`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.