plane.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef TEGRA_PLANE_H
  9. #define TEGRA_PLANE_H 1
  10. #include <drm/drm_plane.h>
  11. struct tegra_bo;
  12. struct tegra_dc;
  13. struct tegra_plane {
  14. struct drm_plane base;
  15. struct tegra_dc *dc;
  16. unsigned int offset;
  17. unsigned int index;
  18. };
  19. struct tegra_cursor {
  20. struct tegra_plane base;
  21. struct tegra_bo *bo;
  22. unsigned int width;
  23. unsigned int height;
  24. };
  25. static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
  26. {
  27. return container_of(plane, struct tegra_plane, base);
  28. }
  29. struct tegra_plane_legacy_blending_state {
  30. bool alpha;
  31. bool top;
  32. };
  33. struct tegra_plane_state {
  34. struct drm_plane_state base;
  35. struct tegra_bo_tiling tiling;
  36. u32 format;
  37. u32 swap;
  38. bool bottom_up;
  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_state_add(struct tegra_plane *plane,
  52. struct drm_plane_state *state);
  53. int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
  54. bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
  55. int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
  56. struct tegra_plane_state *state);
  57. #endif /* TEGRA_PLANE_H */