vsp1_drm.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * vsp1_drm.h -- R-Car VSP1 DRM/KMS Interface
  4. *
  5. * Copyright (C) 2015 Renesas Electronics Corporation
  6. *
  7. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8. */
  9. #ifndef __VSP1_DRM_H__
  10. #define __VSP1_DRM_H__
  11. #include <linux/mutex.h>
  12. #include <linux/videodev2.h>
  13. #include <linux/wait.h>
  14. #include <media/vsp1.h>
  15. #include "vsp1_pipe.h"
  16. /**
  17. * vsp1_drm_pipeline - State for the API exposed to the DRM driver
  18. * @pipe: the VSP1 pipeline used for display
  19. * @width: output display width
  20. * @height: output display height
  21. * @force_brx_release: when set, release the BRx during the next reconfiguration
  22. * @wait_queue: wait queue to wait for BRx release completion
  23. * @uif: UIF entity if available for the pipeline
  24. * @crc: CRC computation configuration
  25. * @du_complete: frame completion callback for the DU driver (optional)
  26. * @du_private: data to be passed to the du_complete callback
  27. */
  28. struct vsp1_drm_pipeline {
  29. struct vsp1_pipeline pipe;
  30. unsigned int width;
  31. unsigned int height;
  32. bool force_brx_release;
  33. wait_queue_head_t wait_queue;
  34. struct vsp1_entity *uif;
  35. struct vsp1_du_crc_config crc;
  36. /* Frame synchronisation */
  37. void (*du_complete)(void *data, bool completed, u32 crc);
  38. void *du_private;
  39. };
  40. /**
  41. * vsp1_drm - State for the API exposed to the DRM driver
  42. * @pipe: the VSP1 DRM pipeline used for display
  43. * @lock: protects the BRU and BRS allocation
  44. * @inputs: source crop rectangle, destination compose rectangle and z-order
  45. * position for every input (indexed by RPF index)
  46. */
  47. struct vsp1_drm {
  48. struct vsp1_drm_pipeline pipe[VSP1_MAX_LIF];
  49. struct mutex lock;
  50. struct {
  51. struct v4l2_rect crop;
  52. struct v4l2_rect compose;
  53. unsigned int zpos;
  54. } inputs[VSP1_MAX_RPF];
  55. };
  56. static inline struct vsp1_drm_pipeline *
  57. to_vsp1_drm_pipeline(struct vsp1_pipeline *pipe)
  58. {
  59. return container_of(pipe, struct vsp1_drm_pipeline, pipe);
  60. }
  61. int vsp1_drm_init(struct vsp1_device *vsp1);
  62. void vsp1_drm_cleanup(struct vsp1_device *vsp1);
  63. #endif /* __VSP1_DRM_H__ */