Thanks to the various atomic_print_state hooks in drm structure all
custom debugfs code could be remove from sti driver (~ -330 lines).
This patchset does two addtion in drm core:
- printing normalized zpos of each plane
- add "atomic_print" hook in encoder structure to be able to dump encoders
at the same time than the others elements
All other patches are implemeting the various hooks in sti driver.
Benjamin Gaignard (7):
drm: print plane state normalized zpos value
drm: add hook to print encoder status
drm: sti: make planes use atomic_print_state instead of debugfs
drm: sti: make connectors use atomic_print_state instead of debugfs
drm: sti: make crtc use atomic_print_state instead of debugfs
drm: sti: make encoders use atomic_print_state instead of debugfs
drm: sti: remove the last call to debugfs
drivers/gpu/drm/drm_atomic.c | 16 +++
drivers/gpu/drm/sti/sti_compositor.c | 16 ---
drivers/gpu/drm/sti/sti_compositor.h | 3 -
drivers/gpu/drm/sti/sti_crtc.c | 17 +--
drivers/gpu/drm/sti/sti_cursor.c | 65 ++++--------
drivers/gpu/drm/sti/sti_drv.c | 50 ---------
drivers/gpu/drm/sti/sti_dvo.c | 60 +++--------
drivers/gpu/drm/sti/sti_gdp.c | 196 +++++++++++------------------------
drivers/gpu/drm/sti/sti_hda.c | 75 ++++----------
drivers/gpu/drm/sti/sti_hdmi.c | 132 ++++++++++-------------
drivers/gpu/drm/sti/sti_hqvdp.c | 149 +++++++++++---------------
drivers/gpu/drm/sti/sti_mixer.c | 89 +++++-----------
drivers/gpu/drm/sti/sti_mixer.h | 3 +-
drivers/gpu/drm/sti/sti_tvout.c | 162 +++++++++++------------------
drivers/gpu/drm/sti/sti_vid.c | 60 ++++-------
drivers/gpu/drm/sti/sti_vid.h | 2 +-
include/drm/drm_encoder.h | 12 +++
17 files changed, 386 insertions(+), 721 deletions(-)
--
2.15.0
Thanks to all the hooks in drm structure, custom debugfs could be
removed of sti driver.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/sti/sti_drv.c | 50 -------------------------------------------
1 file changed, 50 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 90c46b49c931..95b0ac4d819c 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -7,7 +7,6 @@
#include <drm/drmP.h>
#include <linux/component.h>
-#include <linux/debugfs.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_platform.h>
@@ -72,53 +71,6 @@ static int sti_drm_fps_set(void *data, u64 val)
DEFINE_SIMPLE_ATTRIBUTE(sti_drm_fps_fops,
sti_drm_fps_get, sti_drm_fps_set, "%llu\n");
-static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
-{
- struct drm_info_node *node = s->private;
- struct drm_device *dev = node->minor->dev;
- struct drm_plane *p;
-
- list_for_each_entry(p, &dev->mode_config.plane_list, head) {
- struct sti_plane *plane = to_sti_plane(p);
-
- seq_printf(s, "%s%s\n",
- plane->fps_info.fps_str,
- plane->fps_info.fips_str);
- }
-
- return 0;
-}
-
-static struct drm_info_list sti_drm_dbg_list[] = {
- {"fps_get", sti_drm_fps_dbg_show, 0},
-};
-
-static int sti_drm_dbg_init(struct drm_minor *minor)
-{
- struct dentry *dentry;
- int ret;
-
- ret = drm_debugfs_create_files(sti_drm_dbg_list,
- ARRAY_SIZE(sti_drm_dbg_list),
- minor->debugfs_root, minor);
- if (ret)
- goto err;
-
- dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
- minor->debugfs_root, minor->dev,
- &sti_drm_fps_fops);
- if (!dentry) {
- ret = -ENOMEM;
- goto err;
- }
-
- DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
- return 0;
-err:
- DRM_ERROR("%s: cannot install debugfs\n", DRIVER_NAME);
- return ret;
-}
-
static const struct drm_mode_config_funcs sti_mode_config_funcs = {
.fb_create = drm_gem_fb_create,
.output_poll_changed = drm_fb_helper_output_poll_changed,
@@ -167,8 +119,6 @@ static struct drm_driver sti_driver = {
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
.gem_prime_mmap = drm_gem_cma_prime_mmap,
- .debugfs_init = sti_drm_dbg_init,
-
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
--
2.15.0
Even if encoders don't have state it could be useful to get information
from them when dumping of the other elements state.
Add an optional hook in drm_encoder_funcs structure and call it after crtc
print state.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/drm_atomic.c | 15 +++++++++++++++
include/drm/drm_encoder.h | 12 ++++++++++++
2 files changed, 27 insertions(+)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index cd1d677617c8..6a9f5be01172 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -28,6 +28,7 @@
#include <drm/drmP.h>
#include <drm/drm_atomic.h>
+#include <drm/drm_encoder.h>
#include <drm/drm_mode.h>
#include <drm/drm_print.h>
#include <linux/sync_file.h>
@@ -1799,6 +1800,15 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
}
EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
+static void drm_atomic_encoder_print(struct drm_printer *p,
+ struct drm_encoder *encoder)
+{
+ drm_printf(p, "encoder[%u]: %s\n", encoder->base.id, encoder->name);
+
+ if (encoder->funcs->atomic_print)
+ encoder->funcs->atomic_print(p, encoder);
+}
+
static void drm_atomic_print_state(const struct drm_atomic_state *state)
{
struct drm_printer p = drm_info_printer(state->dev->dev);
@@ -1828,6 +1838,7 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
struct drm_mode_config *config = &dev->mode_config;
struct drm_plane *plane;
struct drm_crtc *crtc;
+ struct drm_encoder *encoder;
struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
@@ -1850,6 +1861,10 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
drm_modeset_unlock(&crtc->mutex);
}
+ drm_for_each_encoder(encoder, dev) {
+ drm_atomic_encoder_print(p, encoder);
+ }
+
drm_connector_list_iter_begin(dev, &conn_iter);
if (take_locks)
drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
index fb299696c7c4..b847dad817b0 100644
--- a/include/drm/drm_encoder.h
+++ b/include/drm/drm_encoder.h
@@ -80,6 +80,18 @@ struct drm_encoder_funcs {
* before data structures are torndown.
*/
void (*early_unregister)(struct drm_encoder *encoder);
+
+ /**
+ * @atomic_print
+ *
+ * If driver could implement this optional hook for printing
+ * additional driver specific information.
+ *
+ * Do not call this directly, use drm_atomic_encoder_print()
+ * instead.
+ */
+ void (*atomic_print)(struct drm_printer *p,
+ struct drm_encoder *encoder);
};
/**
--
2.15.0
Convert all sti encoders to atomic_print usage rather than use a
debugfs entry.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/sti/sti_tvout.c | 162 ++++++++++++++++------------------------
1 file changed, 63 insertions(+), 99 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index ea4a3b87fa55..8aa23710b695 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -442,10 +442,10 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool main_path)
tvout_write(tvout, 0, TVO_HD_DAC_CFG_OFF);
}
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(tvout->regs + reg))
-static void tvout_dbg_vip(struct seq_file *s, int val)
+static void tvout_dbg_vip(struct drm_printer *p, int val)
{
int r, g, b, tmp, mask;
char *const reorder[] = {"Y_G", "Cb_B", "Cr_R"};
@@ -459,86 +459,94 @@ static void tvout_dbg_vip(struct seq_file *s, int val)
"Aux (color matrix by-passed)",
"", "", "", "", "", "Force value"};
- seq_putc(s, '\t');
+ drm_printf(p, "\n\t\t\t");
mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT;
r = (val & mask) >> TVO_VIP_REORDER_R_SHIFT;
mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT;
g = (val & mask) >> TVO_VIP_REORDER_G_SHIFT;
mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_B_SHIFT;
b = (val & mask) >> TVO_VIP_REORDER_B_SHIFT;
- seq_printf(s, "%-24s %s->%s %s->%s %s->%s\n", "Reorder:",
+ drm_printf(p, "%-24s %s->%s %s->%s %s->%s", "Reorder:",
reorder[r], reorder[TVO_VIP_REORDER_CR_R_SEL],
reorder[g], reorder[TVO_VIP_REORDER_Y_G_SEL],
reorder[b], reorder[TVO_VIP_REORDER_CB_B_SEL]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\n\t\t\t");
mask = TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT;
tmp = (val & mask) >> TVO_VIP_CLIP_SHIFT;
- seq_printf(s, "%-24s %s\n", "Clipping:", clipping[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "%-24s %s", "Clipping:", clipping[tmp]);
+ drm_printf(p, "\n\t\t\t");
mask = TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT;
tmp = (val & mask) >> TVO_VIP_RND_SHIFT;
- seq_printf(s, "%-24s input data rounded to %s per component\n",
+ drm_printf(p, "%-24s input data rounded to %s per component",
"Round:", round[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\n\t\t\t");
tmp = (val & TVO_VIP_SEL_INPUT_MASK);
- seq_printf(s, "%-24s %s", "Input selection:", input_sel[tmp]);
+ drm_printf(p, "%-24s %s", "Input selection:", input_sel[tmp]);
}
-static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val)
+static void tvout_dbg_hd_dac_cfg(struct drm_printer *p, int val)
{
- seq_printf(s, "\t%-24s %s", "HD DAC:",
+ drm_printf(p, "\t%-24s %s", "HD DAC:",
val & 1 ? "disabled" : "enabled");
}
-static int tvout_dbg_show(struct seq_file *s, void *data)
+static void sti_tvout_print(struct drm_printer *p, struct drm_encoder *encoder)
{
- struct drm_info_node *node = s->private;
- struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data;
+ struct sti_tvout *tvout = to_sti_tvout(encoder);
struct drm_crtc *crtc;
- seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs);
-
- seq_puts(s, "\n\n HDMI encoder: ");
- crtc = tvout->hdmi->crtc;
- if (crtc) {
- seq_printf(s, "connected to %s path",
- sti_crtc_is_main(crtc) ? "main" : "aux");
- DBGFS_DUMP(TVO_HDMI_SYNC_SEL);
- DBGFS_DUMP(TVO_VIP_HDMI);
- tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDMI));
- } else {
- seq_puts(s, "disabled");
+ drm_printf(p, "\tTVOUT: (vaddr = 0x%pK)\n", tvout->regs);
+
+ if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
+ drm_printf(p, "\tHDMI encoder: ");
+ crtc = tvout->hdmi->crtc;
+ if (crtc) {
+ drm_printf(p, "connected to %s path",
+ sti_crtc_is_main(crtc) ? "main" : "aux");
+ DBGFS_DUMP(TVO_HDMI_SYNC_SEL);
+ DBGFS_DUMP(TVO_VIP_HDMI);
+ tvout_dbg_vip(p, readl(tvout->regs + TVO_VIP_HDMI));
+ } else {
+ drm_printf(p, "disabled\n");
+ return;
+ }
}
- seq_puts(s, "\n\n DVO encoder: ");
- crtc = tvout->dvo->crtc;
- if (crtc) {
- seq_printf(s, "connected to %s path",
- sti_crtc_is_main(crtc) ? "main" : "aux");
- DBGFS_DUMP(TVO_DVO_SYNC_SEL);
- DBGFS_DUMP(TVO_DVO_CONFIG);
- DBGFS_DUMP(TVO_VIP_DVO);
- tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_DVO));
- } else {
- seq_puts(s, "disabled");
+ if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) {
+ drm_printf(p, "\tDVO encoder: ");
+ crtc = tvout->dvo->crtc;
+ if (crtc) {
+ drm_printf(p, "connected to %s path",
+ sti_crtc_is_main(crtc) ? "main" : "aux");
+ DBGFS_DUMP(TVO_DVO_SYNC_SEL);
+ DBGFS_DUMP(TVO_DVO_CONFIG);
+ DBGFS_DUMP(TVO_VIP_DVO);
+ tvout_dbg_vip(p, readl(tvout->regs + TVO_VIP_DVO));
+ } else {
+ drm_printf(p, "disabled\n");
+ return;
+ }
}
- seq_puts(s, "\n\n HDA encoder: ");
- crtc = tvout->hda->crtc;
- if (crtc) {
- seq_printf(s, "connected to %s path",
- sti_crtc_is_main(crtc) ? "main" : "aux");
- DBGFS_DUMP(TVO_HD_SYNC_SEL);
- DBGFS_DUMP(TVO_HD_DAC_CFG_OFF);
- tvout_dbg_hd_dac_cfg(s,
- readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
- DBGFS_DUMP(TVO_VIP_HDF);
- tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDF));
- } else {
- seq_puts(s, "disabled");
+ if (encoder->encoder_type == DRM_MODE_ENCODER_DAC) {
+ drm_printf(p, "\tHDA encoder: ");
+ crtc = tvout->hda->crtc;
+ if (crtc) {
+ drm_printf(p, "connected to %s path",
+ sti_crtc_is_main(crtc) ? "main" : "aux");
+ DBGFS_DUMP(TVO_HD_SYNC_SEL);
+ DBGFS_DUMP(TVO_HD_DAC_CFG_OFF);
+ tvout_dbg_hd_dac_cfg(p,
+ readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
+ DBGFS_DUMP(TVO_VIP_HDF);
+ tvout_dbg_vip(p, readl(tvout->regs + TVO_VIP_HDF));
+ } else {
+ drm_printf(p, "disabled\n");
+ return;
+ }
}
- seq_puts(s, "\n\n main path configuration");
+ drm_printf(p, "\n\t\tmain path configuration");
DBGFS_DUMP(TVO_CSC_MAIN_M0);
DBGFS_DUMP(TVO_CSC_MAIN_M1);
DBGFS_DUMP(TVO_CSC_MAIN_M2);
@@ -549,7 +557,7 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP(TVO_CSC_MAIN_M7);
DBGFS_DUMP(TVO_MAIN_IN_VID_FORMAT);
- seq_puts(s, "\n\n auxiliary path configuration");
+ drm_printf(p, "\n\t\tauxiliary path configuration");
DBGFS_DUMP(TVO_CSC_AUX_M0);
DBGFS_DUMP(TVO_CSC_AUX_M2);
DBGFS_DUMP(TVO_CSC_AUX_M3);
@@ -558,24 +566,7 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP(TVO_CSC_AUX_M6);
DBGFS_DUMP(TVO_CSC_AUX_M7);
DBGFS_DUMP(TVO_AUX_IN_VID_FORMAT);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list tvout_debugfs_files[] = {
- { "tvout", tvout_dbg_show, 0, NULL },
-};
-
-static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(tvout_debugfs_files); i++)
- tvout_debugfs_files[i].data = tvout;
-
- return drm_debugfs_create_files(tvout_debugfs_files,
- ARRAY_SIZE(tvout_debugfs_files),
- minor->debugfs_root, minor);
+ drm_printf(p, "\n");
}
static void sti_tvout_encoder_dpms(struct drm_encoder *encoder, int mode)
@@ -596,36 +587,9 @@ static void sti_tvout_encoder_destroy(struct drm_encoder *encoder)
kfree(sti_encoder);
}
-static int sti_tvout_late_register(struct drm_encoder *encoder)
-{
- struct sti_tvout *tvout = to_sti_tvout(encoder);
- int ret;
-
- if (tvout->debugfs_registered)
- return 0;
-
- ret = tvout_debugfs_init(tvout, encoder->dev->primary);
- if (ret)
- return ret;
-
- tvout->debugfs_registered = true;
- return 0;
-}
-
-static void sti_tvout_early_unregister(struct drm_encoder *encoder)
-{
- struct sti_tvout *tvout = to_sti_tvout(encoder);
-
- if (!tvout->debugfs_registered)
- return;
-
- tvout->debugfs_registered = false;
-}
-
static const struct drm_encoder_funcs sti_tvout_encoder_funcs = {
.destroy = sti_tvout_encoder_destroy,
- .late_register = sti_tvout_late_register,
- .early_unregister = sti_tvout_early_unregister,
+ .atomic_print = sti_tvout_print
};
static void sti_dvo_encoder_enable(struct drm_encoder *encoder)
--
2.15.0
Convert sti crtc to atomic_print_state usage rather than use a
debugfs entry.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/sti/sti_compositor.c | 16 -------
drivers/gpu/drm/sti/sti_compositor.h | 3 --
drivers/gpu/drm/sti/sti_crtc.c | 17 ++++---
drivers/gpu/drm/sti/sti_mixer.c | 89 ++++++++++--------------------------
drivers/gpu/drm/sti/sti_mixer.h | 3 +-
drivers/gpu/drm/sti/sti_vid.c | 60 ++++++++----------------
drivers/gpu/drm/sti/sti_vid.h | 2 +-
7 files changed, 59 insertions(+), 131 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
index 021b8fcaa0b9..c08d5c560557 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -39,22 +39,6 @@ static const struct sti_compositor_data stih407_compositor_data = {
},
};
-int sti_compositor_debugfs_init(struct sti_compositor *compo,
- struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < STI_MAX_VID; i++)
- if (compo->vid[i])
- vid_debugfs_init(compo->vid[i], minor);
-
- for (i = 0; i < STI_MAX_MIXER; i++)
- if (compo->mixer[i])
- sti_mixer_debugfs_init(compo->mixer[i], minor);
-
- return 0;
-}
-
static int sti_compositor_bind(struct device *dev,
struct device *master,
void *data)
diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h
index ac4bb3834810..eb8b233e68a2 100644
--- a/drivers/gpu/drm/sti/sti_compositor.h
+++ b/drivers/gpu/drm/sti/sti_compositor.h
@@ -79,7 +79,4 @@ struct sti_compositor {
struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
};
-int sti_compositor_debugfs_init(struct sti_compositor *compo,
- struct drm_minor *minor);
-
#endif
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 5824e6aca8f4..4e137932ffe4 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -316,15 +316,20 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
}
-static int sti_crtc_late_register(struct drm_crtc *crtc)
+static void sti_crtc_print_state(struct drm_printer *p,
+ const struct drm_crtc_state *state)
{
- struct sti_mixer *mixer = to_sti_mixer(crtc);
+ struct sti_mixer *mixer = to_sti_mixer(state->crtc);
struct sti_compositor *compo = dev_get_drvdata(mixer->dev);
+ unsigned int i;
- if (drm_crtc_index(crtc) == 0)
- return sti_compositor_debugfs_init(compo, crtc->dev->primary);
+ for (i = 0; i < STI_MAX_VID; i++)
+ if (compo->vid[i])
+ sti_vid_print_state(p, compo->vid[i]);
- return 0;
+ for (i = 0; i < STI_MAX_MIXER; i++)
+ if (compo->mixer[i])
+ sti_mixer_print_state(p, compo->mixer[i]);
}
static const struct drm_crtc_funcs sti_crtc_funcs = {
@@ -335,7 +340,7 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
.reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
- .late_register = sti_crtc_late_register,
+ .atomic_print_state = sti_crtc_print_state,
};
bool sti_crtc_is_main(struct drm_crtc *crtc)
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index a4f45c74d678..22525139d315 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -70,20 +70,20 @@ static inline void sti_mixer_reg_write(struct sti_mixer *mixer,
writel(val, mixer->regs + reg_id);
}
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
sti_mixer_reg_read(mixer, reg))
-static void mixer_dbg_ctl(struct seq_file *s, int val)
+static void mixer_dbg_ctl(struct drm_printer *p, int val)
{
unsigned int i;
int count = 0;
char *const disp_layer[] = {"BKG", "VID0", "VID1", "GDP0",
"GDP1", "GDP2", "GDP3"};
- seq_puts(s, "\tEnabled: ");
+ drm_printf(p, "\tEnabled: ");
for (i = 0; i < 7; i++) {
if (val & 1) {
- seq_printf(s, "%s ", disp_layer[i]);
+ drm_printf(p, "%s ", disp_layer[i]);
count++;
}
val = val >> 1;
@@ -91,114 +91,75 @@ static void mixer_dbg_ctl(struct seq_file *s, int val)
val = val >> 2;
if (val & 1) {
- seq_puts(s, "CURS ");
+ drm_printf(p, "CURS ");
count++;
}
if (!count)
- seq_puts(s, "Nothing");
+ drm_printf(p, "Nothing");
}
-static void mixer_dbg_crb(struct seq_file *s, int val)
+static void mixer_dbg_crb(struct drm_printer *p, int val)
{
int i;
- seq_puts(s, "\tDepth: ");
+ drm_printf(p, "\tDepth: ");
for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
switch (val & GAM_DEPTH_MASK_ID) {
case GAM_DEPTH_VID0_ID:
- seq_puts(s, "VID0");
+ drm_printf(p, "VID0");
break;
case GAM_DEPTH_VID1_ID:
- seq_puts(s, "VID1");
+ drm_printf(p, "VID1");
break;
case GAM_DEPTH_GDP0_ID:
- seq_puts(s, "GDP0");
+ drm_printf(p, "GDP0");
break;
case GAM_DEPTH_GDP1_ID:
- seq_puts(s, "GDP1");
+ drm_printf(p, "GDP1");
break;
case GAM_DEPTH_GDP2_ID:
- seq_puts(s, "GDP2");
+ drm_printf(p, "GDP2");
break;
case GAM_DEPTH_GDP3_ID:
- seq_puts(s, "GDP3");
+ drm_printf(p, "GDP3");
break;
default:
- seq_puts(s, "---");
+ drm_printf(p, "---");
}
if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
- seq_puts(s, " < ");
+ drm_printf(p, " < ");
val = val >> 3;
}
}
-static void mixer_dbg_mxn(struct seq_file *s, void *addr)
+static void mixer_dbg_mxn(struct drm_printer *p, void *addr)
{
int i;
for (i = 1; i < 8; i++)
- seq_printf(s, "-0x%08X", (int)readl(addr + i * 4));
+ drm_printf(p, "-0x%08X", (int)readl(addr + i * 4));
}
-static int mixer_dbg_show(struct seq_file *s, void *arg)
+void sti_mixer_print_state(struct drm_printer *p, struct sti_mixer *mixer)
{
- struct drm_info_node *node = s->private;
- struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data;
-
- seq_printf(s, "%s: (vaddr = 0x%p)",
+ drm_printf(p, "\t%s: (vaddr = 0x%pK)",
sti_mixer_to_str(mixer), mixer->regs);
DBGFS_DUMP(GAM_MIXER_CTL);
- mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
+ mixer_dbg_ctl(p, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
DBGFS_DUMP(GAM_MIXER_BKC);
DBGFS_DUMP(GAM_MIXER_BCO);
DBGFS_DUMP(GAM_MIXER_BCS);
DBGFS_DUMP(GAM_MIXER_AVO);
DBGFS_DUMP(GAM_MIXER_AVS);
DBGFS_DUMP(GAM_MIXER_CRB);
- mixer_dbg_crb(s, sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
+ mixer_dbg_crb(p, sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
DBGFS_DUMP(GAM_MIXER_ACT);
DBGFS_DUMP(GAM_MIXER_MBP);
DBGFS_DUMP(GAM_MIXER_MX0);
- mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list mixer0_debugfs_files[] = {
- { "mixer_main", mixer_dbg_show, 0, NULL },
-};
-
-static struct drm_info_list mixer1_debugfs_files[] = {
- { "mixer_aux", mixer_dbg_show, 0, NULL },
-};
-
-int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
-{
- unsigned int i;
- struct drm_info_list *mixer_debugfs_files;
- int nb_files;
-
- switch (mixer->id) {
- case STI_MIXER_MAIN:
- mixer_debugfs_files = mixer0_debugfs_files;
- nb_files = ARRAY_SIZE(mixer0_debugfs_files);
- break;
- case STI_MIXER_AUX:
- mixer_debugfs_files = mixer1_debugfs_files;
- nb_files = ARRAY_SIZE(mixer1_debugfs_files);
- break;
- default:
- return -EINVAL;
- }
-
- for (i = 0; i < nb_files; i++)
- mixer_debugfs_files[i].data = mixer;
-
- return drm_debugfs_create_files(mixer_debugfs_files,
- nb_files,
- minor->debugfs_root, minor);
+ mixer_dbg_mxn(p, mixer->regs + GAM_MIXER_MX0);
+ drm_printf(p, "\n");
}
void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable)
@@ -367,7 +328,7 @@ struct sti_mixer *sti_mixer_create(struct device *dev,
mixer->dev = dev;
mixer->id = id;
- DRM_DEBUG_DRIVER("%s created. Regs=%p\n",
+ DRM_DEBUG_DRIVER("%s created. Regs=%pK\n",
sti_mixer_to_str(mixer), mixer->regs);
return mixer;
diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
index 4cb3cfddc03a..067093270bb0 100644
--- a/drivers/gpu/drm/sti/sti_mixer.h
+++ b/drivers/gpu/drm/sti/sti_mixer.h
@@ -53,7 +53,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,
void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
-int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
+void sti_mixer_print_state(struct drm_printer *p, struct sti_mixer *mixer);
+
/* depth in Cross-bar control = z order */
#define GAM_MIXER_NB_DEPTH_LEVEL 6
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 2aac36c95835..9730e9cf2a87 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -55,54 +55,51 @@
#define VID_MIN_HD_HEIGHT 720
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(vid->regs + reg))
-static void vid_dbg_ctl(struct seq_file *s, int val)
+static void vid_dbg_ctl(struct drm_printer *p, int val)
{
val = val >> 30;
- seq_putc(s, '\t');
+ drm_printf(p, "\t");
if (!(val & 1))
- seq_puts(s, "NOT ");
- seq_puts(s, "ignored on main mixer - ");
+ drm_printf(p, "NOT ");
+ drm_printf(p, "ignored on main mixer - ");
if (!(val & 2))
- seq_puts(s, "NOT ");
- seq_puts(s, "ignored on aux mixer");
+ drm_printf(p, "NOT ");
+ drm_printf(p, "ignored on aux mixer");
}
-static void vid_dbg_vpo(struct seq_file *s, int val)
+static void vid_dbg_vpo(struct drm_printer *p, int val)
{
- seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+ drm_printf(p, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
}
-static void vid_dbg_vps(struct seq_file *s, int val)
+static void vid_dbg_vps(struct drm_printer *p, int val)
{
- seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+ drm_printf(p, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
}
-static void vid_dbg_mst(struct seq_file *s, int val)
+static void vid_dbg_mst(struct drm_printer *p, int val)
{
if (val & 1)
- seq_puts(s, "\tBUFFER UNDERFLOW!");
+ drm_printf(p, "\tBUFFER UNDERFLOW!");
}
-static int vid_dbg_show(struct seq_file *s, void *arg)
+void sti_vid_print_state(struct drm_printer *p, struct sti_vid *vid)
{
- struct drm_info_node *node = s->private;
- struct sti_vid *vid = (struct sti_vid *)node->info_ent->data;
-
- seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs);
+ drm_printf(p, "\tVID: (vaddr= 0x%pK)", vid->regs);
DBGFS_DUMP(VID_CTL);
- vid_dbg_ctl(s, readl(vid->regs + VID_CTL));
+ vid_dbg_ctl(p, readl(vid->regs + VID_CTL));
DBGFS_DUMP(VID_ALP);
DBGFS_DUMP(VID_CLF);
DBGFS_DUMP(VID_VPO);
- vid_dbg_vpo(s, readl(vid->regs + VID_VPO));
+ vid_dbg_vpo(p, readl(vid->regs + VID_VPO));
DBGFS_DUMP(VID_VPS);
- vid_dbg_vps(s, readl(vid->regs + VID_VPS));
+ vid_dbg_vps(p, readl(vid->regs + VID_VPS));
DBGFS_DUMP(VID_KEY1);
DBGFS_DUMP(VID_KEY2);
DBGFS_DUMP(VID_MPR0);
@@ -110,28 +107,11 @@ static int vid_dbg_show(struct seq_file *s, void *arg)
DBGFS_DUMP(VID_MPR2);
DBGFS_DUMP(VID_MPR3);
DBGFS_DUMP(VID_MST);
- vid_dbg_mst(s, readl(vid->regs + VID_MST));
+ vid_dbg_mst(p, readl(vid->regs + VID_MST));
DBGFS_DUMP(VID_BC);
DBGFS_DUMP(VID_TINT);
DBGFS_DUMP(VID_CSAT);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list vid_debugfs_files[] = {
- { "vid", vid_dbg_show, 0, NULL },
-};
-
-int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++)
- vid_debugfs_files[i].data = vid;
-
- return drm_debugfs_create_files(vid_debugfs_files,
- ARRAY_SIZE(vid_debugfs_files),
- minor->debugfs_root, minor);
+ drm_printf(p, "\n");
}
void sti_vid_commit(struct sti_vid *vid,
diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h
index 9dbd78461de1..27656dbbd2bc 100644
--- a/drivers/gpu/drm/sti/sti_vid.h
+++ b/drivers/gpu/drm/sti/sti_vid.h
@@ -26,6 +26,6 @@ void sti_vid_disable(struct sti_vid *vid);
struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
int id, void __iomem *baseaddr);
-int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor);
+void sti_vid_print_state(struct drm_printer *p, struct sti_vid *vid);
#endif
--
2.15.0
When dumping plane state print normalized zpos value as done for
the other plane state fields.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/drm_atomic.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 07fef42869aa..cd1d677617c8 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -988,6 +988,7 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,
drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest));
drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src));
drm_printf(p, "\trotation=%x\n", state->rotation);
+ drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos);
drm_printf(p, "\tcolor-encoding=%s\n",
drm_get_color_encoding_name(state->color_encoding));
drm_printf(p, "\tcolor-range=%s\n",
--
2.15.0
Convert all sti planes to atomic_print_state usage rather than use a debugfs
entry.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/sti/sti_cursor.c | 65 +++++--------
drivers/gpu/drm/sti/sti_gdp.c | 196 +++++++++++++--------------------------
drivers/gpu/drm/sti/sti_hqvdp.c | 149 +++++++++++++----------------
3 files changed, 146 insertions(+), 264 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index df0a282b9615..69f6b1091422 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -74,72 +74,57 @@ static const uint32_t cursor_supported_formats[] = {
#define to_sti_cursor(x) container_of(x, struct sti_cursor, plane)
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(cursor->regs + reg))
-static void cursor_dbg_vpo(struct seq_file *s, u32 val)
+static void cursor_dbg_vpo(struct drm_printer *p, u32 val)
{
- seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+ drm_printf(p, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
}
-static void cursor_dbg_size(struct seq_file *s, u32 val)
+static void cursor_dbg_size(struct drm_printer *p, u32 val)
{
- seq_printf(s, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF);
+ drm_printf(p, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF);
}
-static void cursor_dbg_pml(struct seq_file *s,
+static void cursor_dbg_pml(struct drm_printer *p,
struct sti_cursor *cursor, u32 val)
{
if (cursor->pixmap.paddr == val)
- seq_printf(s, "\tVirt @: %p", cursor->pixmap.base);
+ drm_printf(p, "\tVirt @: %pK", cursor->pixmap.base);
}
-static void cursor_dbg_cml(struct seq_file *s,
+static void cursor_dbg_cml(struct drm_printer *p,
struct sti_cursor *cursor, u32 val)
{
if (cursor->clut_paddr == val)
- seq_printf(s, "\tVirt @: %p", cursor->clut);
+ drm_printf(p, "\tVirt @: %pK", cursor->clut);
}
-static int cursor_dbg_show(struct seq_file *s, void *data)
+static void sti_cursor_plane_print_state(struct drm_printer *p,
+ const struct drm_plane_state *state)
{
- struct drm_info_node *node = s->private;
- struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data;
+ struct sti_plane *plane = to_sti_plane(state->plane);
+ struct sti_cursor *cursor = to_sti_cursor(plane);
- seq_printf(s, "%s: (vaddr = 0x%p)",
+ drm_printf(p, "\t%s: (vaddr = 0x%pK)",
sti_plane_to_str(&cursor->plane), cursor->regs);
DBGFS_DUMP(CUR_CTL);
DBGFS_DUMP(CUR_VPO);
- cursor_dbg_vpo(s, readl(cursor->regs + CUR_VPO));
+ cursor_dbg_vpo(p, readl(cursor->regs + CUR_VPO));
DBGFS_DUMP(CUR_PML);
- cursor_dbg_pml(s, cursor, readl(cursor->regs + CUR_PML));
+ cursor_dbg_pml(p, cursor, readl(cursor->regs + CUR_PML));
DBGFS_DUMP(CUR_PMP);
DBGFS_DUMP(CUR_SIZE);
- cursor_dbg_size(s, readl(cursor->regs + CUR_SIZE));
+ cursor_dbg_size(p, readl(cursor->regs + CUR_SIZE));
DBGFS_DUMP(CUR_CML);
- cursor_dbg_cml(s, cursor, readl(cursor->regs + CUR_CML));
+ cursor_dbg_cml(p, cursor, readl(cursor->regs + CUR_CML));
DBGFS_DUMP(CUR_AWS);
DBGFS_DUMP(CUR_AWE);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list cursor_debugfs_files[] = {
- { "cursor", cursor_dbg_show, 0, NULL },
-};
-
-static int cursor_debugfs_init(struct sti_cursor *cursor,
- struct drm_minor *minor)
-{
- unsigned int i;
- for (i = 0; i < ARRAY_SIZE(cursor_debugfs_files); i++)
- cursor_debugfs_files[i].data = cursor;
-
- return drm_debugfs_create_files(cursor_debugfs_files,
- ARRAY_SIZE(cursor_debugfs_files),
- minor->debugfs_root, minor);
+ drm_printf(p, "\t%s%s\n",
+ plane->fps_info.fps_str, plane->fps_info.fips_str);
}
static void sti_cursor_argb8888_to_clut8(struct sti_cursor *cursor, u32 *src)
@@ -336,14 +321,6 @@ static void sti_cursor_destroy(struct drm_plane *drm_plane)
drm_plane_cleanup(drm_plane);
}
-static int sti_cursor_late_register(struct drm_plane *drm_plane)
-{
- struct sti_plane *plane = to_sti_plane(drm_plane);
- struct sti_cursor *cursor = to_sti_cursor(plane);
-
- return cursor_debugfs_init(cursor, drm_plane->dev->primary);
-}
-
static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
@@ -351,7 +328,7 @@ static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
.reset = sti_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
- .late_register = sti_cursor_late_register,
+ .atomic_print_state = sti_cursor_plane_print_state,
};
struct drm_plane *sti_cursor_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 49813d34bdf0..55789bae72c1 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -139,42 +139,42 @@ static const uint32_t gdp_supported_formats[] = {
DRM_FORMAT_RGB888,
};
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(gdp->regs + reg ## _OFFSET))
-static void gdp_dbg_ctl(struct seq_file *s, int val)
+static void gdp_dbg_ctl(struct drm_printer *p, int val)
{
int i;
- seq_puts(s, "\tColor:");
+ drm_printf(p, "\tColor:");
for (i = 0; i < ARRAY_SIZE(gdp_format_to_str); i++) {
if (gdp_format_to_str[i].format == (val & 0x1F)) {
- seq_puts(s, gdp_format_to_str[i].name);
+ drm_printf(p, gdp_format_to_str[i].name);
break;
}
}
if (i == ARRAY_SIZE(gdp_format_to_str))
- seq_puts(s, "<UNKNOWN>");
+ drm_printf(p, "<UNKNOWN>");
- seq_printf(s, "\tWaitNextVsync:%d", val & WAIT_NEXT_VSYNC ? 1 : 0);
+ drm_printf(p, "\tWaitNextVsync:%d", val & WAIT_NEXT_VSYNC ? 1 : 0);
}
-static void gdp_dbg_vpo(struct seq_file *s, int val)
+static void gdp_dbg_vpo(struct drm_printer *p, int val)
{
- seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
+ drm_printf(p, "\txdo:%4d\tydo:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
}
-static void gdp_dbg_vps(struct seq_file *s, int val)
+static void gdp_dbg_vps(struct drm_printer *p, int val)
{
- seq_printf(s, "\txds:%4d\tyds:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
+ drm_printf(p, "\txds:%4d\tyds:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
}
-static void gdp_dbg_size(struct seq_file *s, int val)
+static void gdp_dbg_size(struct drm_printer *p, int val)
{
- seq_printf(s, "\t%d x %d", val & 0xFFFF, (val >> 16) & 0xFFFF);
+ drm_printf(p, "\t%d x %d", val & 0xFFFF, (val >> 16) & 0xFFFF);
}
-static void gdp_dbg_nvn(struct seq_file *s, struct sti_gdp *gdp, int val)
+static void gdp_dbg_nvn(struct drm_printer *p, struct sti_gdp *gdp, int val)
{
void *base = NULL;
unsigned int i;
@@ -191,157 +191,93 @@ static void gdp_dbg_nvn(struct seq_file *s, struct sti_gdp *gdp, int val)
}
if (base)
- seq_printf(s, "\tVirt @: %p", base);
+ drm_printf(p, "\tVirt @: %pK", base);
}
-static void gdp_dbg_ppt(struct seq_file *s, int val)
+static void gdp_dbg_ppt(struct drm_printer *p, int val)
{
if (val & GAM_GDP_PPT_IGNORE)
- seq_puts(s, "\tNot displayed on mixer!");
+ drm_printf(p, "\tNot displayed on mixer!");
}
-static void gdp_dbg_mst(struct seq_file *s, int val)
+static void gdp_dbg_mst(struct drm_printer *p, int val)
{
if (val & 1)
- seq_puts(s, "\tBUFFER UNDERFLOW!");
+ drm_printf(p, "\tBUFFER UNDERFLOW!");
}
-static int gdp_dbg_show(struct seq_file *s, void *data)
+static int gdp_dbg_show(struct drm_printer *p, struct sti_gdp *gdp)
{
- struct drm_info_node *node = s->private;
- struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
- struct drm_plane *drm_plane = &gdp->plane.drm_plane;
- struct drm_crtc *crtc;
-
- drm_modeset_lock(&drm_plane->mutex, NULL);
- crtc = drm_plane->state->crtc;
- drm_modeset_unlock(&drm_plane->mutex);
-
- seq_printf(s, "%s: (vaddr = 0x%p)",
+ drm_printf(p, "\t%s: (vaddr = 0x%pK)",
sti_plane_to_str(&gdp->plane), gdp->regs);
DBGFS_DUMP(GAM_GDP_CTL);
- gdp_dbg_ctl(s, readl(gdp->regs + GAM_GDP_CTL_OFFSET));
+ gdp_dbg_ctl(p, readl(gdp->regs + GAM_GDP_CTL_OFFSET));
DBGFS_DUMP(GAM_GDP_AGC);
DBGFS_DUMP(GAM_GDP_VPO);
- gdp_dbg_vpo(s, readl(gdp->regs + GAM_GDP_VPO_OFFSET));
+ gdp_dbg_vpo(p, readl(gdp->regs + GAM_GDP_VPO_OFFSET));
DBGFS_DUMP(GAM_GDP_VPS);
- gdp_dbg_vps(s, readl(gdp->regs + GAM_GDP_VPS_OFFSET));
+ gdp_dbg_vps(p, readl(gdp->regs + GAM_GDP_VPS_OFFSET));
DBGFS_DUMP(GAM_GDP_PML);
DBGFS_DUMP(GAM_GDP_PMP);
DBGFS_DUMP(GAM_GDP_SIZE);
- gdp_dbg_size(s, readl(gdp->regs + GAM_GDP_SIZE_OFFSET));
+ gdp_dbg_size(p, readl(gdp->regs + GAM_GDP_SIZE_OFFSET));
DBGFS_DUMP(GAM_GDP_NVN);
- gdp_dbg_nvn(s, gdp, readl(gdp->regs + GAM_GDP_NVN_OFFSET));
+ gdp_dbg_nvn(p, gdp, readl(gdp->regs + GAM_GDP_NVN_OFFSET));
DBGFS_DUMP(GAM_GDP_KEY1);
DBGFS_DUMP(GAM_GDP_KEY2);
DBGFS_DUMP(GAM_GDP_PPT);
- gdp_dbg_ppt(s, readl(gdp->regs + GAM_GDP_PPT_OFFSET));
+ gdp_dbg_ppt(p, readl(gdp->regs + GAM_GDP_PPT_OFFSET));
DBGFS_DUMP(GAM_GDP_CML);
DBGFS_DUMP(GAM_GDP_MST);
- gdp_dbg_mst(s, readl(gdp->regs + GAM_GDP_MST_OFFSET));
-
- seq_puts(s, "\n\n");
- if (!crtc)
- seq_puts(s, " Not connected to any DRM CRTC\n");
- else
- seq_printf(s, " Connected to DRM CRTC #%d (%s)\n",
- crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)));
+ gdp_dbg_mst(p, readl(gdp->regs + GAM_GDP_MST_OFFSET));
+ drm_printf(p, "\n");
return 0;
}
-static void gdp_node_dump_node(struct seq_file *s, struct sti_gdp_node *node)
+static void gdp_node_dump_node(struct drm_printer *p, struct sti_gdp_node *node)
{
- seq_printf(s, "\t@:0x%p", node);
- seq_printf(s, "\n\tCTL 0x%08X", node->gam_gdp_ctl);
- gdp_dbg_ctl(s, node->gam_gdp_ctl);
- seq_printf(s, "\n\tAGC 0x%08X", node->gam_gdp_agc);
- seq_printf(s, "\n\tVPO 0x%08X", node->gam_gdp_vpo);
- gdp_dbg_vpo(s, node->gam_gdp_vpo);
- seq_printf(s, "\n\tVPS 0x%08X", node->gam_gdp_vps);
- gdp_dbg_vps(s, node->gam_gdp_vps);
- seq_printf(s, "\n\tPML 0x%08X", node->gam_gdp_pml);
- seq_printf(s, "\n\tPMP 0x%08X", node->gam_gdp_pmp);
- seq_printf(s, "\n\tSIZE 0x%08X", node->gam_gdp_size);
- gdp_dbg_size(s, node->gam_gdp_size);
- seq_printf(s, "\n\tNVN 0x%08X", node->gam_gdp_nvn);
- seq_printf(s, "\n\tKEY1 0x%08X", node->gam_gdp_key1);
- seq_printf(s, "\n\tKEY2 0x%08X", node->gam_gdp_key2);
- seq_printf(s, "\n\tPPT 0x%08X", node->gam_gdp_ppt);
- gdp_dbg_ppt(s, node->gam_gdp_ppt);
- seq_printf(s, "\n\tCML 0x%08X\n", node->gam_gdp_cml);
+ drm_printf(p, "\t@:0x%pK", node);
+ drm_printf(p, "\n\t\tCTL 0x%08X", node->gam_gdp_ctl);
+ gdp_dbg_ctl(p, node->gam_gdp_ctl);
+ drm_printf(p, "\n\t\tAGC 0x%08X", node->gam_gdp_agc);
+ drm_printf(p, "\n\t\tVPO 0x%08X", node->gam_gdp_vpo);
+ gdp_dbg_vpo(p, node->gam_gdp_vpo);
+ drm_printf(p, "\n\t\tVPS 0x%08X", node->gam_gdp_vps);
+ gdp_dbg_vps(p, node->gam_gdp_vps);
+ drm_printf(p, "\n\t\tPML 0x%08X", node->gam_gdp_pml);
+ drm_printf(p, "\n\t\tPMP 0x%08X", node->gam_gdp_pmp);
+ drm_printf(p, "\n\t\tSIZE 0x%08X", node->gam_gdp_size);
+ gdp_dbg_size(p, node->gam_gdp_size);
+ drm_printf(p, "\n\t\tNVN 0x%08X", node->gam_gdp_nvn);
+ drm_printf(p, "\n\t\tKEY1 0x%08X", node->gam_gdp_key1);
+ drm_printf(p, "\n\t\tKEY2 0x%08X", node->gam_gdp_key2);
+ drm_printf(p, "\n\t\tPPT 0x%08X", node->gam_gdp_ppt);
+ gdp_dbg_ppt(p, node->gam_gdp_ppt);
+ drm_printf(p, "\n\t\tCML 0x%08X\n", node->gam_gdp_cml);
}
-static int gdp_node_dbg_show(struct seq_file *s, void *arg)
+static void sti_gdp_plane_print_state(struct drm_printer *p,
+ const struct drm_plane_state *state)
{
- struct drm_info_node *node = s->private;
- struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
+ struct sti_plane *plane = to_sti_plane(state->plane);
+ struct sti_gdp *gdp = to_sti_gdp(plane);
unsigned int b;
- for (b = 0; b < GDP_NODE_NB_BANK; b++) {
- seq_printf(s, "\n%s[%d].top", sti_plane_to_str(&gdp->plane), b);
- gdp_node_dump_node(s, gdp->node_list[b].top_field);
- seq_printf(s, "\n%s[%d].btm", sti_plane_to_str(&gdp->plane), b);
- gdp_node_dump_node(s, gdp->node_list[b].btm_field);
- }
-
- return 0;
-}
-
-static struct drm_info_list gdp0_debugfs_files[] = {
- { "gdp0", gdp_dbg_show, 0, NULL },
- { "gdp0_node", gdp_node_dbg_show, 0, NULL },
-};
-
-static struct drm_info_list gdp1_debugfs_files[] = {
- { "gdp1", gdp_dbg_show, 0, NULL },
- { "gdp1_node", gdp_node_dbg_show, 0, NULL },
-};
-
-static struct drm_info_list gdp2_debugfs_files[] = {
- { "gdp2", gdp_dbg_show, 0, NULL },
- { "gdp2_node", gdp_node_dbg_show, 0, NULL },
-};
-
-static struct drm_info_list gdp3_debugfs_files[] = {
- { "gdp3", gdp_dbg_show, 0, NULL },
- { "gdp3_node", gdp_node_dbg_show, 0, NULL },
-};
-
-static int gdp_debugfs_init(struct sti_gdp *gdp, struct drm_minor *minor)
-{
- unsigned int i;
- struct drm_info_list *gdp_debugfs_files;
- int nb_files;
+ gdp_dbg_show(p, gdp);
- switch (gdp->plane.desc) {
- case STI_GDP_0:
- gdp_debugfs_files = gdp0_debugfs_files;
- nb_files = ARRAY_SIZE(gdp0_debugfs_files);
- break;
- case STI_GDP_1:
- gdp_debugfs_files = gdp1_debugfs_files;
- nb_files = ARRAY_SIZE(gdp1_debugfs_files);
- break;
- case STI_GDP_2:
- gdp_debugfs_files = gdp2_debugfs_files;
- nb_files = ARRAY_SIZE(gdp2_debugfs_files);
- break;
- case STI_GDP_3:
- gdp_debugfs_files = gdp3_debugfs_files;
- nb_files = ARRAY_SIZE(gdp3_debugfs_files);
- break;
- default:
- return -EINVAL;
+ for (b = 0; b < GDP_NODE_NB_BANK; b++) {
+ drm_printf(p, "\t%s[%d].top\n",
+ sti_plane_to_str(&gdp->plane), b);
+ gdp_node_dump_node(p, gdp->node_list[b].top_field);
+ drm_printf(p, "\t%s[%d].btm\n",
+ sti_plane_to_str(&gdp->plane), b);
+ gdp_node_dump_node(p, gdp->node_list[b].btm_field);
}
- for (i = 0; i < nb_files; i++)
- gdp_debugfs_files[i].data = gdp;
-
- return drm_debugfs_create_files(gdp_debugfs_files,
- nb_files,
- minor->debugfs_root, minor);
+ drm_printf(p, "\t%s%s\n",
+ plane->fps_info.fps_str, plane->fps_info.fips_str);
}
static int sti_gdp_fourcc2format(int fourcc)
@@ -887,14 +823,6 @@ static void sti_gdp_destroy(struct drm_plane *drm_plane)
drm_plane_cleanup(drm_plane);
}
-static int sti_gdp_late_register(struct drm_plane *drm_plane)
-{
- struct sti_plane *plane = to_sti_plane(drm_plane);
- struct sti_gdp *gdp = to_sti_gdp(plane);
-
- return gdp_debugfs_init(gdp, drm_plane->dev->primary);
-}
-
static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
@@ -902,7 +830,7 @@ static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
.reset = sti_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
- .late_register = sti_gdp_late_register,
+ .atomic_print_state = sti_gdp_plane_print_state,
};
struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 106be8c4e58b..f218f636966c 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -441,7 +441,7 @@ static int sti_hqvdp_get_next_cmd(struct sti_hqvdp *hqvdp)
return -1;
}
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(hqvdp->regs + reg))
static const char *hqvdp_dbg_get_lut(u32 *coef)
@@ -469,99 +469,100 @@ static const char *hqvdp_dbg_get_lut(u32 *coef)
return "<UNKNOWN>";
}
-static void hqvdp_dbg_dump_cmd(struct seq_file *s, struct sti_hqvdp_cmd *c)
+static void hqvdp_dbg_dump_cmd(struct drm_printer *p, struct sti_hqvdp_cmd *c)
{
int src_w, src_h, dst_w, dst_h;
- seq_puts(s, "\n\tTOP:");
- seq_printf(s, "\n\t %-20s 0x%08X", "Config", c->top.config);
+ drm_printf(p, "\n\tTOP:");
+ drm_printf(p, "\n\t %-20s 0x%08X", "Config", c->top.config);
switch (c->top.config) {
case TOP_CONFIG_PROGRESSIVE:
- seq_puts(s, "\tProgressive");
+ drm_printf(p, "\tProgressive");
break;
case TOP_CONFIG_INTER_TOP:
- seq_puts(s, "\tInterlaced, top field");
+ drm_printf(p, "\tInterlaced, top field");
break;
case TOP_CONFIG_INTER_BTM:
- seq_puts(s, "\tInterlaced, bottom field");
+ drm_printf(p, "\tInterlaced, bottom field");
break;
default:
- seq_puts(s, "\t<UNKNOWN>");
+ drm_printf(p, "\t<UNKNOWN>");
break;
}
- seq_printf(s, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format);
- seq_printf(s, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma);
- seq_printf(s, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma);
- seq_printf(s, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch);
- seq_printf(s, "\n\t %-20s 0x%08X", "CSrcPitch",
+ drm_printf(p, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format);
+ drm_printf(p, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma);
+ drm_printf(p, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma);
+ drm_printf(p, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch);
+ drm_printf(p, "\n\t %-20s 0x%08X", "CSrcPitch",
c->top.chroma_src_pitch);
- seq_printf(s, "\n\t %-20s 0x%08X", "InputFrameSize",
+ drm_printf(p, "\n\t %-20s 0x%08X", "InputFrameSize",
c->top.input_frame_size);
- seq_printf(s, "\t%dx%d",
+ drm_printf(p, "\t%dx%d",
c->top.input_frame_size & 0x0000FFFF,
c->top.input_frame_size >> 16);
- seq_printf(s, "\n\t %-20s 0x%08X", "InputViewportSize",
+ drm_printf(p, "\n\t %-20s 0x%08X", "InputViewportSize",
c->top.input_viewport_size);
src_w = c->top.input_viewport_size & 0x0000FFFF;
src_h = c->top.input_viewport_size >> 16;
- seq_printf(s, "\t%dx%d", src_w, src_h);
+ drm_printf(p, "\t%dx%d", src_w, src_h);
- seq_puts(s, "\n\tHVSRC:");
- seq_printf(s, "\n\t %-20s 0x%08X", "OutputPictureSize",
+ drm_printf(p, "\n\tHVSRC:");
+ drm_printf(p, "\n\t %-20s 0x%08X", "OutputPictureSize",
c->hvsrc.output_picture_size);
dst_w = c->hvsrc.output_picture_size & 0x0000FFFF;
dst_h = c->hvsrc.output_picture_size >> 16;
- seq_printf(s, "\t%dx%d", dst_w, dst_h);
- seq_printf(s, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl);
+ drm_printf(p, "\t%dx%d", dst_w, dst_h);
+ drm_printf(p, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl);
- seq_printf(s, "\n\t %-20s %s", "yh_coef",
+ drm_printf(p, "\n\t %-20s %s", "yh_coef",
hqvdp_dbg_get_lut(c->hvsrc.yh_coef));
- seq_printf(s, "\n\t %-20s %s", "ch_coef",
+ drm_printf(p, "\n\t %-20s %s", "ch_coef",
hqvdp_dbg_get_lut(c->hvsrc.ch_coef));
- seq_printf(s, "\n\t %-20s %s", "yv_coef",
+ drm_printf(p, "\n\t %-20s %s", "yv_coef",
hqvdp_dbg_get_lut(c->hvsrc.yv_coef));
- seq_printf(s, "\n\t %-20s %s", "cv_coef",
+ drm_printf(p, "\n\t %-20s %s", "cv_coef",
hqvdp_dbg_get_lut(c->hvsrc.cv_coef));
- seq_printf(s, "\n\t %-20s", "ScaleH");
+ drm_printf(p, "\n\t %-20s", "ScaleH");
if (dst_w > src_w)
- seq_printf(s, " %d/1", dst_w / src_w);
+ drm_printf(p, " %d/1", dst_w / src_w);
else
- seq_printf(s, " 1/%d", src_w / dst_w);
+ drm_printf(p, " 1/%d", src_w / dst_w);
- seq_printf(s, "\n\t %-20s", "tScaleV");
+ drm_printf(p, "\n\t %-20s", "tScaleV");
if (dst_h > src_h)
- seq_printf(s, " %d/1", dst_h / src_h);
+ drm_printf(p, " %d/1", dst_h / src_h);
else
- seq_printf(s, " 1/%d", src_h / dst_h);
+ drm_printf(p, " 1/%d", src_h / dst_h);
- seq_puts(s, "\n\tCSDI:");
- seq_printf(s, "\n\t %-20s 0x%08X\t", "Config", c->csdi.config);
+ drm_printf(p, "\n\tCSDI:");
+ drm_printf(p, "\n\t %-20s 0x%08X\t", "Config", c->csdi.config);
switch (c->csdi.config) {
case CSDI_CONFIG_PROG:
- seq_puts(s, "Bypass");
+ drm_printf(p, "Bypass");
break;
case CSDI_CONFIG_INTER_DIR:
- seq_puts(s, "Deinterlace, directional");
+ drm_printf(p, "Deinterlace, directional");
break;
default:
- seq_puts(s, "<UNKNOWN>");
+ drm_printf(p, "<UNKNOWN>");
break;
}
- seq_printf(s, "\n\t %-20s 0x%08X", "Config2", c->csdi.config2);
- seq_printf(s, "\n\t %-20s 0x%08X", "DcdiConfig", c->csdi.dcdi_config);
+ drm_printf(p, "\n\t %-20s 0x%08X", "Config2", c->csdi.config2);
+ drm_printf(p, "\n\t %-20s 0x%08X", "DcdiConfig", c->csdi.dcdi_config);
}
-static int hqvdp_dbg_show(struct seq_file *s, void *data)
+static void sti_hqvdp_plane_print_state(struct drm_printer *p,
+ const struct drm_plane_state *state)
{
- struct drm_info_node *node = s->private;
- struct sti_hqvdp *hqvdp = (struct sti_hqvdp *)node->info_ent->data;
+ struct sti_plane *plane = to_sti_plane(state->plane);
+ struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
int cmd, cmd_offset, infoxp70;
void *virt;
- seq_printf(s, "%s: (vaddr = 0x%p)",
+ drm_printf(p, "\t%s: (vaddr = 0x%pK)",
sti_plane_to_str(&hqvdp->plane), hqvdp->regs);
DBGFS_DUMP(HQVDP_MBX_IRQ_TO_XP70);
@@ -569,80 +570,64 @@ static int hqvdp_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP(HQVDP_MBX_IRQ_TO_HOST);
DBGFS_DUMP(HQVDP_MBX_INFO_XP70);
infoxp70 = readl(hqvdp->regs + HQVDP_MBX_INFO_XP70);
- seq_puts(s, "\tFirmware state: ");
+ drm_printf(p, "\tFirmware state: ");
if (infoxp70 & INFO_XP70_FW_READY)
- seq_puts(s, "idle and ready");
+ drm_printf(p, "idle and ready");
else if (infoxp70 & INFO_XP70_FW_PROCESSING)
- seq_puts(s, "processing a picture");
+ drm_printf(p, "processing a picture");
else if (infoxp70 & INFO_XP70_FW_INITQUEUES)
- seq_puts(s, "programming queues");
+ drm_printf(p, "programming queues");
else
- seq_puts(s, "NOT READY");
+ drm_printf(p, "NOT READY");
DBGFS_DUMP(HQVDP_MBX_SW_RESET_CTRL);
DBGFS_DUMP(HQVDP_MBX_STARTUP_CTRL1);
if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1)
& STARTUP_CTRL1_RST_DONE)
- seq_puts(s, "\tReset is done");
+ drm_printf(p, "\tReset is done");
else
- seq_puts(s, "\tReset is NOT done");
+ drm_printf(p, "\tReset is NOT done");
DBGFS_DUMP(HQVDP_MBX_STARTUP_CTRL2);
if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL2)
& STARTUP_CTRL2_FETCH_EN)
- seq_puts(s, "\tFetch is enabled");
+ drm_printf(p, "\tFetch is enabled");
else
- seq_puts(s, "\tFetch is NOT enabled");
+ drm_printf(p, "\tFetch is NOT enabled");
DBGFS_DUMP(HQVDP_MBX_GP_STATUS);
DBGFS_DUMP(HQVDP_MBX_NEXT_CMD);
DBGFS_DUMP(HQVDP_MBX_CURRENT_CMD);
DBGFS_DUMP(HQVDP_MBX_SOFT_VSYNC);
if (!(readl(hqvdp->regs + HQVDP_MBX_SOFT_VSYNC) & 3))
- seq_puts(s, "\tHW Vsync");
+ drm_printf(p, "\tHW Vsync");
else
- seq_puts(s, "\tSW Vsync ?!?!");
+ drm_printf(p, "\tSW Vsync ?!?!");
/* Last command */
cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD);
cmd_offset = sti_hqvdp_get_curr_cmd(hqvdp);
if (cmd_offset == -1) {
- seq_puts(s, "\n\n Last command: unknown");
+ drm_printf(p, "\n\n\t\tLast command: unknown");
} else {
virt = hqvdp->hqvdp_cmd + cmd_offset;
- seq_printf(s, "\n\n Last command: address @ 0x%x (0x%p)",
+ drm_printf(p, "\n\n\t\tLast command: address @ 0x%x (0x%p)",
cmd, virt);
- hqvdp_dbg_dump_cmd(s, (struct sti_hqvdp_cmd *)virt);
+ hqvdp_dbg_dump_cmd(p, (struct sti_hqvdp_cmd *)virt);
}
/* Next command */
cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD);
cmd_offset = sti_hqvdp_get_next_cmd(hqvdp);
if (cmd_offset == -1) {
- seq_puts(s, "\n\n Next command: unknown");
+ drm_printf(p, "\n\n\t\tNext command: unknown");
} else {
virt = hqvdp->hqvdp_cmd + cmd_offset;
- seq_printf(s, "\n\n Next command address: @ 0x%x (0x%p)",
+ drm_printf(p, "\n\n\t\tNext command address: @ 0x%x (0x%p)",
cmd, virt);
- hqvdp_dbg_dump_cmd(s, (struct sti_hqvdp_cmd *)virt);
+ hqvdp_dbg_dump_cmd(p, (struct sti_hqvdp_cmd *)virt);
}
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list hqvdp_debugfs_files[] = {
- { "hqvdp", hqvdp_dbg_show, 0, NULL },
-};
-
-static int hqvdp_debugfs_init(struct sti_hqvdp *hqvdp, struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(hqvdp_debugfs_files); i++)
- hqvdp_debugfs_files[i].data = hqvdp;
-
- return drm_debugfs_create_files(hqvdp_debugfs_files,
- ARRAY_SIZE(hqvdp_debugfs_files),
- minor->debugfs_root, minor);
+ drm_printf(p, "\t%s%s\n",
+ plane->fps_info.fps_str, plane->fps_info.fips_str);
}
/**
@@ -1264,14 +1249,6 @@ static void sti_hqvdp_destroy(struct drm_plane *drm_plane)
drm_plane_cleanup(drm_plane);
}
-static int sti_hqvdp_late_register(struct drm_plane *drm_plane)
-{
- struct sti_plane *plane = to_sti_plane(drm_plane);
- struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
-
- return hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary);
-}
-
static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
@@ -1279,7 +1256,7 @@ static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
.reset = sti_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
- .late_register = sti_hqvdp_late_register,
+ .atomic_print_state = sti_hqvdp_plane_print_state,
};
static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev,
--
2.15.0
Convert all sti connectors to atomic_print_state usage rather than
use a debugfs entry.
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/gpu/drm/sti/sti_dvo.c | 60 +++++--------------
drivers/gpu/drm/sti/sti_hda.c | 75 +++++++----------------
drivers/gpu/drm/sti/sti_hdmi.c | 132 ++++++++++++++++-------------------------
3 files changed, 90 insertions(+), 177 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index a5979cd25cc7..5662613ae6e0 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -6,7 +6,6 @@
#include <linux/clk.h>
#include <linux/component.h>
-#include <linux/debugfs.h>
#include <linux/module.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
@@ -158,52 +157,37 @@ static void dvo_awg_configure(struct sti_dvo *dvo, u32 *awg_ram_code, int nb)
writel(DVO_AWG_CTRL_EN, dvo->regs + DVO_AWG_DIGSYNC_CTRL);
}
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(dvo->regs + reg))
-static void dvo_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
+static void dvo_dbg_awg_microcode(struct drm_printer *p, void __iomem *reg)
{
unsigned int i;
- seq_puts(s, "\n\n");
- seq_puts(s, " DVO AWG microcode:");
+ drm_printf(p, "\n\n");
+ drm_printf(p, " DVO AWG microcode:");
for (i = 0; i < AWG_MAX_INST; i++) {
if (i % 8 == 0)
- seq_printf(s, "\n %04X:", i);
- seq_printf(s, " %04X", readl(reg + i * 4));
+ drm_printf(p, "\n %04X:", i);
+ drm_printf(p, " %04X", readl(reg + i * 4));
}
}
-static int dvo_dbg_show(struct seq_file *s, void *data)
+static void sti_dvo_print_state(struct drm_printer *p,
+ const struct drm_connector_state *state)
{
- struct drm_info_node *node = s->private;
- struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
+ struct sti_dvo_connector *dvo_connector
+ = to_sti_dvo_connector(state->connector);
+ struct sti_dvo *dvo = dvo_connector->dvo;
- seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
+ drm_printf(p, "DVO: (vaddr = 0x%p)", dvo->regs);
DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
DBGFS_DUMP(DVO_DOF_CFG);
DBGFS_DUMP(DVO_LUT_PROG_LOW);
DBGFS_DUMP(DVO_LUT_PROG_MID);
DBGFS_DUMP(DVO_LUT_PROG_HIGH);
- dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list dvo_debugfs_files[] = {
- { "dvo", dvo_dbg_show, 0, NULL },
-};
-
-static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
- dvo_debugfs_files[i].data = dvo;
-
- return drm_debugfs_create_files(dvo_debugfs_files,
- ARRAY_SIZE(dvo_debugfs_files),
- minor->debugfs_root, minor);
+ dvo_dbg_awg_microcode(p, dvo->regs + DVO_DIGSYNC_INSTR_I);
+ drm_printf(p, "\n");
}
static void sti_dvo_disable(struct drm_bridge *bridge)
@@ -397,20 +381,6 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
return connector_status_disconnected;
}
-static int sti_dvo_late_register(struct drm_connector *connector)
-{
- struct sti_dvo_connector *dvo_connector
- = to_sti_dvo_connector(connector);
- struct sti_dvo *dvo = dvo_connector->dvo;
-
- if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) {
- DRM_ERROR("DVO debugfs setup failed\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
static const struct drm_connector_funcs sti_dvo_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_dvo_connector_detect,
@@ -418,7 +388,7 @@ static const struct drm_connector_funcs sti_dvo_connector_funcs = {
.reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
- .late_register = sti_dvo_late_register,
+ .atomic_print_state = sti_dvo_print_state,
};
static struct drm_encoder *sti_dvo_find_encoder(struct drm_device *dev)
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 67bbdb49fffc..0734f2751505 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -307,71 +307,56 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
}
}
-#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
+#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
readl(hda->regs + reg))
-static void hda_dbg_cfg(struct seq_file *s, int val)
+static void hda_dbg_cfg(struct drm_printer *p, int val)
{
- seq_puts(s, "\tAWG ");
- seq_puts(s, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
+ drm_printf(p, "\tAWG ");
+ drm_printf(p, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
}
-static void hda_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
+static void hda_dbg_awg_microcode(struct drm_printer *p, void __iomem *reg)
{
unsigned int i;
- seq_puts(s, "\n\n HDA AWG microcode:");
+ drm_printf(p, "\n\n HDA AWG microcode:");
for (i = 0; i < AWG_MAX_INST; i++) {
if (i % 8 == 0)
- seq_printf(s, "\n %04X:", i);
- seq_printf(s, " %04X", readl(reg + i * 4));
+ drm_printf(p, "\n %04X:", i);
+ drm_printf(p, " %04X", readl(reg + i * 4));
}
}
-static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
+static void hda_dbg_video_dacs_ctrl(struct drm_printer *p, void __iomem *reg)
{
u32 val = readl(reg);
- seq_printf(s, "\n\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
- seq_puts(s, "\tHD DACs ");
- seq_puts(s, val & DAC_CFG_HD_HZUVW_OFF_MASK ? "disabled" : "enabled");
+ drm_printf(p, "\n\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
+ drm_printf(p, "\tHD DACs ");
+ drm_printf(p, val & DAC_CFG_HD_HZUVW_OFF_MASK ? "disabled" : "enabled");
}
-static int hda_dbg_show(struct seq_file *s, void *data)
+static void sti_hda_print_state(struct drm_printer *p,
+ const struct drm_connector_state *state)
{
- struct drm_info_node *node = s->private;
- struct sti_hda *hda = (struct sti_hda *)node->info_ent->data;
+ struct sti_hda_connector *hda_connector
+ = to_sti_hda_connector(state->connector);
+ struct sti_hda *hda = hda_connector->hda;
- seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs);
+ drm_printf(p, "HD Analog: (vaddr = 0x%pK)", hda->regs);
DBGFS_DUMP(HDA_ANA_CFG);
- hda_dbg_cfg(s, readl(hda->regs + HDA_ANA_CFG));
+ hda_dbg_cfg(p, readl(hda->regs + HDA_ANA_CFG));
DBGFS_DUMP(HDA_ANA_SCALE_CTRL_Y);
DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CB);
DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CR);
DBGFS_DUMP(HDA_ANA_ANC_CTRL);
DBGFS_DUMP(HDA_ANA_SRC_Y_CFG);
DBGFS_DUMP(HDA_ANA_SRC_C_CFG);
- hda_dbg_awg_microcode(s, hda->regs + HDA_SYNC_AWGI);
+ hda_dbg_awg_microcode(p, hda->regs + HDA_SYNC_AWGI);
if (hda->video_dacs_ctrl)
- hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list hda_debugfs_files[] = {
- { "hda", hda_dbg_show, 0, NULL },
-};
-
-static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
- hda_debugfs_files[i].data = hda;
-
- return drm_debugfs_create_files(hda_debugfs_files,
- ARRAY_SIZE(hda_debugfs_files),
- minor->debugfs_root, minor);
+ hda_dbg_video_dacs_ctrl(p, hda->video_dacs_ctrl);
+ drm_printf(p, "\n");
}
/**
@@ -632,27 +617,13 @@ struct drm_connector_helper_funcs sti_hda_connector_helper_funcs = {
.mode_valid = sti_hda_connector_mode_valid,
};
-static int sti_hda_late_register(struct drm_connector *connector)
-{
- struct sti_hda_connector *hda_connector
- = to_sti_hda_connector(connector);
- struct sti_hda *hda = hda_connector->hda;
-
- if (hda_debugfs_init(hda, hda->drm_dev->primary)) {
- DRM_ERROR("HDA debugfs setup failed\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
static const struct drm_connector_funcs sti_hda_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
.reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
- .late_register = sti_hda_late_register,
+ .atomic_print_state = sti_hda_print_state,
};
static struct drm_encoder *sti_hda_find_encoder(struct drm_device *dev)
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 58f431102512..b1313b3321bf 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -584,49 +584,49 @@ static void hdmi_swreset(struct sti_hdmi *hdmi)
clk_disable_unprepare(hdmi->clk_audio);
}
-#define DBGFS_PRINT_STR(str1, str2) seq_printf(s, "%-24s %s\n", str1, str2)
-#define DBGFS_PRINT_INT(str1, int2) seq_printf(s, "%-24s %d\n", str1, int2)
-#define DBGFS_DUMP(str, reg) seq_printf(s, "%s %-25s 0x%08X", str, #reg, \
+#define DBGFS_PRINT_STR(str1, str2) drm_printf(p, "%-24s %s\n", str1, str2)
+#define DBGFS_PRINT_INT(str1, int2) drm_printf(p, "%-24s %d\n", str1, int2)
+#define DBGFS_DUMP(str, reg) drm_printf(p, "%s\t%-25s 0x%08X", str, #reg, \
hdmi_read(hdmi, reg))
-#define DBGFS_DUMP_DI(reg, slot) DBGFS_DUMP("\n", reg(slot))
+#define DBGFS_DUMP_DI(reg, slot) DBGFS_DUMP("\n\t\t", reg(slot))
-static void hdmi_dbg_cfg(struct seq_file *s, int val)
+static void hdmi_dbg_cfg(struct drm_printer *p, int val)
{
int tmp;
- seq_putc(s, '\t');
+ drm_printf(p, "\t");
tmp = val & HDMI_CFG_HDMI_NOT_DVI;
DBGFS_PRINT_STR("mode:", tmp ? "HDMI" : "DVI");
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = val & HDMI_CFG_HDCP_EN;
DBGFS_PRINT_STR("HDCP:", tmp ? "enable" : "disable");
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = val & HDMI_CFG_ESS_NOT_OESS;
DBGFS_PRINT_STR("HDCP mode:", tmp ? "ESS enable" : "OESS enable");
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = val & HDMI_CFG_H_SYNC_POL_NEG;
DBGFS_PRINT_STR("Hsync polarity:", tmp ? "inverted" : "normal");
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = val & HDMI_CFG_V_SYNC_POL_NEG;
DBGFS_PRINT_STR("Vsync polarity:", tmp ? "inverted" : "normal");
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = val & HDMI_CFG_422_EN;
DBGFS_PRINT_STR("YUV422 format:", tmp ? "enable" : "disable");
}
-static void hdmi_dbg_sta(struct seq_file *s, int val)
+static void hdmi_dbg_sta(struct drm_printer *p, int val)
{
int tmp;
- seq_putc(s, '\t');
+ drm_printf(p, "\t");
tmp = (val & HDMI_STA_DLL_LCK);
DBGFS_PRINT_STR("pll:", tmp ? "locked" : "not locked");
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = (val & HDMI_STA_HOT_PLUG);
DBGFS_PRINT_STR("hdmi cable:", tmp ? "connected" : "not connected");
}
-static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
+static void hdmi_dbg_sw_di_cfg(struct drm_printer *p, int val)
{
int tmp;
char *const en_di[] = {"no transmission",
@@ -634,57 +634,59 @@ static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
"once every field",
"once every frame"};
- seq_putc(s, '\t');
+ drm_printf(p, "\t");
tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 1));
DBGFS_PRINT_STR("Data island 1:", en_di[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 2)) >> 4;
DBGFS_PRINT_STR("Data island 2:", en_di[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 3)) >> 8;
DBGFS_PRINT_STR("Data island 3:", en_di[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 4)) >> 12;
DBGFS_PRINT_STR("Data island 4:", en_di[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 5)) >> 16;
DBGFS_PRINT_STR("Data island 5:", en_di[tmp]);
- seq_puts(s, "\t\t\t\t\t");
+ drm_printf(p, "\t\t\t\t\t");
tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 6)) >> 20;
DBGFS_PRINT_STR("Data island 6:", en_di[tmp]);
}
-static int hdmi_dbg_show(struct seq_file *s, void *data)
+static void sti_hdmi_print_state(struct drm_printer *p,
+ const struct drm_connector_state *state)
{
- struct drm_info_node *node = s->private;
- struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data;
-
- seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs);
- DBGFS_DUMP("\n", HDMI_CFG);
- hdmi_dbg_cfg(s, hdmi_read(hdmi, HDMI_CFG));
- DBGFS_DUMP("", HDMI_INT_EN);
- DBGFS_DUMP("\n", HDMI_STA);
- hdmi_dbg_sta(s, hdmi_read(hdmi, HDMI_STA));
- DBGFS_DUMP("", HDMI_ACTIVE_VID_XMIN);
- seq_putc(s, '\t');
+ struct sti_hdmi_connector *hdmi_connector
+ = to_sti_hdmi_connector(state->connector);
+ struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+
+ drm_printf(p, "\tHDMI: (vaddr = 0x%pK)", hdmi->regs);
+ DBGFS_DUMP("\n\t\t", HDMI_CFG);
+ hdmi_dbg_cfg(p, hdmi_read(hdmi, HDMI_CFG));
+ DBGFS_DUMP("\t\t", HDMI_INT_EN);
+ DBGFS_DUMP("\n\t\t", HDMI_STA);
+ hdmi_dbg_sta(p, hdmi_read(hdmi, HDMI_STA));
+ DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_XMIN);
+ drm_printf(p, "\t");
DBGFS_PRINT_INT("Xmin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMIN));
- DBGFS_DUMP("", HDMI_ACTIVE_VID_XMAX);
- seq_putc(s, '\t');
+ DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_XMAX);
+ drm_printf(p, "\t");
DBGFS_PRINT_INT("Xmax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMAX));
- DBGFS_DUMP("", HDMI_ACTIVE_VID_YMIN);
- seq_putc(s, '\t');
+ DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_YMIN);
+ drm_printf(p, "\t");
DBGFS_PRINT_INT("Ymin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMIN));
- DBGFS_DUMP("", HDMI_ACTIVE_VID_YMAX);
- seq_putc(s, '\t');
+ DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_YMAX);
+ drm_printf(p, "\t");
DBGFS_PRINT_INT("Ymax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMAX));
- DBGFS_DUMP("", HDMI_SW_DI_CFG);
- hdmi_dbg_sw_di_cfg(s, hdmi_read(hdmi, HDMI_SW_DI_CFG));
+ DBGFS_DUMP("\t\t", HDMI_SW_DI_CFG);
+ hdmi_dbg_sw_di_cfg(p, hdmi_read(hdmi, HDMI_SW_DI_CFG));
- DBGFS_DUMP("\n", HDMI_AUDIO_CFG);
- DBGFS_DUMP("\n", HDMI_SPDIF_FIFO_STATUS);
- DBGFS_DUMP("\n", HDMI_AUDN);
+ DBGFS_DUMP("\n\t\t", HDMI_AUDIO_CFG);
+ DBGFS_DUMP("\n\t\t", HDMI_SPDIF_FIFO_STATUS);
+ DBGFS_DUMP("\n\t\t", HDMI_AUDN);
- seq_printf(s, "\n AVI Infoframe (Data Island slot N=%d):",
+ drm_printf(p, "\n\t\tAVI Infoframe (Data Island slot N=%d):",
HDMI_IFRAME_SLOT_AVI);
DBGFS_DUMP_DI(HDMI_SW_DI_N_HEAD_WORD, HDMI_IFRAME_SLOT_AVI);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD0, HDMI_IFRAME_SLOT_AVI);
@@ -694,7 +696,7 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD4, HDMI_IFRAME_SLOT_AVI);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD5, HDMI_IFRAME_SLOT_AVI);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_AVI);
- seq_printf(s, "\n\n AUDIO Infoframe (Data Island slot N=%d):",
+ drm_printf(p, "\n\t\tAUDIO Infoframe (Data Island slot N=%d):",
HDMI_IFRAME_SLOT_AUDIO);
DBGFS_DUMP_DI(HDMI_SW_DI_N_HEAD_WORD, HDMI_IFRAME_SLOT_AUDIO);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD0, HDMI_IFRAME_SLOT_AUDIO);
@@ -704,7 +706,8 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD4, HDMI_IFRAME_SLOT_AUDIO);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD5, HDMI_IFRAME_SLOT_AUDIO);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_AUDIO);
- seq_printf(s, "\n\n VENDOR SPECIFIC Infoframe (Data Island slot N=%d):",
+ drm_printf(p,
+ "\n\t\tVENDOR SPECIFIC Infoframe (Data Island slot N=%d):",
HDMI_IFRAME_SLOT_VENDOR);
DBGFS_DUMP_DI(HDMI_SW_DI_N_HEAD_WORD, HDMI_IFRAME_SLOT_VENDOR);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD0, HDMI_IFRAME_SLOT_VENDOR);
@@ -714,24 +717,7 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD4, HDMI_IFRAME_SLOT_VENDOR);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD5, HDMI_IFRAME_SLOT_VENDOR);
DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_VENDOR);
- seq_putc(s, '\n');
- return 0;
-}
-
-static struct drm_info_list hdmi_debugfs_files[] = {
- { "hdmi", hdmi_dbg_show, 0, NULL },
-};
-
-static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(hdmi_debugfs_files); i++)
- hdmi_debugfs_files[i].data = hdmi;
-
- return drm_debugfs_create_files(hdmi_debugfs_files,
- ARRAY_SIZE(hdmi_debugfs_files),
- minor->debugfs_root, minor);
+ drm_printf(p, "\n");
}
static void sti_hdmi_disable(struct drm_bridge *bridge)
@@ -1099,20 +1085,6 @@ sti_hdmi_connector_get_property(struct drm_connector *connector,
return -EINVAL;
}
-static int sti_hdmi_late_register(struct drm_connector *connector)
-{
- struct sti_hdmi_connector *hdmi_connector
- = to_sti_hdmi_connector(connector);
- struct sti_hdmi *hdmi = hdmi_connector->hdmi;
-
- if (hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary)) {
- DRM_ERROR("HDMI debugfs setup failed\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_hdmi_connector_detect,
@@ -1122,7 +1094,7 @@ static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
.atomic_get_property = sti_hdmi_connector_get_property,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
- .late_register = sti_hdmi_late_register,
+ .atomic_print_state = sti_hdmi_print_state,
};
static struct drm_encoder *sti_hdmi_find_encoder(struct drm_device *dev)
--
2.15.0
Hi Benjamin,
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> When dumping plane state print normalized zpos value as done for
> the other plane state fields.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/drm_atomic.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 07fef42869aa..cd1d677617c8 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -988,6 +988,7 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,
> drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest));
> drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src));
> drm_printf(p, "\trotation=%x\n", state->rotation);
> + drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos);
> drm_printf(p, "\tcolor-encoding=%s\n",
> drm_get_color_encoding_name(state->color_encoding));
> drm_printf(p, "\tcolor-range=%s\n",
>
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe :-)
Hi Benjamin,
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> Even if encoders don't have state it could be useful to get information
> from them when dumping of the other elements state.
> Add an optional hook in drm_encoder_funcs structure and call it after crtc
> print state.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/drm_atomic.c | 15 +++++++++++++++
> include/drm/drm_encoder.h | 12 ++++++++++++
> 2 files changed, 27 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index cd1d677617c8..6a9f5be01172 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -28,6 +28,7 @@
>
> #include <drm/drmP.h>
> #include <drm/drm_atomic.h>
> +#include <drm/drm_encoder.h>
> #include <drm/drm_mode.h>
> #include <drm/drm_print.h>
> #include <linux/sync_file.h>
> @@ -1799,6 +1800,15 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
> }
> EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
>
> +static void drm_atomic_encoder_print(struct drm_printer *p,
> + struct drm_encoder *encoder)
> +{
> + drm_printf(p, "encoder[%u]: %s\n", encoder->base.id, encoder->name);
> +
> + if (encoder->funcs->atomic_print)
> + encoder->funcs->atomic_print(p, encoder);
> +}
> +
> static void drm_atomic_print_state(const struct drm_atomic_state *state)
> {
> struct drm_printer p = drm_info_printer(state->dev->dev);
> @@ -1828,6 +1838,7 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
> struct drm_mode_config *config = &dev->mode_config;
> struct drm_plane *plane;
> struct drm_crtc *crtc;
> + struct drm_encoder *encoder;
> struct drm_connector *connector;
> struct drm_connector_list_iter conn_iter;
>
> @@ -1850,6 +1861,10 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
> drm_modeset_unlock(&crtc->mutex);
> }
>
> + drm_for_each_encoder(encoder, dev) {
> + drm_atomic_encoder_print(p, encoder);
> + }
> +
> drm_connector_list_iter_begin(dev, &conn_iter);
> if (take_locks)
> drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
> diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
> index fb299696c7c4..b847dad817b0 100644
> --- a/include/drm/drm_encoder.h
> +++ b/include/drm/drm_encoder.h
> @@ -80,6 +80,18 @@ struct drm_encoder_funcs {
> * before data structures are torndown.
> */
> void (*early_unregister)(struct drm_encoder *encoder);
> +
> + /**
> + * @atomic_print
> + *
> + * If driver could implement this optional hook for printing
> + * additional driver specific information.
> + *
> + * Do not call this directly, use drm_atomic_encoder_print()
> + * instead.
> + */
> + void (*atomic_print)(struct drm_printer *p,
> + struct drm_encoder *encoder);
sorry for the late reply.
drm_connector.h, drm_crtc.h & drm_plane.h use "atomic_print_state"
instead of "atomic_print". You may consider renaming it... or not : )
With or without that,
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe :-)
> };
>
> /**
>
Hi Benjamin,
Nice to see all these lines removed :-)
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe :-)
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> Convert all sti planes to atomic_print_state usage rather than use a debugfs
> entry.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/sti/sti_cursor.c | 65 +++++--------
> drivers/gpu/drm/sti/sti_gdp.c | 196 +++++++++++++--------------------------
> drivers/gpu/drm/sti/sti_hqvdp.c | 149 +++++++++++++----------------
> 3 files changed, 146 insertions(+), 264 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
> index df0a282b9615..69f6b1091422 100644
> --- a/drivers/gpu/drm/sti/sti_cursor.c
> +++ b/drivers/gpu/drm/sti/sti_cursor.c
> @@ -74,72 +74,57 @@ static const uint32_t cursor_supported_formats[] = {
>
> #define to_sti_cursor(x) container_of(x, struct sti_cursor, plane)
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(cursor->regs + reg))
>
> -static void cursor_dbg_vpo(struct seq_file *s, u32 val)
> +static void cursor_dbg_vpo(struct drm_printer *p, u32 val)
> {
> - seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
> + drm_printf(p, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
> }
>
> -static void cursor_dbg_size(struct seq_file *s, u32 val)
> +static void cursor_dbg_size(struct drm_printer *p, u32 val)
> {
> - seq_printf(s, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF);
> + drm_printf(p, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF);
> }
>
> -static void cursor_dbg_pml(struct seq_file *s,
> +static void cursor_dbg_pml(struct drm_printer *p,
> struct sti_cursor *cursor, u32 val)
> {
> if (cursor->pixmap.paddr == val)
> - seq_printf(s, "\tVirt @: %p", cursor->pixmap.base);
> + drm_printf(p, "\tVirt @: %pK", cursor->pixmap.base);
> }
>
> -static void cursor_dbg_cml(struct seq_file *s,
> +static void cursor_dbg_cml(struct drm_printer *p,
> struct sti_cursor *cursor, u32 val)
> {
> if (cursor->clut_paddr == val)
> - seq_printf(s, "\tVirt @: %p", cursor->clut);
> + drm_printf(p, "\tVirt @: %pK", cursor->clut);
> }
>
> -static int cursor_dbg_show(struct seq_file *s, void *data)
> +static void sti_cursor_plane_print_state(struct drm_printer *p,
> + const struct drm_plane_state *state)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data;
> + struct sti_plane *plane = to_sti_plane(state->plane);
> + struct sti_cursor *cursor = to_sti_cursor(plane);
>
> - seq_printf(s, "%s: (vaddr = 0x%p)",
> + drm_printf(p, "\t%s: (vaddr = 0x%pK)",
> sti_plane_to_str(&cursor->plane), cursor->regs);
>
> DBGFS_DUMP(CUR_CTL);
> DBGFS_DUMP(CUR_VPO);
> - cursor_dbg_vpo(s, readl(cursor->regs + CUR_VPO));
> + cursor_dbg_vpo(p, readl(cursor->regs + CUR_VPO));
> DBGFS_DUMP(CUR_PML);
> - cursor_dbg_pml(s, cursor, readl(cursor->regs + CUR_PML));
> + cursor_dbg_pml(p, cursor, readl(cursor->regs + CUR_PML));
> DBGFS_DUMP(CUR_PMP);
> DBGFS_DUMP(CUR_SIZE);
> - cursor_dbg_size(s, readl(cursor->regs + CUR_SIZE));
> + cursor_dbg_size(p, readl(cursor->regs + CUR_SIZE));
> DBGFS_DUMP(CUR_CML);
> - cursor_dbg_cml(s, cursor, readl(cursor->regs + CUR_CML));
> + cursor_dbg_cml(p, cursor, readl(cursor->regs + CUR_CML));
> DBGFS_DUMP(CUR_AWS);
> DBGFS_DUMP(CUR_AWE);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list cursor_debugfs_files[] = {
> - { "cursor", cursor_dbg_show, 0, NULL },
> -};
> -
> -static int cursor_debugfs_init(struct sti_cursor *cursor,
> - struct drm_minor *minor)
> -{
> - unsigned int i;
>
> - for (i = 0; i < ARRAY_SIZE(cursor_debugfs_files); i++)
> - cursor_debugfs_files[i].data = cursor;
> -
> - return drm_debugfs_create_files(cursor_debugfs_files,
> - ARRAY_SIZE(cursor_debugfs_files),
> - minor->debugfs_root, minor);
> + drm_printf(p, "\t%s%s\n",
> + plane->fps_info.fps_str, plane->fps_info.fips_str);
> }
>
> static void sti_cursor_argb8888_to_clut8(struct sti_cursor *cursor, u32 *src)
> @@ -336,14 +321,6 @@ static void sti_cursor_destroy(struct drm_plane *drm_plane)
> drm_plane_cleanup(drm_plane);
> }
>
> -static int sti_cursor_late_register(struct drm_plane *drm_plane)
> -{
> - struct sti_plane *plane = to_sti_plane(drm_plane);
> - struct sti_cursor *cursor = to_sti_cursor(plane);
> -
> - return cursor_debugfs_init(cursor, drm_plane->dev->primary);
> -}
> -
> static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
> .update_plane = drm_atomic_helper_update_plane,
> .disable_plane = drm_atomic_helper_disable_plane,
> @@ -351,7 +328,7 @@ static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
> .reset = sti_plane_reset,
> .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> - .late_register = sti_cursor_late_register,
> + .atomic_print_state = sti_cursor_plane_print_state,
> };
>
> struct drm_plane *sti_cursor_create(struct drm_device *drm_dev,
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 49813d34bdf0..55789bae72c1 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -139,42 +139,42 @@ static const uint32_t gdp_supported_formats[] = {
> DRM_FORMAT_RGB888,
> };
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(gdp->regs + reg ## _OFFSET))
>
> -static void gdp_dbg_ctl(struct seq_file *s, int val)
> +static void gdp_dbg_ctl(struct drm_printer *p, int val)
> {
> int i;
>
> - seq_puts(s, "\tColor:");
> + drm_printf(p, "\tColor:");
> for (i = 0; i < ARRAY_SIZE(gdp_format_to_str); i++) {
> if (gdp_format_to_str[i].format == (val & 0x1F)) {
> - seq_puts(s, gdp_format_to_str[i].name);
> + drm_printf(p, gdp_format_to_str[i].name);
> break;
> }
> }
> if (i == ARRAY_SIZE(gdp_format_to_str))
> - seq_puts(s, "<UNKNOWN>");
> + drm_printf(p, "<UNKNOWN>");
>
> - seq_printf(s, "\tWaitNextVsync:%d", val & WAIT_NEXT_VSYNC ? 1 : 0);
> + drm_printf(p, "\tWaitNextVsync:%d", val & WAIT_NEXT_VSYNC ? 1 : 0);
> }
>
> -static void gdp_dbg_vpo(struct seq_file *s, int val)
> +static void gdp_dbg_vpo(struct drm_printer *p, int val)
> {
> - seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
> + drm_printf(p, "\txdo:%4d\tydo:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
> }
>
> -static void gdp_dbg_vps(struct seq_file *s, int val)
> +static void gdp_dbg_vps(struct drm_printer *p, int val)
> {
> - seq_printf(s, "\txds:%4d\tyds:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
> + drm_printf(p, "\txds:%4d\tyds:%4d", val & 0xFFFF, (val >> 16) & 0xFFFF);
> }
>
> -static void gdp_dbg_size(struct seq_file *s, int val)
> +static void gdp_dbg_size(struct drm_printer *p, int val)
> {
> - seq_printf(s, "\t%d x %d", val & 0xFFFF, (val >> 16) & 0xFFFF);
> + drm_printf(p, "\t%d x %d", val & 0xFFFF, (val >> 16) & 0xFFFF);
> }
>
> -static void gdp_dbg_nvn(struct seq_file *s, struct sti_gdp *gdp, int val)
> +static void gdp_dbg_nvn(struct drm_printer *p, struct sti_gdp *gdp, int val)
> {
> void *base = NULL;
> unsigned int i;
> @@ -191,157 +191,93 @@ static void gdp_dbg_nvn(struct seq_file *s, struct sti_gdp *gdp, int val)
> }
>
> if (base)
> - seq_printf(s, "\tVirt @: %p", base);
> + drm_printf(p, "\tVirt @: %pK", base);
> }
>
> -static void gdp_dbg_ppt(struct seq_file *s, int val)
> +static void gdp_dbg_ppt(struct drm_printer *p, int val)
> {
> if (val & GAM_GDP_PPT_IGNORE)
> - seq_puts(s, "\tNot displayed on mixer!");
> + drm_printf(p, "\tNot displayed on mixer!");
> }
>
> -static void gdp_dbg_mst(struct seq_file *s, int val)
> +static void gdp_dbg_mst(struct drm_printer *p, int val)
> {
> if (val & 1)
> - seq_puts(s, "\tBUFFER UNDERFLOW!");
> + drm_printf(p, "\tBUFFER UNDERFLOW!");
> }
>
> -static int gdp_dbg_show(struct seq_file *s, void *data)
> +static int gdp_dbg_show(struct drm_printer *p, struct sti_gdp *gdp)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
> - struct drm_plane *drm_plane = &gdp->plane.drm_plane;
> - struct drm_crtc *crtc;
> -
> - drm_modeset_lock(&drm_plane->mutex, NULL);
> - crtc = drm_plane->state->crtc;
> - drm_modeset_unlock(&drm_plane->mutex);
> -
> - seq_printf(s, "%s: (vaddr = 0x%p)",
> + drm_printf(p, "\t%s: (vaddr = 0x%pK)",
> sti_plane_to_str(&gdp->plane), gdp->regs);
>
> DBGFS_DUMP(GAM_GDP_CTL);
> - gdp_dbg_ctl(s, readl(gdp->regs + GAM_GDP_CTL_OFFSET));
> + gdp_dbg_ctl(p, readl(gdp->regs + GAM_GDP_CTL_OFFSET));
> DBGFS_DUMP(GAM_GDP_AGC);
> DBGFS_DUMP(GAM_GDP_VPO);
> - gdp_dbg_vpo(s, readl(gdp->regs + GAM_GDP_VPO_OFFSET));
> + gdp_dbg_vpo(p, readl(gdp->regs + GAM_GDP_VPO_OFFSET));
> DBGFS_DUMP(GAM_GDP_VPS);
> - gdp_dbg_vps(s, readl(gdp->regs + GAM_GDP_VPS_OFFSET));
> + gdp_dbg_vps(p, readl(gdp->regs + GAM_GDP_VPS_OFFSET));
> DBGFS_DUMP(GAM_GDP_PML);
> DBGFS_DUMP(GAM_GDP_PMP);
> DBGFS_DUMP(GAM_GDP_SIZE);
> - gdp_dbg_size(s, readl(gdp->regs + GAM_GDP_SIZE_OFFSET));
> + gdp_dbg_size(p, readl(gdp->regs + GAM_GDP_SIZE_OFFSET));
> DBGFS_DUMP(GAM_GDP_NVN);
> - gdp_dbg_nvn(s, gdp, readl(gdp->regs + GAM_GDP_NVN_OFFSET));
> + gdp_dbg_nvn(p, gdp, readl(gdp->regs + GAM_GDP_NVN_OFFSET));
> DBGFS_DUMP(GAM_GDP_KEY1);
> DBGFS_DUMP(GAM_GDP_KEY2);
> DBGFS_DUMP(GAM_GDP_PPT);
> - gdp_dbg_ppt(s, readl(gdp->regs + GAM_GDP_PPT_OFFSET));
> + gdp_dbg_ppt(p, readl(gdp->regs + GAM_GDP_PPT_OFFSET));
> DBGFS_DUMP(GAM_GDP_CML);
> DBGFS_DUMP(GAM_GDP_MST);
> - gdp_dbg_mst(s, readl(gdp->regs + GAM_GDP_MST_OFFSET));
> -
> - seq_puts(s, "\n\n");
> - if (!crtc)
> - seq_puts(s, " Not connected to any DRM CRTC\n");
> - else
> - seq_printf(s, " Connected to DRM CRTC #%d (%s)\n",
> - crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)));
> + gdp_dbg_mst(p, readl(gdp->regs + GAM_GDP_MST_OFFSET));
>
> + drm_printf(p, "\n");
> return 0;
> }
>
> -static void gdp_node_dump_node(struct seq_file *s, struct sti_gdp_node *node)
> +static void gdp_node_dump_node(struct drm_printer *p, struct sti_gdp_node *node)
> {
> - seq_printf(s, "\t@:0x%p", node);
> - seq_printf(s, "\n\tCTL 0x%08X", node->gam_gdp_ctl);
> - gdp_dbg_ctl(s, node->gam_gdp_ctl);
> - seq_printf(s, "\n\tAGC 0x%08X", node->gam_gdp_agc);
> - seq_printf(s, "\n\tVPO 0x%08X", node->gam_gdp_vpo);
> - gdp_dbg_vpo(s, node->gam_gdp_vpo);
> - seq_printf(s, "\n\tVPS 0x%08X", node->gam_gdp_vps);
> - gdp_dbg_vps(s, node->gam_gdp_vps);
> - seq_printf(s, "\n\tPML 0x%08X", node->gam_gdp_pml);
> - seq_printf(s, "\n\tPMP 0x%08X", node->gam_gdp_pmp);
> - seq_printf(s, "\n\tSIZE 0x%08X", node->gam_gdp_size);
> - gdp_dbg_size(s, node->gam_gdp_size);
> - seq_printf(s, "\n\tNVN 0x%08X", node->gam_gdp_nvn);
> - seq_printf(s, "\n\tKEY1 0x%08X", node->gam_gdp_key1);
> - seq_printf(s, "\n\tKEY2 0x%08X", node->gam_gdp_key2);
> - seq_printf(s, "\n\tPPT 0x%08X", node->gam_gdp_ppt);
> - gdp_dbg_ppt(s, node->gam_gdp_ppt);
> - seq_printf(s, "\n\tCML 0x%08X\n", node->gam_gdp_cml);
> + drm_printf(p, "\t@:0x%pK", node);
> + drm_printf(p, "\n\t\tCTL 0x%08X", node->gam_gdp_ctl);
> + gdp_dbg_ctl(p, node->gam_gdp_ctl);
> + drm_printf(p, "\n\t\tAGC 0x%08X", node->gam_gdp_agc);
> + drm_printf(p, "\n\t\tVPO 0x%08X", node->gam_gdp_vpo);
> + gdp_dbg_vpo(p, node->gam_gdp_vpo);
> + drm_printf(p, "\n\t\tVPS 0x%08X", node->gam_gdp_vps);
> + gdp_dbg_vps(p, node->gam_gdp_vps);
> + drm_printf(p, "\n\t\tPML 0x%08X", node->gam_gdp_pml);
> + drm_printf(p, "\n\t\tPMP 0x%08X", node->gam_gdp_pmp);
> + drm_printf(p, "\n\t\tSIZE 0x%08X", node->gam_gdp_size);
> + gdp_dbg_size(p, node->gam_gdp_size);
> + drm_printf(p, "\n\t\tNVN 0x%08X", node->gam_gdp_nvn);
> + drm_printf(p, "\n\t\tKEY1 0x%08X", node->gam_gdp_key1);
> + drm_printf(p, "\n\t\tKEY2 0x%08X", node->gam_gdp_key2);
> + drm_printf(p, "\n\t\tPPT 0x%08X", node->gam_gdp_ppt);
> + gdp_dbg_ppt(p, node->gam_gdp_ppt);
> + drm_printf(p, "\n\t\tCML 0x%08X\n", node->gam_gdp_cml);
> }
>
> -static int gdp_node_dbg_show(struct seq_file *s, void *arg)
> +static void sti_gdp_plane_print_state(struct drm_printer *p,
> + const struct drm_plane_state *state)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
> + struct sti_plane *plane = to_sti_plane(state->plane);
> + struct sti_gdp *gdp = to_sti_gdp(plane);
> unsigned int b;
>
> - for (b = 0; b < GDP_NODE_NB_BANK; b++) {
> - seq_printf(s, "\n%s[%d].top", sti_plane_to_str(&gdp->plane), b);
> - gdp_node_dump_node(s, gdp->node_list[b].top_field);
> - seq_printf(s, "\n%s[%d].btm", sti_plane_to_str(&gdp->plane), b);
> - gdp_node_dump_node(s, gdp->node_list[b].btm_field);
> - }
> -
> - return 0;
> -}
> -
> -static struct drm_info_list gdp0_debugfs_files[] = {
> - { "gdp0", gdp_dbg_show, 0, NULL },
> - { "gdp0_node", gdp_node_dbg_show, 0, NULL },
> -};
> -
> -static struct drm_info_list gdp1_debugfs_files[] = {
> - { "gdp1", gdp_dbg_show, 0, NULL },
> - { "gdp1_node", gdp_node_dbg_show, 0, NULL },
> -};
> -
> -static struct drm_info_list gdp2_debugfs_files[] = {
> - { "gdp2", gdp_dbg_show, 0, NULL },
> - { "gdp2_node", gdp_node_dbg_show, 0, NULL },
> -};
> -
> -static struct drm_info_list gdp3_debugfs_files[] = {
> - { "gdp3", gdp_dbg_show, 0, NULL },
> - { "gdp3_node", gdp_node_dbg_show, 0, NULL },
> -};
> -
> -static int gdp_debugfs_init(struct sti_gdp *gdp, struct drm_minor *minor)
> -{
> - unsigned int i;
> - struct drm_info_list *gdp_debugfs_files;
> - int nb_files;
> + gdp_dbg_show(p, gdp);
>
> - switch (gdp->plane.desc) {
> - case STI_GDP_0:
> - gdp_debugfs_files = gdp0_debugfs_files;
> - nb_files = ARRAY_SIZE(gdp0_debugfs_files);
> - break;
> - case STI_GDP_1:
> - gdp_debugfs_files = gdp1_debugfs_files;
> - nb_files = ARRAY_SIZE(gdp1_debugfs_files);
> - break;
> - case STI_GDP_2:
> - gdp_debugfs_files = gdp2_debugfs_files;
> - nb_files = ARRAY_SIZE(gdp2_debugfs_files);
> - break;
> - case STI_GDP_3:
> - gdp_debugfs_files = gdp3_debugfs_files;
> - nb_files = ARRAY_SIZE(gdp3_debugfs_files);
> - break;
> - default:
> - return -EINVAL;
> + for (b = 0; b < GDP_NODE_NB_BANK; b++) {
> + drm_printf(p, "\t%s[%d].top\n",
> + sti_plane_to_str(&gdp->plane), b);
> + gdp_node_dump_node(p, gdp->node_list[b].top_field);
> + drm_printf(p, "\t%s[%d].btm\n",
> + sti_plane_to_str(&gdp->plane), b);
> + gdp_node_dump_node(p, gdp->node_list[b].btm_field);
> }
>
> - for (i = 0; i < nb_files; i++)
> - gdp_debugfs_files[i].data = gdp;
> -
> - return drm_debugfs_create_files(gdp_debugfs_files,
> - nb_files,
> - minor->debugfs_root, minor);
> + drm_printf(p, "\t%s%s\n",
> + plane->fps_info.fps_str, plane->fps_info.fips_str);
> }
>
> static int sti_gdp_fourcc2format(int fourcc)
> @@ -887,14 +823,6 @@ static void sti_gdp_destroy(struct drm_plane *drm_plane)
> drm_plane_cleanup(drm_plane);
> }
>
> -static int sti_gdp_late_register(struct drm_plane *drm_plane)
> -{
> - struct sti_plane *plane = to_sti_plane(drm_plane);
> - struct sti_gdp *gdp = to_sti_gdp(plane);
> -
> - return gdp_debugfs_init(gdp, drm_plane->dev->primary);
> -}
> -
> static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
> .update_plane = drm_atomic_helper_update_plane,
> .disable_plane = drm_atomic_helper_disable_plane,
> @@ -902,7 +830,7 @@ static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
> .reset = sti_plane_reset,
> .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> - .late_register = sti_gdp_late_register,
> + .atomic_print_state = sti_gdp_plane_print_state,
> };
>
> struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 106be8c4e58b..f218f636966c 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -441,7 +441,7 @@ static int sti_hqvdp_get_next_cmd(struct sti_hqvdp *hqvdp)
> return -1;
> }
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(hqvdp->regs + reg))
>
> static const char *hqvdp_dbg_get_lut(u32 *coef)
> @@ -469,99 +469,100 @@ static const char *hqvdp_dbg_get_lut(u32 *coef)
> return "<UNKNOWN>";
> }
>
> -static void hqvdp_dbg_dump_cmd(struct seq_file *s, struct sti_hqvdp_cmd *c)
> +static void hqvdp_dbg_dump_cmd(struct drm_printer *p, struct sti_hqvdp_cmd *c)
> {
> int src_w, src_h, dst_w, dst_h;
>
> - seq_puts(s, "\n\tTOP:");
> - seq_printf(s, "\n\t %-20s 0x%08X", "Config", c->top.config);
> + drm_printf(p, "\n\tTOP:");
> + drm_printf(p, "\n\t %-20s 0x%08X", "Config", c->top.config);
> switch (c->top.config) {
> case TOP_CONFIG_PROGRESSIVE:
> - seq_puts(s, "\tProgressive");
> + drm_printf(p, "\tProgressive");
> break;
> case TOP_CONFIG_INTER_TOP:
> - seq_puts(s, "\tInterlaced, top field");
> + drm_printf(p, "\tInterlaced, top field");
> break;
> case TOP_CONFIG_INTER_BTM:
> - seq_puts(s, "\tInterlaced, bottom field");
> + drm_printf(p, "\tInterlaced, bottom field");
> break;
> default:
> - seq_puts(s, "\t<UNKNOWN>");
> + drm_printf(p, "\t<UNKNOWN>");
> break;
> }
>
> - seq_printf(s, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format);
> - seq_printf(s, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma);
> - seq_printf(s, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma);
> - seq_printf(s, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch);
> - seq_printf(s, "\n\t %-20s 0x%08X", "CSrcPitch",
> + drm_printf(p, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format);
> + drm_printf(p, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma);
> + drm_printf(p, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma);
> + drm_printf(p, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch);
> + drm_printf(p, "\n\t %-20s 0x%08X", "CSrcPitch",
> c->top.chroma_src_pitch);
> - seq_printf(s, "\n\t %-20s 0x%08X", "InputFrameSize",
> + drm_printf(p, "\n\t %-20s 0x%08X", "InputFrameSize",
> c->top.input_frame_size);
> - seq_printf(s, "\t%dx%d",
> + drm_printf(p, "\t%dx%d",
> c->top.input_frame_size & 0x0000FFFF,
> c->top.input_frame_size >> 16);
> - seq_printf(s, "\n\t %-20s 0x%08X", "InputViewportSize",
> + drm_printf(p, "\n\t %-20s 0x%08X", "InputViewportSize",
> c->top.input_viewport_size);
> src_w = c->top.input_viewport_size & 0x0000FFFF;
> src_h = c->top.input_viewport_size >> 16;
> - seq_printf(s, "\t%dx%d", src_w, src_h);
> + drm_printf(p, "\t%dx%d", src_w, src_h);
>
> - seq_puts(s, "\n\tHVSRC:");
> - seq_printf(s, "\n\t %-20s 0x%08X", "OutputPictureSize",
> + drm_printf(p, "\n\tHVSRC:");
> + drm_printf(p, "\n\t %-20s 0x%08X", "OutputPictureSize",
> c->hvsrc.output_picture_size);
> dst_w = c->hvsrc.output_picture_size & 0x0000FFFF;
> dst_h = c->hvsrc.output_picture_size >> 16;
> - seq_printf(s, "\t%dx%d", dst_w, dst_h);
> - seq_printf(s, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl);
> + drm_printf(p, "\t%dx%d", dst_w, dst_h);
> + drm_printf(p, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl);
>
> - seq_printf(s, "\n\t %-20s %s", "yh_coef",
> + drm_printf(p, "\n\t %-20s %s", "yh_coef",
> hqvdp_dbg_get_lut(c->hvsrc.yh_coef));
> - seq_printf(s, "\n\t %-20s %s", "ch_coef",
> + drm_printf(p, "\n\t %-20s %s", "ch_coef",
> hqvdp_dbg_get_lut(c->hvsrc.ch_coef));
> - seq_printf(s, "\n\t %-20s %s", "yv_coef",
> + drm_printf(p, "\n\t %-20s %s", "yv_coef",
> hqvdp_dbg_get_lut(c->hvsrc.yv_coef));
> - seq_printf(s, "\n\t %-20s %s", "cv_coef",
> + drm_printf(p, "\n\t %-20s %s", "cv_coef",
> hqvdp_dbg_get_lut(c->hvsrc.cv_coef));
>
> - seq_printf(s, "\n\t %-20s", "ScaleH");
> + drm_printf(p, "\n\t %-20s", "ScaleH");
> if (dst_w > src_w)
> - seq_printf(s, " %d/1", dst_w / src_w);
> + drm_printf(p, " %d/1", dst_w / src_w);
> else
> - seq_printf(s, " 1/%d", src_w / dst_w);
> + drm_printf(p, " 1/%d", src_w / dst_w);
>
> - seq_printf(s, "\n\t %-20s", "tScaleV");
> + drm_printf(p, "\n\t %-20s", "tScaleV");
> if (dst_h > src_h)
> - seq_printf(s, " %d/1", dst_h / src_h);
> + drm_printf(p, " %d/1", dst_h / src_h);
> else
> - seq_printf(s, " 1/%d", src_h / dst_h);
> + drm_printf(p, " 1/%d", src_h / dst_h);
>
> - seq_puts(s, "\n\tCSDI:");
> - seq_printf(s, "\n\t %-20s 0x%08X\t", "Config", c->csdi.config);
> + drm_printf(p, "\n\tCSDI:");
> + drm_printf(p, "\n\t %-20s 0x%08X\t", "Config", c->csdi.config);
> switch (c->csdi.config) {
> case CSDI_CONFIG_PROG:
> - seq_puts(s, "Bypass");
> + drm_printf(p, "Bypass");
> break;
> case CSDI_CONFIG_INTER_DIR:
> - seq_puts(s, "Deinterlace, directional");
> + drm_printf(p, "Deinterlace, directional");
> break;
> default:
> - seq_puts(s, "<UNKNOWN>");
> + drm_printf(p, "<UNKNOWN>");
> break;
> }
>
> - seq_printf(s, "\n\t %-20s 0x%08X", "Config2", c->csdi.config2);
> - seq_printf(s, "\n\t %-20s 0x%08X", "DcdiConfig", c->csdi.dcdi_config);
> + drm_printf(p, "\n\t %-20s 0x%08X", "Config2", c->csdi.config2);
> + drm_printf(p, "\n\t %-20s 0x%08X", "DcdiConfig", c->csdi.dcdi_config);
> }
>
> -static int hqvdp_dbg_show(struct seq_file *s, void *data)
> +static void sti_hqvdp_plane_print_state(struct drm_printer *p,
> + const struct drm_plane_state *state)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_hqvdp *hqvdp = (struct sti_hqvdp *)node->info_ent->data;
> + struct sti_plane *plane = to_sti_plane(state->plane);
> + struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
> int cmd, cmd_offset, infoxp70;
> void *virt;
>
> - seq_printf(s, "%s: (vaddr = 0x%p)",
> + drm_printf(p, "\t%s: (vaddr = 0x%pK)",
> sti_plane_to_str(&hqvdp->plane), hqvdp->regs);
>
> DBGFS_DUMP(HQVDP_MBX_IRQ_TO_XP70);
> @@ -569,80 +570,64 @@ static int hqvdp_dbg_show(struct seq_file *s, void *data)
> DBGFS_DUMP(HQVDP_MBX_IRQ_TO_HOST);
> DBGFS_DUMP(HQVDP_MBX_INFO_XP70);
> infoxp70 = readl(hqvdp->regs + HQVDP_MBX_INFO_XP70);
> - seq_puts(s, "\tFirmware state: ");
> + drm_printf(p, "\tFirmware state: ");
> if (infoxp70 & INFO_XP70_FW_READY)
> - seq_puts(s, "idle and ready");
> + drm_printf(p, "idle and ready");
> else if (infoxp70 & INFO_XP70_FW_PROCESSING)
> - seq_puts(s, "processing a picture");
> + drm_printf(p, "processing a picture");
> else if (infoxp70 & INFO_XP70_FW_INITQUEUES)
> - seq_puts(s, "programming queues");
> + drm_printf(p, "programming queues");
> else
> - seq_puts(s, "NOT READY");
> + drm_printf(p, "NOT READY");
>
> DBGFS_DUMP(HQVDP_MBX_SW_RESET_CTRL);
> DBGFS_DUMP(HQVDP_MBX_STARTUP_CTRL1);
> if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL1)
> & STARTUP_CTRL1_RST_DONE)
> - seq_puts(s, "\tReset is done");
> + drm_printf(p, "\tReset is done");
> else
> - seq_puts(s, "\tReset is NOT done");
> + drm_printf(p, "\tReset is NOT done");
> DBGFS_DUMP(HQVDP_MBX_STARTUP_CTRL2);
> if (readl(hqvdp->regs + HQVDP_MBX_STARTUP_CTRL2)
> & STARTUP_CTRL2_FETCH_EN)
> - seq_puts(s, "\tFetch is enabled");
> + drm_printf(p, "\tFetch is enabled");
> else
> - seq_puts(s, "\tFetch is NOT enabled");
> + drm_printf(p, "\tFetch is NOT enabled");
> DBGFS_DUMP(HQVDP_MBX_GP_STATUS);
> DBGFS_DUMP(HQVDP_MBX_NEXT_CMD);
> DBGFS_DUMP(HQVDP_MBX_CURRENT_CMD);
> DBGFS_DUMP(HQVDP_MBX_SOFT_VSYNC);
> if (!(readl(hqvdp->regs + HQVDP_MBX_SOFT_VSYNC) & 3))
> - seq_puts(s, "\tHW Vsync");
> + drm_printf(p, "\tHW Vsync");
> else
> - seq_puts(s, "\tSW Vsync ?!?!");
> + drm_printf(p, "\tSW Vsync ?!?!");
>
> /* Last command */
> cmd = readl(hqvdp->regs + HQVDP_MBX_CURRENT_CMD);
> cmd_offset = sti_hqvdp_get_curr_cmd(hqvdp);
> if (cmd_offset == -1) {
> - seq_puts(s, "\n\n Last command: unknown");
> + drm_printf(p, "\n\n\t\tLast command: unknown");
> } else {
> virt = hqvdp->hqvdp_cmd + cmd_offset;
> - seq_printf(s, "\n\n Last command: address @ 0x%x (0x%p)",
> + drm_printf(p, "\n\n\t\tLast command: address @ 0x%x (0x%p)",
> cmd, virt);
> - hqvdp_dbg_dump_cmd(s, (struct sti_hqvdp_cmd *)virt);
> + hqvdp_dbg_dump_cmd(p, (struct sti_hqvdp_cmd *)virt);
> }
>
> /* Next command */
> cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD);
> cmd_offset = sti_hqvdp_get_next_cmd(hqvdp);
> if (cmd_offset == -1) {
> - seq_puts(s, "\n\n Next command: unknown");
> + drm_printf(p, "\n\n\t\tNext command: unknown");
> } else {
> virt = hqvdp->hqvdp_cmd + cmd_offset;
> - seq_printf(s, "\n\n Next command address: @ 0x%x (0x%p)",
> + drm_printf(p, "\n\n\t\tNext command address: @ 0x%x (0x%p)",
> cmd, virt);
> - hqvdp_dbg_dump_cmd(s, (struct sti_hqvdp_cmd *)virt);
> + hqvdp_dbg_dump_cmd(p, (struct sti_hqvdp_cmd *)virt);
> }
>
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list hqvdp_debugfs_files[] = {
> - { "hqvdp", hqvdp_dbg_show, 0, NULL },
> -};
> -
> -static int hqvdp_debugfs_init(struct sti_hqvdp *hqvdp, struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < ARRAY_SIZE(hqvdp_debugfs_files); i++)
> - hqvdp_debugfs_files[i].data = hqvdp;
> -
> - return drm_debugfs_create_files(hqvdp_debugfs_files,
> - ARRAY_SIZE(hqvdp_debugfs_files),
> - minor->debugfs_root, minor);
> + drm_printf(p, "\t%s%s\n",
> + plane->fps_info.fps_str, plane->fps_info.fips_str);
> }
>
> /**
> @@ -1264,14 +1249,6 @@ static void sti_hqvdp_destroy(struct drm_plane *drm_plane)
> drm_plane_cleanup(drm_plane);
> }
>
> -static int sti_hqvdp_late_register(struct drm_plane *drm_plane)
> -{
> - struct sti_plane *plane = to_sti_plane(drm_plane);
> - struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
> -
> - return hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary);
> -}
> -
> static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
> .update_plane = drm_atomic_helper_update_plane,
> .disable_plane = drm_atomic_helper_disable_plane,
> @@ -1279,7 +1256,7 @@ static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
> .reset = sti_plane_reset,
> .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> - .late_register = sti_hqvdp_late_register,
> + .atomic_print_state = sti_hqvdp_plane_print_state,
> };
>
> static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev,
>
Hi Benjamin,
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> Convert all sti connectors to atomic_print_state usage rather than
> use a debugfs entry.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/sti/sti_dvo.c | 60 +++++--------------
> drivers/gpu/drm/sti/sti_hda.c | 75 +++++++----------------
> drivers/gpu/drm/sti/sti_hdmi.c | 132 ++++++++++++++++-------------------------
> 3 files changed, 90 insertions(+), 177 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index a5979cd25cc7..5662613ae6e0 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -6,7 +6,6 @@
>
> #include <linux/clk.h>
> #include <linux/component.h>
> -#include <linux/debugfs.h>
> #include <linux/module.h>
> #include <linux/of_gpio.h>
> #include <linux/platform_device.h>
> @@ -158,52 +157,37 @@ static void dvo_awg_configure(struct sti_dvo *dvo, u32 *awg_ram_code, int nb)
> writel(DVO_AWG_CTRL_EN, dvo->regs + DVO_AWG_DIGSYNC_CTRL);
> }
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(dvo->regs + reg))
>
> -static void dvo_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
> +static void dvo_dbg_awg_microcode(struct drm_printer *p, void __iomem *reg)
> {
> unsigned int i;
>
> - seq_puts(s, "\n\n");
> - seq_puts(s, " DVO AWG microcode:");
> + drm_printf(p, "\n\n");
> + drm_printf(p, " DVO AWG microcode:");
> for (i = 0; i < AWG_MAX_INST; i++) {
> if (i % 8 == 0)
> - seq_printf(s, "\n %04X:", i);
> - seq_printf(s, " %04X", readl(reg + i * 4));
> + drm_printf(p, "\n %04X:", i);
> + drm_printf(p, " %04X", readl(reg + i * 4));
> }
> }
>
> -static int dvo_dbg_show(struct seq_file *s, void *data)
> +static void sti_dvo_print_state(struct drm_printer *p,
> + const struct drm_connector_state *state)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
> + struct sti_dvo_connector *dvo_connector
> + = to_sti_dvo_connector(state->connector);
> + struct sti_dvo *dvo = dvo_connector->dvo;
>
> - seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
> + drm_printf(p, "DVO: (vaddr = 0x%p)", dvo->regs);
> DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
> DBGFS_DUMP(DVO_DOF_CFG);
> DBGFS_DUMP(DVO_LUT_PROG_LOW);
> DBGFS_DUMP(DVO_LUT_PROG_MID);
> DBGFS_DUMP(DVO_LUT_PROG_HIGH);
> - dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list dvo_debugfs_files[] = {
> - { "dvo", dvo_dbg_show, 0, NULL },
> -};
> -
> -static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
> - dvo_debugfs_files[i].data = dvo;
> -
> - return drm_debugfs_create_files(dvo_debugfs_files,
> - ARRAY_SIZE(dvo_debugfs_files),
> - minor->debugfs_root, minor);
> + dvo_dbg_awg_microcode(p, dvo->regs + DVO_DIGSYNC_INSTR_I);
> + drm_printf(p, "\n");
> }
>
> static void sti_dvo_disable(struct drm_bridge *bridge)
> @@ -397,20 +381,6 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
> return connector_status_disconnected;
> }
>
> -static int sti_dvo_late_register(struct drm_connector *connector)
> -{
> - struct sti_dvo_connector *dvo_connector
> - = to_sti_dvo_connector(connector);
> - struct sti_dvo *dvo = dvo_connector->dvo;
> -
> - if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) {
> - DRM_ERROR("DVO debugfs setup failed\n");
> - return -EINVAL;
> - }
> -
> - return 0;
> -}
> -
> static const struct drm_connector_funcs sti_dvo_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .detect = sti_dvo_connector_detect,
> @@ -418,7 +388,7 @@ static const struct drm_connector_funcs sti_dvo_connector_funcs = {
> .reset = drm_atomic_helper_connector_reset,
> .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> - .late_register = sti_dvo_late_register,
> + .atomic_print_state = sti_dvo_print_state,
> };
>
> static struct drm_encoder *sti_dvo_find_encoder(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index 67bbdb49fffc..0734f2751505 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -307,71 +307,56 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
> }
> }
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(hda->regs + reg))
>
> -static void hda_dbg_cfg(struct seq_file *s, int val)
> +static void hda_dbg_cfg(struct drm_printer *p, int val)
> {
> - seq_puts(s, "\tAWG ");
> - seq_puts(s, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
> + drm_printf(p, "\tAWG ");
> + drm_printf(p, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
> }
>
> -static void hda_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
> +static void hda_dbg_awg_microcode(struct drm_printer *p, void __iomem *reg)
> {
> unsigned int i;
>
> - seq_puts(s, "\n\n HDA AWG microcode:");
> + drm_printf(p, "\n\n HDA AWG microcode:");
> for (i = 0; i < AWG_MAX_INST; i++) {
> if (i % 8 == 0)
> - seq_printf(s, "\n %04X:", i);
> - seq_printf(s, " %04X", readl(reg + i * 4));
> + drm_printf(p, "\n %04X:", i);
> + drm_printf(p, " %04X", readl(reg + i * 4));
> }
> }
>
> -static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
> +static void hda_dbg_video_dacs_ctrl(struct drm_printer *p, void __iomem *reg)
> {
> u32 val = readl(reg);
>
> - seq_printf(s, "\n\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
> - seq_puts(s, "\tHD DACs ");
> - seq_puts(s, val & DAC_CFG_HD_HZUVW_OFF_MASK ? "disabled" : "enabled");
> + drm_printf(p, "\n\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
> + drm_printf(p, "\tHD DACs ");
> + drm_printf(p, val & DAC_CFG_HD_HZUVW_OFF_MASK ? "disabled" : "enabled");
> }
>
> -static int hda_dbg_show(struct seq_file *s, void *data)
> +static void sti_hda_print_state(struct drm_printer *p,
> + const struct drm_connector_state *state)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_hda *hda = (struct sti_hda *)node->info_ent->data;
> + struct sti_hda_connector *hda_connector
> + = to_sti_hda_connector(state->connector);
> + struct sti_hda *hda = hda_connector->hda;
>
> - seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs);
> + drm_printf(p, "HD Analog: (vaddr = 0x%pK)", hda->regs);
> DBGFS_DUMP(HDA_ANA_CFG);
> - hda_dbg_cfg(s, readl(hda->regs + HDA_ANA_CFG));
> + hda_dbg_cfg(p, readl(hda->regs + HDA_ANA_CFG));
> DBGFS_DUMP(HDA_ANA_SCALE_CTRL_Y);
> DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CB);
> DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CR);
> DBGFS_DUMP(HDA_ANA_ANC_CTRL);
> DBGFS_DUMP(HDA_ANA_SRC_Y_CFG);
> DBGFS_DUMP(HDA_ANA_SRC_C_CFG);
> - hda_dbg_awg_microcode(s, hda->regs + HDA_SYNC_AWGI);
> + hda_dbg_awg_microcode(p, hda->regs + HDA_SYNC_AWGI);
> if (hda->video_dacs_ctrl)
> - hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list hda_debugfs_files[] = {
> - { "hda", hda_dbg_show, 0, NULL },
> -};
> -
> -static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
> - hda_debugfs_files[i].data = hda;
> -
> - return drm_debugfs_create_files(hda_debugfs_files,
> - ARRAY_SIZE(hda_debugfs_files),
> - minor->debugfs_root, minor);
> + hda_dbg_video_dacs_ctrl(p, hda->video_dacs_ctrl);
> + drm_printf(p, "\n");
> }
>
> /**
> @@ -632,27 +617,13 @@ struct drm_connector_helper_funcs sti_hda_connector_helper_funcs = {
> .mode_valid = sti_hda_connector_mode_valid,
> };
>
> -static int sti_hda_late_register(struct drm_connector *connector)
> -{
> - struct sti_hda_connector *hda_connector
> - = to_sti_hda_connector(connector);
> - struct sti_hda *hda = hda_connector->hda;
> -
> - if (hda_debugfs_init(hda, hda->drm_dev->primary)) {
> - DRM_ERROR("HDA debugfs setup failed\n");
> - return -EINVAL;
> - }
> -
> - return 0;
> -}
> -
> static const struct drm_connector_funcs sti_hda_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .destroy = drm_connector_cleanup,
> .reset = drm_atomic_helper_connector_reset,
> .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> - .late_register = sti_hda_late_register,
> + .atomic_print_state = sti_hda_print_state,
> };
>
> static struct drm_encoder *sti_hda_find_encoder(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 58f431102512..b1313b3321bf 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -584,49 +584,49 @@ static void hdmi_swreset(struct sti_hdmi *hdmi)
> clk_disable_unprepare(hdmi->clk_audio);
> }
>
> -#define DBGFS_PRINT_STR(str1, str2) seq_printf(s, "%-24s %s\n", str1, str2)
> -#define DBGFS_PRINT_INT(str1, int2) seq_printf(s, "%-24s %d\n", str1, int2)
> -#define DBGFS_DUMP(str, reg) seq_printf(s, "%s %-25s 0x%08X", str, #reg, \
> +#define DBGFS_PRINT_STR(str1, str2) drm_printf(p, "%-24s %s\n", str1, str2)
> +#define DBGFS_PRINT_INT(str1, int2) drm_printf(p, "%-24s %d\n", str1, int2)
> +#define DBGFS_DUMP(str, reg) drm_printf(p, "%s\t%-25s 0x%08X", str, #reg, \
> hdmi_read(hdmi, reg))
> -#define DBGFS_DUMP_DI(reg, slot) DBGFS_DUMP("\n", reg(slot))
> +#define DBGFS_DUMP_DI(reg, slot) DBGFS_DUMP("\n\t\t", reg(slot))
>
> -static void hdmi_dbg_cfg(struct seq_file *s, int val)
> +static void hdmi_dbg_cfg(struct drm_printer *p, int val)
> {
> int tmp;
>
> - seq_putc(s, '\t');
> + drm_printf(p, "\t");
> tmp = val & HDMI_CFG_HDMI_NOT_DVI;
> DBGFS_PRINT_STR("mode:", tmp ? "HDMI" : "DVI");
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = val & HDMI_CFG_HDCP_EN;
> DBGFS_PRINT_STR("HDCP:", tmp ? "enable" : "disable");
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = val & HDMI_CFG_ESS_NOT_OESS;
> DBGFS_PRINT_STR("HDCP mode:", tmp ? "ESS enable" : "OESS enable");
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = val & HDMI_CFG_H_SYNC_POL_NEG;
> DBGFS_PRINT_STR("Hsync polarity:", tmp ? "inverted" : "normal");
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = val & HDMI_CFG_V_SYNC_POL_NEG;
> DBGFS_PRINT_STR("Vsync polarity:", tmp ? "inverted" : "normal");
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = val & HDMI_CFG_422_EN;
> DBGFS_PRINT_STR("YUV422 format:", tmp ? "enable" : "disable");
> }
>
> -static void hdmi_dbg_sta(struct seq_file *s, int val)
> +static void hdmi_dbg_sta(struct drm_printer *p, int val)
> {
> int tmp;
>
> - seq_putc(s, '\t');
> + drm_printf(p, "\t");
> tmp = (val & HDMI_STA_DLL_LCK);
> DBGFS_PRINT_STR("pll:", tmp ? "locked" : "not locked");
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = (val & HDMI_STA_HOT_PLUG);
> DBGFS_PRINT_STR("hdmi cable:", tmp ? "connected" : "not connected");
> }
>
> -static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
> +static void hdmi_dbg_sw_di_cfg(struct drm_printer *p, int val)
> {
> int tmp;
> char *const en_di[] = {"no transmission",
> @@ -634,57 +634,59 @@ static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
> "once every field",
> "once every frame"};
>
> - seq_putc(s, '\t');
> + drm_printf(p, "\t");
> tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 1));
> DBGFS_PRINT_STR("Data island 1:", en_di[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 2)) >> 4;
> DBGFS_PRINT_STR("Data island 2:", en_di[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 3)) >> 8;
> DBGFS_PRINT_STR("Data island 3:", en_di[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 4)) >> 12;
> DBGFS_PRINT_STR("Data island 4:", en_di[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 5)) >> 16;
> DBGFS_PRINT_STR("Data island 5:", en_di[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\t\t\t\t\t");
> tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 6)) >> 20;
> DBGFS_PRINT_STR("Data island 6:", en_di[tmp]);
> }
>
> -static int hdmi_dbg_show(struct seq_file *s, void *data)
> +static void sti_hdmi_print_state(struct drm_printer *p,
> + const struct drm_connector_state *state)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data;
> -
> - seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs);
> - DBGFS_DUMP("\n", HDMI_CFG);
> - hdmi_dbg_cfg(s, hdmi_read(hdmi, HDMI_CFG));
> - DBGFS_DUMP("", HDMI_INT_EN);
> - DBGFS_DUMP("\n", HDMI_STA);
> - hdmi_dbg_sta(s, hdmi_read(hdmi, HDMI_STA));
> - DBGFS_DUMP("", HDMI_ACTIVE_VID_XMIN);
> - seq_putc(s, '\t');
> + struct sti_hdmi_connector *hdmi_connector
> + = to_sti_hdmi_connector(state->connector);
> + struct sti_hdmi *hdmi = hdmi_connector->hdmi;
> +
> + drm_printf(p, "\tHDMI: (vaddr = 0x%pK)", hdmi->regs);
> + DBGFS_DUMP("\n\t\t", HDMI_CFG);
> + hdmi_dbg_cfg(p, hdmi_read(hdmi, HDMI_CFG));
> + DBGFS_DUMP("\t\t", HDMI_INT_EN);
> + DBGFS_DUMP("\n\t\t", HDMI_STA);
> + hdmi_dbg_sta(p, hdmi_read(hdmi, HDMI_STA));
> + DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_XMIN);
> + drm_printf(p, "\t");
> DBGFS_PRINT_INT("Xmin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMIN));
> - DBGFS_DUMP("", HDMI_ACTIVE_VID_XMAX);
> - seq_putc(s, '\t');
> + DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_XMAX);
> + drm_printf(p, "\t");
> DBGFS_PRINT_INT("Xmax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMAX));
> - DBGFS_DUMP("", HDMI_ACTIVE_VID_YMIN);
> - seq_putc(s, '\t');
> + DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_YMIN);
> + drm_printf(p, "\t");
> DBGFS_PRINT_INT("Ymin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMIN));
> - DBGFS_DUMP("", HDMI_ACTIVE_VID_YMAX);
> - seq_putc(s, '\t');
> + DBGFS_DUMP("\t\t", HDMI_ACTIVE_VID_YMAX);
> + drm_printf(p, "\t");
> DBGFS_PRINT_INT("Ymax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMAX));
> - DBGFS_DUMP("", HDMI_SW_DI_CFG);
> - hdmi_dbg_sw_di_cfg(s, hdmi_read(hdmi, HDMI_SW_DI_CFG));
> + DBGFS_DUMP("\t\t", HDMI_SW_DI_CFG);
> + hdmi_dbg_sw_di_cfg(p, hdmi_read(hdmi, HDMI_SW_DI_CFG));
>
> - DBGFS_DUMP("\n", HDMI_AUDIO_CFG);
> - DBGFS_DUMP("\n", HDMI_SPDIF_FIFO_STATUS);
> - DBGFS_DUMP("\n", HDMI_AUDN);
> + DBGFS_DUMP("\n\t\t", HDMI_AUDIO_CFG);
> + DBGFS_DUMP("\n\t\t", HDMI_SPDIF_FIFO_STATUS);
> + DBGFS_DUMP("\n\t\t", HDMI_AUDN);
>
> - seq_printf(s, "\n AVI Infoframe (Data Island slot N=%d):",
> + drm_printf(p, "\n\t\tAVI Infoframe (Data Island slot N=%d):",
> HDMI_IFRAME_SLOT_AVI);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_HEAD_WORD, HDMI_IFRAME_SLOT_AVI);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD0, HDMI_IFRAME_SLOT_AVI);
> @@ -694,7 +696,7 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD4, HDMI_IFRAME_SLOT_AVI);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD5, HDMI_IFRAME_SLOT_AVI);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_AVI);
> - seq_printf(s, "\n\n AUDIO Infoframe (Data Island slot N=%d):",
> + drm_printf(p, "\n\t\tAUDIO Infoframe (Data Island slot N=%d):",
> HDMI_IFRAME_SLOT_AUDIO);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_HEAD_WORD, HDMI_IFRAME_SLOT_AUDIO);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD0, HDMI_IFRAME_SLOT_AUDIO);
> @@ -704,7 +706,8 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD4, HDMI_IFRAME_SLOT_AUDIO);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD5, HDMI_IFRAME_SLOT_AUDIO);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_AUDIO);
> - seq_printf(s, "\n\n VENDOR SPECIFIC Infoframe (Data Island slot N=%d):",
> + drm_printf(p,
> + "\n\t\tVENDOR SPECIFIC Infoframe (Data Island slot N=%d):",
> HDMI_IFRAME_SLOT_VENDOR);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_HEAD_WORD, HDMI_IFRAME_SLOT_VENDOR);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD0, HDMI_IFRAME_SLOT_VENDOR);
> @@ -714,24 +717,7 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD4, HDMI_IFRAME_SLOT_VENDOR);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD5, HDMI_IFRAME_SLOT_VENDOR);
> DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_VENDOR);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list hdmi_debugfs_files[] = {
> - { "hdmi", hdmi_dbg_show, 0, NULL },
> -};
> -
> -static int hdmi_debugfs_init(struct sti_hdmi *hdmi, struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < ARRAY_SIZE(hdmi_debugfs_files); i++)
> - hdmi_debugfs_files[i].data = hdmi;
> -
> - return drm_debugfs_create_files(hdmi_debugfs_files,
> - ARRAY_SIZE(hdmi_debugfs_files),
> - minor->debugfs_root, minor);
> + drm_printf(p, "\n");
> }
>
> static void sti_hdmi_disable(struct drm_bridge *bridge)
> @@ -1099,20 +1085,6 @@ sti_hdmi_connector_get_property(struct drm_connector *connector,
> return -EINVAL;
> }
>
> -static int sti_hdmi_late_register(struct drm_connector *connector)
> -{
> - struct sti_hdmi_connector *hdmi_connector
> - = to_sti_hdmi_connector(connector);
> - struct sti_hdmi *hdmi = hdmi_connector->hdmi;
> -
> - if (hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary)) {
> - DRM_ERROR("HDMI debugfs setup failed\n");
> - return -EINVAL;
> - }
> -
> - return 0;
> -}
> -
> static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
> .fill_modes = drm_helper_probe_single_connector_modes,
> .detect = sti_hdmi_connector_detect,
> @@ -1122,7 +1094,7 @@ static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
> .atomic_get_property = sti_hdmi_connector_get_property,
> .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> - .late_register = sti_hdmi_late_register,
> + .atomic_print_state = sti_hdmi_print_state,
> };
>
> static struct drm_encoder *sti_hdmi_find_encoder(struct drm_device *dev)
>
Hi Benjamin,
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> Convert sti crtc to atomic_print_state usage rather than use a
> debugfs entry.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/sti/sti_compositor.c | 16 -------
> drivers/gpu/drm/sti/sti_compositor.h | 3 --
> drivers/gpu/drm/sti/sti_crtc.c | 17 ++++---
> drivers/gpu/drm/sti/sti_mixer.c | 89 ++++++++++--------------------------
> drivers/gpu/drm/sti/sti_mixer.h | 3 +-
> drivers/gpu/drm/sti/sti_vid.c | 60 ++++++++----------------
> drivers/gpu/drm/sti/sti_vid.h | 2 +-
> 7 files changed, 59 insertions(+), 131 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
> index 021b8fcaa0b9..c08d5c560557 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.c
> +++ b/drivers/gpu/drm/sti/sti_compositor.c
> @@ -39,22 +39,6 @@ static const struct sti_compositor_data stih407_compositor_data = {
> },
> };
>
> -int sti_compositor_debugfs_init(struct sti_compositor *compo,
> - struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < STI_MAX_VID; i++)
> - if (compo->vid[i])
> - vid_debugfs_init(compo->vid[i], minor);
> -
> - for (i = 0; i < STI_MAX_MIXER; i++)
> - if (compo->mixer[i])
> - sti_mixer_debugfs_init(compo->mixer[i], minor);
> -
> - return 0;
> -}
> -
> static int sti_compositor_bind(struct device *dev,
> struct device *master,
> void *data)
> diff --git a/drivers/gpu/drm/sti/sti_compositor.h b/drivers/gpu/drm/sti/sti_compositor.h
> index ac4bb3834810..eb8b233e68a2 100644
> --- a/drivers/gpu/drm/sti/sti_compositor.h
> +++ b/drivers/gpu/drm/sti/sti_compositor.h
> @@ -79,7 +79,4 @@ struct sti_compositor {
> struct notifier_block vtg_vblank_nb[STI_MAX_MIXER];
> };
>
> -int sti_compositor_debugfs_init(struct sti_compositor *compo,
> - struct drm_minor *minor);
> -
> #endif
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index 5824e6aca8f4..4e137932ffe4 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -316,15 +316,20 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> DRM_DEBUG_DRIVER("Warning: cannot unregister VTG notifier\n");
> }
>
> -static int sti_crtc_late_register(struct drm_crtc *crtc)
> +static void sti_crtc_print_state(struct drm_printer *p,
> + const struct drm_crtc_state *state)
> {
> - struct sti_mixer *mixer = to_sti_mixer(crtc);
> + struct sti_mixer *mixer = to_sti_mixer(state->crtc);
> struct sti_compositor *compo = dev_get_drvdata(mixer->dev);
> + unsigned int i;
>
> - if (drm_crtc_index(crtc) == 0)
> - return sti_compositor_debugfs_init(compo, crtc->dev->primary);
> + for (i = 0; i < STI_MAX_VID; i++)
> + if (compo->vid[i])
> + sti_vid_print_state(p, compo->vid[i]);
>
> - return 0;
> + for (i = 0; i < STI_MAX_MIXER; i++)
> + if (compo->mixer[i])
> + sti_mixer_print_state(p, compo->mixer[i]);
> }
>
> static const struct drm_crtc_funcs sti_crtc_funcs = {
> @@ -335,7 +340,7 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
> .reset = drm_atomic_helper_crtc_reset,
> .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> - .late_register = sti_crtc_late_register,
> + .atomic_print_state = sti_crtc_print_state,
> };
>
> bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
> index a4f45c74d678..22525139d315 100644
> --- a/drivers/gpu/drm/sti/sti_mixer.c
> +++ b/drivers/gpu/drm/sti/sti_mixer.c
> @@ -70,20 +70,20 @@ static inline void sti_mixer_reg_write(struct sti_mixer *mixer,
> writel(val, mixer->regs + reg_id);
> }
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> sti_mixer_reg_read(mixer, reg))
>
> -static void mixer_dbg_ctl(struct seq_file *s, int val)
> +static void mixer_dbg_ctl(struct drm_printer *p, int val)
> {
> unsigned int i;
> int count = 0;
> char *const disp_layer[] = {"BKG", "VID0", "VID1", "GDP0",
> "GDP1", "GDP2", "GDP3"};
>
> - seq_puts(s, "\tEnabled: ");
> + drm_printf(p, "\tEnabled: ");
> for (i = 0; i < 7; i++) {
> if (val & 1) {
> - seq_printf(s, "%s ", disp_layer[i]);
> + drm_printf(p, "%s ", disp_layer[i]);
> count++;
> }
> val = val >> 1;
> @@ -91,114 +91,75 @@ static void mixer_dbg_ctl(struct seq_file *s, int val)
>
> val = val >> 2;
> if (val & 1) {
> - seq_puts(s, "CURS ");
> + drm_printf(p, "CURS ");
> count++;
> }
> if (!count)
> - seq_puts(s, "Nothing");
> + drm_printf(p, "Nothing");
> }
>
> -static void mixer_dbg_crb(struct seq_file *s, int val)
> +static void mixer_dbg_crb(struct drm_printer *p, int val)
> {
> int i;
>
> - seq_puts(s, "\tDepth: ");
> + drm_printf(p, "\tDepth: ");
> for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
> switch (val & GAM_DEPTH_MASK_ID) {
> case GAM_DEPTH_VID0_ID:
> - seq_puts(s, "VID0");
> + drm_printf(p, "VID0");
> break;
> case GAM_DEPTH_VID1_ID:
> - seq_puts(s, "VID1");
> + drm_printf(p, "VID1");
> break;
> case GAM_DEPTH_GDP0_ID:
> - seq_puts(s, "GDP0");
> + drm_printf(p, "GDP0");
> break;
> case GAM_DEPTH_GDP1_ID:
> - seq_puts(s, "GDP1");
> + drm_printf(p, "GDP1");
> break;
> case GAM_DEPTH_GDP2_ID:
> - seq_puts(s, "GDP2");
> + drm_printf(p, "GDP2");
> break;
> case GAM_DEPTH_GDP3_ID:
> - seq_puts(s, "GDP3");
> + drm_printf(p, "GDP3");
> break;
> default:
> - seq_puts(s, "---");
> + drm_printf(p, "---");
> }
>
> if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
> - seq_puts(s, " < ");
> + drm_printf(p, " < ");
> val = val >> 3;
> }
> }
>
> -static void mixer_dbg_mxn(struct seq_file *s, void *addr)
> +static void mixer_dbg_mxn(struct drm_printer *p, void *addr)
> {
> int i;
>
> for (i = 1; i < 8; i++)
> - seq_printf(s, "-0x%08X", (int)readl(addr + i * 4));
> + drm_printf(p, "-0x%08X", (int)readl(addr + i * 4));
> }
>
> -static int mixer_dbg_show(struct seq_file *s, void *arg)
> +void sti_mixer_print_state(struct drm_printer *p, struct sti_mixer *mixer)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data;
> -
> - seq_printf(s, "%s: (vaddr = 0x%p)",
> + drm_printf(p, "\t%s: (vaddr = 0x%pK)",
> sti_mixer_to_str(mixer), mixer->regs);
>
> DBGFS_DUMP(GAM_MIXER_CTL);
> - mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
> + mixer_dbg_ctl(p, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
> DBGFS_DUMP(GAM_MIXER_BKC);
> DBGFS_DUMP(GAM_MIXER_BCO);
> DBGFS_DUMP(GAM_MIXER_BCS);
> DBGFS_DUMP(GAM_MIXER_AVO);
> DBGFS_DUMP(GAM_MIXER_AVS);
> DBGFS_DUMP(GAM_MIXER_CRB);
> - mixer_dbg_crb(s, sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
> + mixer_dbg_crb(p, sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
> DBGFS_DUMP(GAM_MIXER_ACT);
> DBGFS_DUMP(GAM_MIXER_MBP);
> DBGFS_DUMP(GAM_MIXER_MX0);
> - mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list mixer0_debugfs_files[] = {
> - { "mixer_main", mixer_dbg_show, 0, NULL },
> -};
> -
> -static struct drm_info_list mixer1_debugfs_files[] = {
> - { "mixer_aux", mixer_dbg_show, 0, NULL },
> -};
> -
> -int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
> -{
> - unsigned int i;
> - struct drm_info_list *mixer_debugfs_files;
> - int nb_files;
> -
> - switch (mixer->id) {
> - case STI_MIXER_MAIN:
> - mixer_debugfs_files = mixer0_debugfs_files;
> - nb_files = ARRAY_SIZE(mixer0_debugfs_files);
> - break;
> - case STI_MIXER_AUX:
> - mixer_debugfs_files = mixer1_debugfs_files;
> - nb_files = ARRAY_SIZE(mixer1_debugfs_files);
> - break;
> - default:
> - return -EINVAL;
> - }
> -
> - for (i = 0; i < nb_files; i++)
> - mixer_debugfs_files[i].data = mixer;
> -
> - return drm_debugfs_create_files(mixer_debugfs_files,
> - nb_files,
> - minor->debugfs_root, minor);
> + mixer_dbg_mxn(p, mixer->regs + GAM_MIXER_MX0);
> + drm_printf(p, "\n");
> }
>
> void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable)
> @@ -367,7 +328,7 @@ struct sti_mixer *sti_mixer_create(struct device *dev,
> mixer->dev = dev;
> mixer->id = id;
>
> - DRM_DEBUG_DRIVER("%s created. Regs=%p\n",
> + DRM_DEBUG_DRIVER("%s created. Regs=%pK\n",
> sti_mixer_to_str(mixer), mixer->regs);
>
> return mixer;
> diff --git a/drivers/gpu/drm/sti/sti_mixer.h b/drivers/gpu/drm/sti/sti_mixer.h
> index 4cb3cfddc03a..067093270bb0 100644
> --- a/drivers/gpu/drm/sti/sti_mixer.h
> +++ b/drivers/gpu/drm/sti/sti_mixer.h
> @@ -53,7 +53,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,
>
> void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
>
> -int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
> +void sti_mixer_print_state(struct drm_printer *p, struct sti_mixer *mixer);
> +
>
> /* depth in Cross-bar control = z order */
> #define GAM_MIXER_NB_DEPTH_LEVEL 6
> diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
> index 2aac36c95835..9730e9cf2a87 100644
> --- a/drivers/gpu/drm/sti/sti_vid.c
> +++ b/drivers/gpu/drm/sti/sti_vid.c
> @@ -55,54 +55,51 @@
>
> #define VID_MIN_HD_HEIGHT 720
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(vid->regs + reg))
>
> -static void vid_dbg_ctl(struct seq_file *s, int val)
> +static void vid_dbg_ctl(struct drm_printer *p, int val)
> {
> val = val >> 30;
> - seq_putc(s, '\t');
> + drm_printf(p, "\t");
>
> if (!(val & 1))
> - seq_puts(s, "NOT ");
> - seq_puts(s, "ignored on main mixer - ");
> + drm_printf(p, "NOT ");
> + drm_printf(p, "ignored on main mixer - ");
>
> if (!(val & 2))
> - seq_puts(s, "NOT ");
> - seq_puts(s, "ignored on aux mixer");
> + drm_printf(p, "NOT ");
> + drm_printf(p, "ignored on aux mixer");
> }
>
> -static void vid_dbg_vpo(struct seq_file *s, int val)
> +static void vid_dbg_vpo(struct drm_printer *p, int val)
> {
> - seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
> + drm_printf(p, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
> }
>
> -static void vid_dbg_vps(struct seq_file *s, int val)
> +static void vid_dbg_vps(struct drm_printer *p, int val)
> {
> - seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
> + drm_printf(p, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
> }
>
> -static void vid_dbg_mst(struct seq_file *s, int val)
> +static void vid_dbg_mst(struct drm_printer *p, int val)
> {
> if (val & 1)
> - seq_puts(s, "\tBUFFER UNDERFLOW!");
> + drm_printf(p, "\tBUFFER UNDERFLOW!");
> }
>
> -static int vid_dbg_show(struct seq_file *s, void *arg)
> +void sti_vid_print_state(struct drm_printer *p, struct sti_vid *vid)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_vid *vid = (struct sti_vid *)node->info_ent->data;
> -
> - seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs);
> + drm_printf(p, "\tVID: (vaddr= 0x%pK)", vid->regs);
>
> DBGFS_DUMP(VID_CTL);
> - vid_dbg_ctl(s, readl(vid->regs + VID_CTL));
> + vid_dbg_ctl(p, readl(vid->regs + VID_CTL));
> DBGFS_DUMP(VID_ALP);
> DBGFS_DUMP(VID_CLF);
> DBGFS_DUMP(VID_VPO);
> - vid_dbg_vpo(s, readl(vid->regs + VID_VPO));
> + vid_dbg_vpo(p, readl(vid->regs + VID_VPO));
> DBGFS_DUMP(VID_VPS);
> - vid_dbg_vps(s, readl(vid->regs + VID_VPS));
> + vid_dbg_vps(p, readl(vid->regs + VID_VPS));
> DBGFS_DUMP(VID_KEY1);
> DBGFS_DUMP(VID_KEY2);
> DBGFS_DUMP(VID_MPR0);
> @@ -110,28 +107,11 @@ static int vid_dbg_show(struct seq_file *s, void *arg)
> DBGFS_DUMP(VID_MPR2);
> DBGFS_DUMP(VID_MPR3);
> DBGFS_DUMP(VID_MST);
> - vid_dbg_mst(s, readl(vid->regs + VID_MST));
> + vid_dbg_mst(p, readl(vid->regs + VID_MST));
> DBGFS_DUMP(VID_BC);
> DBGFS_DUMP(VID_TINT);
> DBGFS_DUMP(VID_CSAT);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list vid_debugfs_files[] = {
> - { "vid", vid_dbg_show, 0, NULL },
> -};
> -
> -int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++)
> - vid_debugfs_files[i].data = vid;
> -
> - return drm_debugfs_create_files(vid_debugfs_files,
> - ARRAY_SIZE(vid_debugfs_files),
> - minor->debugfs_root, minor);
> + drm_printf(p, "\n");
> }
>
> void sti_vid_commit(struct sti_vid *vid,
> diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h
> index 9dbd78461de1..27656dbbd2bc 100644
> --- a/drivers/gpu/drm/sti/sti_vid.h
> +++ b/drivers/gpu/drm/sti/sti_vid.h
> @@ -26,6 +26,6 @@ void sti_vid_disable(struct sti_vid *vid);
> struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
> int id, void __iomem *baseaddr);
>
> -int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor);
> +void sti_vid_print_state(struct drm_printer *p, struct sti_vid *vid);
>
> #endif
>
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe :-)
Hi Benjamin,
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> Thanks to all the hooks in drm structure, custom debugfs could be
> removed of sti driver.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/sti/sti_drv.c | 50 -------------------------------------------
> 1 file changed, 50 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 90c46b49c931..95b0ac4d819c 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -7,7 +7,6 @@
> #include <drm/drmP.h>
>
> #include <linux/component.h>
> -#include <linux/debugfs.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> #include <linux/of_platform.h>
> @@ -72,53 +71,6 @@ static int sti_drm_fps_set(void *data, u64 val)
> DEFINE_SIMPLE_ATTRIBUTE(sti_drm_fps_fops,
> sti_drm_fps_get, sti_drm_fps_set, "%llu\n");
>
> -static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
> -{
> - struct drm_info_node *node = s->private;
> - struct drm_device *dev = node->minor->dev;
> - struct drm_plane *p;
> -
> - list_for_each_entry(p, &dev->mode_config.plane_list, head) {
> - struct sti_plane *plane = to_sti_plane(p);
> -
> - seq_printf(s, "%s%s\n",
> - plane->fps_info.fps_str,
> - plane->fps_info.fips_str);
> - }
> -
> - return 0;
> -}
> -
> -static struct drm_info_list sti_drm_dbg_list[] = {
> - {"fps_get", sti_drm_fps_dbg_show, 0},
> -};
> -
> -static int sti_drm_dbg_init(struct drm_minor *minor)
> -{
> - struct dentry *dentry;
> - int ret;
> -
> - ret = drm_debugfs_create_files(sti_drm_dbg_list,
> - ARRAY_SIZE(sti_drm_dbg_list),
> - minor->debugfs_root, minor);
> - if (ret)
> - goto err;
> -
> - dentry = debugfs_create_file("fps_show", S_IRUGO | S_IWUSR,
> - minor->debugfs_root, minor->dev,
> - &sti_drm_fps_fops);
> - if (!dentry) {
> - ret = -ENOMEM;
> - goto err;
> - }
> -
> - DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
> - return 0;
> -err:
> - DRM_ERROR("%s: cannot install debugfs\n", DRIVER_NAME);
> - return ret;
> -}
> -
> static const struct drm_mode_config_funcs sti_mode_config_funcs = {
> .fb_create = drm_gem_fb_create,
> .output_poll_changed = drm_fb_helper_output_poll_changed,
> @@ -167,8 +119,6 @@ static struct drm_driver sti_driver = {
> .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
> .gem_prime_mmap = drm_gem_cma_prime_mmap,
>
> - .debugfs_init = sti_drm_dbg_init,
> -
> .name = DRIVER_NAME,
> .desc = DRIVER_DESC,
> .date = DRIVER_DATE,
>
Great,
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe :-)
Hi Benjamin,
On 06/05/2018 03:54 PM, Benjamin Gaignard wrote:
> Convert all sti encoders to atomic_print usage rather than use a
> debugfs entry.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/sti/sti_tvout.c | 162 ++++++++++++++++------------------------
> 1 file changed, 63 insertions(+), 99 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
> index ea4a3b87fa55..8aa23710b695 100644
> --- a/drivers/gpu/drm/sti/sti_tvout.c
> +++ b/drivers/gpu/drm/sti/sti_tvout.c
> @@ -442,10 +442,10 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool main_path)
> tvout_write(tvout, 0, TVO_HD_DAC_CFG_OFF);
> }
>
> -#define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
> +#define DBGFS_DUMP(reg) drm_printf(p, "\n\t\t%-25s 0x%08X", #reg, \
> readl(tvout->regs + reg))
>
> -static void tvout_dbg_vip(struct seq_file *s, int val)
> +static void tvout_dbg_vip(struct drm_printer *p, int val)
> {
> int r, g, b, tmp, mask;
> char *const reorder[] = {"Y_G", "Cb_B", "Cr_R"};
> @@ -459,86 +459,94 @@ static void tvout_dbg_vip(struct seq_file *s, int val)
> "Aux (color matrix by-passed)",
> "", "", "", "", "", "Force value"};
>
> - seq_putc(s, '\t');
> + drm_printf(p, "\n\t\t\t");
> mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT;
> r = (val & mask) >> TVO_VIP_REORDER_R_SHIFT;
> mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT;
> g = (val & mask) >> TVO_VIP_REORDER_G_SHIFT;
> mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_B_SHIFT;
> b = (val & mask) >> TVO_VIP_REORDER_B_SHIFT;
> - seq_printf(s, "%-24s %s->%s %s->%s %s->%s\n", "Reorder:",
> + drm_printf(p, "%-24s %s->%s %s->%s %s->%s", "Reorder:",
> reorder[r], reorder[TVO_VIP_REORDER_CR_R_SEL],
> reorder[g], reorder[TVO_VIP_REORDER_Y_G_SEL],
> reorder[b], reorder[TVO_VIP_REORDER_CB_B_SEL]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\n\t\t\t");
> mask = TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT;
> tmp = (val & mask) >> TVO_VIP_CLIP_SHIFT;
> - seq_printf(s, "%-24s %s\n", "Clipping:", clipping[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "%-24s %s", "Clipping:", clipping[tmp]);
> + drm_printf(p, "\n\t\t\t");
> mask = TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT;
> tmp = (val & mask) >> TVO_VIP_RND_SHIFT;
> - seq_printf(s, "%-24s input data rounded to %s per component\n",
> + drm_printf(p, "%-24s input data rounded to %s per component",
> "Round:", round[tmp]);
> - seq_puts(s, "\t\t\t\t\t");
> + drm_printf(p, "\n\t\t\t");
> tmp = (val & TVO_VIP_SEL_INPUT_MASK);
> - seq_printf(s, "%-24s %s", "Input selection:", input_sel[tmp]);
> + drm_printf(p, "%-24s %s", "Input selection:", input_sel[tmp]);
> }
>
> -static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val)
> +static void tvout_dbg_hd_dac_cfg(struct drm_printer *p, int val)
> {
> - seq_printf(s, "\t%-24s %s", "HD DAC:",
> + drm_printf(p, "\t%-24s %s", "HD DAC:",
> val & 1 ? "disabled" : "enabled");
> }
>
> -static int tvout_dbg_show(struct seq_file *s, void *data)
> +static void sti_tvout_print(struct drm_printer *p, struct drm_encoder *encoder)
> {
> - struct drm_info_node *node = s->private;
> - struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data;
> + struct sti_tvout *tvout = to_sti_tvout(encoder);
> struct drm_crtc *crtc;
>
> - seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs);
> -
> - seq_puts(s, "\n\n HDMI encoder: ");
> - crtc = tvout->hdmi->crtc;
> - if (crtc) {
> - seq_printf(s, "connected to %s path",
> - sti_crtc_is_main(crtc) ? "main" : "aux");
> - DBGFS_DUMP(TVO_HDMI_SYNC_SEL);
> - DBGFS_DUMP(TVO_VIP_HDMI);
> - tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDMI));
> - } else {
> - seq_puts(s, "disabled");
> + drm_printf(p, "\tTVOUT: (vaddr = 0x%pK)\n", tvout->regs);
> +
> + if (encoder->encoder_type == DRM_MODE_ENCODER_TMDS) {
> + drm_printf(p, "\tHDMI encoder: ");
> + crtc = tvout->hdmi->crtc;
> + if (crtc) {
> + drm_printf(p, "connected to %s path",
> + sti_crtc_is_main(crtc) ? "main" : "aux");
> + DBGFS_DUMP(TVO_HDMI_SYNC_SEL);
> + DBGFS_DUMP(TVO_VIP_HDMI);
> + tvout_dbg_vip(p, readl(tvout->regs + TVO_VIP_HDMI));
> + } else {
> + drm_printf(p, "disabled\n");
> + return;
> + }
> }
>
> - seq_puts(s, "\n\n DVO encoder: ");
> - crtc = tvout->dvo->crtc;
> - if (crtc) {
> - seq_printf(s, "connected to %s path",
> - sti_crtc_is_main(crtc) ? "main" : "aux");
> - DBGFS_DUMP(TVO_DVO_SYNC_SEL);
> - DBGFS_DUMP(TVO_DVO_CONFIG);
> - DBGFS_DUMP(TVO_VIP_DVO);
> - tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_DVO));
> - } else {
> - seq_puts(s, "disabled");
> + if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) {
> + drm_printf(p, "\tDVO encoder: ");
> + crtc = tvout->dvo->crtc;
> + if (crtc) {
> + drm_printf(p, "connected to %s path",
> + sti_crtc_is_main(crtc) ? "main" : "aux");
> + DBGFS_DUMP(TVO_DVO_SYNC_SEL);
> + DBGFS_DUMP(TVO_DVO_CONFIG);
> + DBGFS_DUMP(TVO_VIP_DVO);
> + tvout_dbg_vip(p, readl(tvout->regs + TVO_VIP_DVO));
> + } else {
> + drm_printf(p, "disabled\n");
> + return;
> + }
> }
>
> - seq_puts(s, "\n\n HDA encoder: ");
> - crtc = tvout->hda->crtc;
> - if (crtc) {
> - seq_printf(s, "connected to %s path",
> - sti_crtc_is_main(crtc) ? "main" : "aux");
> - DBGFS_DUMP(TVO_HD_SYNC_SEL);
> - DBGFS_DUMP(TVO_HD_DAC_CFG_OFF);
> - tvout_dbg_hd_dac_cfg(s,
> - readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
> - DBGFS_DUMP(TVO_VIP_HDF);
> - tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDF));
> - } else {
> - seq_puts(s, "disabled");
> + if (encoder->encoder_type == DRM_MODE_ENCODER_DAC) {
> + drm_printf(p, "\tHDA encoder: ");
> + crtc = tvout->hda->crtc;
> + if (crtc) {
> + drm_printf(p, "connected to %s path",
> + sti_crtc_is_main(crtc) ? "main" : "aux");
> + DBGFS_DUMP(TVO_HD_SYNC_SEL);
> + DBGFS_DUMP(TVO_HD_DAC_CFG_OFF);
> + tvout_dbg_hd_dac_cfg(p,
> + readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
> + DBGFS_DUMP(TVO_VIP_HDF);
> + tvout_dbg_vip(p, readl(tvout->regs + TVO_VIP_HDF));
> + } else {
> + drm_printf(p, "disabled\n");
> + return;
> + }
> }
>
> - seq_puts(s, "\n\n main path configuration");
> + drm_printf(p, "\n\t\tmain path configuration");
> DBGFS_DUMP(TVO_CSC_MAIN_M0);
> DBGFS_DUMP(TVO_CSC_MAIN_M1);
> DBGFS_DUMP(TVO_CSC_MAIN_M2);
> @@ -549,7 +557,7 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
> DBGFS_DUMP(TVO_CSC_MAIN_M7);
> DBGFS_DUMP(TVO_MAIN_IN_VID_FORMAT);
>
> - seq_puts(s, "\n\n auxiliary path configuration");
> + drm_printf(p, "\n\t\tauxiliary path configuration");
> DBGFS_DUMP(TVO_CSC_AUX_M0);
> DBGFS_DUMP(TVO_CSC_AUX_M2);
> DBGFS_DUMP(TVO_CSC_AUX_M3);
> @@ -558,24 +566,7 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
> DBGFS_DUMP(TVO_CSC_AUX_M6);
> DBGFS_DUMP(TVO_CSC_AUX_M7);
> DBGFS_DUMP(TVO_AUX_IN_VID_FORMAT);
> - seq_putc(s, '\n');
> - return 0;
> -}
> -
> -static struct drm_info_list tvout_debugfs_files[] = {
> - { "tvout", tvout_dbg_show, 0, NULL },
> -};
> -
> -static int tvout_debugfs_init(struct sti_tvout *tvout, struct drm_minor *minor)
> -{
> - unsigned int i;
> -
> - for (i = 0; i < ARRAY_SIZE(tvout_debugfs_files); i++)
> - tvout_debugfs_files[i].data = tvout;
> -
> - return drm_debugfs_create_files(tvout_debugfs_files,
> - ARRAY_SIZE(tvout_debugfs_files),
> - minor->debugfs_root, minor);
> + drm_printf(p, "\n");
> }
>
> static void sti_tvout_encoder_dpms(struct drm_encoder *encoder, int mode)
> @@ -596,36 +587,9 @@ static void sti_tvout_encoder_destroy(struct drm_encoder *encoder)
> kfree(sti_encoder);
> }
>
> -static int sti_tvout_late_register(struct drm_encoder *encoder)
> -{
> - struct sti_tvout *tvout = to_sti_tvout(encoder);
> - int ret;
> -
> - if (tvout->debugfs_registered)
> - return 0;
> -
> - ret = tvout_debugfs_init(tvout, encoder->dev->primary);
> - if (ret)
> - return ret;
> -
> - tvout->debugfs_registered = true;
> - return 0;
> -}
> -
> -static void sti_tvout_early_unregister(struct drm_encoder *encoder)
> -{
> - struct sti_tvout *tvout = to_sti_tvout(encoder);
> -
> - if (!tvout->debugfs_registered)
> - return;
> -
> - tvout->debugfs_registered = false;
> -}
> -
> static const struct drm_encoder_funcs sti_tvout_encoder_funcs = {
> .destroy = sti_tvout_encoder_destroy,
> - .late_register = sti_tvout_late_register,
> - .early_unregister = sti_tvout_early_unregister,
> + .atomic_print = sti_tvout_print
> };
>
> static void sti_dvo_encoder_enable(struct drm_encoder *encoder)
>
Reviewed-by: Philippe Cornu <[email protected]>
Many thanks
Philippe :-)
Gentle ping on this serie,
Thanks
Benjamin
2018-06-05 15:54 GMT+02:00 Benjamin Gaignard <[email protected]>:
> Thanks to the various atomic_print_state hooks in drm structure all
> custom debugfs code could be remove from sti driver (~ -330 lines).
>
> This patchset does two addtion in drm core:
> - printing normalized zpos of each plane
> - add "atomic_print" hook in encoder structure to be able to dump encoders
> at the same time than the others elements
>
> All other patches are implemeting the various hooks in sti driver.
>
> Benjamin Gaignard (7):
> drm: print plane state normalized zpos value
> drm: add hook to print encoder status
> drm: sti: make planes use atomic_print_state instead of debugfs
> drm: sti: make connectors use atomic_print_state instead of debugfs
> drm: sti: make crtc use atomic_print_state instead of debugfs
> drm: sti: make encoders use atomic_print_state instead of debugfs
> drm: sti: remove the last call to debugfs
>
> drivers/gpu/drm/drm_atomic.c | 16 +++
> drivers/gpu/drm/sti/sti_compositor.c | 16 ---
> drivers/gpu/drm/sti/sti_compositor.h | 3 -
> drivers/gpu/drm/sti/sti_crtc.c | 17 +--
> drivers/gpu/drm/sti/sti_cursor.c | 65 ++++--------
> drivers/gpu/drm/sti/sti_drv.c | 50 ---------
> drivers/gpu/drm/sti/sti_dvo.c | 60 +++--------
> drivers/gpu/drm/sti/sti_gdp.c | 196 +++++++++++------------------------
> drivers/gpu/drm/sti/sti_hda.c | 75 ++++----------
> drivers/gpu/drm/sti/sti_hdmi.c | 132 ++++++++++-------------
> drivers/gpu/drm/sti/sti_hqvdp.c | 149 +++++++++++---------------
> drivers/gpu/drm/sti/sti_mixer.c | 89 +++++-----------
> drivers/gpu/drm/sti/sti_mixer.h | 3 +-
> drivers/gpu/drm/sti/sti_tvout.c | 162 +++++++++++------------------
> drivers/gpu/drm/sti/sti_vid.c | 60 ++++-------
> drivers/gpu/drm/sti/sti_vid.h | 2 +-
> include/drm/drm_encoder.h | 12 +++
> 17 files changed, 386 insertions(+), 721 deletions(-)
>
> --
> 2.15.0
>
--
Benjamin Gaignard
Graphic Study Group
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
On Tue, Jun 05, 2018 at 03:54:02PM +0200, Benjamin Gaignard wrote:
> Even if encoders don't have state it could be useful to get information
> from them when dumping of the other elements state.
> Add an optional hook in drm_encoder_funcs structure and call it after crtc
> print state.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> drivers/gpu/drm/drm_atomic.c | 15 +++++++++++++++
> include/drm/drm_encoder.h | 12 ++++++++++++
> 2 files changed, 27 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index cd1d677617c8..6a9f5be01172 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -28,6 +28,7 @@
>
> #include <drm/drmP.h>
> #include <drm/drm_atomic.h>
> +#include <drm/drm_encoder.h>
> #include <drm/drm_mode.h>
> #include <drm/drm_print.h>
> #include <linux/sync_file.h>
> @@ -1799,6 +1800,15 @@ int drm_atomic_nonblocking_commit(struct drm_atomic_state *state)
> }
> EXPORT_SYMBOL(drm_atomic_nonblocking_commit);
>
> +static void drm_atomic_encoder_print(struct drm_printer *p,
> + struct drm_encoder *encoder)
> +{
> + drm_printf(p, "encoder[%u]: %s\n", encoder->base.id, encoder->name);
> +
> + if (encoder->funcs->atomic_print)
> + encoder->funcs->atomic_print(p, encoder);
> +}
> +
> static void drm_atomic_print_state(const struct drm_atomic_state *state)
> {
> struct drm_printer p = drm_info_printer(state->dev->dev);
> @@ -1828,6 +1838,7 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
> struct drm_mode_config *config = &dev->mode_config;
> struct drm_plane *plane;
> struct drm_crtc *crtc;
> + struct drm_encoder *encoder;
> struct drm_connector *connector;
> struct drm_connector_list_iter conn_iter;
>
> @@ -1850,6 +1861,10 @@ static void __drm_state_dump(struct drm_device *dev, struct drm_printer *p,
> drm_modeset_unlock(&crtc->mutex);
> }
>
> + drm_for_each_encoder(encoder, dev) {
> + drm_atomic_encoder_print(p, encoder);
> + }
This doesn't make sense to me at all. There's no encoder state, what
exactly do you want to print here?
Note that if you just want to dump hw state from your atomic state
functions (which might be useful sometimes, who knows) you can also dump
encoders by looking at connector_state->best_encoder.
Of have your own sti_dump_state which also adds this loop here.
Ack on the first patch from me.
-Daniel
> +
> drm_connector_list_iter_begin(dev, &conn_iter);
> if (take_locks)
> drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
> diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
> index fb299696c7c4..b847dad817b0 100644
> --- a/include/drm/drm_encoder.h
> +++ b/include/drm/drm_encoder.h
> @@ -80,6 +80,18 @@ struct drm_encoder_funcs {
> * before data structures are torndown.
> */
> void (*early_unregister)(struct drm_encoder *encoder);
> +
> + /**
> + * @atomic_print
> + *
> + * If driver could implement this optional hook for printing
> + * additional driver specific information.
> + *
> + * Do not call this directly, use drm_atomic_encoder_print()
> + * instead.
> + */
> + void (*atomic_print)(struct drm_printer *p,
> + struct drm_encoder *encoder);
> };
>
> /**
> --
> 2.15.0
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
2018-06-05 15:54 GMT+02:00 Benjamin Gaignard <[email protected]>:
> When dumping plane state print normalized zpos value as done for
> the other plane state fields.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
Applied on drm-misc-next.
The others patches of this series are abandoned
Benjamin
> ---
> drivers/gpu/drm/drm_atomic.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 07fef42869aa..cd1d677617c8 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -988,6 +988,7 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,
> drm_printf(p, "\tcrtc-pos=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&dest));
> drm_printf(p, "\tsrc-pos=" DRM_RECT_FP_FMT "\n", DRM_RECT_FP_ARG(&src));
> drm_printf(p, "\trotation=%x\n", state->rotation);
> + drm_printf(p, "\tnormalized-zpos=%x\n", state->normalized_zpos);
> drm_printf(p, "\tcolor-encoding=%s\n",
> drm_get_color_encoding_name(state->color_encoding));
> drm_printf(p, "\tcolor-range=%s\n",
> --
> 2.15.0
>