helpers.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
  3. * Copyright (C) 2017 Linaro Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 and
  7. * only version 2 as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #ifndef __VENUS_HELPERS_H__
  16. #define __VENUS_HELPERS_H__
  17. #include <media/videobuf2-v4l2.h>
  18. struct venus_inst;
  19. bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt);
  20. struct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst,
  21. unsigned int type, u32 idx);
  22. void venus_helper_buffers_done(struct venus_inst *inst,
  23. enum vb2_buffer_state state);
  24. int venus_helper_vb2_buf_init(struct vb2_buffer *vb);
  25. int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb);
  26. void venus_helper_vb2_buf_queue(struct vb2_buffer *vb);
  27. void venus_helper_vb2_stop_streaming(struct vb2_queue *q);
  28. int venus_helper_vb2_start_streaming(struct venus_inst *inst);
  29. void venus_helper_m2m_device_run(void *priv);
  30. void venus_helper_m2m_job_abort(void *priv);
  31. int venus_helper_get_bufreq(struct venus_inst *inst, u32 type,
  32. struct hfi_buffer_requirements *req);
  33. u32 venus_helper_get_framesz_raw(u32 hfi_fmt, u32 width, u32 height);
  34. u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height);
  35. int venus_helper_set_input_resolution(struct venus_inst *inst,
  36. unsigned int width, unsigned int height);
  37. int venus_helper_set_output_resolution(struct venus_inst *inst,
  38. unsigned int width, unsigned int height,
  39. u32 buftype);
  40. int venus_helper_set_work_mode(struct venus_inst *inst, u32 mode);
  41. int venus_helper_set_core_usage(struct venus_inst *inst, u32 usage);
  42. int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
  43. unsigned int output_bufs,
  44. unsigned int output2_bufs);
  45. int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format,
  46. u32 buftype);
  47. int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt);
  48. int venus_helper_set_dyn_bufmode(struct venus_inst *inst);
  49. int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype);
  50. int venus_helper_set_multistream(struct venus_inst *inst, bool out_en,
  51. bool out2_en);
  52. unsigned int venus_helper_get_opb_size(struct venus_inst *inst);
  53. void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf);
  54. void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx);
  55. void venus_helper_init_instance(struct venus_inst *inst);
  56. int venus_helper_get_out_fmts(struct venus_inst *inst, u32 fmt, u32 *out_fmt,
  57. u32 *out2_fmt, bool ubwc);
  58. int venus_helper_alloc_dpb_bufs(struct venus_inst *inst);
  59. int venus_helper_free_dpb_bufs(struct venus_inst *inst);
  60. int venus_helper_power_enable(struct venus_core *core, u32 session_type,
  61. bool enable);
  62. #endif