Skip to contentSkip to conversation

drm/i915: Rename IS_GEN to IS_GEN_RANGE.

RFC In review Rodrigo Vivi 6 participants 18 messages Oct 23, 2018 – Oct 29, 2018

Subsystems (2)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

RFC 1/3 drm/i915: Rename IS_GEN to IS_GEN_RANGE.

RANGE makes it longer, but clear.

Diff generated with:

sed 's/IS_GEN(/IS_GEN_RANGE(/g' drivers/gpu/drm/i915/*.{c,h} -i

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c     |  2 +-
 drivers/gpu/drm/i915/i915_drv.h         |  2 +-
 drivers/gpu/drm/i915/i915_perf.c        |  4 ++--
 drivers/gpu/drm/i915/intel_bios.c       |  2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c  |  2 +-
 drivers/gpu/drm/i915/intel_fbc.c        |  2 +-
 drivers/gpu/drm/i915/intel_hangcheck.c  |  2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |  8 ++++----
 drivers/gpu/drm/i915/intel_uncore.c     | 12 ++++++------
 9 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 5b37d5f8e132..3deab30388f2 100644
@@ -2919,7 +2919,7 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
 	if (IS_BROXTON(dev_priv)) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(BXT_CSR_DC3_DC5_COUNT));
-	} else if (IS_GEN(dev_priv, 9, 11)) {
+	} else if (IS_GEN_RANGE(dev_priv, 9, 11)) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(SKL_CSR_DC3_DC5_COUNT));
 		seq_printf(m, "DC5 -> DC6 count: %d\n",
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 3017ef037fed..f766bb1e873b 100644
@@ -2387,7 +2387,7 @@ intel_info(const struct drm_i915_private *dev_priv)
  *
  * Use GEN_FOREVER for unbound start and or end.
  */
-#define IS_GEN(dev_priv, s, e) \
+#define IS_GEN_RANGE(dev_priv, s, e) \
 	(!!((dev_priv)->info.gen_mask & INTEL_GEN_MASK((s), (e))))
 
 /*
drivers/gpu/drm/i915/i915_perf.c +2 -2
index 664b96bb65a3..0888b6e6080f 100644
@@ -1795,7 +1795,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
 	 * be read back from automatically triggered reports, as part of the
 	 * RPT_ID field.
 	 */
-	if (IS_GEN(dev_priv, 9, 11)) {
+	if (IS_GEN_RANGE(dev_priv, 9, 11)) {
 		I915_WRITE(GEN8_OA_DEBUG,
 			   _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
 					      GEN9_OA_DEBUG_INCLUDE_CLK_RATIO));
@@ -3439,7 +3439,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
 
 				dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16);
 			}
-		} else if (IS_GEN(dev_priv, 10, 11)) {
+		} else if (IS_GEN_RANGE(dev_priv, 10, 11)) {
 			dev_priv->perf.oa.ops.is_valid_b_counter_reg =
 				gen7_is_valid_b_counter_addr;
 			dev_priv->perf.oa.ops.is_valid_mux_reg =
drivers/gpu/drm/i915/intel_bios.c +1 -1
index 1faa494e2bc9..43cf0b026143 100644
@@ -446,7 +446,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, u8 bdb_version)
 	 * Only parse SDVO mappings on gens that could have SDVO. This isn't
 	 * accurate and doesn't have to be, as long as it's not too strict.
 	 */
-	if (!IS_GEN(dev_priv, 3, 7)) {
+	if (!IS_GEN_RANGE(dev_priv, 3, 7)) {
 		DRM_DEBUG_KMS("Skipping SDVO device mapping\n");
 		return;
 	}
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 8bfab22068a3..65f6c9bc10cf 100644
@@ -1286,7 +1286,7 @@ static void intel_engine_print_registers(const struct intel_engine_cs *engine,
 		&engine->execlists;
 	u64 addr;
 
-	if (engine->id == RCS && IS_GEN(dev_priv, 4, 7))
+	if (engine->id == RCS && IS_GEN_RANGE(dev_priv, 4, 7))
 		drm_printf(m, "\tCCID: 0x%08x\n", I915_READ(CCID));
 	drm_printf(m, "\tRING_START: 0x%08x\n",
 		   I915_READ(RING_START(engine->mmio_base)));
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index e3cfc3c176e7..c90954cdfb15 100644
@@ -784,7 +784,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 	 * having a Y offset that isn't divisible by 4 causes FIFO underrun
 	 * and screen flicker.
 	 */
-	if (IS_GEN(dev_priv, 9, 10) &&
+	if (IS_GEN_RANGE(dev_priv, 9, 10) &&
 	    (fbc->state_cache.plane.adjusted_y & 3)) {
 		fbc->no_fbc_reason = "plane Y offset is misaligned";
 		return false;
drivers/gpu/drm/i915/intel_hangcheck.c +1 -1
index e26d05a46451..41921a843d42 100644
@@ -252,7 +252,7 @@ engine_stuck(struct intel_engine_cs *engine, u64 acthd)
 		return ENGINE_WAIT_KICK;
 	}
 
-	if (IS_GEN(dev_priv, 6, 7) && tmp & RING_WAIT_SEMAPHORE) {
+	if (IS_GEN_RANGE(dev_priv, 6, 7) && tmp & RING_WAIT_SEMAPHORE) {
 		switch (semaphore_passed(engine)) {
 		default:
 			return ENGINE_DEAD;
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -4
index b8a7a014d46d..608e5c65b655 100644
@@ -407,7 +407,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *engine)
 	POSTING_READ(mmio);
 
 	/* Flush the TLB for this page */
-	if (IS_GEN(dev_priv, 6, 7)) {
+	if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		i915_reg_t reg = RING_INSTPM(engine->mmio_base);
 
 		/* ring should be idle before issuing a sync flush*/
@@ -629,7 +629,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	intel_whitelist_workarounds_apply(engine);
 
 	/* WaTimedSingleVertexDispatch:cl,bw,ctg,elk,ilk,snb */
-	if (IS_GEN(dev_priv, 4, 6))
+	if (IS_GEN_RANGE(dev_priv, 4, 6))
 		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
 
 	/* We need to disable the AsyncFlip performance optimisations in order
@@ -638,7 +638,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	 *
 	 * WaDisableAsyncFlipPerfMode:snb,ivb,hsw,vlv
 	 */
-	if (IS_GEN(dev_priv, 6, 7))
+	if (IS_GEN_RANGE(dev_priv, 6, 7))
 		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE));
 
 	/* Required for the hardware to program scanline values for waiting */
@@ -663,7 +663,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
 	}
 
-	if (IS_GEN(dev_priv, 6, 7))
+	if (IS_GEN_RANGE(dev_priv, 6, 7))
 		I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING));
 
 	if (INTEL_GEN(dev_priv) >= 6)
drivers/gpu/drm/i915/intel_uncore.c +6 -6
index 9289515108c3..631b4165fe00 100644
@@ -1567,13 +1567,13 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
+	if (IS_GEN_RANGE(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen2);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen2);
 	} else if (IS_GEN5(dev_priv)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen5);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen5);
-	} else if (IS_GEN(dev_priv, 6, 7)) {
+	} else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen6);
 
 		if (IS_VALLEYVIEW(dev_priv)) {
@@ -1592,7 +1592,7 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 			ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen8);
 			ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen6);
 		}
-	} else if (IS_GEN(dev_priv, 9, 10)) {
+	} else if (IS_GEN_RANGE(dev_priv, 9, 10)) {
 		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, fwtable);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, fwtable);
