mali_kbase_sync.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. *
  3. * (C) COPYRIGHT 2012-2015 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. * @file mali_kbase_sync.h
  17. *
  18. */
  19. #ifndef MALI_KBASE_SYNC_H
  20. #define MALI_KBASE_SYNC_H
  21. #include "sync.h"
  22. /*
  23. * Create a stream object.
  24. * Built on top of timeline object.
  25. * Exposed as a file descriptor.
  26. * Life-time controlled via the file descriptor:
  27. * - dup to add a ref
  28. * - close to remove a ref
  29. */
  30. int kbase_stream_create(const char *name, int *const out_fd);
  31. /*
  32. * Create a fence in a stream object
  33. */
  34. int kbase_stream_create_fence(int tl_fd);
  35. /*
  36. * Validate a fd to be a valid fence
  37. * No reference is taken.
  38. *
  39. * This function is only usable to catch unintentional user errors early,
  40. * it does not stop malicious code changing the fd after this function returns.
  41. */
  42. int kbase_fence_validate(int fd);
  43. /* Returns true if the specified timeline is allocated by Mali */
  44. int kbase_sync_timeline_is_ours(struct sync_timeline *timeline);
  45. /* Allocates a timeline for Mali
  46. *
  47. * One timeline should be allocated per API context.
  48. */
  49. struct sync_timeline *kbase_sync_timeline_alloc(const char *name);
  50. /* Allocates a sync point within the timeline.
  51. *
  52. * The timeline must be the one allocated by kbase_sync_timeline_alloc
  53. *
  54. * Sync points must be triggered in *exactly* the same order as they are allocated.
  55. */
  56. struct sync_pt *kbase_sync_pt_alloc(struct sync_timeline *parent);
  57. /* Signals a particular sync point
  58. *
  59. * Sync points must be triggered in *exactly* the same order as they are allocated.
  60. *
  61. * If they are signalled in the wrong order then a message will be printed in debug
  62. * builds and otherwise attempts to signal order sync_pts will be ignored.
  63. *
  64. * result can be negative to indicate error, any other value is interpreted as success.
  65. */
  66. void kbase_sync_signal_pt(struct sync_pt *pt, int result);
  67. #endif