mali_session.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * This confidential and proprietary software may be used only as
  3. * authorised by a licensing agreement from ARM Limited
  4. * (C) COPYRIGHT 2008-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_SESSION_H__
  11. #define __MALI_SESSION_H__
  12. #include "mali_mmu_page_directory.h"
  13. #include "mali_kernel_descriptor_mapping.h"
  14. #include "mali_osk.h"
  15. #include "mali_osk_list.h"
  16. struct mali_timeline_system;
  17. struct mali_soft_system;
  18. /* Number of frame builder job lists per session. */
  19. #define MALI_PP_JOB_FB_LOOKUP_LIST_SIZE 16
  20. #define MALI_PP_JOB_FB_LOOKUP_LIST_MASK (MALI_PP_JOB_FB_LOOKUP_LIST_SIZE - 1)
  21. struct mali_session_data {
  22. _mali_osk_notification_queue_t * ioctl_queue;
  23. _mali_osk_mutex_t *memory_lock; /**< Lock protecting the vm manipulation */
  24. mali_descriptor_mapping * descriptor_mapping; /**< Mapping between userspace descriptors and our pointers */
  25. _mali_osk_list_t memory_head; /**< Track all the memory allocated in this session, for freeing on abnormal termination */
  26. struct mali_page_directory *page_directory; /**< MMU page directory for this session */
  27. _MALI_OSK_LIST_HEAD(link); /**< Link for list of all sessions */
  28. _MALI_OSK_LIST_HEAD(pp_job_list); /**< List of all PP jobs on this session */
  29. #if defined(CONFIG_MALI400_POWER_PERFORMANCE_POLICY)
  30. _mali_osk_atomic_t number_of_window_jobs; /**< Record the window jobs completed on this session in a period */
  31. #endif
  32. _mali_osk_list_t pp_job_fb_lookup_list[MALI_PP_JOB_FB_LOOKUP_LIST_SIZE]; /**< List of PP job lists per frame builder id. Used to link jobs from same frame builder. */
  33. struct mali_soft_job_system *soft_job_system; /**< Soft job system for this session. */
  34. struct mali_timeline_system *timeline_system; /**< Timeline system for this session. */
  35. mali_bool is_aborting; /**< MALI_TRUE if the session is aborting, MALI_FALSE if not. */
  36. mali_bool use_high_priority_job_queue; /**< If MALI_TRUE, jobs added from this session will use the high priority job queues. */
  37. };
  38. _mali_osk_errcode_t mali_session_initialize(void);
  39. void mali_session_terminate(void);
  40. /* List of all sessions. Actual list head in mali_kernel_core.c */
  41. extern _mali_osk_list_t mali_sessions;
  42. /* Lock to protect modification and access to the mali_sessions list */
  43. extern _mali_osk_spinlock_irq_t *mali_sessions_lock;
  44. MALI_STATIC_INLINE void mali_session_lock(void)
  45. {
  46. _mali_osk_spinlock_irq_lock(mali_sessions_lock);
  47. }
  48. MALI_STATIC_INLINE void mali_session_unlock(void)
  49. {
  50. _mali_osk_spinlock_irq_unlock(mali_sessions_lock);
  51. }
  52. void mali_session_add(struct mali_session_data *session);
  53. void mali_session_remove(struct mali_session_data *session);
  54. u32 mali_session_get_count(void);
  55. #define MALI_SESSION_FOREACH(session, tmp, link) \
  56. _MALI_OSK_LIST_FOREACHENTRY(session, tmp, &mali_sessions, struct mali_session_data, link)
  57. MALI_STATIC_INLINE struct mali_page_directory *mali_session_get_page_directory(struct mali_session_data *session)
  58. {
  59. return session->page_directory;
  60. }
  61. MALI_STATIC_INLINE void mali_session_send_notification(struct mali_session_data *session, _mali_osk_notification_t *object)
  62. {
  63. _mali_osk_notification_queue_send(session->ioctl_queue, object);
  64. }
  65. /*
  66. * Get the max completed window jobs from all active session,
  67. * which will be used in window render frame per sec calculate
  68. */
  69. #if defined(CONFIG_MALI400_POWER_PERFORMANCE_POLICY)
  70. u32 mali_session_max_window_num(void);
  71. #endif
  72. #endif /* __MALI_SESSION_H__ */