drivers/gpu/drm/amd/display/dc/dsc/dcn401/dcn401_dsc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dsc/dcn401/dcn401_dsc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dsc/dcn401/dcn401_dsc.c- Extension
.c- Size
- 15732 bytes
- Lines
- 401
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/display/drm_dsc_helper.hreg_helper.hdcn401_dsc.hdsc/dscc_types.hdsc/rc_calc.h
Detected Declarations
function dsc401_constructfunction dsc401_get_single_enc_capsfunction dsc401_read_statefunction dsc401_validate_streamfunction dsc401_set_configfunction dsc401_enablefunction dsc401_disablefunction dsc401_wait_disconnect_pending_clearfunction dsc401_disconnectfunction dsc_write_to_registersfunction dsc401_set_fgcg
Annotated Snippet
// SPDX-License-Identifier: MIT
//
// Copyright 2024 Advanced Micro Devices, Inc.
#include <drm/display/drm_dsc_helper.h>
#include "reg_helper.h"
#include "dcn401_dsc.h"
#include "dsc/dscc_types.h"
#include "dsc/rc_calc.h"
static void dsc_write_to_registers(struct display_stream_compressor *dsc, const struct dsc_reg_values *reg_vals);
/* Object I/F functions */
//static void dsc401_get_enc_caps(struct dsc_enc_caps *dsc_enc_caps, int pixel_clock_100Hz);
//static bool dsc401_get_packed_pps(struct display_stream_compressor *dsc, const struct dsc_config *dsc_cfg, uint8_t *dsc_packed_pps);
static void dsc401_get_single_enc_caps(struct dsc_enc_caps *dsc_enc_caps, unsigned int max_dscclk_khz);
static const struct dsc_funcs dcn401_dsc_funcs = {
.dsc_read_state = dsc401_read_state,
.dsc_validate_stream = dsc401_validate_stream,
.dsc_set_config = dsc401_set_config,
.dsc_get_packed_pps = dsc2_get_packed_pps,
.dsc_enable = dsc401_enable,
.dsc_disable = dsc401_disable,
.dsc_disconnect = dsc401_disconnect,
.dsc_wait_disconnect_pending_clear = dsc401_wait_disconnect_pending_clear,
.dsc_get_single_enc_caps = dsc401_get_single_enc_caps,
.dsc_read_reg_state = dsc2_read_reg_state
};
/* Macro definitios for REG_SET macros*/
#define CTX \
dsc401->base.ctx
#define REG(reg)\
dsc401->dsc_regs->reg
#undef FN
#define FN(reg_name, field_name) \
dsc401->dsc_shift->field_name, dsc401->dsc_mask->field_name
#define DC_LOGGER \
dsc->ctx->logger
/* API functions (external or via structure->function_pointer) */
void dsc401_construct(struct dcn401_dsc *dsc,
struct dc_context *ctx,
int inst,
const struct dcn401_dsc_registers *dsc_regs,
const struct dcn401_dsc_shift *dsc_shift,
const struct dcn401_dsc_mask *dsc_mask)
{
dsc->base.ctx = ctx;
dsc->base.inst = inst;
dsc->base.funcs = &dcn401_dsc_funcs;
dsc->dsc_regs = dsc_regs;
dsc->dsc_shift = dsc_shift;
dsc->dsc_mask = dsc_mask;
dsc->max_image_width = 5184;
}
static void dsc401_get_single_enc_caps(struct dsc_enc_caps *dsc_enc_caps, unsigned int max_dscclk_khz)
{
dsc_enc_caps->dsc_version = 0x21; /* v1.2 - DP spec defined it in reverse order and we kept it */
dsc_enc_caps->slice_caps.bits.NUM_SLICES_1 = 1;
dsc_enc_caps->slice_caps.bits.NUM_SLICES_2 = 1;
dsc_enc_caps->slice_caps.bits.NUM_SLICES_3 = 1;
dsc_enc_caps->slice_caps.bits.NUM_SLICES_4 = 1;
dsc_enc_caps->lb_bit_depth = 13;
dsc_enc_caps->is_block_pred_supported = true;
dsc_enc_caps->color_formats.bits.RGB = 1;
dsc_enc_caps->color_formats.bits.YCBCR_444 = 1;
dsc_enc_caps->color_formats.bits.YCBCR_SIMPLE_422 = 1;
dsc_enc_caps->color_formats.bits.YCBCR_NATIVE_422 = 1;
dsc_enc_caps->color_formats.bits.YCBCR_NATIVE_420 = 1;
dsc_enc_caps->color_depth.bits.COLOR_DEPTH_8_BPC = 1;
dsc_enc_caps->color_depth.bits.COLOR_DEPTH_10_BPC = 1;
dsc_enc_caps->color_depth.bits.COLOR_DEPTH_12_BPC = 1;
dsc_enc_caps->max_total_throughput_mps = max_dscclk_khz * 3 / 1000;
dsc_enc_caps->max_slice_width = 5184; /* (including 64 overlap pixels for eDP MSO mode) */
dsc_enc_caps->bpp_increment_div = 16; /* 1/16th of a bit */
Annotation
- Immediate include surface: `drm/display/drm_dsc_helper.h`, `reg_helper.h`, `dcn401_dsc.h`, `dsc/dscc_types.h`, `dsc/rc_calc.h`.
- Detected declarations: `function dsc401_construct`, `function dsc401_get_single_enc_caps`, `function dsc401_read_state`, `function dsc401_validate_stream`, `function dsc401_set_config`, `function dsc401_enable`, `function dsc401_disable`, `function dsc401_wait_disconnect_pending_clear`, `function dsc401_disconnect`, `function dsc_write_to_registers`.
- 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.