msm_fence.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2013-2016 Red Hat
  3. * Author: Rob Clark <robdclark@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef __MSM_FENCE_H__
  18. #define __MSM_FENCE_H__
  19. #include "msm_drv.h"
  20. struct msm_fence_context {
  21. struct drm_device *dev;
  22. const char *name;
  23. unsigned context;
  24. /* last_fence == completed_fence --> no pending work */
  25. uint32_t last_fence; /* last assigned fence */
  26. uint32_t completed_fence; /* last completed fence */
  27. wait_queue_head_t event;
  28. spinlock_t spinlock;
  29. };
  30. struct msm_fence_context * msm_fence_context_alloc(struct drm_device *dev,
  31. const char *name);
  32. void msm_fence_context_free(struct msm_fence_context *fctx);
  33. int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
  34. ktime_t *timeout, bool interruptible);
  35. int msm_queue_fence_cb(struct msm_fence_context *fctx,
  36. struct msm_fence_cb *cb, uint32_t fence);
  37. void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence);
  38. struct fence * msm_fence_alloc(struct msm_fence_context *fctx);
  39. #endif