@@ -2321,7 +2321,7 @@ intel_uncore_forcewake_for_read(struct drm_i915_private *dev_priv,
 	} else if (INTEL_GEN(dev_priv) >= 6) {
 		fw_domains = __gen6_reg_read_fw_domains(offset);
 	} else {
-		WARN_ON(!IS_GEN(dev_priv, 2, 5));
+		WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
 		fw_domains = 0;
 	}
 
@@ -2343,10 +2343,10 @@ intel_uncore_forcewake_for_write(struct drm_i915_private *dev_priv,
 		fw_domains = __fwtable_reg_write_fw_domains(offset);
 	} else if (IS_GEN8(dev_priv)) {
 		fw_domains = __gen8_reg_write_fw_domains(offset);
-	} else if (IS_GEN(dev_priv, 6, 7)) {
+	} else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		fw_domains = FORCEWAKE_RENDER;
 	} else {
-		WARN_ON(!IS_GEN(dev_priv, 2, 5));
+		WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
 		fw_domains = 0;
 	}
 
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

RFC 2/3 drm/i915: Prefer IS_GEN<n> check with bitmask.

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@
-INTEL_GEN(e) == 2
+IS_GEN2(e)
@gen3@ expression e; @@
-INTEL_GEN(e) == 3
+IS_GEN3(e)
@gen4@ expression e; @@
-INTEL_GEN(e) == 4
+IS_GEN4(e)
@gen5@ expression e; @@
-INTEL_GEN(e) == 5
+IS_GEN5(e)
@gen6@ expression e; @@
-INTEL_GEN(e) == 6
+IS_GEN6(e)
@gen7@ expression e; @@
-INTEL_GEN(e) == 7
+IS_GEN7(e)
@gen8@ expression e; @@
-INTEL_GEN(e) == 8
+IS_GEN8(e)
@gen9@ expression e; @@
-INTEL_GEN(e) == 9
+IS_GEN9(e)
@gen10@ expression e; @@
-INTEL_GEN(e) == 10
+IS_GEN10(e)
@gen11@ expression e; @@
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/3
#2 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 40 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

Review

Quoted 2 lines
(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version. Sadly not super neat on account of having to use the python stuff.

@find@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
@@
old(exp) == gen

@script:python rename@
old << find.old;
gen << find.gen;
new;
@@
def do_rename(old, gen):
return "IS_GEN" + gen
coccinelle.new = cocci.make_ident(do_rename(old, gen)) print coccinelle.new

@@
identifier find.old;
expression find.exp;
constant find.gen;
identifier rename.new;
@@
- old(exp) == gen
+ new(exp)

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

Patch looks fine anyways

Quoted 191 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 11 lines

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

Quoted 2 lines

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

I think that the idea was to be sure that there would be no whitespace in the middle of the variable name. But a constant should indeed be fine. I can adjust that, in case it's useful in the future.

julia

Quoted 192 lines

Patch looks fine anyways

Quoted 187 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -2
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
--

2.19.1

Quoted 9 lines
Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 11 lines · Julia Lawall
Quoted 11 lines

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

Quoted 6 lines
Quoted 2 lines

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

I think that the idea was to be sure that there would be no whitespace in the middle of the variable name. But a constant should indeed be fine. I can adjust that, in case it's useful in the future.

I think I had another similar case recently where I also wanted a constant in there. Ah yes, now I remember. I was trying to convert "n * 1024" to "SZ_nK" etc.

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#5 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

In reply to Ville Syrjälä
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)
Quoted 8 lines

Review

Quoted 6 lines

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version.

Thanks. I'm supper newbie on coccinelle and it was easier to duplicate then trying to learn all this new lang.

But I really appreciate you sharing this. I'd like to go with this so the better rule keeps on commit message.

Quoted 2 lines

Sadly not super neat on
account of having to use the python stuff.

however it seems python version didn't work so well here:

init_defs_builtins: /usr/lib64/coccinelle/standard.h Python error: No module named coccilib.elems

do you have any idea about it?

I couldn't find anything on google or on pip repositories for that.

Thanks,
Rodrigo.

Quoted 229 lines

@find@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
@@
old(exp) == gen

@script:python rename@
old << find.old;
gen << find.gen;
new;
@@
def do_rename(old, gen):
return "IS_GEN" + gen
coccinelle.new = cocci.make_ident(do_rename(old, gen)) print coccinelle.new

@@
identifier find.old;
expression find.exp;
constant find.gen;
identifier rename.new;
@@
- old(exp) == gen
+ new(exp)

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

Patch looks fine anyways

Quoted 183 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
Quoted 12 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +0 -0
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 56 lines · Rodrigo Vivi
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)
Quoted 8 lines

Review

Quoted 6 lines

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version.

Thanks. I'm supper newbie on coccinelle and it was easier to duplicate then trying to learn all this new lang.

But I really appreciate you sharing this. I'd like to go with this so the better rule keeps on commit message.

Quoted 2 lines

Sadly not super neat on
account of having to use the python stuff.

Quoted 6 lines

however it seems python version didn't work so well here:

init_defs_builtins: /usr/lib64/coccinelle/standard.h Python error: No module named coccilib.elems

do you have any idea about it?

Never seen it. On gentoo it just works when I have the python use flag enabled.

Maybe your distro doesn't include the python support in the build, or maybe some kind of python version issue?

Quoted 248 lines

I couldn't find anything on google or on pip repositories for that.

Thanks,
Rodrigo.

Quoted 241 lines

@find@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
@@
old(exp) == gen

@script:python rename@
old << find.old;
gen << find.gen;
new;
@@
def do_rename(old, gen):
return "IS_GEN" + gen
coccinelle.new = cocci.make_ident(do_rename(old, gen)) print coccinelle.new

@@
identifier find.old;
expression find.exp;
constant find.gen;
identifier rename.new;
@@
- old(exp) == gen
+ new(exp)

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

Patch looks fine anyways

Quoted 191 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 62 lines · Ville Syrjälä
Quoted 61 lines · Rodrigo Vivi
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)
Quoted 8 lines

Review

Quoted 6 lines

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version.

Thanks. I'm supper newbie on coccinelle and it was easier to duplicate then trying to learn all this new lang.

But I really appreciate you sharing this. I'd like to go with this so the better rule keeps on commit message.

Quoted 2 lines

Sadly not super neat on
account of having to use the python stuff.

however it seems python version didn't work so well here:

init_defs_builtins: /usr/lib64/coccinelle/standard.h Python error: No module named coccilib.elems

Quoted 7 lines
Quoted 1 line

do you have any idea about it?

Never seen it. On gentoo it just works when I have the python use flag enabled.

Maybe your distro doesn't include the python support in the build, or maybe some kind of python version issue?

Thanks for the report. I will have someone look into it. It's an internal Coccinelle thing. Perhaps python is not enabled. Do you have the version of Coccinelle from github?

julia

Quoted 250 lines
Quoted 249 lines

I couldn't find anything on google or on pip repositories for that.

Thanks,
Rodrigo.

Quoted 241 lines

@find@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
@@
old(exp) == gen

@script:python rename@
old << find.old;
gen << find.gen;
new;
@@
def do_rename(old, gen):
return "IS_GEN" + gen
coccinelle.new = cocci.make_ident(do_rename(old, gen)) print coccinelle.new

@@
identifier find.old;
expression find.exp;
constant find.gen;
identifier rename.new;
@@
- old(exp) == gen
+ new(exp)

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

