From 6d7e5cebd077b296a4a5a6aa9eb589a1b8640076 Mon Sep 17 00:00:00 2001 From: Vinod Govindapillai Date: Mon, 15 Jun 2026 23:33:52 +0300 Subject: [PATCH] drm/i915/bw: Extract icl_init_qgv_info() Simplify the initialization of QGV points info by extracting the code to initialize the QGV points info from dram info based on the memory type. This will reduce the complexity of the init QGV info routine as we will be supporting new memory types in future platforms. v2: rebase after Ville's refactoring v3: patch description updated Signed-off-by: Vinod Govindapillai Reviewed-by: Suraj Kandpal Link: https://patch.msgid.link/20260615203355.218578-5-vinod.govindapillai@intel.com --- drivers/gpu/drm/i915/display/intel_bw.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c index 4557de85fade..6649220d81b4 100644 --- a/drivers/gpu/drm/i915/display/intel_bw.c +++ b/drivers/gpu/drm/i915/display/intel_bw.c @@ -246,12 +246,10 @@ static bool is_y_tile(struct intel_display *display) return !HAS_4TILE(display); } -static int icl_get_qgv_points(struct intel_display *display, - const struct dram_info *dram_info, - struct intel_qgv_info *qi) +static int icl_init_qgv_info(struct intel_display *display, + const struct dram_info *dram_info, + struct intel_qgv_info *qi) { - int i, ret; - qi->num_qgv_points = dram_info->num_qgv_points; qi->num_psf_points = dram_info->num_psf_gv_points; @@ -323,6 +321,18 @@ static int icl_get_qgv_points(struct intel_display *display, qi->max_numchannels = 1; } + return 0; +} + +static int icl_get_qgv_points(struct intel_display *display, + const struct dram_info *dram_info, + struct intel_qgv_info *qi) +{ + int i, ret; + + if (icl_init_qgv_info(display, dram_info, qi)) + return -EINVAL; + if (drm_WARN_ON(display->drm, qi->num_qgv_points > ARRAY_SIZE(qi->points))) qi->num_qgv_points = ARRAY_SIZE(qi->points);