950-0426-drm-vc4-Add-debugfs-node-that-dumps-the-current-disp.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From d2391d8e17532da2e4edf69672504cad2ab4bca1 Mon Sep 17 00:00:00 2001
  2. From: Dave Stevenson <[email protected]>
  3. Date: Tue, 6 Oct 2020 18:44:42 +0100
  4. Subject: [PATCH] drm/vc4: Add debugfs node that dumps the current
  5. display lists
  6. This allows easy analysis of display lists when debugging.
  7. Signed-off-by: Dave Stevenson <[email protected]>
  8. ---
  9. drivers/gpu/drm/vc4/vc4_hvs.c | 41 +++++++++++++++++++++++++++++++++++
  10. 1 file changed, 41 insertions(+)
  11. --- a/drivers/gpu/drm/vc4/vc4_hvs.c
  12. +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
  13. @@ -95,6 +95,45 @@ static int vc4_hvs_debugfs_underrun(stru
  14. return 0;
  15. }
  16. +static int vc4_hvs_debugfs_dlist(struct seq_file *m, void *data)
  17. +{
  18. + struct drm_info_node *node = m->private;
  19. + struct drm_device *dev = node->minor->dev;
  20. + struct vc4_dev *vc4 = to_vc4_dev(dev);
  21. + struct drm_printer p = drm_seq_file_printer(m);
  22. + unsigned int next_entry_start = 0;
  23. + unsigned int i, j;
  24. + u32 dlist_word, dispstat;
  25. +
  26. + for (i = 0; i < SCALER_CHANNELS_COUNT; i++) {
  27. + dispstat = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTATX(i)),
  28. + SCALER_DISPSTATX_MODE);
  29. + if (dispstat == SCALER_DISPSTATX_MODE_DISABLED ||
  30. + dispstat == SCALER_DISPSTATX_MODE_EOF) {
  31. + drm_printf(&p, "HVS chan %u disabled\n", i);
  32. + continue;
  33. + }
  34. +
  35. + drm_printf(&p, "HVS chan %u:\n", i);
  36. +
  37. + for (j = HVS_READ(SCALER_DISPLISTX(i)); j < 256; j++) {
  38. + dlist_word = readl((u32 __iomem *)vc4->hvs->dlist + j);
  39. + drm_printf(&p, "dlist: %02d: 0x%08x\n", j,
  40. + dlist_word);
  41. + if (!next_entry_start ||
  42. + next_entry_start == j) {
  43. + if (dlist_word & SCALER_CTL0_END)
  44. + break;
  45. + next_entry_start = j +
  46. + VC4_GET_FIELD(dlist_word,
  47. + SCALER_CTL0_SIZE);
  48. + }
  49. + }
  50. + }
  51. +
  52. + return 0;
  53. +}
  54. +
  55. /* The filter kernel is composed of dwords each containing 3 9-bit
  56. * signed integers packed next to each other.
  57. */
  58. @@ -739,6 +778,8 @@ static int vc4_hvs_bind(struct device *d
  59. vc4_debugfs_add_regset32(drm, "hvs_regs", &hvs->regset);
  60. vc4_debugfs_add_file(drm, "hvs_underrun", vc4_hvs_debugfs_underrun,
  61. NULL);
  62. + vc4_debugfs_add_file(drm, "hvs_dlists", vc4_hvs_debugfs_dlist,
  63. + NULL);
  64. return 0;
  65. }