Patch looks fine anyways

Quoted 187 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -2
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
--

2.19.1

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel

Quoted 4 lines

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#8 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 71 lines · Julia Lawall
Quoted 67 lines · Ville Syrjälä
Quoted 56 lines · Rodrigo Vivi
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)
Quoted 8 lines

Review

Quoted 6 lines

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version.

Thanks. I'm supper newbie on coccinelle and it was easier to duplicate then trying to learn all this new lang.

But I really appreciate you sharing this. I'd like to go with this so the better rule keeps on commit message.

Quoted 2 lines

Sadly not super neat on
account of having to use the python stuff.

Quoted 6 lines

however it seems python version didn't work so well here:

init_defs_builtins: /usr/lib64/coccinelle/standard.h Python error: No module named coccilib.elems

do you have any idea about it?

Never seen it. On gentoo it just works when I have the python use flag enabled.

Quoted 6 lines
Quoted 2 lines

Maybe your distro doesn't include the python support in the build, or maybe some kind of python version issue?

Thanks for the report. I will have someone look into it. It's an internal Coccinelle thing. Perhaps python is not enabled. Do you have the version of Coccinelle from github?

I just tried with coccinelle from github but got same result.

But with this commit before the bump to automake1.16:

commit 4db95998768557c66d6e337be2253032b5d810bc (HEAD -> master)

Author: Thierry Martinez <[email protected]>
Date:   Wed Sep 12 14:43:41 2018 +0200

Compute depend by calling make recursilevy

The set of files in $(source_files) may change when the tarball is unpacked.

----

$ python --version
Python 2.7.15
$ python3 --version
Python 3.6.6

----

I believe I'm moving this patch with the repetitive bad rule for now that I'm sure it works in most of the distros.

Thanks,
Rodrigo.

Quoted 257 lines

julia

Quoted 254 lines
Quoted 249 lines

I couldn't find anything on google or on pip repositories for that.

Thanks,
Rodrigo.

Quoted 241 lines

@find@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
@@
old(exp) == gen

@script:python rename@
old << find.old;
gen << find.gen;
new;
@@
def do_rename(old, gen):
return "IS_GEN" + gen
coccinelle.new = cocci.make_ident(do_rename(old, gen)) print coccinelle.new

@@
identifier find.old;
expression find.exp;
constant find.gen;
identifier rename.new;
@@
- old(exp) == gen
+ new(exp)

I wish it would look something more like this:

@@
identifier old =~ "^INTEL_GEN$";
expression exp;
constant gen;
fresh identifier new = "IS_GEN" ## gen;
@@
- old(exp) == gen
+ new(exp)

But coccinelle doesn't seem to accept the constant in the fresh identifier thing.

Patch looks fine anyways

Quoted 187 lines
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.c          | 2 +-
 drivers/gpu/drm/i915/intel_atomic.c      | 2 +-
 drivers/gpu/drm/i915/intel_device_info.c | 6 +++---
 drivers/gpu/drm/i915/intel_display.c     | 2 +-
 drivers/gpu/drm/i915/intel_dp.c          | 2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   | 2 +-
 drivers/gpu/drm/i915/intel_fbc.c         | 2 +-
 drivers/gpu/drm/i915/intel_pm.c          | 4 ++--
 drivers/gpu/drm/i915/intel_psr.c         | 2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.h  | 4 ++--
 drivers/gpu/drm/i915/intel_sprite.c      | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
index baac35f698f9..d755e84fed07 100644
@@ -1329,7 +1329,7 @@ intel_get_dram_info(struct drm_i915_private *dev_priv)
 	/* Need to calculate bandwidth only for Gen9 */
 	if (IS_BROXTON(dev_priv))
 		ret = bxt_get_dram_info(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		ret = skl_get_dram_info(dev_priv);
 	else
 		ret = skl_dram_get_channels_info(dev_priv);
drivers/gpu/drm/i915/intel_atomic.c +1 -1
index 760758ad21c1..3526f6d9c1ad 100644
@@ -232,7 +232,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
 	if (plane_state && plane_state->base.fb &&
 	    plane_state->base.fb->format->is_yuv &&
 	    plane_state->base.fb->format->num_planes > 1) {
-		if (INTEL_GEN(dev_priv) == 9 &&
+		if (IS_GEN9(dev_priv) &&
 		    !IS_GEMINILAKE(dev_priv))
 			mode = SKL_PS_SCALER_MODE_NV12;
 		else
drivers/gpu/drm/i915/intel_device_info.c +3 -3
index 03df4e33763d..561ad0d4a53d 100644
@@ -744,7 +744,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		for_each_pipe(dev_priv, pipe)
 			info->num_scalers[pipe] = 2;
-	} else if (INTEL_GEN(dev_priv) == 9) {
+	} else if (IS_GEN9(dev_priv)) {
 		info->num_scalers[PIPE_A] = 2;
 		info->num_scalers[PIPE_B] = 2;
 		info->num_scalers[PIPE_C] = 1;
@@ -843,9 +843,9 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
 		cherryview_sseu_info_init(dev_priv);
 	else if (IS_BROADWELL(dev_priv))
 		broadwell_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 9)
+	else if (IS_GEN9(dev_priv))
 		gen9_sseu_info_init(dev_priv);
-	else if (INTEL_GEN(dev_priv) == 10)
+	else if (IS_GEN10(dev_priv))
 		gen10_sseu_info_init(dev_priv);
 	else if (INTEL_GEN(dev_priv) >= 11)
 		gen11_sseu_info_init(dev_priv);
drivers/gpu/drm/i915/intel_display.c +1 -1
index fc7e3b0bd95c..a6869c547f3c 100644
@@ -5268,7 +5268,7 @@ static bool needs_nv12_wa(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if ((INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv)) ||
+	if ((IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv)) ||
 	    IS_CANNONLAKE(dev_priv))
 		return true;
 
drivers/gpu/drm/i915/intel_dp.c +1 -1
index 8c38efef77a1..761447c456c7 100644
@@ -455,7 +455,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
 	if (INTEL_GEN(dev_priv) >= 10) {
 		source_rates = cnl_rates;
 		size = ARRAY_SIZE(cnl_rates);
-		if (INTEL_GEN(dev_priv) == 10)
+		if (IS_GEN10(dev_priv))
 			max_rate = cnl_max_source_rate(intel_dp);
 		else
 			max_rate = icl_max_source_rate(intel_dp);
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 65f6c9bc10cf..a4b1d82c89da 100644
@@ -812,7 +812,7 @@ u32 intel_calculate_mcr_s_ss_select(struct drm_i915_private *dev_priv)
 	u32 slice = fls(sseu->slice_mask);
 	u32 subslice = fls(sseu->subslice_mask[slice]);
 
-	if (INTEL_GEN(dev_priv) == 10)
+	if (IS_GEN10(dev_priv))
 		mcr_s_ss_select = GEN8_MCR_SLICE(slice) |
 				  GEN8_MCR_SUBSLICE(subslice);
 	else if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index c90954cdfb15..96f70d896c10 100644
@@ -84,7 +84,7 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_GEN(dev_priv) == 7)
+	if (IS_GEN7(dev_priv))
 		lines = min(lines, 2048);
 	else if (INTEL_GEN(dev_priv) >= 8)
 		lines = min(lines, 2560);
drivers/gpu/drm/i915/intel_pm.c +2 -2
index 67a4d0735291..3793866a9ee7 100644
@@ -4676,13 +4676,13 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 			selected_result = method2;
 		} else if (ddb_allocation >=
 			 fixed16_to_u32_round_up(wp->plane_blocks_per_line)) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
 				selected_result = method2;
 		} else if (latency >= wp->linetime_us) {
-			if (INTEL_GEN(dev_priv) == 9 &&
+			if (IS_GEN9(dev_priv) &&
 			    !IS_GEMINILAKE(dev_priv))
 				selected_result = min_fixed16(method1, method2);
 			else
drivers/gpu/drm/i915/intel_psr.c +1 -1
index 423cdf84059c..bc2d88313ed0 100644
@@ -574,7 +574,7 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp,
 	if (dev_priv->psr.psr2_enabled) {
 		u32 chicken = I915_READ(CHICKEN_TRANS(cpu_transcoder));
 
-		if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv))
+		if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv))
 			chicken |= (PSR2_VSC_ENABLE_PROG_HEADER
 				   | PSR2_ADD_VERTICAL_LINE_COUNT);
 
drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index f6ec48a75a69..d3a08d0f02fe 100644
@@ -93,11 +93,11 @@ hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
 #define I915_MAX_SUBSLICES 8
 
 #define instdone_slice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
 
 #define instdone_subslice_mask(dev_priv__) \
-	(INTEL_GEN(dev_priv__) == 7 ? \
+	(IS_GEN7(dev_priv__) ? \
 	 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
 
 #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
drivers/gpu/drm/i915/intel_sprite.c +1 -2
index 7cd59eee5cad..4c9f0b7138b3 100644
@@ -1798,7 +1798,7 @@ static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
 	if (IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
 		return false;
 
-	if (INTEL_GEN(dev_priv) == 9 && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
+	if (IS_GEN9(dev_priv) && !IS_GEMINILAKE(dev_priv) && pipe == PIPE_C)
 		return false;
 
 	if (plane_id != PLANE_PRIMARY && plane_id != PLANE_SPRITE0)
--

2.19.1

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel

--
Ville Syrjälä
Intel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 99 lines · Rodrigo Vivi
Quoted 71 lines · Julia Lawall
Quoted 67 lines · Ville Syrjälä
Quoted 56 lines · Rodrigo Vivi
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)
Quoted 8 lines

Review

Quoted 6 lines

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version.

Thanks. I'm supper newbie on coccinelle and it was easier to duplicate then trying to learn all this new lang.

But I really appreciate you sharing this. I'd like to go with this so the better rule keeps on commit message.

Quoted 2 lines

Sadly not super neat on
account of having to use the python stuff.

Quoted 6 lines

however it seems python version didn't work so well here:

init_defs_builtins: /usr/lib64/coccinelle/standard.h Python error: No module named coccilib.elems

do you have any idea about it?

Never seen it. On gentoo it just works when I have the python use flag enabled.

Quoted 6 lines
Quoted 2 lines

Maybe your distro doesn't include the python support in the build, or maybe some kind of python version issue?

Thanks for the report. I will have someone look into it. It's an internal Coccinelle thing. Perhaps python is not enabled. Do you have the version of Coccinelle from github?

I just tried with coccinelle from github but got same result.

But with this commit before the bump to automake1.16:

commit 4db95998768557c66d6e337be2253032b5d810bc (HEAD -> master)

Author: Thierry Martinez <[email protected]>
Date:   Wed Sep 12 14:43:41 2018 +0200

Compute depend by calling make recursilevy

The set of files in $(source_files) may change when the tarball is unpacked.

----

$ python --version
Python 2.7.15
$ python3 --version
Python 3.6.6
Quoted 4 lines

----

I believe I'm moving this patch with the repetitive bad rule for now that I'm sure it works in most of the distros.

Sorry, I'm not sure to understand the last sentence. Are things ok now, or not?

thanks,
julia

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#10 lore raw

Re: [RFC 2/3] drm/i915: Prefer IS_GEN<n> check with bitmask.

Quoted 103 lines · Julia Lawall
Quoted 99 lines · Rodrigo Vivi
Quoted 71 lines · Julia Lawall
Quoted 67 lines · Ville Syrjälä
Quoted 56 lines · Rodrigo Vivi
Quoted 37 lines · Ville Syrjälä
Quoted 36 lines · Rodrigo Vivi

Whenever possible we should stick with IS_GEN<n> checks.

Bitmaks has been introduced on commit ae7617f0ef18 ("drm/i915:
Allow optimized platform checks") for efficiency.

Let's stick with it whenever possible.

This patch was generated with coccinelle:

spatch -sp_file is_gen.cocci *{c,h} --in-place

is_gen.cocci:
@gen2@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 2
+IS_GEN2(e)

@gen3@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 3
+IS_GEN3(e)

@gen4@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 4
+IS_GEN4(e)

@gen5@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 5
+IS_GEN5(e)

@gen6@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 6
+IS_GEN6(e)

@gen7@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 7
+IS_GEN7(e)

@gen8@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 8
+IS_GEN8(e)

@gen9@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 9
+IS_GEN9(e)
Quoted 8 lines

Review

Quoted 6 lines

@gen10@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 10
+IS_GEN10(e)

@gen11@ expression e; @@

(quoted diff) +1 -1
-INTEL_GEN(e) == 11
+IS_GEN11(e)

Slightly less repetitive version.

Thanks. I'm supper newbie on coccinelle and it was easier to duplicate then trying to learn all this new lang.

But I really appreciate you sharing this. I'd like to go with this so the better rule keeps on commit message.

Quoted 2 lines

Sadly not super neat on
account of having to use the python stuff.

Quoted 6 lines

however it seems python version didn't work so well here:

init_defs_builtins: /usr/lib64/coccinelle/standard.h Python error: No module named coccilib.elems

do you have any idea about it?

Never seen it. On gentoo it just works when I have the python use flag enabled.

Quoted 6 lines
Quoted 2 lines

Maybe your distro doesn't include the python support in the build, or maybe some kind of python version issue?

Thanks for the report. I will have someone look into it. It's an internal Coccinelle thing. Perhaps python is not enabled. Do you have the version of Coccinelle from github?

I just tried with coccinelle from github but got same result.

But with this commit before the bump to automake1.16:

commit 4db95998768557c66d6e337be2253032b5d810bc (HEAD -> master)

Author: Thierry Martinez <[email protected]>
Date:   Wed Sep 12 14:43:41 2018 +0200

Compute depend by calling make recursilevy

The set of files in $(source_files) may change when the tarball is unpacked.

----

$ python --version
Python 2.7.15
$ python3 --version
Python 3.6.6
Quoted 7 lines
Quoted 4 lines

----

I believe I'm moving this patch with the repetitive bad rule for now that I'm sure it works in most of the distros.

Sorry, I'm not sure to understand the last sentence. Are things ok now, or not?

Well, I'd like to learn more and be able to run the python rules on my system. So if you still have any idea I'd like to listen.

But I don't see any rush on that since for this patch we can go with the simple repetitive rule that works on default coccinelle that comes with fedora 28.

In other words, for this patch we are good.

For the future I'd like to learn, but with no pressure or rush!

I really appreciate your support

Thanks a lot,
Rodrigo.

Quoted 3 lines

thanks,
julia

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#11 lore raw

RFC 3/3 drm/i915: Kill GEN_FOREVER

In reply to Rodrigo Vivi

commit ac657f6461e5 ("drm/i915: Introduce IS_GEN macro") introduced GEN_FOREVER that was never used.

My first attempt was to rename it to FOREVER since GEN is already part of the macro. Then I used coccinelle to change all -INTEL_GEN(e1) >= e2
+INTEL_GEN_RANGE(e1, e2, FOREVER)
-INTEL_GEN(e1) <= e2
+INTEL_GEN_RANGE(e1, 0, e2)

and I liked it.

However I didn't like very much the remaining
INTEL_GEN(dev_priv) < n

and:
INTEL_GEN(e1) < n
INTEL_GEN_RANGE(e1, 0, n - 1)

didn't make much sense either.

So INTEL_GEN use for > or < seems a better unified way for unlimited bounds. So, no reason to keep GEN_FOREVER here.

Let's kill before someone start using it.

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -5
index f766bb1e873b..24f17e711772 100644
@@ -2373,14 +2373,10 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define REVID_FOREVER		0xff
 #define INTEL_REVID(dev_priv)	((dev_priv)->drm.pdev->revision)
 
-#define GEN_FOREVER (0)
-
 #define INTEL_GEN_MASK(s, e) ( \
 	BUILD_BUG_ON_ZERO(!__builtin_constant_p(s)) + \
 	BUILD_BUG_ON_ZERO(!__builtin_constant_p(e)) + \
-	GENMASK((e) != GEN_FOREVER ? (e) - 1 : BITS_PER_LONG - 1, \
-		(s) != GEN_FOREVER ? (s) - 1 : 0) \
-)
+	GENMASK((e) - 1, (s) - 1))
 
 /*
  * Returns true if Gen is in inclusive range [Start, End].
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/3
#12 lore raw

Re: [RFC 3/3] drm/i915: Kill GEN_FOREVER

Quoted 42 lines · Rodrigo Vivi

commit ac657f6461e5 ("drm/i915: Introduce IS_GEN macro") introduced GEN_FOREVER that was never used.

My first attempt was to rename it to FOREVER since GEN is already part of the macro. Then I used coccinelle to change all

(quoted diff) +2 -2
-INTEL_GEN(e1) >= e2
+INTEL_GEN_RANGE(e1, e2, FOREVER)
-INTEL_GEN(e1) <= e2
+INTEL_GEN_RANGE(e1, 0, e2)

and I liked it.

However I didn't like very much the remaining
INTEL_GEN(dev_priv) < n

and:
INTEL_GEN(e1) < n
INTEL_GEN_RANGE(e1, 0, n - 1)

didn't make much sense either.

So INTEL_GEN use for > or < seems a better unified way for unlimited bounds. So, no reason to keep GEN_FOREVER here.

Let's kill before someone start using it.

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index f766bb1e873b..24f17e711772 100644
@@ -2373,14 +2373,10 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define REVID_FOREVER		0xff
 #define INTEL_REVID(dev_priv)	((dev_priv)->drm.pdev->revision)
 
-#define GEN_FOREVER (0)
-

drivers/gpu/drm/i915/i915_drv.h intel_info(const struct drm_i915_private *dev_priv) · line 2382

Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.h +1 -3
 #define INTEL_GEN_MASK(s, e) ( \
 	BUILD_BUG_ON_ZERO(!__builtin_constant_p(s)) + \
 	BUILD_BUG_ON_ZERO(!__builtin_constant_p(e)) + \
-	GENMASK((e) != GEN_FOREVER ? (e) - 1 : BITS_PER_LONG - 1, \
-		(s) != GEN_FOREVER ? (s) - 1 : 0) \
-)
+	GENMASK((e) - 1, (s) - 1))
 
 /*
  * Returns true if Gen is in inclusive range [Start, End].

You missed GEN_FOREVER a bit below here in a comment. With that fixed, on the series:

Quoted 7 lines
Signature · 6 lines
2.19.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

✗ Fi.CI.SPARSE: warning for series starting with [RFC,1/3] drm/i915: Rename IS_GEN to IS_GEN_RANGE.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/3] drm/i915: Rename IS_GEN to IS_GEN_RANGE.
URL : https://patchwork.freedesktop.org/series/51415/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915: Rename IS_GEN to IS_GEN_RANGE.
Okay!

Commit: drm/i915: Prefer IS_GEN<n> check with bitmask. -O:drivers/gpu/drm/i915/intel_fbc.c:88:25: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/intel_fbc.c:90:25: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_fbc.c:88:25: warning: expression using sizeof(void) +drivers/gpu/drm/i915/intel_fbc.c:90:25: warning: expression using sizeof(void)

Commit: drm/i915: Kill GEN_FOREVER -drivers/gpu/drm/i915/selftests/../i915_drv.h:3708:16: warning: expression using sizeof(void) +drivers/gpu/drm/i915/selftests/../i915_drv.h:3704:16: warning: expression using sizeof(void)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

✓ Fi.CI.BAT: success for series starting with [RFC,1/3] drm/i915: Rename IS_GEN to IS_GEN_RANGE.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/3] drm/i915: Rename IS_GEN to IS_GEN_RANGE.
URL : https://patchwork.freedesktop.org/series/51415/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5023 -> Patchwork_10555 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/51415/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_10555 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@amdgpu/amd_basic@cs-compute:
      fi-kbl-8809g:       NOTRUN -> FAIL (fdo#108094)

    igt@amdgpu/amd_prime@amd-to-i915:
      fi-kbl-8809g:       NOTRUN -> FAIL (fdo#107341)

    igt@drv_module_reload@basic-reload:
      fi-blb-e6850:       NOTRUN -> INCOMPLETE (fdo#107718)

    igt@gem_exec_suspend@basic-s3:
      fi-icl-u:           NOTRUN -> INCOMPLETE (fdo#107713)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-hsw-4770r:       PASS -> DMESG-WARN (fdo#105602)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362, fdo#103191)

    
    ==== Possible fixes ====

    igt@drv_selftest@live_execlists:
      fi-apl-guc:         INCOMPLETE (fdo#106693) -> PASS

    igt@gem_ctx_switch@basic-default:
      fi-icl-u:           DMESG-FAIL -> PASS

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       INCOMPLETE (fdo#107718) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-byt-clapper:     FAIL (fdo#103167) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-a:
      fi-byt-clapper:     FAIL (fdo#107362) -> PASS

fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#106693 https://bugs.freedesktop.org/show_bug.cgi?id=106693
fdo#107341 https://bugs.freedesktop.org/show_bug.cgi?id=107341
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107713 https://bugs.freedesktop.org/show_bug.cgi?id=107713
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
fdo#108094 https://bugs.freedesktop.org/show_bug.cgi?id=108094

== Participating hosts (49 -> 45) ==

Additional (1): fi-kbl-7560u
Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600

== Build changes ==

* Linux: CI_DRM_5023 -> Patchwork_10555

CI_DRM_5023: 166bc98d7b77005943ab670506f164783cdc3f56 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4688: fa6dbf8c048961356fd642df047cb58ab49309b2 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10555: 3d4a4c3ccf413ac2264fdfd0507ba69f69cb26a0 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

3d4a4c3ccf41 drm/i915: Kill GEN_FOREVER 553196a3b87f drm/i915: Prefer IS_GEN<n> check with bitmask. f179a555c700 drm/i915: Rename IS_GEN to IS_GEN_RANGE.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10555/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#15 lore raw

✓ Fi.CI.IGT: success for series starting with [RFC,1/3] drm/i915: Rename IS_GEN to IS_GEN_RANGE.

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: series starting with [RFC,1/3] drm/i915: Rename IS_GEN to IS_GEN_RANGE.
URL : https://patchwork.freedesktop.org/series/51415/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5023_full -> Patchwork_10555_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_10555_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_10555_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_10555_full:

=== IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-snb:          PASS -> SKIP

== Known issues ==

Here are the changes found in Patchwork_10555_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665, fdo#106023)

    igt@kms_busy@extended-modeset-hang-newfb-render-b:
      shard-kbl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_busy@extended-pageflip-hang-newfb-render-b:
      shard-apl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_color@pipe-b-degamma:
      shard-apl:          PASS -> FAIL (fdo#104782)

    igt@kms_cursor_crc@cursor-256x85-onscreen:
      shard-apl:          NOTRUN -> FAIL (fdo#103232)
      shard-glk:          PASS -> FAIL (fdo#103232) +2

    igt@kms_cursor_crc@cursor-256x85-random:
      shard-apl:          PASS -> FAIL (fdo#103232) +4

    igt@kms_cursor_crc@cursor-64x64-suspend:
      shard-apl:          NOTRUN -> FAIL (fdo#103191, fdo#103232)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
      shard-apl:          PASS -> FAIL (fdo#103167) +2

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-fullscreen:
      shard-glk:          PASS -> FAIL (fdo#103167) +1

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      shard-skl:          PASS -> INCOMPLETE (fdo#104108, fdo#107773)

    igt@kms_plane@plane-position-covered-pipe-c-planes:
      shard-apl:          PASS -> FAIL (fdo#103166)
      shard-glk:          PASS -> FAIL (fdo#103166) +1

    igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
      shard-skl:          NOTRUN -> FAIL (fdo#108146)

    igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
      shard-apl:          PASS -> FAIL (fdo#108145)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)
      shard-kbl:          NOTRUN -> FAIL (fdo#99912)
      shard-snb:          NOTRUN -> FAIL (fdo#99912)

    igt@perf@polling:
      shard-hsw:          PASS -> FAIL (fdo#102252)

    
    ==== Possible fixes ====

    igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
      shard-glk:          FAIL (fdo#108145) -> PASS +1

    igt@kms_cursor_crc@cursor-256x256-onscreen:
      shard-glk:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_crc@cursor-size-change:
      shard-apl:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
      shard-glk:          DMESG-WARN (fdo#106538, fdo#105763) -> PASS +1

    igt@kms_flip@busy-flip-interruptible:
      shard-skl:          FAIL (fdo#103257) -> PASS

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-skl:          FAIL (fdo#105363) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
      shard-apl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
      shard-glk:          FAIL (fdo#103167) -> PASS

    igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
      shard-skl:          INCOMPLETE (fdo#104108, fdo#107773) -> PASS

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-apl:          FAIL (fdo#103166) -> PASS

    igt@kms_rotation_crc@sprite-rotation-180:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@kms_vblank@pipe-a-ts-continuation-suspend:
      shard-kbl:          INCOMPLETE (fdo#103665) -> PASS +1

    igt@perf@short-reads:
      shard-skl:          FAIL (fdo#103183) -> PASS

    igt@pm_rpm@legacy-planes-dpms:
      shard-skl:          INCOMPLETE (fdo#105959, fdo#107807) -> PASS

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103183 https://bugs.freedesktop.org/show_bug.cgi?id=103183
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103257 https://bugs.freedesktop.org/show_bug.cgi?id=103257
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104108 https://bugs.freedesktop.org/show_bug.cgi?id=104108
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#105959 https://bugs.freedesktop.org/show_bug.cgi?id=105959
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#107773 https://bugs.freedesktop.org/show_bug.cgi?id=107773
fdo#107807 https://bugs.freedesktop.org/show_bug.cgi?id=107807
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108146 https://bugs.freedesktop.org/show_bug.cgi?id=108146
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (6 -> 6) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_5023 -> Patchwork_10555

CI_DRM_5023: 166bc98d7b77005943ab670506f164783cdc3f56 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4688: fa6dbf8c048961356fd642df047cb58ab49309b2 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10555: 3d4a4c3ccf413ac2264fdfd0507ba69f69cb26a0 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10555/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#16 lore raw
In reply to Rodrigo Vivi
Quoted 1 line · Rodrigo Vivi

RANGE makes it longer, but clear.

IS_GEN_RANGE() was the first proposal, but in review this was changed to IS_GEN() following IS_REVID() and IS_<platform>_REVID().

IMO unnecessary change.

BR,
Jani.

Quoted 209 lines

Diff generated with:

sed 's/IS_GEN(/IS_GEN_RANGE(/g' drivers/gpu/drm/i915/*.{c,h} -i

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c     |  2 +-
 drivers/gpu/drm/i915/i915_drv.h         |  2 +-
 drivers/gpu/drm/i915/i915_perf.c        |  4 ++--
 drivers/gpu/drm/i915/intel_bios.c       |  2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c  |  2 +-
 drivers/gpu/drm/i915/intel_fbc.c        |  2 +-
 drivers/gpu/drm/i915/intel_hangcheck.c  |  2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |  8 ++++----
 drivers/gpu/drm/i915/intel_uncore.c     | 12 ++++++------
 9 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 5b37d5f8e132..3deab30388f2 100644
@@ -2919,7 +2919,7 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
 	if (IS_BROXTON(dev_priv)) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(BXT_CSR_DC3_DC5_COUNT));
-	} else if (IS_GEN(dev_priv, 9, 11)) {
+	} else if (IS_GEN_RANGE(dev_priv, 9, 11)) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(SKL_CSR_DC3_DC5_COUNT));
 		seq_printf(m, "DC5 -> DC6 count: %d\n",
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 3017ef037fed..f766bb1e873b 100644
@@ -2387,7 +2387,7 @@ intel_info(const struct drm_i915_private *dev_priv)
  *
  * Use GEN_FOREVER for unbound start and or end.
  */
-#define IS_GEN(dev_priv, s, e) \
+#define IS_GEN_RANGE(dev_priv, s, e) \
 	(!!((dev_priv)->info.gen_mask & INTEL_GEN_MASK((s), (e))))
 
 /*
drivers/gpu/drm/i915/i915_perf.c +2 -2
index 664b96bb65a3..0888b6e6080f 100644
@@ -1795,7 +1795,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
 	 * be read back from automatically triggered reports, as part of the
 	 * RPT_ID field.
 	 */
-	if (IS_GEN(dev_priv, 9, 11)) {
+	if (IS_GEN_RANGE(dev_priv, 9, 11)) {
 		I915_WRITE(GEN8_OA_DEBUG,
 			   _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
 					      GEN9_OA_DEBUG_INCLUDE_CLK_RATIO));
@@ -3439,7 +3439,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
 
 				dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16);
 			}
-		} else if (IS_GEN(dev_priv, 10, 11)) {
+		} else if (IS_GEN_RANGE(dev_priv, 10, 11)) {
 			dev_priv->perf.oa.ops.is_valid_b_counter_reg =
 				gen7_is_valid_b_counter_addr;
 			dev_priv->perf.oa.ops.is_valid_mux_reg =
drivers/gpu/drm/i915/intel_bios.c +1 -1
index 1faa494e2bc9..43cf0b026143 100644
@@ -446,7 +446,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, u8 bdb_version)
 	 * Only parse SDVO mappings on gens that could have SDVO. This isn't
 	 * accurate and doesn't have to be, as long as it's not too strict.
 	 */
-	if (!IS_GEN(dev_priv, 3, 7)) {
+	if (!IS_GEN_RANGE(dev_priv, 3, 7)) {
 		DRM_DEBUG_KMS("Skipping SDVO device mapping\n");
 		return;
 	}
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 8bfab22068a3..65f6c9bc10cf 100644
@@ -1286,7 +1286,7 @@ static void intel_engine_print_registers(const struct intel_engine_cs *engine,
 		&engine->execlists;
 	u64 addr;
 
-	if (engine->id == RCS && IS_GEN(dev_priv, 4, 7))
+	if (engine->id == RCS && IS_GEN_RANGE(dev_priv, 4, 7))
 		drm_printf(m, "\tCCID: 0x%08x\n", I915_READ(CCID));
 	drm_printf(m, "\tRING_START: 0x%08x\n",
 		   I915_READ(RING_START(engine->mmio_base)));
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index e3cfc3c176e7..c90954cdfb15 100644
@@ -784,7 +784,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 	 * having a Y offset that isn't divisible by 4 causes FIFO underrun
 	 * and screen flicker.
 	 */
-	if (IS_GEN(dev_priv, 9, 10) &&
+	if (IS_GEN_RANGE(dev_priv, 9, 10) &&
 	    (fbc->state_cache.plane.adjusted_y & 3)) {
 		fbc->no_fbc_reason = "plane Y offset is misaligned";
 		return false;
drivers/gpu/drm/i915/intel_hangcheck.c +1 -1
index e26d05a46451..41921a843d42 100644
@@ -252,7 +252,7 @@ engine_stuck(struct intel_engine_cs *engine, u64 acthd)
 		return ENGINE_WAIT_KICK;
 	}
 
-	if (IS_GEN(dev_priv, 6, 7) && tmp & RING_WAIT_SEMAPHORE) {
+	if (IS_GEN_RANGE(dev_priv, 6, 7) && tmp & RING_WAIT_SEMAPHORE) {
 		switch (semaphore_passed(engine)) {
 		default:
 			return ENGINE_DEAD;
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -4
index b8a7a014d46d..608e5c65b655 100644
@@ -407,7 +407,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *engine)
 	POSTING_READ(mmio);
 
 	/* Flush the TLB for this page */
-	if (IS_GEN(dev_priv, 6, 7)) {
+	if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		i915_reg_t reg = RING_INSTPM(engine->mmio_base);
 
 		/* ring should be idle before issuing a sync flush*/
@@ -629,7 +629,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	intel_whitelist_workarounds_apply(engine);
 
 	/* WaTimedSingleVertexDispatch:cl,bw,ctg,elk,ilk,snb */
-	if (IS_GEN(dev_priv, 4, 6))
+	if (IS_GEN_RANGE(dev_priv, 4, 6))
 		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
 
 	/* We need to disable the AsyncFlip performance optimisations in order
@@ -638,7 +638,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	 *
 	 * WaDisableAsyncFlipPerfMode:snb,ivb,hsw,vlv
 	 */
-	if (IS_GEN(dev_priv, 6, 7))
+	if (IS_GEN_RANGE(dev_priv, 6, 7))
 		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE));
 
 	/* Required for the hardware to program scanline values for waiting */
@@ -663,7 +663,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
 	}
 
-	if (IS_GEN(dev_priv, 6, 7))
+	if (IS_GEN_RANGE(dev_priv, 6, 7))
 		I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING));
 
 	if (INTEL_GEN(dev_priv) >= 6)
drivers/gpu/drm/i915/intel_uncore.c +6 -6
index 9289515108c3..631b4165fe00 100644
@@ -1567,13 +1567,13 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
+	if (IS_GEN_RANGE(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen2);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen2);
 	} else if (IS_GEN5(dev_priv)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen5);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen5);
