mali_pp_scheduler.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * This confidential and proprietary software may be used only as
  3. * authorised by a licensing agreement from ARM Limited
  4. * (C) COPYRIGHT 2012-2013 ARM Limited
  5. * ALL RIGHTS RESERVED
  6. * The entire notice above must be reproduced on all authorised
  7. * copies and copies may only be made to the extent permitted
  8. * by a licensing agreement from ARM Limited.
  9. */
  10. #ifndef __MALI_PP_SCHEDULER_H__
  11. #define __MALI_PP_SCHEDULER_H__
  12. #include "mali_osk.h"
  13. #include "mali_pp_job.h"
  14. #include "mali_group.h"
  15. #include "linux/mali/mali_utgard.h"
  16. /** Initalize the HW independent parts of the PP scheduler
  17. */
  18. _mali_osk_errcode_t mali_pp_scheduler_initialize(void);
  19. void mali_pp_scheduler_terminate(void);
  20. /** Poplulate the PP scheduler with groups
  21. */
  22. void mali_pp_scheduler_populate(void);
  23. void mali_pp_scheduler_depopulate(void);
  24. /**
  25. * @brief Handle job completion.
  26. *
  27. * Will attempt to start a new job on the locked group.
  28. *
  29. * If all sub jobs have completed the job's tracker will be released, any other resources associated
  30. * with the job will be freed. A notification will also be sent to user space.
  31. *
  32. * Releasing the tracker might activate other jobs, so if appropriate we also schedule them.
  33. *
  34. * @note Group must be locked when entering this function. Will be unlocked before exiting.
  35. *
  36. * @param group The group that completed the job.
  37. * @param job The job that is done.
  38. * @param sub_job Sub job of job.
  39. * @param success MALI_TRUE if job completed successfully, MALI_FALSE if not.
  40. * @param in_upper_half MALI_TRUE if called from upper half, MALI_FALSE if not.
  41. */
  42. void mali_pp_scheduler_job_done(struct mali_group *group, struct mali_pp_job *job, u32 sub_job, mali_bool success, mali_bool in_upper_half);
  43. void mali_pp_scheduler_suspend(void);
  44. void mali_pp_scheduler_resume(void);
  45. /**
  46. * @brief Abort all running and queued PP jobs from session.
  47. *
  48. * This functions aborts all PP jobs from the specified session. Queued jobs are removed from the
  49. * queue and jobs currently running on a core will be aborted.
  50. *
  51. * @param session Session that is aborting.
  52. */
  53. void mali_pp_scheduler_abort_session(struct mali_session_data *session);
  54. /**
  55. * @brief Reset all groups
  56. *
  57. * This function resets all groups known by the PP scheuduler. This must be
  58. * called after the Mali HW has been powered on in order to reset the HW.
  59. *
  60. * This function is intended for power on reset of all cores.
  61. * No locking is done, which can only be safe if the scheduler is paused and
  62. * all cores idle. That is always the case on init and power on.
  63. */
  64. void mali_pp_scheduler_reset_all_groups(void);
  65. /**
  66. * @brief Zap TLB on all groups with \a session active
  67. *
  68. * The scheculer will zap the session on all groups it owns.
  69. */
  70. void mali_pp_scheduler_zap_all_active(struct mali_session_data *session);
  71. /**
  72. * @brief Get the virtual PP core
  73. *
  74. * The returned PP core may only be used to prepare DMA command buffers for the
  75. * PP core. Other actions must go through the PP scheduler, or the virtual
  76. * group.
  77. *
  78. * @return Pointer to the virtual PP core, NULL if this doesn't exist
  79. */
  80. struct mali_pp_core *mali_pp_scheduler_get_virtual_pp(void);
  81. u32 mali_pp_scheduler_dump_state(char *buf, u32 size);
  82. void mali_pp_scheduler_enable_group(struct mali_group *group);
  83. void mali_pp_scheduler_disable_group(struct mali_group *group);
  84. /**
  85. * @brief Used by the Timeline system to queue a PP job.
  86. *
  87. * @note @ref mali_scheduler_schedule_from_mask() should be called if this function returns non-zero.
  88. *
  89. * @param job The PP job that is being activated.
  90. *
  91. * @return A scheduling bitmask that can be used to decide if scheduling is necessary after this
  92. * call.
  93. */
  94. mali_scheduler_mask mali_pp_scheduler_activate_job(struct mali_pp_job *job);
  95. /**
  96. * @brief Schedule queued jobs on idle cores.
  97. */
  98. void mali_pp_scheduler_schedule(void);
  99. int mali_pp_scheduler_set_perf_level(u32 cores, mali_bool override);
  100. void mali_pp_scheduler_core_scaling_enable(void);
  101. void mali_pp_scheduler_core_scaling_disable(void);
  102. mali_bool mali_pp_scheduler_core_scaling_is_enabled(void);
  103. u32 mali_pp_scheduler_get_num_cores_total(void);
  104. u32 mali_pp_scheduler_get_num_cores_enabled(void);
  105. /**
  106. * @brief Returns the number of Pixel Processors in the system irrespective of the context
  107. *
  108. * @return number of physical Pixel Processor cores in the system
  109. */
  110. u32 mali_pp_scheduler_get_num_cores_total(void);
  111. #endif /* __MALI_PP_SCHEDULER_H__ */