Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 604db650 authored by Joonas Lahtinen's avatar Joonas Lahtinen
Browse files

drm/i915: Reduce trickery in DEV_INFO_FOR_EACH_FLAG



Get rid of SEP_SEMICOLON and SEP_BLANK in DEV_INFO_FOR_EACH_FLAG.
Consolidate the debug output so that instead of one huge line with
"cap1,cap2,capN" each capability is split to own line and displayed
as "capN: [yes|no]" to make the dumps more historically informative.

v2:
- Do not break auto-indent by keeping semicolon after macro (Jani)
- Consolidate and use yesno() in all locations (Chris)

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent 5cb651a7
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -79,10 +79,8 @@ static int i915_capabilities(struct seq_file *m, void *data)
	seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
	seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
#define PRINT_FLAG(x)  seq_printf(m, #x ": %s\n", yesno(info->x))
#define PRINT_FLAG(x)  seq_printf(m, #x ": %s\n", yesno(info->x))
#define SEP_SEMICOLON ;
	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG, SEP_SEMICOLON);
#undef PRINT_FLAG
#undef PRINT_FLAG
#undef SEP_SEMICOLON


	return 0;
	return 0;
}
}
+47 −51
Original line number Original line Diff line number Diff line
@@ -646,55 +646,52 @@ struct intel_csr {
	uint32_t allowed_dc_mask;
	uint32_t allowed_dc_mask;
};
};


#define DEV_INFO_FOR_EACH_FLAG(func, sep) \
#define DEV_INFO_FOR_EACH_FLAG(func) \
	func(is_mobile) sep \
	func(is_mobile); \
	func(is_i85x) sep \
	func(is_i85x); \
	func(is_i915g) sep \
	func(is_i915g); \
	func(is_i945gm) sep \
	func(is_i945gm); \
	func(is_g33) sep \
	func(is_g33); \
	func(hws_needs_physical) sep \
	func(hws_needs_physical); \
	func(is_g4x) sep \
	func(is_g4x); \
	func(is_pineview) sep \
	func(is_pineview); \
	func(is_broadwater) sep \
	func(is_broadwater); \
	func(is_crestline) sep \
	func(is_crestline); \
	func(is_ivybridge) sep \
	func(is_ivybridge); \
	func(is_valleyview) sep \
	func(is_valleyview); \
	func(is_cherryview) sep \
	func(is_cherryview); \
	func(is_haswell) sep \
	func(is_haswell); \
	func(is_broadwell) sep \
	func(is_broadwell); \
	func(is_skylake) sep \
	func(is_skylake); \
	func(is_broxton) sep \
	func(is_broxton); \
	func(is_kabylake) sep \
	func(is_kabylake); \
	func(is_preliminary) sep \
	func(is_preliminary); \
	func(has_fbc) sep \
	func(has_fbc); \
	func(has_psr) sep \
	func(has_psr); \
	func(has_runtime_pm) sep \
	func(has_runtime_pm); \
	func(has_csr) sep \
	func(has_csr); \
	func(has_resource_streamer) sep \
	func(has_resource_streamer); \
	func(has_rc6) sep \
	func(has_rc6); \
	func(has_rc6p) sep \
	func(has_rc6p); \
	func(has_dp_mst) sep \
	func(has_dp_mst); \
	func(has_gmbus_irq) sep \
	func(has_gmbus_irq); \
	func(has_hw_contexts) sep \
	func(has_hw_contexts); \
	func(has_logical_ring_contexts) sep \
	func(has_logical_ring_contexts); \
	func(has_l3_dpf) sep \
	func(has_l3_dpf); \
	func(has_gmch_display) sep \
	func(has_gmch_display); \
	func(has_guc) sep \
	func(has_guc); \
	func(has_pipe_cxsr) sep \
	func(has_pipe_cxsr); \
	func(has_hotplug) sep \
	func(has_hotplug); \
	func(cursor_needs_physical) sep \
	func(cursor_needs_physical); \
	func(has_overlay) sep \
	func(has_overlay); \
	func(overlay_needs_physical) sep \
	func(overlay_needs_physical); \
	func(supports_tv) sep \
	func(supports_tv); \
	func(has_llc) sep \
	func(has_llc); \
	func(has_snoop) sep \
	func(has_snoop); \
	func(has_ddi) sep \
	func(has_ddi); \
	func(has_fpga_dbg) sep \
	func(has_fpga_dbg); \
	func(has_pooled_eu)
	func(has_pooled_eu)


