Skip to content

Commit 6400c21

Browse files
vgovind2Radhakrishna Sripada
authored andcommitted
drm/i915: modify max_bw to return index to intel_bw_info
MTL uses the peak BW of a QGV point to lock the required QGV point instead of the QGV index. Instead of passing the deratedbw of the selected bw_info, return the index to the selected bw_info so that either deratedbw or peakbw can be used based on the platform. v2: use idx to store index returned by max_bw_index functions v3: return UINT_MAX in icl_max_bw_index in case no match found v3: check idx >= ARRAY_SIZE Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com> Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com> Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230606093509.221709-6-vinod.govindapillai@intel.com
1 parent 463cc94 commit 6400c21

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

drivers/gpu/drm/i915/display/intel_bw.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ static void dg2_get_bw_info(struct drm_i915_private *i915)
593593
i915->display.sagv.status = I915_SAGV_NOT_CONTROLLED;
594594
}
595595

596-
static unsigned int icl_max_bw(struct drm_i915_private *dev_priv,
597-
int num_planes, int qgv_point)
596+
static unsigned int icl_max_bw_index(struct drm_i915_private *dev_priv,
597+
int num_planes, int qgv_point)
598598
{
599599
int i;
600600

@@ -615,14 +615,14 @@ static unsigned int icl_max_bw(struct drm_i915_private *dev_priv,
615615
return UINT_MAX;
616616

617617
if (num_planes >= bi->num_planes)
618-
return bi->deratedbw[qgv_point];
618+
return i;
619619
}
620620

621-
return 0;
621+
return UINT_MAX;
622622
}
623623

624-
static unsigned int tgl_max_bw(struct drm_i915_private *dev_priv,
625-
int num_planes, int qgv_point)
624+
static unsigned int tgl_max_bw_index(struct drm_i915_private *dev_priv,
625+
int num_planes, int qgv_point)
626626
{
627627
int i;
628628

@@ -643,10 +643,10 @@ static unsigned int tgl_max_bw(struct drm_i915_private *dev_priv,
643643
return UINT_MAX;
644644

645645
if (num_planes <= bi->num_planes)
646-
return bi->deratedbw[qgv_point];
646+
return i;
647647
}
648648

649-
return dev_priv->display.bw.max[0].deratedbw[qgv_point];
649+
return 0;
650650
}
651651

652652
static unsigned int adl_psf_bw(struct drm_i915_private *dev_priv,
@@ -823,12 +823,19 @@ static int icl_find_qgv_points(struct drm_i915_private *i915,
823823
return ret;
824824

825825
for (i = 0; i < num_qgv_points; i++) {
826+
unsigned int idx;
826827
unsigned int max_data_rate;
827828

828829
if (DISPLAY_VER(i915) > 11)
829-
max_data_rate = tgl_max_bw(i915, num_active_planes, i);
830+
idx = tgl_max_bw_index(i915, num_active_planes, i);
830831
else
831-
max_data_rate = icl_max_bw(i915, num_active_planes, i);
832+
idx = icl_max_bw_index(i915, num_active_planes, i);
833+
834+
if (idx >= ARRAY_SIZE(i915->display.bw.max))
835+
continue;
836+
837+
max_data_rate = i915->display.bw.max[idx].deratedbw[i];
838+
832839
/*
833840
* We need to know which qgv point gives us
834841
* maximum bandwidth in order to disable SAGV

0 commit comments

Comments
 (0)