mtk_plane.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015 MediaTek Inc.
  4. * Author: CK Hu <ck.hu@mediatek.com>
  5. */
  6. #ifndef _MTK_PLANE_H_
  7. #define _MTK_PLANE_H_
  8. #include <drm/drm_crtc.h>
  9. #include <linux/types.h>
  10. #define AFBC_DATA_BLOCK_WIDTH 32
  11. #define AFBC_DATA_BLOCK_HEIGHT 8
  12. #define AFBC_HEADER_BLOCK_SIZE 16
  13. #define AFBC_HEADER_ALIGNMENT 1024
  14. struct mtk_plane_pending_state {
  15. bool config;
  16. bool enable;
  17. dma_addr_t addr;
  18. dma_addr_t hdr_addr;
  19. unsigned int pitch;
  20. unsigned int hdr_pitch;
  21. unsigned int format;
  22. unsigned long long modifier;
  23. unsigned int x;
  24. unsigned int y;
  25. unsigned int width;
  26. unsigned int height;
  27. unsigned int rotation;
  28. bool dirty;
  29. bool async_dirty;
  30. bool async_config;
  31. enum drm_color_encoding color_encoding;
  32. };
  33. struct mtk_plane_state {
  34. struct drm_plane_state base;
  35. struct mtk_plane_pending_state pending;
  36. };
  37. static inline struct mtk_plane_state *
  38. to_mtk_plane_state(struct drm_plane_state *state)
  39. {
  40. return container_of(state, struct mtk_plane_state, base);
  41. }
  42. int mtk_plane_init(struct drm_device *dev, struct drm_plane *plane,
  43. unsigned long possible_crtcs, enum drm_plane_type type,
  44. unsigned int supported_rotations, const u32 blend_modes,
  45. const u32 *formats, size_t num_formats,
  46. bool supports_afbc, unsigned int plane_idx);
  47. #endif