rcar_du_vsp.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * rcar_du_vsp.h -- R-Car Display Unit VSP-Based Compositor
  4. *
  5. * Copyright (C) 2015 Renesas Electronics Corporation
  6. *
  7. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  8. */
  9. #ifndef __RCAR_DU_VSP_H__
  10. #define __RCAR_DU_VSP_H__
  11. #include <drm/drmP.h>
  12. #include <drm/drm_crtc.h>
  13. struct rcar_du_format_info;
  14. struct rcar_du_vsp;
  15. struct rcar_du_vsp_plane {
  16. struct drm_plane plane;
  17. struct rcar_du_vsp *vsp;
  18. unsigned int index;
  19. };
  20. struct rcar_du_vsp {
  21. unsigned int index;
  22. struct device *vsp;
  23. struct rcar_du_device *dev;
  24. struct rcar_du_vsp_plane *planes;
  25. unsigned int num_planes;
  26. };
  27. static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p)
  28. {
  29. return container_of(p, struct rcar_du_vsp_plane, plane);
  30. }
  31. /**
  32. * struct rcar_du_vsp_plane_state - Driver-specific plane state
  33. * @state: base DRM plane state
  34. * @format: information about the pixel format used by the plane
  35. * @sg_tables: scatter-gather tables for the frame buffer memory
  36. */
  37. struct rcar_du_vsp_plane_state {
  38. struct drm_plane_state state;
  39. const struct rcar_du_format_info *format;
  40. struct sg_table sg_tables[3];
  41. };
  42. static inline struct rcar_du_vsp_plane_state *
  43. to_rcar_vsp_plane_state(struct drm_plane_state *state)
  44. {
  45. return container_of(state, struct rcar_du_vsp_plane_state, state);
  46. }
  47. #ifdef CONFIG_DRM_RCAR_VSP
  48. int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
  49. unsigned int crtcs);
  50. void rcar_du_vsp_enable(struct rcar_du_crtc *crtc);
  51. void rcar_du_vsp_disable(struct rcar_du_crtc *crtc);
  52. void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc);
  53. void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc);
  54. #else
  55. static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp,
  56. struct device_node *np,
  57. unsigned int crtcs)
  58. {
  59. return -ENXIO;
  60. }
  61. static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { };
  62. static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { };
  63. static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { };
  64. static inline void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { };
  65. #endif
  66. #endif /* __RCAR_DU_VSP_H__ */