msm_vidc_inst.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _MSM_VIDC_INST_H_
  6. #define _MSM_VIDC_INST_H_
  7. #include "msm_vidc_internal.h"
  8. struct msm_vidc_inst;
  9. #define call_session_op(c, op, ...) \
  10. (((c) && (c)->session_ops && (c)->session_ops->op) ? \
  11. ((c)->session_ops->op(__VA_ARGS__)) : 0)
  12. struct msm_vidc_session_ops {
  13. u64 (*calc_freq)(struct msm_vidc_inst *inst);
  14. u64 (*calc_bw)(struct msm_vidc_inst *inst);
  15. int (*decide_work_route)(struct msm_vidc_inst *inst);
  16. int (*decide_work_mode)(struct msm_vidc_inst *inst);
  17. int (*decide_core_and_power_mode)(struct msm_vidc_inst *inst);
  18. int (*buffer_size)(struct msm_vidc_inst *inst, enum msm_vidc_buffer_type type);
  19. int (*min_count)(struct msm_vidc_inst *inst, enum msm_vidc_buffer_type type);
  20. int (*extra_count)(struct msm_vidc_inst *inst, enum msm_vidc_buffer_type type);
  21. };
  22. struct msm_vidc_allocations_info {
  23. struct msm_vidc_allocations bin;
  24. struct msm_vidc_allocations arp;
  25. struct msm_vidc_allocations comv;
  26. struct msm_vidc_allocations non_comv;
  27. struct msm_vidc_allocations line;
  28. struct msm_vidc_allocations dpb;
  29. struct msm_vidc_allocations persist;
  30. };
  31. struct msm_vidc_mappings_info {
  32. struct msm_vidc_mappings input;
  33. struct msm_vidc_mappings output;
  34. struct msm_vidc_mappings input_meta;
  35. struct msm_vidc_mappings output_meta;
  36. struct msm_vidc_mappings bin;
  37. struct msm_vidc_mappings arp;
  38. struct msm_vidc_mappings comv;
  39. struct msm_vidc_mappings non_comv;
  40. struct msm_vidc_mappings line;
  41. struct msm_vidc_mappings dpb;
  42. struct msm_vidc_mappings persist;
  43. };
  44. struct msm_vidc_buffers_info {
  45. struct msm_vidc_buffers input;
  46. struct msm_vidc_buffers output;
  47. struct msm_vidc_buffers input_meta;
  48. struct msm_vidc_buffers output_meta;
  49. struct msm_vidc_buffers bin;
  50. struct msm_vidc_buffers arp;
  51. struct msm_vidc_buffers comv;
  52. struct msm_vidc_buffers non_comv;
  53. struct msm_vidc_buffers line;
  54. struct msm_vidc_buffers dpb;
  55. struct msm_vidc_buffers persist;
  56. };
  57. enum msm_vidc_inst_state {
  58. MSM_VIDC_OPEN = 1,
  59. MSM_VIDC_START_INPUT = 2,
  60. MSM_VIDC_START_OUTPUT = 3,
  61. MSM_VIDC_START = 4,
  62. MSM_VIDC_DRC = 5,
  63. MSM_VIDC_DRC_LAST_FLAG = 6,
  64. MSM_VIDC_DRAIN = 7,
  65. MSM_VIDC_DRAIN_LAST_FLAG = 8,
  66. MSM_VIDC_DRC_DRAIN = 9,
  67. MSM_VIDC_DRC_DRAIN_LAST_FLAG = 10,
  68. MSM_VIDC_DRAIN_START_INPUT = 11,
  69. MSM_VIDC_ERROR = 12,
  70. };
  71. struct msm_vidc_inst {
  72. struct list_head list;
  73. struct mutex lock;
  74. enum msm_vidc_inst_state state;
  75. enum msm_vidc_domain_type domain;
  76. enum msm_vidc_codec_type codec;
  77. void *core;
  78. struct kref kref;
  79. u32 session_id;
  80. u32 sid;
  81. void *packet;
  82. u32 packet_size;
  83. struct v4l2_format fmts[MAX_PORT];
  84. struct v4l2_ctrl_handler ctrl_handler;
  85. struct v4l2_fh event_handler;
  86. struct v4l2_ctrl **ctrls;
  87. u32 num_ctrls;
  88. struct msm_vidc_inst_cap_entry children;
  89. struct msm_vidc_inst_cap_entry firmware;
  90. bool request;
  91. struct vb2_queue vb2q[MAX_PORT];
  92. struct msm_vidc_crop crop;
  93. struct msm_vidc_properties prop;
  94. enum msm_vidc_stage_type stage;
  95. enum msm_vidc_pipe_type pipe;
  96. struct msm_vidc_power power;
  97. struct msm_vidc_buffers_info buffers;
  98. struct msm_vidc_mappings_info mappings;
  99. struct msm_vidc_allocations_info allocations;
  100. bool subscribed_input_psc;
  101. bool subscribed_output_psc;
  102. bool subscribed_input_prop;
  103. bool subscribed_output_prop;
  104. struct msm_vidc_subscription_params subcr_params[MAX_PORT];
  105. struct msm_vidc_decode_batch decode_batch;
  106. struct msm_vidc_decode_vpp_delay decode_vpp_delay;
  107. struct msm_vidc_session_idle session_idle;
  108. struct list_head input_ts;
  109. struct list_head enc_input_crs;
  110. struct list_head decode_bitrate_data;
  111. bool once_per_session_set;
  112. bool ipsc_properties_set;
  113. bool opsc_properties_set;
  114. struct dentry *debugfs_root;
  115. struct msm_vidc_debug debug;
  116. struct msm_vidc_inst_capability *capabilities;
  117. struct completion completions[MAX_SIGNAL];
  118. };
  119. #endif // _MSM_VIDC_INST_H_