msm_cvp_synx.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _MSM_CVP_SYNX_H_
  6. #define _MSM_CVP_SYNX_H_
  7. #include <linux/types.h>
  8. #include <media/msm_eva_private.h>
  9. #include "cvp_comm_def.h"
  10. struct cvp_fence_queue {
  11. struct mutex lock;
  12. enum queue_state state;
  13. enum op_mode mode;
  14. struct list_head wait_list;
  15. wait_queue_head_t wq;
  16. struct list_head sched_list;
  17. };
  18. struct cvp_fence_type {
  19. s32 h_synx;
  20. u32 secure_key;
  21. };
  22. struct cvp_fence_command {
  23. struct list_head list;
  24. u64 frame_id;
  25. enum op_mode mode;
  26. u32 signature;
  27. u32 num_fences;
  28. u32 output_index;
  29. u32 type;
  30. u32 synx[MAX_HFI_FENCE_SIZE/2];
  31. struct cvp_hfi_cmd_session_hdr *pkt;
  32. };
  33. enum cvp_synx_type {
  34. CVP_UINIT_SYNX,
  35. CVP_INPUT_SYNX,
  36. CVP_OUTPUT_SYNX,
  37. CVP_INVALID_SYNX,
  38. };
  39. #ifdef CVP_SYNX_ENABLED
  40. int cvp_sess_init_synx(struct msm_cvp_inst *inst);
  41. int cvp_sess_deinit_synx(struct msm_cvp_inst *inst);
  42. int cvp_import_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc,
  43. u32 *fence);
  44. int cvp_release_synx(struct msm_cvp_inst *inst, struct cvp_fence_command *fc);
  45. int cvp_cancel_synx(struct msm_cvp_inst *inst, enum cvp_synx_type type,
  46. struct cvp_fence_command *fc, int synx_state);
  47. int cvp_synx_ops(struct msm_cvp_inst *inst, enum cvp_synx_type type,
  48. struct cvp_fence_command *fc, u32 *synx_state);
  49. void cvp_dump_fence_queue(struct msm_cvp_inst *inst);
  50. #else
  51. static inline int cvp_sess_init_synx(struct msm_cvp_inst *inst)
  52. {
  53. return -ENODEV;
  54. }
  55. static inline int cvp_sess_deinit_synx(struct msm_cvp_inst *inst)
  56. {
  57. return -ENODEV;
  58. }
  59. static inline int cvp_import_synx(struct msm_cvp_inst *inst,
  60. struct cvp_fence_command *fc,
  61. u32 *fence)
  62. {
  63. return -ENODEV;
  64. }
  65. static inline int cvp_release_synx(struct msm_cvp_inst *inst,
  66. struct cvp_fence_command *fc)
  67. {
  68. return -ENODEV;
  69. }
  70. static inline int cvp_cancel_synx(struct msm_cvp_inst *inst,
  71. enum cvp_synx_type type,
  72. struct cvp_fence_command *fc,
  73. int synx_state)
  74. {
  75. return -ENODEV;
  76. }
  77. static inline int cvp_synx_ops(struct msm_cvp_inst *inst,
  78. enum cvp_synx_type type,
  79. struct cvp_fence_command *fc,
  80. u32 *synx_state)
  81. {
  82. return -ENODEV;
  83. }
  84. static inline void cvp_dump_fence_queue(struct msm_cvp_inst *inst)
  85. {
  86. return;
  87. }
  88. #endif
  89. #endif