Skip to content

Commit 5eb2e78

Browse files
committed
drm/i915/display: use x100 version for full version and release
Use x100, or ver * 100 + rel, versions for full IP version checks, similar to what xe driver does: - Replace IP_VER(14, 1) inline with 1401, etc. - Convert DISPLAY_VER_FULL() to DISPLAY_VERx100() - Convert IS_DISPLAY_VER_FULL() to IS_DISPLAY_VERx100() - Convert IS_DISPLAY_VER_STEP() to IS_DISPLAY_VERx100_STEP() This makes ver.rel versions easier to use, follows the xe driver pattern, and drops the dependency on the IP_VER() macro. v2: Rebase, drop IP_VER() from xe compat headers v3: Rebase Cc: Ville Syrjälä <[email protected]> Acked-by: Matt Roper <[email protected]> Reviewed-by: Suraj Kandpal <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 3291b74 commit 5eb2e78

15 files changed

+36
-38
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
10261026
vsub = 1;
10271027

10281028
/* Wa_16023981245 */
1029-
if ((DISPLAY_VER_FULL(i915) == IP_VER(20, 0) ||
1030-
DISPLAY_VER_FULL(i915) == IP_VER(30, 0)) &&
1029+
if ((DISPLAY_VERx100(i915) == 2000 ||
1030+
DISPLAY_VERx100(i915) == 3000) &&
10311031
src_x % 2 != 0)
10321032
hsub = 2;
10331033
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ void intel_bw_init_hw(struct drm_i915_private *dev_priv)
743743
if (!HAS_DISPLAY(dev_priv))
744744
return;
745745

746-
if (DISPLAY_VER_FULL(dev_priv) >= IP_VER(14, 1) && IS_DGFX(dev_priv))
746+
if (DISPLAY_VERx100(dev_priv) >= 1401 && IS_DGFX(dev_priv))
747747
xe2_hpd_get_bw_info(dev_priv, &xe2_hpd_sa_info);
748748
else if (DISPLAY_VER(dev_priv) >= 14)
749749
tgl_get_bw_info(dev_priv, &mtl_sa_info);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,8 +2058,8 @@ static bool pll_enable_wa_needed(struct intel_display *display)
20582058
{
20592059
struct drm_i915_private *dev_priv = to_i915(display->drm);
20602060

2061-
return (DISPLAY_VER_FULL(display) == IP_VER(20, 0) ||
2062-
DISPLAY_VER_FULL(display) == IP_VER(14, 0) ||
2061+
return (DISPLAY_VERx100(display) == 2000 ||
2062+
DISPLAY_VERx100(display) == 1400 ||
20632063
IS_DG2(dev_priv)) &&
20642064
display->cdclk.hw.vco > 0;
20652065
}
@@ -3852,7 +3852,7 @@ void intel_init_cdclk_hooks(struct intel_display *display)
38523852
} else if (DISPLAY_VER(display) >= 20) {
38533853
display->funcs.cdclk = &rplu_cdclk_funcs;
38543854
display->cdclk.table = xe2lpd_cdclk_table;
3855-
} else if (DISPLAY_VER_FULL(display) >= IP_VER(14, 1)) {
3855+
} else if (DISPLAY_VERx100(display) >= 1401) {
38563856
display->funcs.cdclk = &rplu_cdclk_funcs;
38573857
display->cdclk.table = xe2hpd_cdclk_table;
38583858
} else if (DISPLAY_VER(display) >= 14) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,13 +2286,13 @@ intel_c20_pll_tables_get(struct intel_crtc_state *crtc_state,
22862286
if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP)) {
22872287
if (DISPLAY_RUNTIME_INFO(display)->edp_typec_support)
22882288
return xe3lpd_c20_dp_edp_tables;
2289-
if (DISPLAY_VER_FULL(display) == IP_VER(14, 1))
2289+
if (DISPLAY_VERx100(display) == 1401)
22902290
return xe2hpd_c20_edp_tables;
22912291
}
22922292

