summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishnu Reddy Mandalapu <vmandalapu@nvidia.com>2017-07-22 19:32:39 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-28 00:40:37 -0400
commitea44f00a236726681f8fc154d7ea34e98712e2a2 (patch)
tree9824aeff3059f8b2656e5cf7388674555836eb07
parent20826434e107c8432cec11111d1fe0e2cd4d3636 (diff)
dc: video: debugfs: Add flip stats node
-- /sys/kernel/debugfs/tegradc.x/flip_stats node added. -- flip_stats node has two counters queued and skipped. -- Increment flips_queued counter for each queued fliip on a head. -- Increment flips_skipped counter for each skipped flip which are queued on a head. -- Increment flips_completed counter for each completed flip which are queued on a head. EVLR-1247 Bug 200275224 Change-Id: Ide33fc3446d127ee65fad9b922862f3204898229 Signed-off-by: Vishnu Reddy Mandalapu <vmandalapu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1525014 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/video/tegra/dc/dc.c39
-rw-r--r--drivers/video/tegra/dc/dc_priv_defs.h9
-rw-r--r--drivers/video/tegra/dc/ext/dev.c8
3 files changed, 51 insertions, 5 deletions
diff --git a/drivers/video/tegra/dc/dc.c b/drivers/video/tegra/dc/dc.c
index 9f4b8fc18..6bb4ec20b 100644
--- a/drivers/video/tegra/dc/dc.c
+++ b/drivers/video/tegra/dc/dc.c
@@ -2419,6 +2419,35 @@ static const struct file_operations dbg_hw_index_ops = {
2419 .release = single_release, 2419 .release = single_release,
2420}; 2420};
2421 2421
2422static int dbg_flip_stats_show(struct seq_file *m, void *unused)
2423{
2424 struct tegra_dc *dc = m->private;
2425
2426 if (WARN_ON(!dc || !dc->out))
2427 return -EINVAL;
2428
2429 seq_printf(m, "Flips queued: %ld\n",
2430 atomic64_read(&dc->flip_stats.flips_queued));
2431 seq_printf(m, "Flips skipped: %ld\n",
2432 atomic64_read(&dc->flip_stats.flips_skipped));
2433 seq_printf(m, "Flips completed: %ld\n",
2434 atomic64_read(&dc->flip_stats.flips_cmpltd));
2435
2436 return 0;
2437}
2438
2439static int dbg_flip_stats_open(struct inode *inode, struct file *file)
2440{
2441 return single_open(file, dbg_flip_stats_show, inode->i_private);
2442}
2443
2444static const struct file_operations dbg_flip_stats_ops = {
2445 .open = dbg_flip_stats_open,
2446 .read = seq_read,
2447 .llseek = seq_lseek,
2448 .release = single_release,
2449};
2450
2422static void tegra_dc_remove_debugfs(struct tegra_dc *dc) 2451static void tegra_dc_remove_debugfs(struct tegra_dc *dc)
2423{ 2452{
2424 if (dc->debugdir) 2453 if (dc->debugdir)
@@ -2671,6 +2700,11 @@ static void tegra_dc_create_debugfs(struct tegra_dc *dc)
2671 if (!retval) 2700 if (!retval)
2672 goto remove_out; 2701 goto remove_out;
2673 2702
2703 retval = debugfs_create_file("flip_stats", S_IRUGO, dc->debugdir,
2704 dc, &dbg_flip_stats_ops);
2705 if (!retval)
2706 goto remove_out;
2707
2674 if (dc->out_ops->get_connector_instance) { 2708 if (dc->out_ops->get_connector_instance) {
2675 char sor_path[CHAR_BUF_SIZE_MAX]; 2709 char sor_path[CHAR_BUF_SIZE_MAX];
2676 int ctrl_num = -1; 2710 int ctrl_num = -1;
@@ -6211,6 +6245,11 @@ static int tegra_dc_probe(struct platform_device *ndev)
6211 } 6245 }
6212#endif 6246#endif
6213 6247
6248 /* Initialize the flip stats to 0. */
6249 atomic64_set(&dc->flip_stats.flips_queued, 0);
6250 atomic64_set(&dc->flip_stats.flips_skipped, 0);
6251 atomic64_set(&dc->flip_stats.flips_cmpltd, 0);
6252
6214 tegra_dc_create_debugfs(dc); 6253 tegra_dc_create_debugfs(dc);
6215 6254
6216 6255
diff --git a/drivers/video/tegra/dc/dc_priv_defs.h b/drivers/video/tegra/dc/dc_priv_defs.h
index c058550d4..6cf2e2f53 100644
--- a/drivers/video/tegra/dc/dc_priv_defs.h
+++ b/drivers/video/tegra/dc/dc_priv_defs.h
@@ -227,6 +227,12 @@ struct tegra_dc_hw_data {
227 enum tegra_dc_hw version; 227 enum tegra_dc_hw version;
228}; 228};
229 229
230struct tegra_dc_flip_stats {
231 atomic64_t flips_skipped;
232 atomic64_t flips_queued;
233 atomic64_t flips_cmpltd;
234};
235
230/* 236/*
231 * struct tegra_dc_client_data - stores all per client specific data for 237 * struct tegra_dc_client_data - stores all per client specific data for
232 * required for notifying when the requested events occur. 238 * required for notifying when the requested events occur.
@@ -569,8 +575,7 @@ struct tegra_dc {
569 struct frame_lock_info frm_lck_info; 575 struct frame_lock_info frm_lck_info;
570 unsigned long act_req_mask; 576 unsigned long act_req_mask;
571 struct tegra_dc_clients_info clients_info; 577 struct tegra_dc_clients_info clients_info;
572 578 struct tegra_dc_flip_stats flip_stats;
573 u64 flips_queued;
574 579
575 struct tegra_dc_ring_buf flip_buf; /* Buffer to save flip requests */ 580 struct tegra_dc_ring_buf flip_buf; /* Buffer to save flip requests */
576 struct tegra_dc_ring_buf crc_buf; /* Buffer to save HW generated CRCs */ 581 struct tegra_dc_ring_buf crc_buf; /* Buffer to save HW generated CRCs */
diff --git a/drivers/video/tegra/dc/ext/dev.c b/drivers/video/tegra/dc/ext/dev.c
index 12e2dcdbb..0edf51e6b 100644
--- a/drivers/video/tegra/dc/ext/dev.c
+++ b/drivers/video/tegra/dc/ext/dev.c
@@ -1224,6 +1224,9 @@ static void tegra_dc_ext_flip_worker(struct kthread_work *work)
1224 tegra_dc_incr_syncpt_min(dc, index, 1224 tegra_dc_incr_syncpt_min(dc, index,
1225 flip_win->syncpt_max); 1225 flip_win->syncpt_max);
1226 } 1226 }
1227 atomic64_inc(&dc->flip_stats.flips_cmpltd);
1228 } else {
1229 atomic64_inc(&dc->flip_stats.flips_skipped);
1227 } 1230 }
1228 1231
1229 /* unpin and deref previous front buffers */ 1232 /* unpin and deref previous front buffers */
@@ -1918,11 +1921,10 @@ static int tegra_dc_ext_flip(struct tegra_dc_ext_user *user,
1918#endif 1921#endif
1919 data->flags = flip_flags; 1922 data->flags = flip_flags;
1920 1923
1921 mutex_lock(&user->ext->dc->lock); 1924 flip_id_local = atomic64_inc_return
1922 flip_id_local = user->ext->dc->flips_queued++; 1925 (&user->ext->dc->flip_stats.flips_queued);
1923 if (flip_id) 1926 if (flip_id)
1924 *flip_id = flip_id_local; 1927 *flip_id = flip_id_local;
1925 mutex_unlock(&user->ext->dc->lock);
1926 1928
1927 /* Insert the flip in the flip queue if CRC is enabled */ 1929 /* Insert the flip in the flip queue if CRC is enabled */
1928 if (atomic_read(&ext->dc->crc_ref_cnt.global)) { 1930 if (atomic_read(&ext->dc->crc_ref_cnt.global)) {