mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
drm/amd/display: Move DSC functions from dc.c to dc_dsc.c
Move dsc functions from dc.c to dc_dsc.c. Co-developed-by: George Shen <george.shen@amd.com> Signed-off-by: George Shen <george.shen@amd.com> Signed-off-by: Wenjing Liu <wenjing.liu@amd.com> Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
062a7ce676
commit
964cf2c28d
|
|
@ -5979,102 +5979,3 @@ struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state
|
|||
|
||||
return profile;
|
||||
}
|
||||
|
||||
/* Need to account for padding due to pixel-to-symbol packing
|
||||
* for uncompressed 128b/132b streams.
|
||||
*/
|
||||
static uint32_t apply_128b_132b_stream_overhead(
|
||||
const struct dc_crtc_timing *timing, const uint32_t kbps)
|
||||
{
|
||||
uint32_t total_kbps = kbps;
|
||||
#if defined(CONFIG_DRM_AMD_DC_FP)
|
||||
if (dc_get_disable_128b_132b_stream_overhead())
|
||||
return kbps;
|
||||
#endif
|
||||
|
||||
if (!timing->flags.DSC) {
|
||||
struct fixed31_32 bpp;
|
||||
struct fixed31_32 overhead_factor;
|
||||
|
||||
bpp = dc_fixpt_from_int(kbps);
|
||||
bpp = dc_fixpt_div_int(bpp, timing->pix_clk_100hz / 10);
|
||||
|
||||
/* Symbols_per_HActive = HActive * bpp / (4 lanes * 32-bit symbol size)
|
||||
* Overhead_factor = ceil(Symbols_per_HActive) / Symbols_per_HActive
|
||||
*/
|
||||
overhead_factor = dc_fixpt_from_int(timing->h_addressable);
|
||||
overhead_factor = dc_fixpt_mul(overhead_factor, bpp);
|
||||
overhead_factor = dc_fixpt_div_int(overhead_factor, 128);
|
||||
overhead_factor = dc_fixpt_div(
|
||||
dc_fixpt_from_int(dc_fixpt_ceil(overhead_factor)),
|
||||
overhead_factor);
|
||||
|
||||
total_kbps = dc_fixpt_ceil(
|
||||
dc_fixpt_mul_int(overhead_factor, total_kbps));
|
||||
}
|
||||
|
||||
return total_kbps;
|
||||
}
|
||||
|
||||
uint32_t dc_bandwidth_in_kbps_from_timing(
|
||||
const struct dc_crtc_timing *timing,
|
||||
const enum dc_link_encoding_format link_encoding)
|
||||
{
|
||||
uint32_t bits_per_channel = 0;
|
||||
uint32_t kbps;
|
||||
|
||||
#if defined(CONFIG_DRM_AMD_DC_FP)
|
||||
if (timing->flags.DSC)
|
||||
return dc_dsc_stream_bandwidth_in_kbps(timing,
|
||||
timing->dsc_cfg.bits_per_pixel,
|
||||
timing->dsc_cfg.num_slices_h,
|
||||
timing->dsc_cfg.is_dp);
|
||||
#endif
|
||||
|
||||
switch (timing->display_color_depth) {
|
||||
case COLOR_DEPTH_666:
|
||||
bits_per_channel = 6;
|
||||
break;
|
||||
case COLOR_DEPTH_888:
|
||||
bits_per_channel = 8;
|
||||
break;
|
||||
case COLOR_DEPTH_101010:
|
||||
bits_per_channel = 10;
|
||||
break;
|
||||
case COLOR_DEPTH_121212:
|
||||
bits_per_channel = 12;
|
||||
break;
|
||||
case COLOR_DEPTH_141414:
|
||||
bits_per_channel = 14;
|
||||
break;
|
||||
case COLOR_DEPTH_161616:
|
||||
bits_per_channel = 16;
|
||||
break;
|
||||
default:
|
||||
ASSERT(bits_per_channel != 0);
|
||||
bits_per_channel = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
kbps = timing->pix_clk_100hz / 10;
|
||||
kbps *= bits_per_channel;
|
||||
|
||||
if (timing->flags.Y_ONLY != 1) {
|
||||
/*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/
|
||||
kbps *= 3;
|
||||
if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420)
|
||||
kbps /= 2;
|
||||
else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422)
|
||||
kbps = kbps * 2 / 3;
|
||||
}
|
||||
|
||||
if (link_encoding == DC_LINK_ENCODING_DP_128b_132b)
|
||||
kbps = apply_128b_132b_stream_overhead(timing, kbps);
|
||||
|
||||
if (link_encoding == DC_LINK_ENCODING_HDMI_FRL &&
|
||||
timing->vic == 0 && timing->hdmi_vic == 0 &&
|
||||
timing->frl_uncompressed_video_bandwidth_in_kbps != 0)
|
||||
kbps = timing->frl_uncompressed_video_bandwidth_in_kbps;
|
||||
|
||||
return kbps;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,102 @@ static bool disable_128b_132b_stream_overhead;
|
|||
#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
|
||||
#endif
|
||||
|
||||
/* Need to account for padding due to pixel-to-symbol packing
|
||||
* for uncompressed 128b/132b streams.
|
||||
*/
|
||||
static uint32_t apply_128b_132b_stream_overhead(
|
||||
const struct dc_crtc_timing *timing, const uint32_t kbps)
|
||||
{
|
||||
uint32_t total_kbps = kbps;
|
||||
|
||||
if (disable_128b_132b_stream_overhead)
|
||||
return kbps;
|
||||
|
||||
if (!timing->flags.DSC) {
|
||||
struct fixed31_32 bpp;
|
||||
struct fixed31_32 overhead_factor;
|
||||
|
||||
bpp = dc_fixpt_from_int(kbps);
|
||||
bpp = dc_fixpt_div_int(bpp, timing->pix_clk_100hz / 10);
|
||||
|
||||
/* Symbols_per_HActive = HActive * bpp / (4 lanes * 32-bit symbol size)
|
||||
* Overhead_factor = ceil(Symbols_per_HActive) / Symbols_per_HActive
|
||||
*/
|
||||
overhead_factor = dc_fixpt_from_int(timing->h_addressable);
|
||||
overhead_factor = dc_fixpt_mul(overhead_factor, bpp);
|
||||
overhead_factor = dc_fixpt_div_int(overhead_factor, 128);
|
||||
overhead_factor = dc_fixpt_div(
|
||||
dc_fixpt_from_int(dc_fixpt_ceil(overhead_factor)),
|
||||
overhead_factor);
|
||||
|
||||
total_kbps = dc_fixpt_ceil(
|
||||
dc_fixpt_mul_int(overhead_factor, total_kbps));
|
||||
}
|
||||
|
||||
return total_kbps;
|
||||
}
|
||||
|
||||
uint32_t dc_bandwidth_in_kbps_from_timing(
|
||||
const struct dc_crtc_timing *timing,
|
||||
const enum dc_link_encoding_format link_encoding)
|
||||
{
|
||||
uint32_t bits_per_channel = 0;
|
||||
uint32_t kbps;
|
||||
|
||||
if (timing->flags.DSC)
|
||||
return dc_dsc_stream_bandwidth_in_kbps(timing,
|
||||
timing->dsc_cfg.bits_per_pixel,
|
||||
timing->dsc_cfg.num_slices_h,
|
||||
timing->dsc_cfg.is_dp);
|
||||
|
||||
switch (timing->display_color_depth) {
|
||||
case COLOR_DEPTH_666:
|
||||
bits_per_channel = 6;
|
||||
break;
|
||||
case COLOR_DEPTH_888:
|
||||
bits_per_channel = 8;
|
||||
break;
|
||||
case COLOR_DEPTH_101010:
|
||||
bits_per_channel = 10;
|
||||
break;
|
||||
case COLOR_DEPTH_121212:
|
||||
bits_per_channel = 12;
|
||||
break;
|
||||
case COLOR_DEPTH_141414:
|
||||
bits_per_channel = 14;
|
||||
break;
|
||||
case COLOR_DEPTH_161616:
|
||||
bits_per_channel = 16;
|
||||
break;
|
||||
default:
|
||||
ASSERT(bits_per_channel != 0);
|
||||
bits_per_channel = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
kbps = timing->pix_clk_100hz / 10;
|
||||
kbps *= bits_per_channel;
|
||||
|
||||
if (timing->flags.Y_ONLY != 1) {
|
||||
/*Only YOnly make reduce bandwidth by 1/3 compares to RGB*/
|
||||
kbps *= 3;
|
||||
if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR420)
|
||||
kbps /= 2;
|
||||
else if (timing->pixel_encoding == PIXEL_ENCODING_YCBCR422)
|
||||
kbps = kbps * 2 / 3;
|
||||
}
|
||||
|
||||
if (link_encoding == DC_LINK_ENCODING_DP_128b_132b)
|
||||
kbps = apply_128b_132b_stream_overhead(timing, kbps);
|
||||
|
||||
if (link_encoding == DC_LINK_ENCODING_HDMI_FRL &&
|
||||
timing->vic == 0 && timing->hdmi_vic == 0 &&
|
||||
timing->frl_uncompressed_video_bandwidth_in_kbps != 0)
|
||||
kbps = timing->frl_uncompressed_video_bandwidth_in_kbps;
|
||||
|
||||
return kbps;
|
||||
}
|
||||
|
||||
/* Forward Declerations */
|
||||
static bool decide_dsc_bandwidth_range(
|
||||
const uint32_t min_bpp_x16,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user