22932293
if (DISPLAY_VER(display) >= 30)
22942294
return xe3lpd_c20_dp_edp_tables;
2295-
else if (DISPLAY_VER_FULL(display) == IP_VER(14, 1))
2295+
else if (DISPLAY_VERx100(display) == 1401)
22962296
return xe2hpd_c20_dp_tables;
22972297
else
22982298
return mtl_c20_dp_tables;

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
#define _XE2HPD_C20_A_MPLLB_CFG 0xCCC2
274274
#define _XE2HPD_C20_B_MPLLB_CFG 0xCCB6
275275

276-
#define _IS_XE2HPD_C20(i915) (DISPLAY_VER_FULL(i915) == IP_VER(14, 1))
276+
#define _IS_XE2HPD_C20(i915) (DISPLAY_VERx100(i915) == 1401)
277277

278278
#define PHY_C20_A_TX_CNTX_CFG(i915, idx) \
279279
((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG : _MTL_C20_A_TX_CNTX_CFG) - (idx))

drivers/gpu/drm/i915/display/intel_display_device.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ struct intel_display_platforms {
186186
#define SUPPORTS_TV(i915) (DISPLAY_INFO(i915)->supports_tv)
187187

188188
/* Check that device has a display IP version within the specific range. */
189-
#define IS_DISPLAY_VER_FULL(__i915, from, until) ( \
190-
BUILD_BUG_ON_ZERO((from) < IP_VER(2, 0)) + \
191-
(DISPLAY_VER_FULL(__i915) >= (from) && \
192-
DISPLAY_VER_FULL(__i915) <= (until)))
189+
#define IS_DISPLAY_VERx100(__i915, from, until) ( \
190+
BUILD_BUG_ON_ZERO((from) < 200) + \
191+
(DISPLAY_VERx100(__i915) >= (from) && \
192+
DISPLAY_VERx100(__i915) <= (until)))
193193

