Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 6/9] drm/i915: Replace to_bpp_frac() with drm_x16_to_frac()
Date: Fri, 14 Jun 2024 20:39:06 +0300	[thread overview]
Message-ID: <20240614173911.3743172-7-imre.deak@intel.com> (raw)
In-Reply-To: <20240614173911.3743172-1-imre.deak@intel.com>

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

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_types.h | 7 +------
 drivers/gpu/drm/i915/display/intel_dp.c            | 4 ++--
 drivers/gpu/drm/i915/display/intel_vdsc.c          | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 68f37029dbd88..128edecb69a20 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -2168,13 +2168,8 @@ to_intel_frontbuffer(struct drm_framebuffer *fb)
 	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_ARGS(bpp_x16)	drm_x16_to_int(bpp_x16), (to_bpp_frac(bpp_x16) * 625)
+#define BPP_X16_ARGS(bpp_x16)	drm_x16_to_int(bpp_x16), (drm_x16_to_frac(bpp_x16) * 625)
 
 /*
  * Conversion functions/macros from various pointer types to struct
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 67d0348152878..168852e20f756 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -1947,7 +1947,7 @@ xelpd_dsc_compute_link_config(struct intel_dp *intel_dp,
 	     compressed_bppx16 >= dsc_min_bpp;
 	     compressed_bppx16 -= bppx16_step) {
 		if (intel_dp->force_dsc_fractional_bpp_en &&
-		    !to_bpp_frac(compressed_bppx16))
+		    !drm_x16_to_frac(compressed_bppx16))
 			continue;
 		ret = dsc_compute_link_config(intel_dp,
 					      pipe_config,
@@ -1957,7 +1957,7 @@ xelpd_dsc_compute_link_config(struct intel_dp *intel_dp,
 		if (ret == 0) {
 			pipe_config->dsc.compressed_bpp_x16 = compressed_bppx16;
 			if (intel_dp->force_dsc_fractional_bpp_en &&
-			    to_bpp_frac(compressed_bppx16))
+			    drm_x16_to_frac(compressed_bppx16))
 				drm_dbg_kms(&i915->drm, "Forcing DSC fractional bpp\n");
 
 			return 0;
diff --git a/drivers/gpu/drm/i915/display/intel_vdsc.c b/drivers/gpu/drm/i915/display/intel_vdsc.c
index 5c0acbed7d6a1..ffda11b417e24 100644
--- a/drivers/gpu/drm/i915/display/intel_vdsc.c
+++ b/drivers/gpu/drm/i915/display/intel_vdsc.c
@@ -185,7 +185,7 @@ calculate_rc_params(struct drm_dsc_config *vdsc_cfg)
 		}
 	} else {
 		/* 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 = drm_x16_to_frac(vdsc_cfg->bits_per_pixel);
 
 		static const s8 ofs_und6[] = {
 			0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12
-- 
2.43.3


  parent reply	other threads:[~2024-06-14 17:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 17:39 [PATCH 0/9] drm/i915: Dump DSC state to dmesg/debugfs Imre Deak
2024-06-14 17:39 ` [PATCH 1/9] drm: Add helpers for x16 fixed point values Imre Deak
2024-06-19 10:10   ` Jani Nikula
2024-06-19 12:00     ` Imre Deak
2024-06-25 16:08       ` Imre Deak
2024-06-27 15:41       ` Jani Nikula
2024-06-28 14:09         ` Imre Deak
2024-06-14 17:39 ` [PATCH 2/9] drm/display/dsc: Add a helper to dump the DSC configuration Imre Deak
2024-06-14 17:39 ` [PATCH 3/9] drm/i915: Replace to_bpp_x16() with drm_x16_from_int() Imre Deak
2024-06-14 17:39 ` [PATCH 4/9] drm/i915: Replace to_bpp_int() with drm_x16_to_int() Imre Deak
2024-06-14 17:39 ` [PATCH 5/9] drm/i915: Replace to_bpp_int_roundup() with drm_x16_to_int_roundup() Imre Deak
2024-06-14 17:39 ` Imre Deak [this message]
2024-06-14 17:39 ` [PATCH 7/9] drm/i915: Replace BPP_X16_FMT()/ARGS() with DRM_X16_FMT()/ARGS() Imre Deak
2024-06-14 17:39 ` [PATCH 8/9] drm/i915: Dump DSC state to dmesg and debugfs/i915_display_info Imre Deak
2024-06-14 17:39 ` [PATCH 9/9] drm/i915: Remove DSC register dump Imre Deak
2024-06-14 19:07 ` ✗ Fi.CI.BUILD: warning for drm/i915: Dump DSC state to dmesg/debugfs Patchwork
2024-06-14 19:07 ` ✗ Fi.CI.CHECKPATCH: " Patchwork
2024-06-14 19:07 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-06-14 19:27 ` ✓ Fi.CI.BAT: success " Patchwork
2024-06-17  7:59 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240614173911.3743172-7-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox