drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_frl_cap_check.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_frl_cap_check.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/lib_frl_cap_check.c- Extension
.c- Size
- 13778 bytes
- Lines
- 397
- 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
lib_float_math.hlib_frl_cap_check.h
Detected Declarations
function frl_cap_check_commonfunction frl_cap_check_uncompressedfunction frl_cap_check_compressedfunction frl_cap_checkfunction frl_cap_check_intermediates
Annotated Snippet
// SPDX-License-Identifier: MIT
//
// Copyright 2024 Advanced Micro Devices, Inc.
#include "lib_float_math.h"
#include "lib_frl_cap_check.h"
#define frl_dump_var(fmt, var) {}
#define frl_print(fmt, ...) {}
static const double EPSILON = 0.01;
static const double DBL_EPSILON = 2.2204460492503131e-16;
static const int C_FRL_CB = 510;
static const double OVERHEAD_M = 0.003; /* % */
static const double TOLERANCE_PIXEL_CLOCK = 0.005; /* % */
static const double TOLERANCE_AUDIO_CLOCK = 1000; /* ppm */
static const int TOLERANCE_FRL_BIT = 300; /* ppm */
static const int ACR_RATE_MAX = 1500;
const int DML2_FRL_CHK_TB_BORROWED_MAX = 400;
static enum lib_frl_cap_check_status frl_cap_check_common(struct lib_frl_cap_check_intermediates *inter, struct lib_frl_cap_check_params *params)
{
double audio_bw_reserve = (params->compressed ? 192000.0 : 0.0);
/*
if (getenv("DEBUG_FRL_CAP_CHK"))
{
printf("frl_cap_chk inputs:\n");
printf("-------------------\n");
frl_dump_var("%i", params->lanes);
frl_dump_var("%le", params->f_pixel_clock_nominal);
frl_dump_var("%le", params->r_bit_nominal);
frl_dump_var("%i", params->audio_packet_type);
frl_dump_var("%le", params->f_audio);
frl_dump_var("%i", params->h_active);
frl_dump_var("%i", params->h_blank);
frl_dump_var("%i", params->bpc);
frl_dump_var("%i", params->pixel_encoding);
frl_dump_var("%i", params->compressed);
frl_dump_var("%i", params->slices);
frl_dump_var("%i", params->slice_width);
frl_dump_var("%le", params->bpp_target);
frl_dump_var("%i", params->layout);
frl_dump_var("%i", params->acat);
printf("frl_cap_chk outputs:\n");
printf("---------------------\n");
}
*/
inter->c_frl_sb = 4 * C_FRL_CB + params->lanes;
inter->overhead_sb = (double)params->lanes / inter->c_frl_sb;
inter->overhead_rs = 8.0 * 4.0 / inter->c_frl_sb;
inter->overhead_map = 2.5 / inter->c_frl_sb;
inter->overhead_min = inter->overhead_sb + inter->overhead_rs + inter->overhead_map;
inter->overhead_max = inter->overhead_min + OVERHEAD_M;
inter->f_pixel_clock_max = params->f_pixel_clock_nominal * (1.0 + TOLERANCE_PIXEL_CLOCK);
inter->t_line = (params->h_active + params->h_blank) / inter->f_pixel_clock_max;
inter->r_bit_min = params->r_bit_nominal * (1.0 - TOLERANCE_FRL_BIT / 1000000.0);
inter->r_frl_char_min = inter->r_bit_min / 18.0;
inter->c_frl_line = math_floor(inter->t_line * inter->r_frl_char_min * params->lanes);
/*
if (getenv("DEBUG_FRL_CAP_CHK"))
{
frl_dump_var("%i", inter->c_frl_sb);
frl_dump_var("%le", inter->overhead_sb);
frl_dump_var("%le", inter->overhead_rs);
frl_dump_var("%le", inter->overhead_map);
frl_dump_var("%le", inter->overhead_min);
frl_dump_var("%le", inter->overhead_max);
frl_dump_var("%le", inter->f_pixel_clock_max);
frl_dump_var("%le", inter->t_line);
frl_dump_var("%le", inter->r_bit_min);
frl_dump_var("%le", inter->r_frl_char_min);
frl_dump_var("%le", inter->c_frl_line);
}
*/
switch (params->audio_packet_type) {
case 0x02:
/* unsupported
case 0x07:
*/
if (params->layout == 0)
inter->ap = 0.25;
else if (params->layout == 1)
inter->ap = 1.0;
break;
case 0x08:
inter->ap = 0.25;
break;
case 0x09:
/* unsupported
case 0x0e:
Annotation
- Immediate include surface: `lib_float_math.h`, `lib_frl_cap_check.h`.
- Detected declarations: `function frl_cap_check_common`, `function frl_cap_check_uncompressed`, `function frl_cap_check_compressed`, `function frl_cap_check`, `function frl_cap_check_intermediates`.
- 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.