-	} else if (IS_GEN(dev_priv, 6, 7)) {
+	} else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen6);
 
 		if (IS_VALLEYVIEW(dev_priv)) {
@@ -1592,7 +1592,7 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 			ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen8);
 			ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen6);
 		}
-	} else if (IS_GEN(dev_priv, 9, 10)) {
+	} else if (IS_GEN_RANGE(dev_priv, 9, 10)) {
 		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, fwtable);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, fwtable);
@@ -2321,7 +2321,7 @@ intel_uncore_forcewake_for_read(struct drm_i915_private *dev_priv,
 	} else if (INTEL_GEN(dev_priv) >= 6) {
 		fw_domains = __gen6_reg_read_fw_domains(offset);
 	} else {
-		WARN_ON(!IS_GEN(dev_priv, 2, 5));
+		WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
 		fw_domains = 0;
 	}
 
@@ -2343,10 +2343,10 @@ intel_uncore_forcewake_for_write(struct drm_i915_private *dev_priv,
 		fw_domains = __fwtable_reg_write_fw_domains(offset);
 	} else if (IS_GEN8(dev_priv)) {
 		fw_domains = __gen8_reg_write_fw_domains(offset);
-	} else if (IS_GEN(dev_priv, 6, 7)) {
+	} else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		fw_domains = FORCEWAKE_RENDER;
 	} else {
-		WARN_ON(!IS_GEN(dev_priv, 2, 5));
+		WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
 		fw_domains = 0;
 	}
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#17 lore raw
Quoted 7 lines · Jani Nikula
Quoted 1 line · Rodrigo Vivi

