@@ -896,49 +896,6 @@ static int align_max_vesa_compressed_bpp_x16(int max_link_bpp_x16)
896896 return 0 ;
897897}
898898
899- static u32 intel_dp_dsc_nearest_valid_bpp (struct intel_display * display , u32 bpp , u32 pipe_bpp )
900- {
901- u32 bits_per_pixel = bpp ;
902-
903- /* Error out if the max bpp is less than smallest allowed valid bpp */
904- if (bits_per_pixel < valid_dsc_bpp [0 ]) {
905- drm_dbg_kms (display -> drm , "Unsupported BPP %u, min %u\n" ,
906- bits_per_pixel , valid_dsc_bpp [0 ]);
907- return 0 ;
908- }
909-
910- /* From XE_LPD onwards we support from bpc upto uncompressed bpp-1 BPPs */
911- if (DISPLAY_VER (display ) >= 13 ) {
912- bits_per_pixel = min (bits_per_pixel , pipe_bpp - 1 );
913-
914- /*
915- * According to BSpec, 27 is the max DSC output bpp,
916- * 8 is the min DSC output bpp.
917- * While we can still clamp higher bpp values to 27, saving bandwidth,
918- * if it is required to oompress up to bpp < 8, means we can't do
919- * that and probably means we can't fit the required mode, even with
920- * DSC enabled.
921- */
922- if (bits_per_pixel < 8 ) {
923- drm_dbg_kms (display -> drm ,
924- "Unsupported BPP %u, min 8\n" ,
925- bits_per_pixel );
926- return 0 ;
927- }
928- bits_per_pixel = min_t (u32 , bits_per_pixel , 27 );
929- } else {
930- int link_bpp_x16 = fxp_q4_from_int (bits_per_pixel );
931-
932- /* Find the nearest match in the array of known BPPs from VESA */
933- link_bpp_x16 = align_max_vesa_compressed_bpp_x16 (link_bpp_x16 );
934-
935- drm_WARN_ON (display -> drm , fxp_q4_to_frac (link_bpp_x16 ));
936- bits_per_pixel = fxp_q4_to_int (link_bpp_x16 );
937- }
938-
939- return bits_per_pixel ;
940- }
941-
942899static int bigjoiner_interface_bits (struct intel_display * display )
943900{
944901 return DISPLAY_VER (display ) >= 14 ? 36 : 24 ;
@@ -1002,64 +959,6 @@ u32 get_max_compressed_bpp_with_joiner(struct intel_display *display,
1002959 return max_bpp ;
1003960}
1004961
1005- /* TODO: return a bpp_x16 value */
1006- u16 intel_dp_dsc_get_max_compressed_bpp (struct intel_display * display ,
1007- u32 link_clock , u32 lane_count ,
1008- u32 mode_clock , u32 mode_hdisplay ,
1009- int num_joined_pipes ,
1010- enum intel_output_format output_format ,
1011- u32 pipe_bpp ,
1012- u32 timeslots )
1013- {
1014- u32 bits_per_pixel , joiner_max_bpp ;
1015-
1016- /*
1017- * Available Link Bandwidth(Kbits/sec) = (NumberOfLanes)*
1018- * (LinkSymbolClock)* 8 * (TimeSlots / 64)
1019- * for SST -> TimeSlots is 64(i.e all TimeSlots that are available)
1020- * for MST -> TimeSlots has to be calculated, based on mode requirements
1021- *
1022- * Due to FEC overhead, the available bw is reduced to 97.2261%.
1023- * To support the given mode:
1024- * Bandwidth required should be <= Available link Bandwidth * FEC Overhead
1025- * =>ModeClock * bits_per_pixel <= Available Link Bandwidth * FEC Overhead
1026- * =>bits_per_pixel <= Available link Bandwidth * FEC Overhead / ModeClock
1027- * =>bits_per_pixel <= (NumberOfLanes * LinkSymbolClock) * 8 (TimeSlots / 64) /
1028- * (ModeClock / FEC Overhead)
1029- * =>bits_per_pixel <= (NumberOfLanes * LinkSymbolClock * TimeSlots) /
1030- * (ModeClock / FEC Overhead * 8)
1031- */
1032- bits_per_pixel = ((link_clock * lane_count ) * timeslots ) /
1033- (intel_dp_mode_to_fec_clock (mode_clock ) * 8 );
1034-
1035- /* Bandwidth required for 420 is half, that of 444 format */
1036- if (output_format == INTEL_OUTPUT_FORMAT_YCBCR420 )
1037- bits_per_pixel *= 2 ;
1038-
1039- /*
1040- * According to DSC 1.2a Section 4.1.1 Table 4.1 the maximum
1041- * supported PPS value can be 63.9375 and with the further
1042- * mention that for 420, 422 formats, bpp should be programmed double
1043- * the target bpp restricting our target bpp to be 31.9375 at max.
1044- */
1045- if (output_format == INTEL_OUTPUT_FORMAT_YCBCR420 )
1046- bits_per_pixel = min_t (u32 , bits_per_pixel , 31 );
1047-
1048- drm_dbg_kms (display -> drm , "Max link bpp is %u for %u timeslots "
1049- "total bw %u pixel clock %u\n" ,
1050- bits_per_pixel , timeslots ,
1051- (link_clock * lane_count * 8 ),
1052- intel_dp_mode_to_fec_clock (mode_clock ));
1053-
1054- joiner_max_bpp = get_max_compressed_bpp_with_joiner (display , mode_clock ,
1055- mode_hdisplay , num_joined_pipes );
1056- bits_per_pixel = min (bits_per_pixel , joiner_max_bpp );
1057-
1058- bits_per_pixel = intel_dp_dsc_nearest_valid_bpp (display , bits_per_pixel , pipe_bpp );
1059-
1060- return bits_per_pixel ;
1061- }
1062-
1063962u8 intel_dp_dsc_get_slice_count (const struct intel_connector * connector ,
1064963 int mode_clock , int mode_hdisplay ,
1065964 int num_joined_pipes )
@@ -2708,26 +2607,26 @@ bool intel_dp_mode_valid_with_dsc(struct intel_connector *connector,
27082607 enum intel_output_format output_format ,
27092608 int pipe_bpp , unsigned long bw_overhead_flags )
27102609{
2711- struct intel_display * display = to_intel_display (connector );
2712- int dsc_max_compressed_bpp ;
2713- int dsc_slice_count ;
2714-
2715- dsc_max_compressed_bpp =
2716- intel_dp_dsc_get_max_compressed_bpp ( display ,
2717- link_clock ,
2718- lane_count ,
2719- mode_clock ,
2720- mode_hdisplay ,
2721- num_joined_pipes ,
2722- output_format ,
2723- pipe_bpp , 64 );
2724- dsc_slice_count =
2725- intel_dp_dsc_get_slice_count ( connector ,
2726- mode_clock ,
2727- mode_hdisplay ,
2728- num_joined_pipes );
2729-
2730- return dsc_max_compressed_bpp && dsc_slice_count ;
2610+ struct intel_dp * intel_dp = intel_attached_dp (connector );
2611+ int min_bpp_x16 = compute_min_compressed_bpp_x16 ( connector , output_format ) ;
2612+ int max_bpp_x16 = compute_max_compressed_bpp_x16 ( connector ,
2613+ mode_clock , mode_hdisplay ,
2614+ num_joined_pipes ,
2615+ output_format ,
2616+ pipe_bpp , INT_MAX );
2617+ int dsc_slice_count = intel_dp_dsc_get_slice_count ( connector ,
2618+ mode_clock ,
2619+ mode_hdisplay ,
2620+ num_joined_pipes );
2621+
2622+ if ( min_bpp_x16 <= 0 || min_bpp_x16 > max_bpp_x16 )
2623+ return false;
2624+
2625+ return is_bw_sufficient_for_dsc_config ( intel_dp ,
2626+ link_clock , lane_count ,
2627+ mode_clock , mode_hdisplay ,
2628+ dsc_slice_count , min_bpp_x16 ,
2629+ bw_overhead_flags ) ;
27312630}
27322631
27332632/*
0 commit comments