194194
/*
195195
* Check if a device has a specific IP version as well as a stepping within the
@@ -200,22 +200,22 @@ struct intel_display_platforms {
200200
* hardware fix is present and the software workaround is no longer necessary.
201201
* E.g.,
202202
*
203-
* IS_DISPLAY_VER_STEP(i915, IP_VER(14, 0), STEP_A0, STEP_B2)
204-
* IS_DISPLAY_VER_STEP(i915, IP_VER(14, 0), STEP_C0, STEP_FOREVER)
203+
* IS_DISPLAY_VERx100_STEP(i915, 1400, STEP_A0, STEP_B2)
204+
* IS_DISPLAY_VERx100_STEP(i915, 1400, STEP_C0, STEP_FOREVER)
205205
*
206206
* "STEP_FOREVER" can be passed as "until" for workarounds that have no upper
207207
* stepping bound for the specified IP version.
208208
*/
209-
#define IS_DISPLAY_VER_STEP(__i915, ipver, from, until) \
210-
(IS_DISPLAY_VER_FULL((__i915), (ipver), (ipver)) && \
209+
#define IS_DISPLAY_VERx100_STEP(__i915, ipver, from, until) \
210+
(IS_DISPLAY_VERx100((__i915), (ipver), (ipver)) && \
211211
IS_DISPLAY_STEP((__i915), (from), (until)))
212212

213213
#define DISPLAY_INFO(i915) (__to_intel_display(i915)->info.__device_info)
214214
#define DISPLAY_RUNTIME_INFO(i915) (&__to_intel_display(i915)->info.__runtime_info)
215215

216216
#define DISPLAY_VER(i915) (DISPLAY_RUNTIME_INFO(i915)->ip.ver)
217-
#define DISPLAY_VER_FULL(i915) IP_VER(DISPLAY_RUNTIME_INFO(i915)->ip.ver, \
218-
DISPLAY_RUNTIME_INFO(i915)->ip.rel)
217+
#define DISPLAY_VERx100(i915) (DISPLAY_RUNTIME_INFO(i915)->ip.ver * 100 + \
218+
DISPLAY_RUNTIME_INFO(i915)->ip.rel)
219219
#define IS_DISPLAY_VER(i915, from, until) \
220220
(DISPLAY_VER(i915) >= (from) && DISPLAY_VER(i915) <= (until))
221221

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,14 +1684,14 @@ static void icl_display_core_init(struct drm_i915_private *dev_priv,
16841684
intel_snps_phy_wait_for_calibration(dev_priv);
16851685

16861686
/* 9. XE2_HPD: Program CHICKEN_MISC_2 before any cursor or planes are enabled */
1687-
if (DISPLAY_VER_FULL(dev_priv) == IP_VER(14, 1))
1687+
if (DISPLAY_VERx100(dev_priv) == 1401)
16881688
intel_de_rmw(dev_priv, CHICKEN_MISC_2, BMG_DARB_HALF_BLK_END_BURST, 1);
16891689

16901690
if (resume)
16911691
intel_dmc_load_program(display);
16921692

16931693
/* Wa_14011508470:tgl,dg1,rkl,adl-s,adl-p,dg2 */
1694-
if (IS_DISPLAY_VER_FULL(dev_priv, IP_VER(12, 0), IP_VER(13, 0)))
1694+
if (IS_DISPLAY_VERx100(dev_priv, 1200, 1300))
16951695
intel_de_rmw(dev_priv, GEN11_CHICKEN_DCPR_2, 0,
16961696
DCPR_CLEAR_MEMSTAT_DIS | DCPR_SEND_RESP_IMM |
16971697
DCPR_MASK_LPMODE | DCPR_MASK_MAXLATENCY_MEMUP_CLR);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,16 @@ static const char *dmc_firmware_default(struct intel_display *display, u32 *size
171171
const char *fw_path = NULL;
172172
u32 max_fw_size = 0;
173173

174-
if (DISPLAY_VER_FULL(display) == IP_VER(30, 0)) {
174+
if (DISPLAY_VERx100(display) == 3000) {
175175
fw_path = XE3LPD_DMC_PATH;
176176
max_fw_size = XE2LPD_DMC_MAX_FW_SIZE;
177-
} else if (DISPLAY_VER_FULL(display) == IP_VER(20, 0)) {
177+
} else if (DISPLAY_VERx100(display) == 2000) {
178178
fw_path = XE2LPD_DMC_PATH;
179179
max_fw_size = XE2LPD_DMC_MAX_FW_SIZE;
180-
} else if (DISPLAY_VER_FULL(display) == IP_VER(14, 1)) {
180+
} else if (DISPLAY_VERx100(display) == 1401) {
181181
fw_path = BMG_DMC_PATH;
182182
max_fw_size = XELPDP_DMC_MAX_FW_SIZE;
183-
} else if (DISPLAY_VER_FULL(display) == IP_VER(14, 0)) {
183+
} else if (DISPLAY_VERx100(display) == 1400) {
184184
fw_path = MTL_DMC_PATH;
185185
max_fw_size = XELPDP_DMC_MAX_FW_SIZE;
186186
} else if (IS_DG2(i915)) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ static int mtl_max_source_rate(struct intel_dp *intel_dp)
497497
if (intel_encoder_is_c10phy(encoder))
498498
return 810000;
499499

500-
if (DISPLAY_VER_FULL(to_i915(encoder->base.dev)) == IP_VER(14, 1))
500+
if (DISPLAY_VERx100(to_i915(encoder->base.dev)) == 1401)
501501
return 1350000;
502502

503503
return 2000000;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state,
13471347

13481348
/* Wa_14016291713 */
13491349
if ((IS_DISPLAY_VER(display, 12, 13) ||
1350-
IS_DISPLAY_VER_STEP(i915, IP_VER(14, 0), STEP_A0, STEP_C0)) &&
1350+
IS_DISPLAY_VERx100_STEP(i915, 1400, STEP_A0, STEP_C0)) &&
13511351
crtc_state->has_psr && !crtc_state->has_panel_replay) {
13521352
plane_state->no_fbc_reason = "PSR1 enabled (Wa_14016291713)";
13531353
return 0;

0 commit comments

Comments
 (0)