rcar_du_vsp.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * rcar_du_vsp.h -- R-Car Display Unit VSP-Based Compositor
  3. *
  4. * Copyright (C) 2015 Renesas Electronics Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #ifndef __RCAR_DU_VSP_H__
  14. #define __RCAR_DU_VSP_H__
  15. #include <drm/drmP.h>
  16. #include <drm/drm_crtc.h>
  17. struct rcar_du_format_info;
  18. struct rcar_du_vsp;
  19. struct rcar_du_vsp_plane {
  20. struct drm_plane plane;
  21. struct rcar_du_vsp *vsp;
  22. unsigned int index;
  23. };
  24. struct rcar_du_vsp {
  25. unsigned int index;
  26. struct device *vsp;
  27. struct rcar_du_device *dev;
  28. struct rcar_du_vsp_plane *planes;
  29. unsigned int num_planes;
  30. };
  31. static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p)
  32. {
  33. return container_of(p, struct rcar_du_vsp_plane, plane);
  34. }
  35. /**
  36. * struct rcar_du_vsp_plane_state - Driver-specific plane state
  37. * @state: base DRM plane state
  38. * @format: information about the pixel format used by the plane
  39. * @sg_tables: scatter-gather tables for the frame buffer memory
  40. * @alpha: value of the plane alpha property
  41. * @zpos: value of the plane zpos property
  42. */
  43. struct rcar_du_vsp_plane_state {
  44. struct drm_plane_state state;
  45. const struct rcar_du_format_info *format;
  46. struct sg_table sg_tables[3];
  47. unsigned int alpha;
  48. unsigned int zpos;
  49. };
  50. static inline struct rcar_du_vsp_plane_state *
  51. to_rcar_vsp_plane_state(struct drm_plane_state *state)
  52. {
  53. return container_of(state, struct rcar_du_vsp_plane_state, state);
  54. }
  55. #ifdef CONFIG_DRM_RCAR_VSP
  56. int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
  57. unsigned int crtcs);
  58. void rcar_du_vsp_enable(struct rcar_du_crtc *crtc);
  59. void rcar_du_vsp_disable(struct rcar_du_crtc *crtc);
  60. void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc);
  61. void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc);
  62. #else
  63. static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp,
  64. struct device_node *np,
  65. unsigned int crtcs)
  66. {
  67. return -ENXIO;
  68. }
  69. static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { };
  70. static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { };
  71. static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { };
  72. static inline void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { };
  73. #endif
  74. #endif /* __RCAR_DU_VSP_H__ */