|
14 | 14 |
|
15 | 15 | #include <drm/display/drm_dp_helper.h>
|
16 | 16 | #include <drm/display/drm_dsc_helper.h>
|
| 17 | +#include <drm/drm_fixed.h> |
17 | 18 | #include <drm/drm_print.h>
|
18 | 19 |
|
19 | 20 | /**
|
@@ -1472,3 +1473,93 @@ u32 drm_dsc_flatness_det_thresh(const struct drm_dsc_config *dsc)
|
1472 | 1473 | return 2 << (dsc->bits_per_component - 8);
|
1473 | 1474 | }
|
1474 | 1475 | EXPORT_SYMBOL(drm_dsc_flatness_det_thresh);
|
| 1476 | + |
| 1477 | +static void drm_dsc_dump_config_main_params(struct drm_printer *p, int indent, |
| 1478 | + const struct drm_dsc_config *cfg) |
| 1479 | +{ |
| 1480 | + drm_printf_indent(p, indent, |
| 1481 | + "dsc-cfg: version: %d.%d, picture: w=%d, h=%d, slice: count=%d, w=%d, h=%d, size=%d\n", |
| 1482 | + cfg->dsc_version_major, cfg->dsc_version_minor, |
| 1483 | + cfg->pic_width, cfg->pic_height, |
| 1484 | + cfg->slice_count, cfg->slice_width, cfg->slice_height, cfg->slice_chunk_size); |
| 1485 | + drm_printf_indent(p, indent, |
| 1486 | + "dsc-cfg: mode: block-pred=%s, vbr=%s, rgb=%s, simple-422=%s, native-422=%s, native-420=%s\n", |
| 1487 | + str_yes_no(cfg->block_pred_enable), str_yes_no(cfg->vbr_enable), |
| 1488 | + str_yes_no(cfg->convert_rgb), |
| 1489 | + str_yes_no(cfg->simple_422), str_yes_no(cfg->native_422), str_yes_no(cfg->native_420)); |
| 1490 | + drm_printf_indent(p, indent, |
| 1491 | + "dsc-cfg: color-depth: uncompressed-bpc=%d, compressed-bpp=" FXP_Q4_FMT " line-buf-bpp=%d\n", |
| 1492 | + cfg->bits_per_component, FXP_Q4_ARGS(cfg->bits_per_pixel), cfg->line_buf_depth); |
| 1493 | + drm_printf_indent(p, indent, |
| 1494 | + "dsc-cfg: rc-model: size=%d, bits=%d, mux-word-size: %d, initial-delays: xmit=%d, dec=%d\n", |
| 1495 | + cfg->rc_model_size, cfg->rc_bits, cfg->mux_word_size, |
| 1496 | + cfg->initial_xmit_delay, cfg->initial_dec_delay); |
| 1497 | + drm_printf_indent(p, indent, |
| 1498 | + "dsc-cfg: offsets: initial=%d, final=%d, slice-bpg=%d\n", |
| 1499 | + cfg->initial_offset, cfg->final_offset, cfg->slice_bpg_offset); |
| 1500 | + drm_printf_indent(p, indent, |
| 1501 | + "dsc-cfg: line-bpg-offsets: first=%d, non-first=%d, second=%d, non-second=%d, second-adj=%d\n", |
| 1502 | + cfg->first_line_bpg_offset, cfg->nfl_bpg_offset, |
| 1503 | + cfg->second_line_bpg_offset, cfg->nsl_bpg_offset, cfg->second_line_offset_adj); |
| 1504 | + drm_printf_indent(p, indent, |
| 1505 | + "dsc-cfg: rc-tgt-offsets: low=%d, high=%d, rc-edge-factor: %d, rc-quant-incr-limits: [0]=%d, [1]=%d\n", |
| 1506 | + cfg->rc_tgt_offset_low, cfg->rc_tgt_offset_high, |
| 1507 | + cfg->rc_edge_factor, cfg->rc_quant_incr_limit0, cfg->rc_quant_incr_limit1); |
| 1508 | + drm_printf_indent(p, indent, |
| 1509 | + "dsc-cfg: initial-scale: %d, scale-intervals: increment=%d, decrement=%d\n", |
| 1510 | + cfg->initial_scale_value, cfg->scale_increment_interval, cfg->scale_decrement_interval); |
| 1511 | + drm_printf_indent(p, indent, |
| 1512 | + "dsc-cfg: flatness: min-qp=%d, max-qp=%d\n", |
| 1513 | + cfg->flatness_min_qp, cfg->flatness_max_qp); |
| 1514 | +} |
| 1515 | + |
| 1516 | +static void drm_dsc_dump_config_rc_params(struct drm_printer *p, int indent, |
| 1517 | + const struct drm_dsc_config *cfg) |
| 1518 | +{ |
| 1519 | + const u16 *bt = cfg->rc_buf_thresh; |
| 1520 | + const struct drm_dsc_rc_range_parameters *rp = cfg->rc_range_params; |
| 1521 | + |
| 1522 | + BUILD_BUG_ON(ARRAY_SIZE(cfg->rc_buf_thresh) != 14); |
| 1523 | + BUILD_BUG_ON(ARRAY_SIZE(cfg->rc_range_params) != 15); |
| 1524 | + |
| 1525 | + drm_printf_indent(p, indent, |
| 1526 | + "dsc-cfg: rc-level: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14\n"); |
| 1527 | + drm_printf_indent(p, indent, |
| 1528 | + "dsc-cfg: rc-buf-thresh: %3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d\n", |
| 1529 | + bt[0], bt[1], bt[2], bt[3], bt[4], bt[5], bt[6], bt[7], |
| 1530 | + bt[8], bt[9], bt[10], bt[11], bt[12], bt[13]); |
| 1531 | + drm_printf_indent(p, indent, |
| 1532 | + "dsc-cfg: rc-min-qp: %3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d\n", |
| 1533 | + rp[0].range_min_qp, rp[1].range_min_qp, rp[2].range_min_qp, rp[3].range_min_qp, |
| 1534 | + rp[4].range_min_qp, rp[5].range_min_qp, rp[6].range_min_qp, rp[7].range_min_qp, |
| 1535 | + rp[8].range_min_qp, rp[9].range_min_qp, rp[10].range_min_qp, rp[11].range_min_qp, |
| 1536 | + rp[12].range_min_qp, rp[13].range_min_qp, rp[14].range_min_qp); |
| 1537 | + drm_printf_indent(p, indent, |
| 1538 | + "dsc-cfg: rc-max-qp: %3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d\n", |
| 1539 | + rp[0].range_max_qp, rp[1].range_max_qp, rp[2].range_max_qp, rp[3].range_max_qp, |
| 1540 | + rp[4].range_max_qp, rp[5].range_max_qp, rp[6].range_max_qp, rp[7].range_max_qp, |
| 1541 | + rp[8].range_max_qp, rp[9].range_max_qp, rp[10].range_max_qp, rp[11].range_max_qp, |
| 1542 | + rp[12].range_max_qp, rp[13].range_max_qp, rp[14].range_max_qp); |
| 1543 | + drm_printf_indent(p, indent, |
| 1544 | + "dsc-cfg: rc-bpg-offset: %3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d\n", |
| 1545 | + rp[0].range_bpg_offset, rp[1].range_bpg_offset, rp[2].range_bpg_offset, rp[3].range_bpg_offset, |
| 1546 | + rp[4].range_bpg_offset, rp[5].range_bpg_offset, rp[6].range_bpg_offset, rp[7].range_bpg_offset, |
| 1547 | + rp[8].range_bpg_offset, rp[9].range_bpg_offset, rp[10].range_bpg_offset, rp[11].range_bpg_offset, |
| 1548 | + rp[12].range_bpg_offset, rp[13].range_bpg_offset, rp[14].range_bpg_offset); |
| 1549 | +} |
| 1550 | + |
| 1551 | +/** |
| 1552 | + * drm_dsc_dump_config - Dump the provided DSC configuration |
| 1553 | + * @p: The printer used for output |
| 1554 | + * @indent: Tab indentation level (max 5) |
| 1555 | + * @cfg: DSC configuration to print |
| 1556 | + * |
| 1557 | + * Print the provided DSC configuration in @cfg. |
| 1558 | + */ |
| 1559 | +void drm_dsc_dump_config(struct drm_printer *p, int indent, |
| 1560 | + const struct drm_dsc_config *cfg) |
| 1561 | +{ |
| 1562 | + drm_dsc_dump_config_main_params(p, indent, cfg); |
| 1563 | + drm_dsc_dump_config_rc_params(p, indent, cfg); |
| 1564 | +} |
| 1565 | +EXPORT_SYMBOL(drm_dsc_dump_config); |
0 commit comments