# DF-4199 — dead DCC/PTE bandwidth-overhead factors in dcn_calc_auto.c (integer-constant division transcription bug)

**File:** `sys/dev/drm/amd/display/dc/calcs/dcn_calc_auto.c` (pass 2)
**Severity:** Info (correctness; no kernel memory-safety impact)
**Status:** reproduced at source level on the audit guest by compiling the
REAL kernel source (DF-4198 pattern).

## What

`mode_support_and_system_configuration()` applies DCC-compression and PTE-row
read-bandwidth overhead factors that were transcribed from the DCN1
spreadsheet ("HW gospel", REVISION#250) as **C integer constant expressions**:

```c
v->read_bandwidth[k] = v->read_bandwidth[k] * (1 + 1 / 256);   /* :178 DCC  */
v->read_bandwidth[k] = v->read_bandwidth[k] * (1 + 1 / 64);    /* :181 PTE  */
v->read_bandwidth[k] = v->read_bandwidth[k] * (1 + 1 / 256);   /* :184 PTE  */
v->read_bandwidth[k] = v->read_bandwidth[k] * (1 + 1 / 512);   /* :187 PTE  */
```

In C, `1 / 256`, `1 / 64`, `1 / 512` are *int* divisions that evaluate to
**0**, so every factor compiles to exactly `1` and the entire DCC/PTE
overhead accounting is dead code. The spreadsheet intends 1.00390625,
1.015625, 1.00390625, 1.001953125 respectively.

## Impact

`total_read_bandwidth_consumed_gbyte_per_second` (dcn_calc_auto.c:189) is
under-estimated by up to ~1.5% per DCC+PTE plane, and `bandwidth_support[i]`
(:231) can therefore say *yes* for a configuration the hardware model would
reject — a marginal mode passes DCN1 validation and can hit DRAM/DCFCLK
underruns (visual corruption / flicker on Raven APUs). No kernel memory
corruption: every consumer in the file is an IEEE-754 float comparison;
the only float->int conversions (`voltage_level`, `dispclk_dppclk_ratio`)
are provably in-range (see VERDICT.md "killed candidates").

## Reproduce

```
./build.sh    # pulls REAL dcn_calc_auto.c + dcn_calc_math.c + real DCN
              # headers from guest /usr/src; only dm_services.h and
              # display_clock.h are stubs; builds baseline + fixed
./run.sh      # dcc / pte / degen / log0 tests
```

Expected (see run.log / run.2.log):

```
baseline: read_bw[dcc]=518.400024  read_bw[nodcc]=518.400024  ratio=1.000000000
          DEFECT PRESENT: factor (1 + 1/256) evaluated to exactly 1
fixed:    read_bw[dcc]=522.457947  read_bw[nodcc]=520.425049  ratio=1.003906250
          FIXED: factor is (1.0 + 1.0/256.0) = 1.00390625
```

The same binary also documents the pass-2 negative results: degenerate
crafted inputs (pixel_clock=0, htotal=0, all-zero socBB clocks,
viewport_width=0 feeding `dcn_bw_log(0) = -127`) produce **no SIGFPE/#DE**
— every division in this file is float — validation fails safe, and
`voltage_level` stays within [0,5].

## Fix

`fix.diff` (4 lines, applied and validated in this pack).