RANGE makes it longer, but clear.

IS_GEN_RANGE() was the first proposal, but in review this was changed to IS_GEN() following IS_REVID() and IS_<platform>_REVID().

IMO unnecessary change.

consider this one dropped then.

other 2 patches from this series got pushed.

Thanks,
Rodrigo.

Quoted 201 lines

BR,
Jani.

Quoted 197 lines

Diff generated with:

sed 's/IS_GEN(/IS_GEN_RANGE(/g' drivers/gpu/drm/i915/*.{c,h} -i

Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs.c     |  2 +-
 drivers/gpu/drm/i915/i915_drv.h         |  2 +-
 drivers/gpu/drm/i915/i915_perf.c        |  4 ++--
 drivers/gpu/drm/i915/intel_bios.c       |  2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c  |  2 +-
 drivers/gpu/drm/i915/intel_fbc.c        |  2 +-
 drivers/gpu/drm/i915/intel_hangcheck.c  |  2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c |  8 ++++----
 drivers/gpu/drm/i915/intel_uncore.c     | 12 ++++++------
 9 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -1
index 5b37d5f8e132..3deab30388f2 100644
@@ -2919,7 +2919,7 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
 	if (IS_BROXTON(dev_priv)) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(BXT_CSR_DC3_DC5_COUNT));
-	} else if (IS_GEN(dev_priv, 9, 11)) {
+	} else if (IS_GEN_RANGE(dev_priv, 9, 11)) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(SKL_CSR_DC3_DC5_COUNT));
 		seq_printf(m, "DC5 -> DC6 count: %d\n",
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 3017ef037fed..f766bb1e873b 100644
@@ -2387,7 +2387,7 @@ intel_info(const struct drm_i915_private *dev_priv)
  *
  * Use GEN_FOREVER for unbound start and or end.
  */
-#define IS_GEN(dev_priv, s, e) \
+#define IS_GEN_RANGE(dev_priv, s, e) \
 	(!!((dev_priv)->info.gen_mask & INTEL_GEN_MASK((s), (e))))
 
 /*
drivers/gpu/drm/i915/i915_perf.c +2 -2
index 664b96bb65a3..0888b6e6080f 100644
@@ -1795,7 +1795,7 @@ static int gen8_enable_metric_set(struct drm_i915_private *dev_priv,
 	 * be read back from automatically triggered reports, as part of the
 	 * RPT_ID field.
 	 */
