mali_kbase_jm.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. *
  3. * (C) COPYRIGHT 2014 ARM Limited. All rights reserved.
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * A copy of the licence is included with the program, and can also be obtained
  11. * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  12. * Boston, MA 02110-1301, USA.
  13. *
  14. */
  15. /*
  16. * Job manager common APIs
  17. */
  18. #ifndef _KBASE_JM_H_
  19. #define _KBASE_JM_H_
  20. /**
  21. * kbase_jm_kick() - Indicate that there are jobs ready to run.
  22. * @kbdev: Device pointer
  23. * @js_mask: Mask of the job slots that can be pulled from.
  24. *
  25. * Caller must hold the runpool_irq lock and schedule_sem semaphore
  26. *
  27. * Return: Mask of the job slots that can still be submitted to.
  28. */
  29. u32 kbase_jm_kick(struct kbase_device *kbdev, u32 js_mask);
  30. /**
  31. * kbase_jm_kick_all() - Indicate that there are jobs ready to run on all job
  32. * slots.
  33. * @kbdev: Device pointer
  34. *
  35. * Caller must hold the runpool_irq lock and schedule_sem semaphore
  36. *
  37. * Return: Mask of the job slots that can still be submitted to.
  38. */
  39. static inline u32 kbase_jm_kick_all(struct kbase_device *kbdev)
  40. {
  41. return kbase_jm_kick(kbdev, (1 << kbdev->gpu_props.num_job_slots) - 1);
  42. }
  43. /**
  44. * kbase_jm_try_kick - Attempt to call kbase_jm_kick
  45. * @kbdev: Device pointer
  46. * @js_mask: Mask of the job slots that can be pulled from
  47. * Context: Caller must hold runpool_irq lock
  48. *
  49. * If schedule_sem can be immediately obtained then this function will call
  50. * kbase_jm_kick() otherwise it will do nothing.
  51. */
  52. void kbase_jm_try_kick(struct kbase_device *kbdev, u32 js_mask);
  53. /**
  54. * kbase_jm_try_kick_all() - Attempt to call kbase_jm_kick_all
  55. * @kbdev: Device pointer
  56. * Context: Caller must hold runpool_irq lock
  57. *
  58. * If schedule_sem can be immediately obtained then this function will call
  59. * kbase_jm_kick_all() otherwise it will do nothing.
  60. */
  61. void kbase_jm_try_kick_all(struct kbase_device *kbdev);
  62. /**
  63. * kbase_jm_idle_ctx() - Mark a context as idle.
  64. * @kbdev: Device pointer
  65. * @kctx: Context to mark as idle
  66. *
  67. * No more atoms will be pulled from this context until it is marked as active
  68. * by kbase_js_use_ctx().
  69. *
  70. * The context should have no atoms currently pulled from it
  71. * (kctx->atoms_pulled == 0).
  72. *
  73. * Caller must hold the runpool_irq lock
  74. */
  75. void kbase_jm_idle_ctx(struct kbase_device *kbdev, struct kbase_context *kctx);
  76. /**
  77. * kbase_jm_return_atom_to_js() - Return an atom to the job scheduler that has
  78. * been soft-stopped or will fail due to a
  79. * dependency
  80. * @kbdev: Device pointer
  81. * @katom: Atom that has been stopped or will be failed
  82. */
  83. void kbase_jm_return_atom_to_js(struct kbase_device *kbdev,
  84. struct kbase_jd_atom *katom);
  85. /**
  86. * kbase_jm_complete() - Complete an atom
  87. * @kbdev: Device pointer
  88. * @katom: Atom that has completed
  89. * @end_timestamp: Timestamp of atom completion
  90. */
  91. void kbase_jm_complete(struct kbase_device *kbdev, struct kbase_jd_atom *katom,
  92. ktime_t *end_timestamp);
  93. #endif // ifndef _KBASE_JM_H_