*
* Author: AMD
*/
+
struct dc_dsc_bw_range {
- uint32_t min_kbps;
+ uint32_t min_kbps; /* Bandwidth if min_target_bpp_x16 is used */
uint32_t min_target_bpp_x16;
- uint32_t max_kbps;
+ uint32_t max_kbps; /* Bandwidth if max_target_bpp_x16 is used */
uint32_t max_target_bpp_x16;
- uint32_t stream_kbps;
+ uint32_t stream_kbps; /* Uncompressed stream bandwidth */
};
const struct dsc_dec_dpcd_caps *dsc_sink_caps,
const struct dc_crtc_timing *timing,
struct dc_dsc_bw_range *range);
+
bool dc_dsc_compute_config(
const struct dc *dc,
const struct dsc_dec_dpcd_caps *dsc_sink_caps,
- int target_bandwidth,
+ uint32_t target_bandwidth_kbps,
const struct dc_crtc_timing *timing,
struct dc_dsc_config *dsc_cfg);
#endif
.min_target_bpp = 8,
};
+
+/* Get DSC bandwidth range based on [min_bpp, max_bpp] target bitrate range, and timing's pixel clock
+ * and uncompressed bandwidth.
+ */
static void get_dsc_bandwidth_range(
const uint32_t min_bpp,
const uint32_t max_bpp,
}
}
+
/* Decides if DSC should be used and calculates target bpp if it should, applying DSC policy.
*
* Returns:
*
* dsc_enc_caps - DSC encoder capabilities
*
- * target_bandwidth - Target bandwidth to fit the stream into.
- * If 0, do not calculate target bpp.
+ * target_bandwidth_kbps - Target bandwidth to fit the stream into.
+ * If 0, do not calculate target bpp.
*
- * timing - The stream timing to fit into 'target_bandwidth' or apply
+ * timing - The stream timing to fit into 'target_bandwidth_kbps' or apply
* maximum compression to, if 'target_badwidth == 0'
*
* dsc_cfg - DSC configuration to use if it was possible to come up with
static bool setup_dsc_config(
const struct dsc_dec_dpcd_caps *dsc_sink_caps,
const struct dsc_enc_caps *dsc_enc_caps,
- int target_bandwidth,
+ int target_bandwidth_kbps,
const struct dc_crtc_timing *timing,
struct dc_dsc_config *dsc_cfg)
{
if (!is_dsc_possible)
goto done;
- if (target_bandwidth > 0) {
- is_dsc_possible = decide_dsc_target_bpp_x16(&dsc_policy, &dsc_common_caps, target_bandwidth, timing, &target_bpp);
+ if (target_bandwidth_kbps > 0) {
+ is_dsc_possible = decide_dsc_target_bpp_x16(&dsc_policy, &dsc_common_caps, target_bandwidth_kbps, timing, &target_bpp);
dsc_cfg->bits_per_pixel = target_bpp;
}
if (!is_dsc_possible)
}
+/* If DSC is possbile, get DSC bandwidth range based on [min_bpp, max_bpp] target bitrate range and
+ * timing's pixel clock and uncompressed bandwidth.
+ * If DSC is not possible, leave '*range' untouched.
+ */
bool dc_dsc_compute_bandwidth_range(
const struct dc *dc,
const uint32_t min_bpp,
bool dc_dsc_compute_config(
const struct dc *dc,
const struct dsc_dec_dpcd_caps *dsc_sink_caps,
- int target_bandwidth,
+ uint32_t target_bandwidth_kbps,
const struct dc_crtc_timing *timing,
struct dc_dsc_config *dsc_cfg)
{
get_dsc_enc_caps(dc, &dsc_enc_caps, timing->pix_clk_100hz);
is_dsc_possible = setup_dsc_config(dsc_sink_caps,
&dsc_enc_caps,
- target_bandwidth,
+ target_bandwidth_kbps,
timing, dsc_cfg);
return is_dsc_possible;
}