-	if (IS_GEN(dev_priv, 9, 11)) {
+	if (IS_GEN_RANGE(dev_priv, 9, 11)) {
 		I915_WRITE(GEN8_OA_DEBUG,
 			   _MASKED_BIT_ENABLE(GEN9_OA_DEBUG_DISABLE_CLK_RATIO_REPORTS |
 					      GEN9_OA_DEBUG_INCLUDE_CLK_RATIO));
@@ -3439,7 +3439,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
 
 				dev_priv->perf.oa.gen8_valid_ctx_bit = (1<<16);
 			}
-		} else if (IS_GEN(dev_priv, 10, 11)) {
+		} else if (IS_GEN_RANGE(dev_priv, 10, 11)) {
 			dev_priv->perf.oa.ops.is_valid_b_counter_reg =
 				gen7_is_valid_b_counter_addr;
 			dev_priv->perf.oa.ops.is_valid_mux_reg =
drivers/gpu/drm/i915/intel_bios.c +1 -1
index 1faa494e2bc9..43cf0b026143 100644
@@ -446,7 +446,7 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv, u8 bdb_version)
 	 * Only parse SDVO mappings on gens that could have SDVO. This isn't
 	 * accurate and doesn't have to be, as long as it's not too strict.
 	 */
-	if (!IS_GEN(dev_priv, 3, 7)) {
+	if (!IS_GEN_RANGE(dev_priv, 3, 7)) {
 		DRM_DEBUG_KMS("Skipping SDVO device mapping\n");
 		return;
 	}
drivers/gpu/drm/i915/intel_engine_cs.c +1 -1
index 8bfab22068a3..65f6c9bc10cf 100644
@@ -1286,7 +1286,7 @@ static void intel_engine_print_registers(const struct intel_engine_cs *engine,
 		&engine->execlists;
 	u64 addr;
 
-	if (engine->id == RCS && IS_GEN(dev_priv, 4, 7))
+	if (engine->id == RCS && IS_GEN_RANGE(dev_priv, 4, 7))
 		drm_printf(m, "\tCCID: 0x%08x\n", I915_READ(CCID));
 	drm_printf(m, "\tRING_START: 0x%08x\n",
 		   I915_READ(RING_START(engine->mmio_base)));
drivers/gpu/drm/i915/intel_fbc.c +1 -1
index e3cfc3c176e7..c90954cdfb15 100644
@@ -784,7 +784,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 	 * having a Y offset that isn't divisible by 4 causes FIFO underrun
 	 * and screen flicker.
 	 */
-	if (IS_GEN(dev_priv, 9, 10) &&
+	if (IS_GEN_RANGE(dev_priv, 9, 10) &&
 	    (fbc->state_cache.plane.adjusted_y & 3)) {
 		fbc->no_fbc_reason = "plane Y offset is misaligned";
 		return false;
drivers/gpu/drm/i915/intel_hangcheck.c +1 -1
index e26d05a46451..41921a843d42 100644
@@ -252,7 +252,7 @@ engine_stuck(struct intel_engine_cs *engine, u64 acthd)
 		return ENGINE_WAIT_KICK;
 	}
 
-	if (IS_GEN(dev_priv, 6, 7) && tmp & RING_WAIT_SEMAPHORE) {
+	if (IS_GEN_RANGE(dev_priv, 6, 7) && tmp & RING_WAIT_SEMAPHORE) {
 		switch (semaphore_passed(engine)) {
 		default:
 			return ENGINE_DEAD;
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -4
index b8a7a014d46d..608e5c65b655 100644
@@ -407,7 +407,7 @@ static void intel_ring_setup_status_page(struct intel_engine_cs *engine)
 	POSTING_READ(mmio);
 
 	/* Flush the TLB for this page */
-	if (IS_GEN(dev_priv, 6, 7)) {
+	if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		i915_reg_t reg = RING_INSTPM(engine->mmio_base);
 
 		/* ring should be idle before issuing a sync flush*/
@@ -629,7 +629,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	intel_whitelist_workarounds_apply(engine);
 
 	/* WaTimedSingleVertexDispatch:cl,bw,ctg,elk,ilk,snb */
-	if (IS_GEN(dev_priv, 4, 6))
+	if (IS_GEN_RANGE(dev_priv, 4, 6))
 		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
 
 	/* We need to disable the AsyncFlip performance optimisations in order
@@ -638,7 +638,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 	 *
 	 * WaDisableAsyncFlipPerfMode:snb,ivb,hsw,vlv
 	 */
-	if (IS_GEN(dev_priv, 6, 7))
+	if (IS_GEN_RANGE(dev_priv, 6, 7))
 		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(ASYNC_FLIP_PERF_DISABLE));
 
 	/* Required for the hardware to program scanline values for waiting */
@@ -663,7 +663,7 @@ static int init_render_ring(struct intel_engine_cs *engine)
 			   _MASKED_BIT_DISABLE(CM0_STC_EVICT_DISABLE_LRA_SNB));
 	}
 
-	if (IS_GEN(dev_priv, 6, 7))
+	if (IS_GEN_RANGE(dev_priv, 6, 7))
 		I915_WRITE(INSTPM, _MASKED_BIT_ENABLE(INSTPM_FORCE_ORDERING));
 
 	if (INTEL_GEN(dev_priv) >= 6)
drivers/gpu/drm/i915/intel_uncore.c +4 -4
index 9289515108c3..631b4165fe00 100644
@@ -1567,13 +1567,13 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
+	if (IS_GEN_RANGE(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen2);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen2);
 	} else if (IS_GEN5(dev_priv)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen5);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen5);
-	} else if (IS_GEN(dev_priv, 6, 7)) {
+	} else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen6);
 
 		if (IS_VALLEYVIEW(dev_priv)) {
@@ -1592,7 +1592,7 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 			ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, gen8);
 			ASSIGN_READ_MMIO_VFUNCS(dev_priv, gen6);
 		}
-	} else if (IS_GEN(dev_priv, 9, 10)) {
+	} else if (IS_GEN_RANGE(dev_priv, 9, 10)) {
 		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
 		ASSIGN_WRITE_MMIO_VFUNCS(dev_priv, fwtable);
 		ASSIGN_READ_MMIO_VFUNCS(dev_priv, fwtable);
@@ -2321,7 +2321,7 @@ intel_uncore_forcewake_for_read(struct drm_i915_private *dev_priv,
 	} else if (INTEL_GEN(dev_priv) >= 6) {
 		fw_domains = __gen6_reg_read_fw_domains(offset);
 	} else {
-		WARN_ON(!IS_GEN(dev_priv, 2, 5));
+		WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
 		fw_domains = 0;
 	}
 
Quoted 15 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_uncore.c +2 -2
@@ -2343,10 +2343,10 @@ intel_uncore_forcewake_for_write(struct drm_i915_private *dev_priv,
 		fw_domains = __fwtable_reg_write_fw_domains(offset);
 	} else if (IS_GEN8(dev_priv)) {
 		fw_domains = __gen8_reg_write_fw_domains(offset);
-	} else if (IS_GEN(dev_priv, 6, 7)) {
+	} else if (IS_GEN_RANGE(dev_priv, 6, 7)) {
 		fw_domains = FORCEWAKE_RENDER;
 	} else {
-		WARN_ON(!IS_GEN(dev_priv, 2, 5));
+		WARN_ON(!IS_GEN_RANGE(dev_priv, 2, 5));
 		fw_domains = 0;
 	}
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx