Commit e6024455 authored by Imre Deak's avatar Imre Deak

drm/i915: Replace to_bpp_frac() with fxp_q4_to_frac()

Replace the to_bpp_frac() helper defined by the driver with the
equivalent fxp_q4_to_frac() helper defined by DRM core.

v2: Rebase on the s/drm_x16/fxp_q4 change.
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240805150802.3568970-5-imre.deak@intel.com
parent ce9b1466
...@@ -2200,13 +2200,8 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) ...@@ -2200,13 +2200,8 @@ to_intel_frontbuffer(struct drm_framebuffer *fb)
return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL; return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
} }
static inline int to_bpp_frac(int bpp_x16)
{
return bpp_x16 & 0xf;
}
#define BPP_X16_FMT "%d.%04d" #define BPP_X16_FMT "%d.%04d"
#define BPP_X16_ARGS(bpp_x16) fxp_q4_to_int(bpp_x16), (to_bpp_frac(bpp_x16) * 625) #define BPP_X16_ARGS(bpp_x16) fxp_q4_to_int(bpp_x16), (fxp_q4_to_frac(bpp_x16) * 625)
/* /*
* Conversion functions/macros from various pointer types to struct * Conversion functions/macros from various pointer types to struct
......
...@@ -2066,7 +2066,7 @@ xelpd_dsc_compute_link_config(struct intel_dp *intel_dp, ...@@ -2066,7 +2066,7 @@ xelpd_dsc_compute_link_config(struct intel_dp *intel_dp,
compressed_bppx16 >= dsc_min_bpp; compressed_bppx16 >= dsc_min_bpp;
compressed_bppx16 -= bppx16_step) { compressed_bppx16 -= bppx16_step) {
if (intel_dp->force_dsc_fractional_bpp_en && if (intel_dp->force_dsc_fractional_bpp_en &&
!to_bpp_frac(compressed_bppx16)) !fxp_q4_to_frac(compressed_bppx16))
continue; continue;
ret = dsc_compute_link_config(intel_dp, ret = dsc_compute_link_config(intel_dp,
pipe_config, pipe_config,
...@@ -2076,7 +2076,7 @@ xelpd_dsc_compute_link_config(struct intel_dp *intel_dp, ...@@ -2076,7 +2076,7 @@ xelpd_dsc_compute_link_config(struct intel_dp *intel_dp,
if (ret == 0) { if (ret == 0) {
pipe_config->dsc.compressed_bpp_x16 = compressed_bppx16; pipe_config->dsc.compressed_bpp_x16 = compressed_bppx16;
if (intel_dp->force_dsc_fractional_bpp_en && if (intel_dp->force_dsc_fractional_bpp_en &&
to_bpp_frac(compressed_bppx16)) fxp_q4_to_frac(compressed_bppx16))
drm_dbg_kms(&i915->drm, "Forcing DSC fractional bpp\n"); drm_dbg_kms(&i915->drm, "Forcing DSC fractional bpp\n");
return 0; return 0;
......
...@@ -185,7 +185,7 @@ calculate_rc_params(struct drm_dsc_config *vdsc_cfg) ...@@ -185,7 +185,7 @@ calculate_rc_params(struct drm_dsc_config *vdsc_cfg)
} }
} else { } else {
/* fractional bpp part * 10000 (for precision up to 4 decimal places) */ /* fractional bpp part * 10000 (for precision up to 4 decimal places) */
int fractional_bits = to_bpp_frac(vdsc_cfg->bits_per_pixel); int fractional_bits = fxp_q4_to_frac(vdsc_cfg->bits_per_pixel);
static const s8 ofs_und6[] = { static const s8 ofs_und6[] = {
0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment