nouveau_exec.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: MIT */
  2. #ifndef __NOUVEAU_EXEC_H__
  3. #define __NOUVEAU_EXEC_H__
  4. #include "nouveau_drv.h"
  5. #include "nouveau_sched.h"
  6. struct nouveau_exec_job_args {
  7. struct drm_file *file_priv;
  8. struct nouveau_sched *sched;
  9. struct nouveau_channel *chan;
  10. struct {
  11. struct drm_nouveau_sync *s;
  12. u32 count;
  13. } in_sync;
  14. struct {
  15. struct drm_nouveau_sync *s;
  16. u32 count;
  17. } out_sync;
  18. struct {
  19. struct drm_nouveau_exec_push *s;
  20. u32 count;
  21. } push;
  22. };
  23. struct nouveau_exec_job {
  24. struct nouveau_job base;
  25. struct nouveau_fence *fence;
  26. struct nouveau_channel *chan;
  27. struct {
  28. struct drm_nouveau_exec_push *s;
  29. u32 count;
  30. } push;
  31. };
  32. #define to_nouveau_exec_job(job) \
  33. container_of((job), struct nouveau_exec_job, base)
  34. int nouveau_exec_job_init(struct nouveau_exec_job **job,
  35. struct nouveau_exec_job_args *args);
  36. int nouveau_exec_ioctl_exec(struct drm_device *dev, void *data,
  37. struct drm_file *file_priv);
  38. static inline unsigned int
  39. nouveau_exec_push_max_from_ib_max(int ib_max)
  40. {
  41. /* Limit the number of IBs per job to half the size of the ring in order
  42. * to avoid the ring running dry between submissions and preserve one
  43. * more slot for the job's HW fence.
  44. */
  45. return ib_max > 1 ? ib_max / 2 - 1 : 0;
  46. }
  47. #endif