plane.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
  4. */
  5. #ifndef TEGRA_PLANE_H
  6. #define TEGRA_PLANE_H 1
  7. #include <drm/drm_plane.h>
  8. struct tegra_bo;
  9. struct tegra_dc;
  10. struct tegra_plane {
  11. struct drm_plane base;
  12. struct tegra_dc *dc;
  13. unsigned int offset;
  14. unsigned int index;
  15. };
  16. struct tegra_cursor {
  17. struct tegra_plane base;
  18. struct tegra_bo *bo;
  19. unsigned int width;
  20. unsigned int height;
  21. };
  22. static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
  23. {
  24. return container_of(plane, struct tegra_plane, base);
  25. }
  26. struct tegra_plane_legacy_blending_state {
  27. bool alpha;
  28. bool top;
  29. };
  30. struct tegra_plane_state {
  31. struct drm_plane_state base;
  32. struct sg_table *sgt[3];
  33. dma_addr_t iova[3];
  34. struct tegra_bo_tiling tiling;
  35. u32 format;
  36. u32 swap;
  37. bool reflect_x;
  38. bool reflect_y;
  39. /* used for legacy blending support only */
  40. struct tegra_plane_legacy_blending_state blending[2];
  41. bool opaque;
  42. };
  43. static inline struct tegra_plane_state *
  44. to_tegra_plane_state(struct drm_plane_state *state)
  45. {
  46. if (state)
  47. return container_of(state, struct tegra_plane_state, base);
  48. return NULL;
  49. }
  50. extern const struct drm_plane_funcs tegra_plane_funcs;
  51. int tegra_plane_prepare_fb(struct drm_plane *plane,
  52. struct drm_plane_state *state);
  53. void tegra_plane_cleanup_fb(struct drm_plane *plane,
  54. struct drm_plane_state *state);
  55. int tegra_plane_state_add(struct tegra_plane *plane,
  56. struct drm_plane_state *state);
  57. int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
  58. bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
  59. int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
  60. struct tegra_plane_state *state);
  61. #endif /* TEGRA_PLANE_H */