mtk_gpu_utility.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) 2015 MediaTek Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __MTK_GPU_UTILITY_H__
  14. #define __MTK_GPU_UTILITY_H__
  15. #include <linux/types.h>
  16. #define MTK_GPU_DVFS_TYPE_LIST {\
  17. MTK_GPU_DVFS_TYPE_ITEM(NONE) \
  18. MTK_GPU_DVFS_TYPE_ITEM(SMARTBOOST) \
  19. MTK_GPU_DVFS_TYPE_ITEM(VSYNCBASED) \
  20. MTK_GPU_DVFS_TYPE_ITEM(FALLBACK) \
  21. MTK_GPU_DVFS_TYPE_ITEM(TIMERBASED) \
  22. MTK_GPU_DVFS_TYPE_ITEM(FASTDVFS) \
  23. MTK_GPU_DVFS_TYPE_ITEM(TOUCHBOOST) \
  24. MTK_GPU_DVFS_TYPE_ITEM(THERMAL) \
  25. MTK_GPU_DVFS_TYPE_ITEM(CUSTOMIZATION) }
  26. typedef enum MTK_GPU_DVFS_TYPE_TAG
  27. #define MTK_GPU_DVFS_TYPE_ITEM(type) MTK_GPU_DVFS_TYPE_##type,
  28. MTK_GPU_DVFS_TYPE_LIST
  29. #undef MTK_GPU_DVFS_TYPE_ITEM
  30. MTK_GPU_DVFS_TYPE;
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. /* returning false indicated no implement */
  36. /* unit: x bytes */
  37. bool mtk_get_gpu_memory_usage(unsigned int *pMemUsage);
  38. bool mtk_get_gpu_page_cache(unsigned int *pPageCache);
  39. /* unit: 0~100 % */
  40. bool mtk_get_gpu_loading(unsigned int *pLoading);
  41. bool mtk_get_gpu_block(unsigned int *pBlock);
  42. bool mtk_get_gpu_idle(unsigned int *pIlde);
  43. bool mtk_get_gpu_freq(unsigned int *pFreq);
  44. bool mtk_get_gpu_GP_loading(unsigned int *pLoading);
  45. bool mtk_get_gpu_PP_loading(unsigned int *pLoading);
  46. bool mtk_get_gpu_power_loading(unsigned int *pLoading);
  47. bool mtk_enable_gpu_dvfs_timer(bool bEnable);
  48. bool mtk_boost_gpu_freq(void);
  49. bool mtk_set_bottom_gpu_freq(unsigned int ui32FreqLevel);
  50. /* ui32FreqLevel: 0=>lowest freq, count-1=>highest freq */
  51. bool mtk_custom_get_gpu_freq_level_count(unsigned int *pui32FreqLevelCount);
  52. bool mtk_custom_boost_gpu_freq(unsigned int ui32FreqLevel);
  53. bool mtk_custom_upbound_gpu_freq(unsigned int ui32FreqLevel);
  54. bool mtk_get_custom_boost_gpu_freq(unsigned int *pui32FreqLevel);
  55. bool mtk_get_custom_upbound_gpu_freq(unsigned int *pui32FreqLevel);
  56. bool mtk_dump_gpu_memory_usage(void);
  57. bool mtk_get_gpu_dvfs_from(MTK_GPU_DVFS_TYPE *peType, unsigned long *pulFreq);
  58. bool mtk_get_3D_fences_count(int *pi32Count);
  59. bool mtk_get_vsync_based_target_freq(unsigned long *pulFreq);
  60. bool mtk_get_gpu_sub_loading(unsigned int *pLoading);
  61. bool mtk_get_gpu_bottom_freq(unsigned long *pulFreq);
  62. bool mtk_get_gpu_custom_boost_freq(unsigned long *pulFreq);
  63. bool mtk_get_gpu_custom_upbound_freq(unsigned long *pulFreq);
  64. bool mtk_get_vsync_offset_event_status(unsigned int *pui32EventStatus);
  65. bool mtk_get_vsync_offset_debug_status(unsigned int *pui32DebugStatus);
  66. bool mtk_report_3D_fence_count(int i32Count);
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif