vs_plane.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020 VeriSilicon Holdings Co., Ltd.
  4. */
  5. #ifndef __VS_PLANE_H__
  6. #define __VS_PLANE_H__
  7. #include <drm/drm_plane_helper.h>
  8. #include <drm/drm_fourcc.h>
  9. #include "vs_type.h"
  10. #include "vs_fb.h"
  11. #define MAX_NUM_PLANES 3 /* colour format plane */
  12. struct vs_plane;
  13. struct vs_plane_funcs {
  14. void (*update)(struct device *dev, struct vs_plane *plane);
  15. void (*disable)(struct device *dev, struct vs_plane *plane,
  16. struct drm_plane_state *old_state);
  17. int (*check)(struct device *dev, struct vs_plane *plane,
  18. struct drm_plane_state *state);
  19. };
  20. struct vs_plane_status {
  21. u32 tile_mode;
  22. struct drm_rect src;
  23. struct drm_rect dest;
  24. struct drm_format_name_buf format_name;
  25. };
  26. struct vs_plane_state {
  27. struct drm_plane_state base;
  28. struct vs_plane_status status; /* for debugfs */
  29. struct drm_property_blob *watermark;
  30. struct drm_property_blob *color_mgmt;
  31. struct drm_property_blob *roi;
  32. u32 degamma;
  33. bool degamma_changed;
  34. };
  35. struct vs_plane {
  36. struct drm_plane base;
  37. u8 id;
  38. dma_addr_t dma_addr[MAX_NUM_PLANES];
  39. struct drm_property *degamma_mode;
  40. struct drm_property *watermark_prop;
  41. struct drm_property *color_mgmt_prop;
  42. struct drm_property *roi_prop;
  43. const struct vs_plane_funcs *funcs;
  44. };
  45. void vs_plane_destory(struct drm_plane *plane);
  46. struct vs_plane *vs_plane_create(struct drm_device *drm_dev,
  47. struct vs_plane_info *info,
  48. unsigned int layer_num,
  49. unsigned int possible_crtcs);
  50. static inline struct vs_plane *to_vs_plane(struct drm_plane *plane)
  51. {
  52. return container_of(plane, struct vs_plane, base);
  53. }
  54. static inline struct vs_plane_state *
  55. to_vs_plane_state(struct drm_plane_state *state)
  56. {
  57. return container_of(state, struct vs_plane_state, base);
  58. }
  59. #endif /* __VS_PLANE_H__ */