Try to make the device info flags a bit more maintainable
Subsystems (2)
Hi,
We had a few places (3) to update every time we wanted to add a device info flag, somewhat error prone. With this series we just need to touch DEV_INFO_FOR_EACH_FLAG() to add a flag (patches 1-3).
On top of that, I add two more flags, has_ddi (patch 4) and has_fpga_dbg (patches 5/6), flags that should slightly ease our next enablings.
All pretty simple changes.
Signature · 1 line
Damien
PATCH 1/6 drm/i915: Turn DEV_INFO_FLAGS into for foreach style macro
DEV_INFO_FOR_FLAG() now takes 2 parameters:
• A function to apply to the flag
• A separator
This will allow us to use the macro twice in the DRM_DEBUG_DRIVER() call of i915_dump_device_info().
--- drivers/gpu/drm/i915/i915_debugfs.c | 8 +++--- drivers/gpu/drm/i915/i915_dma.c | 8 +++--- drivers/gpu/drm/i915/i915_drv.h | 50 ++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -5
@@ -61,11 +61,9 @@ static int i915_capabilities(struct seq_file *m, void *data)seq_printf (m,"gen: %d\n" , info->gen);seq_printf (m,"pch: %d\n" ,INTEL_PCH_TYPE (dev)); -#define DEV_INFO_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) -#define DEV_INFO_SEP ; -DEV_INFO_FLAGS ; -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +#define PRINT_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) +#define SEP_SEMICOLON ; +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_SEMICOLON );return 0 ; }
drivers/gpu/drm/i915/i915_dma.c +3 -5
@@ -1445,15 +1445,13 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; -#define DEV_INFO_FLAG (name) info->name ? #name "," : "" -#define DEV_INFO_SEP , +#define PRINT_FLAG (name) info->name ? #name "," : "" +#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , info->gen, dev_priv->dev->pdev->device, -DEV_INFO_FLAGS ); -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA )); }/**
drivers/gpu/drm/i915/i915_drv.h +25 -25
56 lines not on this page · raw message
Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/6] drm/i915: Turn DEV_INFO_FLAGS into for foreach style macro
Quoted 3 lines · Damien Lespiau
DEV_INFO_FOR_FLAG()now takes 2 parameters:
• A function to apply to the flag
• A separator
Oooh, fancy bullets. ;)
Tiny bikeshed, is leaving out #undefs for the temp macros intentional?
Quoted 121 lines
This will allow us to use the macro twice in the
DRM_DEBUG_DRIVER()call ofi915_dump_device_info().Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 8 +++--- drivers/gpu/drm/i915/i915_dma.c | 8 +++--- drivers/gpu/drm/i915/i915_drv.h | 50 ++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +3
-5@@ -61,11 +61,9 @@ static int i915_capabilities(struct seq_file *m, void *data)seq_printf (m,"gen: %d\n" , info->gen);seq_printf (m,"pch: %d\n" ,INTEL_PCH_TYPE (dev)); -#define DEV_INFO_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) -#define DEV_INFO_SEP ; -DEV_INFO_FLAGS ; -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +#define PRINT_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) +#define SEP_SEMICOLON ; +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_SEMICOLON );return 0 ; }drivers/gpu/drm/i915/i915_dma.c +3
-5@@ -1445,15 +1445,13 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; -#define DEV_INFO_FLAG (name) info->name ? #name "," : "" -#define DEV_INFO_SEP , +#define PRINT_FLAG (name) info->name ? #name "," : "" +#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , info->gen, dev_priv->dev->pdev->device, -DEV_INFO_FLAGS ); -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA )); }/** drivers/gpu/drm/i915/i915_drv.h +25
-25@@ -333,31 +333,31 @@ struct drm_i915_gt_funcs {void (*force_wake_put)(struct drm_i915_private *dev_priv); }; -#define DEV_INFO_FLAGS \ - DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_i85x) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_i915g) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_i945gm) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_g33) DEV_INFO_SEP \ - DEV_INFO_FLAG(need_gfx_hws) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_g4x) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_pineview) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_broadwater) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_crestline) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_ivybridge) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_valleyview) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_haswell) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_force_wake) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_fbc) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_pipe_cxsr) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_hotplug) DEV_INFO_SEP \ - DEV_INFO_FLAG(cursor_needs_physical) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_overlay) DEV_INFO_SEP \ - DEV_INFO_FLAG(overlay_needs_physical) DEV_INFO_SEP \ - DEV_INFO_FLAG(supports_tv) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_bsd_ring) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_blt_ring) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_llc) +#define DEV_INFO_FOR_EACH_FLAG (func, sep) \ + func(is_mobile) sep \ + func(is_i85x) sep \ + func(is_i915g) sep \ + func(is_i945gm) sep \ + func(is_g33) sep \ + func(need_gfx_hws) sep \ + func(is_g4x) sep \ + func(is_pineview) sep \ + func(is_broadwater) sep \ + func(is_crestline) sep \ + func(is_ivybridge) sep \ + func(is_valleyview) sep \ + func(is_haswell) sep \ + func(has_force_wake) sep \ + func(has_fbc) sep \ + func(has_pipe_cxsr) sep \ + func(has_hotplug) sep \ + func(cursor_needs_physical) sep \ + func(has_overlay) sep \ + func(overlay_needs_physical) sep \ + func(supports_tv) sep \ + func(has_bsd_ring) sep \ + func(has_blt_ring) sep \ + func(has_llc)struct intel_device_info {u32 display_mmio_offset;Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 1/6] drm/i915: Turn DEV_INFO_FLAGS into for foreach style macro
Quoted 8 lines · Jani Nikula
Quoted 3 lines · Damien Lespiau
DEV_INFO_FOR_FLAG()now takes 2 parameters:
• A function to apply to the flag
• A separatorOooh, fancy bullets. ;)
Tiny bikeshed, is leaving out #undefs for the temp macros intentional?
Forgot to nitpick about the extra "for" in the subject.
J.
Quoted 120 lines
Reviewed-by Jani Nikula <[email protected]>Quoted 117 lines
This will allow us to use the macro twice in the
DRM_DEBUG_DRIVER()call ofi915_dump_device_info().Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 8 +++--- drivers/gpu/drm/i915/i915_dma.c | 8 +++--- drivers/gpu/drm/i915/i915_drv.h | 50 ++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 35 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +3
-5@@ -61,11 +61,9 @@ static int i915_capabilities(struct seq_file *m, void *data)seq_printf (m,"gen: %d\n" , info->gen);seq_printf (m,"pch: %d\n" ,INTEL_PCH_TYPE (dev)); -#define DEV_INFO_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) -#define DEV_INFO_SEP ; -DEV_INFO_FLAGS ; -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +#define PRINT_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) +#define SEP_SEMICOLON ; +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_SEMICOLON );return 0 ; }drivers/gpu/drm/i915/i915_dma.c +3
-5@@ -1445,15 +1445,13 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; -#define DEV_INFO_FLAG (name) info->name ? #name "," : "" -#define DEV_INFO_SEP , +#define PRINT_FLAG (name) info->name ? #name "," : "" +#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , info->gen, dev_priv->dev->pdev->device, -DEV_INFO_FLAGS ); -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA )); }/** drivers/gpu/drm/i915/i915_drv.h +25
-25@@ -333,31 +333,31 @@ struct drm_i915_gt_funcs {void (*force_wake_put)(struct drm_i915_private *dev_priv); }; -#define DEV_INFO_FLAGS \ - DEV_INFO_FLAG(is_mobile) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_i85x) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_i915g) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_i945gm) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_g33) DEV_INFO_SEP \ - DEV_INFO_FLAG(need_gfx_hws) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_g4x) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_pineview) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_broadwater) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_crestline) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_ivybridge) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_valleyview) DEV_INFO_SEP \ - DEV_INFO_FLAG(is_haswell) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_force_wake) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_fbc) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_pipe_cxsr) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_hotplug) DEV_INFO_SEP \ - DEV_INFO_FLAG(cursor_needs_physical) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_overlay) DEV_INFO_SEP \ - DEV_INFO_FLAG(overlay_needs_physical) DEV_INFO_SEP \ - DEV_INFO_FLAG(supports_tv) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_bsd_ring) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_blt_ring) DEV_INFO_SEP \ - DEV_INFO_FLAG(has_llc) +#define DEV_INFO_FOR_EACH_FLAG (func, sep) \ + func(is_mobile) sep \ + func(is_i85x) sep \ + func(is_i915g) sep \ + func(is_i945gm) sep \ + func(is_g33) sep \ + func(need_gfx_hws) sep \ + func(is_g4x) sep \ + func(is_pineview) sep \ + func(is_broadwater) sep \ + func(is_crestline) sep \ + func(is_ivybridge) sep \ + func(is_valleyview) sep \ + func(is_haswell) sep \ + func(has_force_wake) sep \ + func(has_fbc) sep \ + func(has_pipe_cxsr) sep \ + func(has_hotplug) sep \ + func(cursor_needs_physical) sep \ + func(has_overlay) sep \ + func(overlay_needs_physical) sep \ + func(supports_tv) sep \ + func(has_bsd_ring) sep \ + func(has_blt_ring) sep \ + func(has_llc)struct intel_device_info {u32 display_mmio_offset;Signature · 1 line
1.8.1.4
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/i915: Turn DEV_INFO_FLAGS into foreach style macro
DEV_INFO_FOR_FLAG() now takes 2 parameters:
• A function to apply to the flag
• A separator
This will allow us to use the macro twice in the DRM_DEBUG_DRIVER() call of i915_dump_device_info().
v2: Fix a typo in the subject (Jani Nikula)
--- drivers/gpu/drm/i915/i915_debugfs.c | 8 +++--- drivers/gpu/drm/i915/i915_dma.c | 8 +++--- drivers/gpu/drm/i915/i915_drv.h | 50 ++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -5
@@ -61,11 +61,9 @@ static int i915_capabilities(struct seq_file *m, void *data)seq_printf (m,"gen: %d\n" , info->gen);seq_printf (m,"pch: %d\n" ,INTEL_PCH_TYPE (dev)); -#define DEV_INFO_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) -#define DEV_INFO_SEP ; -DEV_INFO_FLAGS ; -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +#define PRINT_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) +#define SEP_SEMICOLON ; +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_SEMICOLON );return 0 ; }
drivers/gpu/drm/i915/i915_dma.c +3 -5
@@ -1445,15 +1445,13 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; -#define DEV_INFO_FLAG (name) info->name ? #name "," : "" -#define DEV_INFO_SEP , +#define PRINT_FLAG (name) info->name ? #name "," : "" +#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , info->gen, dev_priv->dev->pdev->device, -DEV_INFO_FLAGS ); -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA )); }/**
drivers/gpu/drm/i915/i915_drv.h +25 -25
56 lines not on this page · raw message
Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/6 drm/i915: Turn DEV_INFO_FLAGS into a foreach style macro
DEV_INFO_FOR_FLAG() now takes 2 parameters:
• A function to apply to the flag
• A separator
This will allow us to use the macro twice in the DRM_DEBUG_DRIVER() call of i915_dump_device_info().
v2: Fix a typo in the subject (Jani Nikula)
v3: Undef the helper macros (Jani Nikula, Daniel vetter)
--- drivers/gpu/drm/i915/i915_debugfs.c | 10 ++++---- drivers/gpu/drm/i915/i915_dma.c | 10 ++++---- drivers/gpu/drm/i915/i915_drv.h | 50 ++++++++++++++++++------------------- 3 files changed, 35 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +5 -5
@@ -61,11 +61,11 @@ static int i915_capabilities(struct seq_file *m, void *data)seq_printf (m,"gen: %d\n" , info->gen);seq_printf (m,"pch: %d\n" ,INTEL_PCH_TYPE (dev)); -#define DEV_INFO_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) -#define DEV_INFO_SEP ; -DEV_INFO_FLAGS ; -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +#define PRINT_FLAG (x) seq_printf(m, #x ": %s\n", yesno(info->x)) +#define SEP_SEMICOLON ; +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_SEMICOLON ); +#undef PRINT_FLAG +#undef SEP_SEMICOLONreturn 0 ; }
drivers/gpu/drm/i915/i915_dma.c +5 -5
@@ -1445,15 +1445,15 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; -#define DEV_INFO_FLAG (name) info->name ? #name "," : "" -#define DEV_INFO_SEP , +#define PRINT_FLAG (name) info->name ? #name "," : "" +#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , info->gen, dev_priv->dev->pdev->device, -DEV_INFO_FLAGS ); -#undef DEV_INFO_FLAG -#undef DEV_INFO_SEP +DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA )); +#undef PRINT_FLAG +#undef SEP_COMMA }/**
drivers/gpu/drm/i915/i915_drv.h +25 -25
56 lines not on this page · raw message
Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/6] drm/i915: Turn DEV_INFO_FLAGS into for foreach style macro
In reply to Jani NikulaQuoted 6 lines · Jani Nikula
Quoted 3 lines · Damien Lespiau
DEV_INFO_FOR_FLAG()now takes 2 parameters:
• A function to apply to the flag
• A separatorOooh, fancy bullets. ;)
2013 is definitely the year of Unicode!
Quoted 1 line
Tiny bikeshed, is leaving out #undefs for the temp macros intentional?
It was. Before when wanting two invocations of DEV_INFO_FLAGS, you had to define the same macros twice (DEV_INFO_FLAG/DEV_INFO_SEP), so to be defensive about that #undef was added after DEV_INFO_FLAGS.
Now DEV_INFO_FOR_EACH_FLAG() takes the macro/sep to apply to each flag so you can leave the macro defined, the second invocation will define its own transformation (or reuse an existing one).
Signature · 5 lines
Damien _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 drm/i915: Replace the line of %s by a DEV_INFO_FOR_EACH_FLAG() invocation
In reply to Damien LespiauThis way, when adding a device flag we don't have to manually maintain that list.
--- drivers/gpu/drm/i915/i915_dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +3 -1
@@ -1445,10 +1445,12 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; +#define PRINT_S (name) "%s" +#define SEP_EMPTY #define PRINT_FLAG (name) info->name ? #name "," : ""#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" -"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , +DEV_INFO_FOR_EACH_FLAG (PRINT_S ,SEP_EMPTY ), info->gen, dev_priv->dev->pdev->device,DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA ));
Signature · 1 line
1.8.1.4
Re: [PATCH 2/6] drm/i915: Replace the line of %s by a DEV_INFO_FOR_EACH_FLAG() invocation
Quoted 2 lines · Damien Lespiau
This way, when adding a device flag we don't have to manually maintain that list.
\o/-by: and
Quoted 30 lines
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_dma.c +3
-1@@ -1445,10 +1445,12 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; +#define PRINT_S (name) "%s" +#define SEP_EMPTY #define PRINT_FLAG (name) info->name ? #name "," : ""#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" -"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , +DEV_INFO_FOR_EACH_FLAG (PRINT_S ,SEP_EMPTY ), info->gen, dev_priv->dev->pdev->device,DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA ));Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/6 drm/i915: Replace the line of %s by a DEV_INFO_FOR_EACH_FLAG() invocation
In reply to Damien LespiauThis way, when adding a device flag we don't have to manually maintain that list.
v2: undefine the helper macros (Jani Nikula, Daniel Vetter)
--- drivers/gpu/drm/i915/i915_dma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_dma.c +5 -1
@@ -1445,13 +1445,17 @@ static void i915_dump_device_info(struct drm_i915_private *dev_priv) {const struct intel_device_info *info = dev_priv->info; +#define PRINT_S (name) "%s" +#define SEP_EMPTY #define PRINT_FLAG (name) info->name ? #name "," : ""#define SEP_COMMA ,DRM_DEBUG_DRIVER ("i915 device info: gen=%i, pciid=0x%04x flags=" -"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s" , +DEV_INFO_FOR_EACH_FLAG (PRINT_S ,SEP_EMPTY ), info->gen, dev_priv->dev->pdev->device,DEV_INFO_FOR_EACH_FLAG (PRINT_FLAG ,SEP_COMMA )); +#undef PRINT_S +#undef SEP_EMPTY#undef PRINT_FLAG#undef SEP_COMMA }
Signature · 1 line
1.8.1.4
PATCH 3/6 drm/i915: Use DEV_INFO_FOR_EACH_FLAG() to declare flags as well
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_drv.h | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +7 -24
@@ -359,36 +359,19 @@ struct drm_i915_gt_funcs { func(has_blt_ring) sep \ func(has_llc) +#define DEFINE_FLAG (name) u8 name:1 +#define SEP_SEMICOLON ; +struct intel_device_info {u32 display_mmio_offset;u8 num_pipes:3 ;u8 gen; - u8 is_mobile:1; - u8 is_i85x:1; - u8 is_i915g:1; - u8 is_i945gm:1; - u8 is_g33:1; - u8 need_gfx_hws:1; - u8 is_g4x:1; - u8 is_pineview:1; - u8 is_broadwater:1; - u8 is_crestline:1; - u8 is_ivybridge:1; - u8 is_valleyview:1; - u8 has_force_wake:1; - u8 is_haswell:1; - u8 has_fbc:1; - u8 has_pipe_cxsr:1; - u8 has_hotplug:1; - u8 cursor_needs_physical:1; - u8 has_overlay:1; - u8 overlay_needs_physical:1; - u8 supports_tv:1; - u8 has_bsd_ring:1; - u8 has_blt_ring:1; - u8 has_llc:1; + DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON); }; +#undef DEFINE_FLAG +#undef SEP_SEMICOLON +enum i915_cache_level {I915_CACHE_NONE =0 ,I915_CACHE_LLC ,
Signature · 1 line
1.8.1.4
Re: [PATCH 3/6] drm/i915: Use DEV_INFO_FOR_EACH_FLAG() to declare flags as well
Quoted 1 line · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>
Quoted 59 lines
--- drivers/gpu/drm/i915/i915_drv.h | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-)drivers/gpu/drm/i915/i915_drv.h +7
-24@@ -359,36 +359,19 @@ struct drm_i915_gt_funcs { func(has_blt_ring) sep \ func(has_llc) +#define DEFINE_FLAG (name) u8 name:1 +#define SEP_SEMICOLON ; +struct intel_device_info {u32 display_mmio_offset;u8 num_pipes:3 ;u8 gen; - u8 is_mobile:1; - u8 is_i85x:1; - u8 is_i915g:1; - u8 is_i945gm:1; - u8 is_g33:1; - u8 need_gfx_hws:1; - u8 is_g4x:1; - u8 is_pineview:1; - u8 is_broadwater:1; - u8 is_crestline:1; - u8 is_ivybridge:1; - u8 is_valleyview:1; - u8 has_force_wake:1; - u8 is_haswell:1; - u8 has_fbc:1; - u8 has_pipe_cxsr:1; - u8 has_hotplug:1; - u8 cursor_needs_physical:1; - u8 has_overlay:1; - u8 overlay_needs_physical:1; - u8 supports_tv:1; - u8 has_bsd_ring:1; - u8 has_blt_ring:1; - u8 has_llc:1; + DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON); }; +#undef DEFINE_FLAG +#undef SEP_SEMICOLON +enum i915_cache_level {I915_CACHE_NONE =0 ,I915_CACHE_LLC ,Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 drm/i915: Turn HAS_DDI() into a device_info flag
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -308,12 +308,14 @@ static const struct intel_device_info intel_valleyview_d_info = {static const struct intel_device_info intel_haswell_d_info = {GEN7_FEATURES , .is_haswell =1 , + .has_ddi =1 , };static const struct intel_device_info intel_haswell_m_info = {GEN7_FEATURES , .is_haswell =1 , .is_mobile =1 , + .has_ddi =1 , };static const struct pci_device_id pciidlist[] = {/* aka */
drivers/gpu/drm/i915/i915_drv.h +3 -2
@@ -357,7 +357,8 @@ struct drm_i915_gt_funcs { func(supports_tv) sep \ func(has_bsd_ring) sep \ func(has_blt_ring) sep \ - func(has_llc) + func(has_llc) sep \ + func(has_ddi) #define DEFINE_FLAG(name) u8 name:1 #define SEP_SEMICOLON ;
@@ -1366,7 +1367,7 @@ struct drm_i915_file_private {#define HAS_PIPE_CONTROL (dev) (INTEL_INFO(dev)->gen >= 5) -#define HAS_DDI (dev) (IS_HASWELL(dev)) +#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev))#define INTEL_PCH_DEVICE_ID_MASK 0xff00
Signature · 1 line
1.8.1.4
Re: [PATCH 4/6] drm/i915: Turn HAS_DDI() into a device_info flag
Quoted 30 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.c +2
-0@@ -308,12 +308,14 @@ static const struct intel_device_info intel_valleyview_d_info = {static const struct intel_device_info intel_haswell_d_info = {GEN7_FEATURES , .is_haswell =1 , + .has_ddi =1 , };static const struct intel_device_info intel_haswell_m_info = {GEN7_FEATURES , .is_haswell =1 , .is_mobile =1 , + .has_ddi =1 , };static const struct pci_device_id pciidlist[] = {/* aka */ drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h struct drm_i915_gt_funcs { · line 361
Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +2
-1@@ -357,7 +357,8 @@ struct drm_i915_gt_funcs { func(supports_tv) sep \ func(has_bsd_ring) sep \ func(has_blt_ring) sep \ - func(has_llc) + func(has_llc) sep \ + func(has_ddi)
We could just decide to keep something last and insert new stuff before that.
Quoted 19 lines
drivers/gpu/drm/i915/i915_drv.h +1
-1#define DEFINE_FLAG (name) u8 name:1#define SEP_SEMICOLON ;@@ -1366,7 +1367,7 @@ struct drm_i915_file_private {#define HAS_PIPE_CONTROL (dev) (INTEL_INFO(dev)->gen >= 5) -#define HAS_DDI (dev) (IS_HASWELL(dev)) +#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev))#define INTEL_PCH_DEVICE_ID_MASK 0xff00Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 drm/i915: Introduce HAS_FPGA_DBG_UNCLAIMED()
In reply to Damien LespiauLet's introduce one more of those orthogonal feature macros. This should hopefully make the code more readable and make things easier for new platform enabling.
This time, HAS_FPGA_DBG_UNCLAIMED() is true for platforms that have bit 31 of FPGA_DBG able to signal unclaimed writes.
--- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 4 ++-- drivers/gpu/drm/i915/i915_drv.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +1 -1
@@ -1468,7 +1468,7 @@ static void intel_early_sanitize_regs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_HASWELL (dev)) +if (HAS_FPGA_DBG_UNCLAIMED (dev))I915_WRITE_NOTRACE (FPGA_DBG ,FPGA_DBG_RM_NOCLAIM ); }
drivers/gpu/drm/i915/i915_drv.c +2 -2
@@ -1205,7 +1205,7 @@ ilk_dummy_write(struct drm_i915_private *dev_priv)static void hsw_unclaimed_reg_clear (struct drm_i915_private *dev_priv,u32 reg) { -if (IS_HASWELL (dev_priv->dev) && +if (HAS_FPGA_DBG_UNCLAIMED (dev_priv->dev) && (I915_READ_NOTRACE (FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM )) {DRM_ERROR ("Unknown unclaimed register before writing to %x\n" , reg);
@@ -1216,7 +1216,7 @@ hsw_unclaimed_reg_clear(struct drm_i915_private *dev_priv, u32 reg)static void hsw_unclaimed_reg_check (struct drm_i915_private *dev_priv,u32 reg) { -if (IS_HASWELL (dev_priv->dev) && +if (HAS_FPGA_DBG_UNCLAIMED (dev_priv->dev) && (I915_READ_NOTRACE (FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM )) {DRM_ERROR ("Unclaimed write to %x\n" , reg);I915_WRITE_NOTRACE (FPGA_DBG ,FPGA_DBG_RM_NOCLAIM );
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1369,6 +1369,7 @@ struct drm_i915_file_private {#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev)) +#define HAS_FPGA_DBG_UNCLAIMED (dev) (IS_HASWELL(dev))#define INTEL_PCH_DEVICE_ID_MASK 0xff00#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00
Signature · 1 line
1.8.1.4
Re: [PATCH 5/6] drm/i915: Introduce HAS_FPGA_DBG_UNCLAIMED()
Quoted 6 lines · Damien Lespiau
Let's introduce one more of those orthogonal feature macros. This should hopefully make the code more readable and make things easier for new platform enabling.
This time,
HAS_FPGA_DBG_UNCLAIMED()is true for platforms that have bit 31 ofFPGA_DBGable to signal unclaimed writes.
Quoted 62 lines
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_dma.c | 2 +- drivers/gpu/drm/i915/i915_drv.c | 4 ++-- drivers/gpu/drm/i915/i915_drv.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_dma.c +1
-1@@ -1468,7 +1468,7 @@ static void intel_early_sanitize_regs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -if (IS_HASWELL (dev)) +if (HAS_FPGA_DBG_UNCLAIMED (dev))I915_WRITE_NOTRACE (FPGA_DBG ,FPGA_DBG_RM_NOCLAIM ); }drivers/gpu/drm/i915/i915_drv.c +2
-2@@ -1205,7 +1205,7 @@ ilk_dummy_write(struct drm_i915_private *dev_priv)static void hsw_unclaimed_reg_clear (struct drm_i915_private *dev_priv,u32 reg) { -if (IS_HASWELL (dev_priv->dev) && +if (HAS_FPGA_DBG_UNCLAIMED (dev_priv->dev) && (I915_READ_NOTRACE (FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM )) {DRM_ERROR ("Unknown unclaimed register before writing to %x\n" , reg);@@ -1216,7 +1216,7 @@ hsw_unclaimed_reg_clear(struct drm_i915_private *dev_priv, u32 reg)static void hsw_unclaimed_reg_check (struct drm_i915_private *dev_priv,u32 reg) { -if (IS_HASWELL (dev_priv->dev) && +if (HAS_FPGA_DBG_UNCLAIMED (dev_priv->dev) && (I915_READ_NOTRACE (FPGA_DBG ) &FPGA_DBG_RM_NOCLAIM )) {DRM_ERROR ("Unclaimed write to %x\n" , reg);I915_WRITE_NOTRACE (FPGA_DBG ,FPGA_DBG_RM_NOCLAIM );drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -1369,6 +1369,7 @@ struct drm_i915_file_private {#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev)) +#define HAS_FPGA_DBG_UNCLAIMED (dev) (IS_HASWELL(dev))#define INTEL_PCH_DEVICE_ID_MASK 0xff00#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 drm/i915: Turn HAS_FPGA_DBG_UNCLAIMED into a device_info flag
In reply to Damien Lespiau--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -309,6 +309,7 @@ static const struct intel_device_info intel_haswell_d_info = { GEN7_FEATURES, .is_haswell = 1, .has_ddi = 1, + .has_fpga_dbg = 1, };static const struct intel_device_info intel_haswell_m_info = {
@@ -316,6 +317,7 @@ static const struct intel_device_info intel_haswell_m_info = { .is_haswell = 1, .is_mobile = 1, .has_ddi = 1, + .has_fpga_dbg = 1, };static const struct pci_device_id pciidlist[] = {/* aka */
drivers/gpu/drm/i915/i915_drv.h +3 -2
@@ -358,7 +358,8 @@ struct drm_i915_gt_funcs { func(has_bsd_ring) sep \ func(has_blt_ring) sep \ func(has_llc) sep \ - func(has_ddi) + func(has_ddi) sep \ + func(has_fpga_dbg) #define DEFINE_FLAG(name) u8 name:1 #define SEP_SEMICOLON ;
@@ -1369,7 +1370,7 @@ struct drm_i915_file_private {#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev)) -#define HAS_FPGA_DBG_UNCLAIMED (dev) (IS_HASWELL(dev)) +#define HAS_FPGA_DBG_UNCLAIMED (dev) (INTEL_INFO(dev)->has_fpga_dbg)#define INTEL_PCH_DEVICE_ID_MASK 0xff00#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00
Signature · 1 line
1.8.1.4
Re: [PATCH 6/6] drm/i915: Turn HAS_FPGA_DBG_UNCLAIMED into a device_info flag
I think this could be squashed together with the previous patch, but either way,
Quoted 56 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.c +2
-0@@ -309,6 +309,7 @@ static const struct intel_device_info intel_haswell_d_info = { GEN7_FEATURES, .is_haswell = 1, .has_ddi = 1, + .has_fpga_dbg = 1, };static const struct intel_device_info intel_haswell_m_info = {@@ -316,6 +317,7 @@ static const struct intel_device_info intel_haswell_m_info = { .is_haswell = 1, .is_mobile = 1, .has_ddi = 1, + .has_fpga_dbg = 1, };static const struct pci_device_id pciidlist[] = {/* aka */ drivers/gpu/drm/i915/i915_drv.h +3
-2@@ -358,7 +358,8 @@ struct drm_i915_gt_funcs { func(has_bsd_ring) sep \ func(has_blt_ring) sep \ func(has_llc) sep \ - func(has_ddi) + func(has_ddi) sep \ + func(has_fpga_dbg) #define DEFINE_FLAG(name) u8 name:1 #define SEP_SEMICOLON ;@@ -1369,7 +1370,7 @@ struct drm_i915_file_private {#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev)) -#define HAS_FPGA_DBG_UNCLAIMED (dev) (IS_HASWELL(dev)) +#define HAS_FPGA_DBG_UNCLAIMED (dev) (INTEL_INFO(dev)->has_fpga_dbg)#define INTEL_PCH_DEVICE_ID_MASK 0xff00#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915: Turn HAS_FPGA_DBG_UNCLAIMED into a device_info flag
Quoted 5 lines · Jani Nikula
I think this could be squashed together with the previous patch, but either way,
Reviewed-by Jani Nikula <[email protected]>
Entire series merged to dinq, thanks.
-Daniel
Quoted 62 lines · Damien Lespiau
Quoted 56 lines
Signed-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_drv.c +2
-0@@ -309,6 +309,7 @@ static const struct intel_device_info intel_haswell_d_info = { GEN7_FEATURES, .is_haswell = 1, .has_ddi = 1, + .has_fpga_dbg = 1, };static const struct intel_device_info intel_haswell_m_info = {@@ -316,6 +317,7 @@ static const struct intel_device_info intel_haswell_m_info = { .is_haswell = 1, .is_mobile = 1, .has_ddi = 1, + .has_fpga_dbg = 1, };static const struct pci_device_id pciidlist[] = {/* aka */ drivers/gpu/drm/i915/i915_drv.h +3
-2@@ -358,7 +358,8 @@ struct drm_i915_gt_funcs { func(has_bsd_ring) sep \ func(has_blt_ring) sep \ func(has_llc) sep \ - func(has_ddi) + func(has_ddi) sep \ + func(has_fpga_dbg) #define DEFINE_FLAG(name) u8 name:1 #define SEP_SEMICOLON ;@@ -1369,7 +1370,7 @@ struct drm_i915_file_private {#define HAS_DDI (dev) (INTEL_INFO(dev)->has_ddi)#define HAS_POWER_WELL (dev) (IS_HASWELL(dev)) -#define HAS_FPGA_DBG_UNCLAIMED (dev) (IS_HASWELL(dev)) +#define HAS_FPGA_DBG_UNCLAIMED (dev) (INTEL_INFO(dev)->has_fpga_dbg)#define INTEL_PCH_DEVICE_ID_MASK 0xff00#define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch