wfd-util.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #include <linux/debugfs.h>
  14. #include <linux/ktime.h>
  15. #include <linux/list.h>
  16. #include <linux/mutex.h>
  17. #ifndef _WFD_UTIL_H_
  18. #define _WFD_UTIL_H_
  19. /*#define DEBUG_WFD*/
  20. #define WFD_TAG "wfd: "
  21. #define WFD_MSG_INFO(fmt...) pr_info(WFD_TAG fmt)
  22. #define WFD_MSG_WARN(fmt...) pr_warning(WFD_TAG fmt)
  23. #define WFD_MSG_ERR(fmt...) pr_err(WFD_TAG fmt)
  24. #define WFD_MSG_CRIT(fmt...) pr_crit(WFD_TAG fmt)
  25. #define WFD_MSG_DBG(fmt...) pr_debug(WFD_TAG fmt)
  26. struct wfd_stats_encode_sample {
  27. ktime_t encode_start_ts;
  28. struct list_head list;
  29. };
  30. struct wfd_stats {
  31. struct mutex mutex;
  32. /* Output Buffers */
  33. uint32_t v4l2_buf_count;
  34. /* Input Buffers */
  35. uint32_t mdp_buf_count;
  36. uint32_t vsg_buf_count;
  37. uint32_t enc_buf_count;
  38. /* Other */
  39. uint32_t frames_encoded;
  40. uint32_t mdp_updates;
  41. uint32_t enc_avg_latency;
  42. uint32_t enc_cumulative_latency;
  43. uint32_t enc_latency_samples;
  44. struct list_head enc_queue;
  45. /* Debugfs entries */
  46. struct dentry *d_parent;
  47. struct dentry *d_v4l2_buf_count;
  48. struct dentry *d_mdp_buf_count;
  49. struct dentry *d_vsg_buf_count;
  50. struct dentry *d_enc_buf_count;
  51. struct dentry *d_frames_encoded;
  52. struct dentry *d_mdp_updates;
  53. struct dentry *d_enc_avg_latency;
  54. };
  55. enum wfd_stats_event {
  56. WFD_STAT_EVENT_CLIENT_QUEUE,
  57. WFD_STAT_EVENT_CLIENT_DEQUEUE,
  58. WFD_STAT_EVENT_MDP_QUEUE,
  59. WFD_STAT_EVENT_MDP_DEQUEUE,
  60. WFD_STAT_EVENT_VSG_QUEUE,
  61. WFD_STAT_EVENT_VSG_DEQUEUE,
  62. WFD_STAT_EVENT_ENC_QUEUE,
  63. WFD_STAT_EVENT_ENC_DEQUEUE,
  64. };
  65. int wfd_stats_setup(void);
  66. int wfd_stats_init(struct wfd_stats *, int device);
  67. int wfd_stats_update(struct wfd_stats *, enum wfd_stats_event);
  68. int wfd_stats_deinit(struct wfd_stats *);
  69. void wfd_stats_teardown(void);
  70. #endif