Lines Matching +full:display +full:- +full:pipe

1 // SPDX-License-Identifier: MIT
10 #include <drm/display/drm_dsc_helper.h>
25 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_source_support() local
26 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; in intel_dsc_source_support()
28 if (!HAS_DSC(display)) in intel_dsc_source_support()
31 if (DISPLAY_VER(display) == 11 && cpu_transcoder == TRANSCODER_A) in intel_dsc_source_support()
39 struct intel_display *display = to_intel_display(crtc); in is_pipe_dsc() local
41 if (DISPLAY_VER(display) >= 12) in is_pipe_dsc()
49 /* There's no pipe A DSC engine on ICL */ in is_pipe_dsc()
50 drm_WARN_ON(display->drm, crtc->pipe == PIPE_A); in is_pipe_dsc()
59 int bpc = vdsc_cfg->bits_per_component; in intel_vdsc_set_min_max_qp()
62 vdsc_cfg->rc_range_params[buf].range_min_qp = in intel_vdsc_set_min_max_qp()
63 intel_lookup_range_min_qp(bpc, buf, bpp, vdsc_cfg->native_420); in intel_vdsc_set_min_max_qp()
64 vdsc_cfg->rc_range_params[buf].range_max_qp = in intel_vdsc_set_min_max_qp()
65 intel_lookup_range_max_qp(bpc, buf, bpp, vdsc_cfg->native_420); in intel_vdsc_set_min_max_qp()
71 return offset_low + DIV_ROUND_UP((offset_high - offset_low) * (bpp - bpp_low), in get_range_bpg_offset()
72 (bpp_low - bpp_high)); in get_range_bpg_offset()
76 * We are using the method provided in DSC 1.2a C-Model in codec_main.c
82 * DSCParameterValuesVESA V1-2 spreadsheet).
87 int bpp = fxp_q4_to_int(vdsc_cfg->bits_per_pixel); in calculate_rc_params()
88 int bpc = vdsc_cfg->bits_per_component; in calculate_rc_params()
89 int qp_bpc_modifier = (bpc - 8) * 2; in calculate_rc_params()
94 if (vdsc_cfg->slice_height >= 8) in calculate_rc_params()
96 12 + (9 * min(34, vdsc_cfg->slice_height - 8)) / 100; in calculate_rc_params()
98 first_line_bpg_offset = 2 * (vdsc_cfg->slice_height - 1); in calculate_rc_params()
100 uncompressed_bpg_rate = (3 * bpc + (vdsc_cfg->convert_rgb ? 0 : 2)) * 3; in calculate_rc_params()
101 vdsc_cfg->first_line_bpg_offset = clamp(first_line_bpg_offset, 0, in calculate_rc_params()
102 uncompressed_bpg_rate - 3 * bpp); in calculate_rc_params()
106 * -second_line_bpg_offset is 12 in general and equal to 2*(slice_height-1) if slice in calculate_rc_params()
108 * -second_line_offset_adj is 512 as shown by empirical values to yield best chroma in calculate_rc_params()
110 * -nsl_bpg_offset is calculated as second_line_offset/slice_height -1 then rounded in calculate_rc_params()
114 if (vdsc_cfg->native_420) { in calculate_rc_params()
115 if (vdsc_cfg->slice_height >= 8) in calculate_rc_params()
116 vdsc_cfg->second_line_bpg_offset = 12; in calculate_rc_params()
118 vdsc_cfg->second_line_bpg_offset = in calculate_rc_params()
119 2 * (vdsc_cfg->slice_height - 1); in calculate_rc_params()
121 vdsc_cfg->second_line_offset_adj = 512; in calculate_rc_params()
122 vdsc_cfg->nsl_bpg_offset = DIV_ROUND_UP(vdsc_cfg->second_line_bpg_offset << 11, in calculate_rc_params()
123 vdsc_cfg->slice_height - 1); in calculate_rc_params()
127 vdsc_cfg->initial_offset = 2048; in calculate_rc_params()
129 vdsc_cfg->initial_offset = 5632 - DIV_ROUND_UP(((bpp - 10) * 3584), 2); in calculate_rc_params()
131 vdsc_cfg->initial_offset = 6144 - DIV_ROUND_UP(((bpp - 8) * 512), 2); in calculate_rc_params()
133 vdsc_cfg->initial_offset = 6144; in calculate_rc_params()
136 vdsc_cfg->initial_xmit_delay = DIV_ROUND_UP(DSC_RC_MODEL_SIZE_CONST, 2 * bpp); in calculate_rc_params()
138 vdsc_cfg->flatness_min_qp = 3 + qp_bpc_modifier; in calculate_rc_params()
139 vdsc_cfg->flatness_max_qp = 12 + qp_bpc_modifier; in calculate_rc_params()
141 vdsc_cfg->rc_quant_incr_limit0 = 11 + qp_bpc_modifier; in calculate_rc_params()
142 vdsc_cfg->rc_quant_incr_limit1 = 11 + qp_bpc_modifier; in calculate_rc_params()
144 if (vdsc_cfg->native_420) { in calculate_rc_params()
146 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 in calculate_rc_params()
149 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 in calculate_rc_params()
152 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 in calculate_rc_params()
155 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -10, -12, -12, -12 in calculate_rc_params()
164 bpp_i = bpp - 8; in calculate_rc_params()
185 vdsc_cfg->rc_range_params[buf_i].range_bpg_offset = in calculate_rc_params()
190 int fractional_bits = fxp_q4_to_frac(vdsc_cfg->bits_per_pixel); in calculate_rc_params()
193 0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 in calculate_rc_params()
196 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 in calculate_rc_params()
199 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 in calculate_rc_params()
202 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -10, -12, -12, -12 in calculate_rc_params()
211 bpp_i = ((bpp - 6) + (fractional_bits < 5000 ? 0 : 1)); in calculate_rc_params()
233 vdsc_cfg->rc_range_params[buf_i].range_bpg_offset = in calculate_rc_params()
242 if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_RGB || in intel_dsc_slice_dimensions_valid()
243 pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR444) { in intel_dsc_slice_dimensions_valid()
244 if (vdsc_cfg->slice_height > 4095) in intel_dsc_slice_dimensions_valid()
245 return -EINVAL; in intel_dsc_slice_dimensions_valid()
246 if (vdsc_cfg->slice_height * vdsc_cfg->slice_width < 15000) in intel_dsc_slice_dimensions_valid()
247 return -EINVAL; in intel_dsc_slice_dimensions_valid()
248 } else if (pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) { in intel_dsc_slice_dimensions_valid()
249 if (vdsc_cfg->slice_width % 2) in intel_dsc_slice_dimensions_valid()
250 return -EINVAL; in intel_dsc_slice_dimensions_valid()
251 if (vdsc_cfg->slice_height % 2) in intel_dsc_slice_dimensions_valid()
252 return -EINVAL; in intel_dsc_slice_dimensions_valid()
253 if (vdsc_cfg->slice_height > 4094) in intel_dsc_slice_dimensions_valid()
254 return -EINVAL; in intel_dsc_slice_dimensions_valid()
255 if (vdsc_cfg->slice_height * vdsc_cfg->slice_width < 30000) in intel_dsc_slice_dimensions_valid()
256 return -EINVAL; in intel_dsc_slice_dimensions_valid()
264 struct intel_display *display = to_intel_display(pipe_config); in intel_dsc_compute_params() local
265 struct drm_dsc_config *vdsc_cfg = &pipe_config->dsc.config; in intel_dsc_compute_params()
266 u16 compressed_bpp = fxp_q4_to_int(pipe_config->dsc.compressed_bpp_x16); in intel_dsc_compute_params()
270 vdsc_cfg->pic_width = pipe_config->hw.adjusted_mode.crtc_hdisplay; in intel_dsc_compute_params()
271 vdsc_cfg->slice_width = DIV_ROUND_UP(vdsc_cfg->pic_width, in intel_dsc_compute_params()
272 pipe_config->dsc.slice_count); in intel_dsc_compute_params()
277 drm_dbg_kms(display->drm, "Slice dimension requirements not met\n"); in intel_dsc_compute_params()
285 vdsc_cfg->convert_rgb = pipe_config->output_format != INTEL_OUTPUT_FORMAT_YCBCR420 && in intel_dsc_compute_params()
286 pipe_config->output_format != INTEL_OUTPUT_FORMAT_YCBCR444; in intel_dsc_compute_params()
288 if (DISPLAY_VER(display) >= 14 && in intel_dsc_compute_params()
289 pipe_config->output_format == INTEL_OUTPUT_FORMAT_YCBCR420) in intel_dsc_compute_params()
290 vdsc_cfg->native_420 = true; in intel_dsc_compute_params()
292 vdsc_cfg->native_422 = false; in intel_dsc_compute_params()
293 vdsc_cfg->simple_422 = false; in intel_dsc_compute_params()
295 vdsc_cfg->vbr_enable = false; in intel_dsc_compute_params()
297 vdsc_cfg->bits_per_pixel = pipe_config->dsc.compressed_bpp_x16; in intel_dsc_compute_params()
303 if (vdsc_cfg->native_420) in intel_dsc_compute_params()
304 vdsc_cfg->bits_per_pixel <<= 1; in intel_dsc_compute_params()
306 vdsc_cfg->bits_per_component = pipe_config->pipe_bpp / 3; in intel_dsc_compute_params()
308 if (vdsc_cfg->bits_per_component < 8) { in intel_dsc_compute_params()
309 drm_dbg_kms(display->drm, "DSC bpc requirements not met bpc: %d\n", in intel_dsc_compute_params()
310 vdsc_cfg->bits_per_component); in intel_dsc_compute_params()
311 return -EINVAL; in intel_dsc_compute_params()
318 * upto uncompressed bpp-1, hence add calculations for all the rc in intel_dsc_compute_params()
321 if (DISPLAY_VER(display) >= 13) { in intel_dsc_compute_params()
326 (vdsc_cfg->bits_per_component == 8 || in intel_dsc_compute_params()
327 vdsc_cfg->bits_per_component == 10 || in intel_dsc_compute_params()
328 vdsc_cfg->bits_per_component == 12)) in intel_dsc_compute_params()
342 if (vdsc_cfg->bits_per_component <= 10) in intel_dsc_compute_params()
343 vdsc_cfg->mux_word_size = DSC_MUX_WORD_SIZE_8_10_BPC; in intel_dsc_compute_params()
345 vdsc_cfg->mux_word_size = DSC_MUX_WORD_SIZE_12_BPC; in intel_dsc_compute_params()
348 vdsc_cfg->initial_scale_value = (vdsc_cfg->rc_model_size << 3) / in intel_dsc_compute_params()
349 (vdsc_cfg->rc_model_size - vdsc_cfg->initial_offset); in intel_dsc_compute_params()
357 struct intel_display *display = to_intel_display(crtc); in intel_dsc_power_domain() local
358 enum pipe pipe = crtc->pipe; in intel_dsc_power_domain() local
364 * - ICL eDP/DSI transcoder in intel_dsc_power_domain()
365 * - Display version 12 (except RKL) pipe A in intel_dsc_power_domain()
367 * For any other pipe, VDSC/joining uses the power well associated with in intel_dsc_power_domain()
368 * the pipe in use. Hence another reference on the pipe power domain in intel_dsc_power_domain()
369 * will suffice. (Except no VDSC/joining on ICL pipe A.) in intel_dsc_power_domain()
371 if (DISPLAY_VER(display) == 12 && !display->platform.rocketlake && in intel_dsc_power_domain()
372 pipe == PIPE_A) in intel_dsc_power_domain()
375 return POWER_DOMAIN_PIPE(pipe); in intel_dsc_power_domain()
382 return crtc_state->dsc.num_streams; in intel_dsc_get_vdsc_per_pipe()
398 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in intel_dsc_get_pps_reg()
399 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; in intel_dsc_get_pps_reg()
400 enum pipe pipe = crtc->pipe; in intel_dsc_get_pps_reg() local
408 dsc_reg[2] = BMG_DSC2_PPS(pipe, pps); in intel_dsc_get_pps_reg()
410 dsc_reg[1] = pipe_dsc ? ICL_DSC1_PPS(pipe, pps) : DSCC_PPS(pps); in intel_dsc_get_pps_reg()
412 dsc_reg[0] = pipe_dsc ? ICL_DSC0_PPS(pipe, pps) : DSCA_PPS(pps); in intel_dsc_get_pps_reg()
418 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_pps_write() local
425 drm_WARN_ON_ONCE(display->drm, dsc_reg_num < vdsc_per_pipe); in intel_dsc_pps_write()
430 intel_de_write(display, dsc_reg[i], pps_val); in intel_dsc_pps_write()
435 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_pps_configure() local
436 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in intel_dsc_pps_configure()
437 const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; in intel_dsc_pps_configure()
438 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; in intel_dsc_pps_configure()
439 enum pipe pipe = crtc->pipe; in intel_dsc_pps_configure() local
449 DSC_PPS0_VER_MINOR(vdsc_cfg->dsc_version_minor) | in intel_dsc_pps_configure()
450 DSC_PPS0_BPC(vdsc_cfg->bits_per_component) | in intel_dsc_pps_configure()
451 DSC_PPS0_LINE_BUF_DEPTH(vdsc_cfg->line_buf_depth); in intel_dsc_pps_configure()
452 if (vdsc_cfg->dsc_version_minor == 2) { in intel_dsc_pps_configure()
454 if (vdsc_cfg->native_420) in intel_dsc_pps_configure()
456 if (vdsc_cfg->native_422) in intel_dsc_pps_configure()
459 if (vdsc_cfg->block_pred_enable) in intel_dsc_pps_configure()
461 if (vdsc_cfg->convert_rgb) in intel_dsc_pps_configure()
463 if (vdsc_cfg->simple_422) in intel_dsc_pps_configure()
465 if (vdsc_cfg->vbr_enable) in intel_dsc_pps_configure()
470 pps_val = DSC_PPS1_BPP(vdsc_cfg->bits_per_pixel); in intel_dsc_pps_configure()
474 pps_val = DSC_PPS2_PIC_HEIGHT(vdsc_cfg->pic_height) | in intel_dsc_pps_configure()
475 DSC_PPS2_PIC_WIDTH(vdsc_cfg->pic_width / num_vdsc_instances); in intel_dsc_pps_configure()
479 pps_val = DSC_PPS3_SLICE_HEIGHT(vdsc_cfg->slice_height) | in intel_dsc_pps_configure()
480 DSC_PPS3_SLICE_WIDTH(vdsc_cfg->slice_width); in intel_dsc_pps_configure()
484 pps_val = DSC_PPS4_INITIAL_XMIT_DELAY(vdsc_cfg->initial_xmit_delay) | in intel_dsc_pps_configure()
485 DSC_PPS4_INITIAL_DEC_DELAY(vdsc_cfg->initial_dec_delay); in intel_dsc_pps_configure()
489 pps_val = DSC_PPS5_SCALE_INC_INT(vdsc_cfg->scale_increment_interval) | in intel_dsc_pps_configure()
490 DSC_PPS5_SCALE_DEC_INT(vdsc_cfg->scale_decrement_interval); in intel_dsc_pps_configure()
494 pps_val = DSC_PPS6_INITIAL_SCALE_VALUE(vdsc_cfg->initial_scale_value) | in intel_dsc_pps_configure()
495 DSC_PPS6_FIRST_LINE_BPG_OFFSET(vdsc_cfg->first_line_bpg_offset) | in intel_dsc_pps_configure()
496 DSC_PPS6_FLATNESS_MIN_QP(vdsc_cfg->flatness_min_qp) | in intel_dsc_pps_configure()
497 DSC_PPS6_FLATNESS_MAX_QP(vdsc_cfg->flatness_max_qp); in intel_dsc_pps_configure()
501 pps_val = DSC_PPS7_SLICE_BPG_OFFSET(vdsc_cfg->slice_bpg_offset) | in intel_dsc_pps_configure()
502 DSC_PPS7_NFL_BPG_OFFSET(vdsc_cfg->nfl_bpg_offset); in intel_dsc_pps_configure()
506 pps_val = DSC_PPS8_FINAL_OFFSET(vdsc_cfg->final_offset) | in intel_dsc_pps_configure()
507 DSC_PPS8_INITIAL_OFFSET(vdsc_cfg->initial_offset); in intel_dsc_pps_configure()
511 pps_val = DSC_PPS9_RC_MODEL_SIZE(vdsc_cfg->rc_model_size) | in intel_dsc_pps_configure()
516 pps_val = DSC_PPS10_RC_QUANT_INC_LIMIT0(vdsc_cfg->rc_quant_incr_limit0) | in intel_dsc_pps_configure()
517 DSC_PPS10_RC_QUANT_INC_LIMIT1(vdsc_cfg->rc_quant_incr_limit1) | in intel_dsc_pps_configure()
523 pps_val = DSC_PPS16_SLICE_CHUNK_SIZE(vdsc_cfg->slice_chunk_size) | in intel_dsc_pps_configure()
524 DSC_PPS16_SLICE_PER_LINE((vdsc_cfg->pic_width / num_vdsc_instances) / in intel_dsc_pps_configure()
525 vdsc_cfg->slice_width) | in intel_dsc_pps_configure()
526 DSC_PPS16_SLICE_ROW_PER_FRAME(vdsc_cfg->pic_height / in intel_dsc_pps_configure()
527 vdsc_cfg->slice_height); in intel_dsc_pps_configure()
530 if (DISPLAY_VER(display) >= 14) { in intel_dsc_pps_configure()
532 pps_val = DSC_PPS17_SL_BPG_OFFSET(vdsc_cfg->second_line_bpg_offset); in intel_dsc_pps_configure()
536 pps_val = DSC_PPS18_NSL_BPG_OFFSET(vdsc_cfg->nsl_bpg_offset) | in intel_dsc_pps_configure()
537 DSC_PPS18_SL_OFFSET_ADJ(vdsc_cfg->second_line_offset_adj); in intel_dsc_pps_configure()
543 for (i = 0; i < DSC_NUM_BUF_RANGES - 1; i++) in intel_dsc_pps_configure()
545 (u32)(vdsc_cfg->rc_buf_thresh[i] << in intel_dsc_pps_configure()
548 intel_de_write(display, DSCA_RC_BUF_THRESH_0, in intel_dsc_pps_configure()
550 intel_de_write(display, DSCA_RC_BUF_THRESH_0_UDW, in intel_dsc_pps_configure()
552 intel_de_write(display, DSCA_RC_BUF_THRESH_1, in intel_dsc_pps_configure()
554 intel_de_write(display, DSCA_RC_BUF_THRESH_1_UDW, in intel_dsc_pps_configure()
557 intel_de_write(display, DSCC_RC_BUF_THRESH_0, in intel_dsc_pps_configure()
559 intel_de_write(display, DSCC_RC_BUF_THRESH_0_UDW, in intel_dsc_pps_configure()
561 intel_de_write(display, DSCC_RC_BUF_THRESH_1, in intel_dsc_pps_configure()
563 intel_de_write(display, DSCC_RC_BUF_THRESH_1_UDW, in intel_dsc_pps_configure()
567 intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_0(pipe), in intel_dsc_pps_configure()
569 intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_0_UDW(pipe), in intel_dsc_pps_configure()
571 intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_1(pipe), in intel_dsc_pps_configure()
573 intel_de_write(display, ICL_DSC0_RC_BUF_THRESH_1_UDW(pipe), in intel_dsc_pps_configure()
576 intel_de_write(display, in intel_dsc_pps_configure()
577 ICL_DSC1_RC_BUF_THRESH_0(pipe), in intel_dsc_pps_configure()
579 intel_de_write(display, in intel_dsc_pps_configure()
580 ICL_DSC1_RC_BUF_THRESH_0_UDW(pipe), in intel_dsc_pps_configure()
582 intel_de_write(display, in intel_dsc_pps_configure()
583 ICL_DSC1_RC_BUF_THRESH_1(pipe), in intel_dsc_pps_configure()
585 intel_de_write(display, in intel_dsc_pps_configure()
586 ICL_DSC1_RC_BUF_THRESH_1_UDW(pipe), in intel_dsc_pps_configure()
595 (u32)(((vdsc_cfg->rc_range_params[i].range_bpg_offset << in intel_dsc_pps_configure()
597 (vdsc_cfg->rc_range_params[i].range_max_qp << in intel_dsc_pps_configure()
599 (vdsc_cfg->rc_range_params[i].range_min_qp << in intel_dsc_pps_configure()
602 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_0, in intel_dsc_pps_configure()
604 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_0_UDW, in intel_dsc_pps_configure()
606 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_1, in intel_dsc_pps_configure()
608 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_1_UDW, in intel_dsc_pps_configure()
610 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_2, in intel_dsc_pps_configure()
612 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_2_UDW, in intel_dsc_pps_configure()
614 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_3, in intel_dsc_pps_configure()
616 intel_de_write(display, DSCA_RC_RANGE_PARAMETERS_3_UDW, in intel_dsc_pps_configure()
619 intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_0, in intel_dsc_pps_configure()
621 intel_de_write(display, in intel_dsc_pps_configure()
624 intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_1, in intel_dsc_pps_configure()
626 intel_de_write(display, in intel_dsc_pps_configure()
629 intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_2, in intel_dsc_pps_configure()
631 intel_de_write(display, in intel_dsc_pps_configure()
634 intel_de_write(display, DSCC_RC_RANGE_PARAMETERS_3, in intel_dsc_pps_configure()
636 intel_de_write(display, in intel_dsc_pps_configure()
641 intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_0(pipe), in intel_dsc_pps_configure()
643 intel_de_write(display, in intel_dsc_pps_configure()
644 ICL_DSC0_RC_RANGE_PARAMETERS_0_UDW(pipe), in intel_dsc_pps_configure()
646 intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_1(pipe), in intel_dsc_pps_configure()
648 intel_de_write(display, in intel_dsc_pps_configure()
649 ICL_DSC0_RC_RANGE_PARAMETERS_1_UDW(pipe), in intel_dsc_pps_configure()
651 intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_2(pipe), in intel_dsc_pps_configure()
653 intel_de_write(display, in intel_dsc_pps_configure()
654 ICL_DSC0_RC_RANGE_PARAMETERS_2_UDW(pipe), in intel_dsc_pps_configure()
656 intel_de_write(display, ICL_DSC0_RC_RANGE_PARAMETERS_3(pipe), in intel_dsc_pps_configure()
658 intel_de_write(display, in intel_dsc_pps_configure()
659 ICL_DSC0_RC_RANGE_PARAMETERS_3_UDW(pipe), in intel_dsc_pps_configure()
662 intel_de_write(display, in intel_dsc_pps_configure()
663 ICL_DSC1_RC_RANGE_PARAMETERS_0(pipe), in intel_dsc_pps_configure()
665 intel_de_write(display, in intel_dsc_pps_configure()
666 ICL_DSC1_RC_RANGE_PARAMETERS_0_UDW(pipe), in intel_dsc_pps_configure()
668 intel_de_write(display, in intel_dsc_pps_configure()
669 ICL_DSC1_RC_RANGE_PARAMETERS_1(pipe), in intel_dsc_pps_configure()
671 intel_de_write(display, in intel_dsc_pps_configure()
672 ICL_DSC1_RC_RANGE_PARAMETERS_1_UDW(pipe), in intel_dsc_pps_configure()
674 intel_de_write(display, in intel_dsc_pps_configure()
675 ICL_DSC1_RC_RANGE_PARAMETERS_2(pipe), in intel_dsc_pps_configure()
677 intel_de_write(display, in intel_dsc_pps_configure()
678 ICL_DSC1_RC_RANGE_PARAMETERS_2_UDW(pipe), in intel_dsc_pps_configure()
680 intel_de_write(display, in intel_dsc_pps_configure()
681 ICL_DSC1_RC_RANGE_PARAMETERS_3(pipe), in intel_dsc_pps_configure()
683 intel_de_write(display, in intel_dsc_pps_configure()
684 ICL_DSC1_RC_RANGE_PARAMETERS_3_UDW(pipe), in intel_dsc_pps_configure()
693 const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; in intel_dsc_dsi_pps_write()
699 if (!crtc_state->dsc.compression_enable) in intel_dsc_dsi_pps_write()
704 for_each_dsi_port(port, intel_dsi->ports) { in intel_dsc_dsi_pps_write()
705 dsi = intel_dsi->dsi_hosts[port]->device; in intel_dsc_dsi_pps_write()
716 const struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; in intel_dsc_dp_pps_write()
719 if (!crtc_state->dsc.compression_enable) in intel_dsc_dp_pps_write()
722 /* Prepare DP SDP PPS header as per DP 1.4 spec, Table 2-123 */ in intel_dsc_dp_pps_write()
725 /* Fill the PPS payload bytes as per DSC spec 1.2 Table 4-1 */ in intel_dsc_dp_pps_write()
728 dig_port->write_infoframe(encoder, crtc_state, in intel_dsc_dp_pps_write()
736 ICL_PIPE_DSS_CTL1(crtc->pipe) : DSS_CTL1; in dss_ctl1_reg()
742 ICL_PIPE_DSS_CTL2(crtc->pipe) : DSS_CTL2; in dss_ctl2_reg()
747 struct intel_display *display = to_intel_display(crtc_state); in intel_uncompressed_joiner_enable() local
748 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in intel_uncompressed_joiner_enable()
751 if (crtc_state->joiner_pipes && !crtc_state->dsc.compression_enable) { in intel_uncompressed_joiner_enable()
757 intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), in intel_uncompressed_joiner_enable()
764 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_enable() local
765 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in intel_dsc_enable()
770 if (!crtc_state->dsc.compression_enable) in intel_dsc_enable()
786 if (crtc_state->joiner_pipes) { in intel_dsc_enable()
798 intel_de_write(display, dss_ctl1_reg(crtc, crtc_state->cpu_transcoder), dss_ctl1_val); in intel_dsc_enable()
799 intel_de_write(display, dss_ctl2_reg(crtc, crtc_state->cpu_transcoder), dss_ctl2_val); in intel_dsc_enable()
804 struct intel_display *display = to_intel_display(old_crtc_state); in intel_dsc_disable() local
805 struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc); in intel_dsc_disable()
808 if (old_crtc_state->dsc.compression_enable || in intel_dsc_disable()
809 old_crtc_state->joiner_pipes) { in intel_dsc_disable()
810 intel_de_write(display, dss_ctl1_reg(crtc, old_crtc_state->cpu_transcoder), 0); in intel_dsc_disable()
811 intel_de_write(display, dss_ctl2_reg(crtc, old_crtc_state->cpu_transcoder), 0); in intel_dsc_disable()
818 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_pps_read() local
826 drm_WARN_ON_ONCE(display->drm, dsc_reg_num < vdsc_per_pipe); in intel_dsc_pps_read()
832 val = intel_de_read(display, dsc_reg[0]); in intel_dsc_pps_read()
835 if (intel_de_read(display, dsc_reg[i]) != val) { in intel_dsc_pps_read()
846 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_pps_read_and_verify() local
851 drm_WARN_ON(display->drm, !all_equal); in intel_dsc_pps_read_and_verify()
858 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_get_pps_config() local
859 struct drm_dsc_config *vdsc_cfg = &crtc_state->dsc.config; in intel_dsc_get_pps_config()
866 vdsc_cfg->bits_per_component = REG_FIELD_GET(DSC_PPS0_BPC_MASK, pps_temp); in intel_dsc_get_pps_config()
867 vdsc_cfg->line_buf_depth = REG_FIELD_GET(DSC_PPS0_LINE_BUF_DEPTH_MASK, pps_temp); in intel_dsc_get_pps_config()
868 vdsc_cfg->block_pred_enable = pps_temp & DSC_PPS0_BLOCK_PREDICTION; in intel_dsc_get_pps_config()
869 vdsc_cfg->convert_rgb = pps_temp & DSC_PPS0_COLOR_SPACE_CONVERSION; in intel_dsc_get_pps_config()
870 vdsc_cfg->simple_422 = pps_temp & DSC_PPS0_422_ENABLE; in intel_dsc_get_pps_config()
871 vdsc_cfg->native_422 = pps_temp & DSC_PPS0_NATIVE_422_ENABLE; in intel_dsc_get_pps_config()
872 vdsc_cfg->native_420 = pps_temp & DSC_PPS0_NATIVE_420_ENABLE; in intel_dsc_get_pps_config()
873 vdsc_cfg->vbr_enable = pps_temp & DSC_PPS0_VBR_ENABLE; in intel_dsc_get_pps_config()
878 vdsc_cfg->bits_per_pixel = REG_FIELD_GET(DSC_PPS1_BPP_MASK, pps_temp); in intel_dsc_get_pps_config()
880 if (vdsc_cfg->native_420) in intel_dsc_get_pps_config()
881 vdsc_cfg->bits_per_pixel >>= 1; in intel_dsc_get_pps_config()
883 crtc_state->dsc.compressed_bpp_x16 = vdsc_cfg->bits_per_pixel; in intel_dsc_get_pps_config()
888 vdsc_cfg->pic_width = REG_FIELD_GET(DSC_PPS2_PIC_WIDTH_MASK, pps_temp) * num_vdsc_instances; in intel_dsc_get_pps_config()
889 vdsc_cfg->pic_height = REG_FIELD_GET(DSC_PPS2_PIC_HEIGHT_MASK, pps_temp); in intel_dsc_get_pps_config()
894 vdsc_cfg->slice_width = REG_FIELD_GET(DSC_PPS3_SLICE_WIDTH_MASK, pps_temp); in intel_dsc_get_pps_config()
895 vdsc_cfg->slice_height = REG_FIELD_GET(DSC_PPS3_SLICE_HEIGHT_MASK, pps_temp); in intel_dsc_get_pps_config()
900 vdsc_cfg->initial_dec_delay = REG_FIELD_GET(DSC_PPS4_INITIAL_DEC_DELAY_MASK, pps_temp); in intel_dsc_get_pps_config()
901 vdsc_cfg->initial_xmit_delay = REG_FIELD_GET(DSC_PPS4_INITIAL_XMIT_DELAY_MASK, pps_temp); in intel_dsc_get_pps_config()
906 vdsc_cfg->scale_decrement_interval = REG_FIELD_GET(DSC_PPS5_SCALE_DEC_INT_MASK, pps_temp); in intel_dsc_get_pps_config()
907 vdsc_cfg->scale_increment_interval = REG_FIELD_GET(DSC_PPS5_SCALE_INC_INT_MASK, pps_temp); in intel_dsc_get_pps_config()
912 vdsc_cfg->initial_scale_value = REG_FIELD_GET(DSC_PPS6_INITIAL_SCALE_VALUE_MASK, pps_temp); in intel_dsc_get_pps_config()
913 vdsc_cfg->first_line_bpg_offset = REG_FIELD_GET(DSC_PPS6_FIRST_LINE_BPG_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
914 vdsc_cfg->flatness_min_qp = REG_FIELD_GET(DSC_PPS6_FLATNESS_MIN_QP_MASK, pps_temp); in intel_dsc_get_pps_config()
915 vdsc_cfg->flatness_max_qp = REG_FIELD_GET(DSC_PPS6_FLATNESS_MAX_QP_MASK, pps_temp); in intel_dsc_get_pps_config()
920 vdsc_cfg->nfl_bpg_offset = REG_FIELD_GET(DSC_PPS7_NFL_BPG_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
921 vdsc_cfg->slice_bpg_offset = REG_FIELD_GET(DSC_PPS7_SLICE_BPG_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
926 vdsc_cfg->initial_offset = REG_FIELD_GET(DSC_PPS8_INITIAL_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
927 vdsc_cfg->final_offset = REG_FIELD_GET(DSC_PPS8_FINAL_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
932 vdsc_cfg->rc_model_size = REG_FIELD_GET(DSC_PPS9_RC_MODEL_SIZE_MASK, pps_temp); in intel_dsc_get_pps_config()
937 vdsc_cfg->rc_quant_incr_limit0 = REG_FIELD_GET(DSC_PPS10_RC_QUANT_INC_LIMIT0_MASK, pps_temp); in intel_dsc_get_pps_config()
938 vdsc_cfg->rc_quant_incr_limit1 = REG_FIELD_GET(DSC_PPS10_RC_QUANT_INC_LIMIT1_MASK, pps_temp); in intel_dsc_get_pps_config()
943 vdsc_cfg->slice_chunk_size = REG_FIELD_GET(DSC_PPS16_SLICE_CHUNK_SIZE_MASK, pps_temp); in intel_dsc_get_pps_config()
945 if (DISPLAY_VER(display) >= 14) { in intel_dsc_get_pps_config()
949 vdsc_cfg->second_line_bpg_offset = REG_FIELD_GET(DSC_PPS17_SL_BPG_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
954 vdsc_cfg->nsl_bpg_offset = REG_FIELD_GET(DSC_PPS18_NSL_BPG_OFFSET_MASK, pps_temp); in intel_dsc_get_pps_config()
955 vdsc_cfg->second_line_offset_adj = REG_FIELD_GET(DSC_PPS18_SL_OFFSET_ADJ_MASK, pps_temp); in intel_dsc_get_pps_config()
961 struct intel_display *display = to_intel_display(crtc_state); in intel_dsc_get_config() local
962 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in intel_dsc_get_config()
963 enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; in intel_dsc_get_config()
973 wakeref = intel_display_power_get_if_enabled(display, power_domain); in intel_dsc_get_config()
977 dss_ctl1 = intel_de_read(display, dss_ctl1_reg(crtc, cpu_transcoder)); in intel_dsc_get_config()
978 dss_ctl2 = intel_de_read(display, dss_ctl2_reg(crtc, cpu_transcoder)); in intel_dsc_get_config()
980 crtc_state->dsc.compression_enable = dss_ctl2 & VDSC0_ENABLE; in intel_dsc_get_config()
981 if (!crtc_state->dsc.compression_enable) in intel_dsc_get_config()
985 crtc_state->dsc.num_streams = 3; in intel_dsc_get_config()
987 crtc_state->dsc.num_streams = 2; in intel_dsc_get_config()
989 crtc_state->dsc.num_streams = 1; in intel_dsc_get_config()
993 intel_display_power_put(display, power_domain, wakeref); in intel_dsc_get_config()
1000 "dsc-dss: compressed-bpp:" FXP_Q4_FMT ", slice-count: %d, num_streams: %d\n", in intel_vdsc_dump_state()
1001 FXP_Q4_ARGS(crtc_state->dsc.compressed_bpp_x16), in intel_vdsc_dump_state()
1002 crtc_state->dsc.slice_count, in intel_vdsc_dump_state()
1003 crtc_state->dsc.num_streams); in intel_vdsc_dump_state()
1009 if (!crtc_state->dsc.compression_enable) in intel_vdsc_state_dump()
1013 drm_dsc_dump_config(p, indent, &crtc_state->dsc.config); in intel_vdsc_state_dump()
1018 struct intel_display *display = to_intel_display(crtc_state); in intel_vdsc_min_cdclk() local
1022 if (!crtc_state->dsc.compression_enable) in intel_vdsc_min_cdclk()
1032 min_cdclk = DIV_ROUND_UP(crtc_state->pixel_rate, num_vdsc_instances); in intel_vdsc_min_cdclk()
1034 if (crtc_state->joiner_pipes) { in intel_vdsc_min_cdclk()
1035 int pixel_clock = intel_dp_mode_to_fec_clock(crtc_state->hw.adjusted_mode.clock); in intel_vdsc_min_cdclk()
1049 int bigjoiner_interface_bits = DISPLAY_VER(display) >= 14 ? 36 : 24; in intel_vdsc_min_cdclk()
1051 (fxp_q4_to_int_roundup(crtc_state->dsc.compressed_bpp_x16) * in intel_vdsc_min_cdclk()