plane.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_state {
  30. struct drm_plane_state base;
  31. struct tegra_bo_tiling tiling;
  32. u32 format;
  33. u32 swap;
  34. /* used for legacy blending support only */
  35. bool opaque;
  36. bool dependent[3];
  37. };
  38. static inline struct tegra_plane_state *
  39. to_tegra_plane_state(struct drm_plane_state *state)
  40. {
  41. if (state)
  42. return container_of(state, struct tegra_plane_state, base);
  43. return NULL;
  44. }
  45. extern const struct drm_plane_funcs tegra_plane_funcs;
  46. int tegra_plane_state_add(struct tegra_plane *plane,
  47. struct drm_plane_state *state);
  48. int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
  49. bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
  50. bool tegra_plane_format_has_alpha(unsigned int format);
  51. int tegra_plane_format_get_alpha(unsigned int opaque, unsigned int *alpha);
  52. void tegra_plane_check_dependent(struct tegra_plane *tegra,
  53. struct tegra_plane_state *state);
  54. #endif /* TEGRA_PLANE_H */