#define DEFINE_FLAG(name) u8 name:1
#define SEP_SEMICOLON ;

struct sseu_dev_info {
struct sseu_dev_info {
	u8 slice_mask;
	u8 slice_mask;
	u8 subslice_mask;
	u8 subslice_mask;
@@ -722,7 +719,9 @@ struct intel_device_info {
	u16 gen_mask;
	u16 gen_mask;
	u8 ring_mask; /* Rings supported by the HW */
	u8 ring_mask; /* Rings supported by the HW */
	u8 num_rings;
	u8 num_rings;
	DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON);
#define DEFINE_FLAG(name) u8 name:1
	DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG);
#undef DEFINE_FLAG
	u16 ddb_size; /* in blocks */
	u16 ddb_size; /* in blocks */
	/* Register offsets for the various display pipes and transcoders */
	/* Register offsets for the various display pipes and transcoders */
	int pipe_offsets[I915_MAX_TRANSCODERS];
	int pipe_offsets[I915_MAX_TRANSCODERS];
@@ -739,9 +738,6 @@ struct intel_device_info {
	} color;
	} color;
};
};


#undef DEFINE_FLAG
#undef SEP_SEMICOLON

struct intel_display_error_state;
struct intel_display_error_state;


struct drm_i915_error_state {
struct drm_i915_error_state {
+1 −3
Original line number Original line Diff line number Diff line
@@ -357,10 +357,8 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,
				   const struct intel_device_info *info)
				   const struct intel_device_info *info)
{
{
#define PRINT_FLAG(x)  err_printf(m, #x ": %s\n", yesno(info->x))
#define PRINT_FLAG(x)  err_printf(m, #x ": %s\n", yesno(info->x))
#define SEP_SEMICOLON ;
	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG, SEP_SEMICOLON);
#undef PRINT_FLAG
#undef PRINT_FLAG
#undef SEP_SEMICOLON
}
}


int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
+5 −11
Original line number Original line Diff line number Diff line
@@ -28,20 +28,14 @@ void intel_device_info_dump(struct drm_i915_private *dev_priv)
{
{
	const struct intel_device_info *info = &dev_priv->info;
	const struct intel_device_info *info = &dev_priv->info;


#define PRINT_S(name) "%s"
	DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x rev=0x%02x",
#define SEP_EMPTY
#define PRINT_FLAG(name) info->name ? #name "," : ""
#define SEP_COMMA ,
	DRM_DEBUG_DRIVER("i915 device info: gen=%i, pciid=0x%04x rev=0x%02x flags="
			 DEV_INFO_FOR_EACH_FLAG(PRINT_S, SEP_EMPTY),
			 info->gen,
			 info->gen,
			 dev_priv->drm.pdev->device,
			 dev_priv->drm.pdev->device,
			 dev_priv->drm.pdev->revision,
			 dev_priv->drm.pdev->revision);
			 DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG, SEP_COMMA));
#define PRINT_FLAG(name) \
#undef PRINT_S
	DRM_DEBUG_DRIVER("i915 device info: " #name ": %s", yesno(info->name))
#undef SEP_EMPTY
	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
#undef PRINT_FLAG
#undef PRINT_FLAG
#undef SEP_COMMA
}
}


static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)
static void cherryview_sseu_info_init(struct drm_i915_private *dev_priv)