sun8i_ui_layer.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) Icenowy Zheng <icenowy@aosc.io>
  4. *
  5. * Based on sun4i_layer.h, which is:
  6. * Copyright (C) 2015 Free Electrons
  7. * Copyright (C) 2015 NextThing Co
  8. *
  9. * Maxime Ripard <maxime.ripard@free-electrons.com>
  10. */
  11. #ifndef _SUN8I_UI_LAYER_H_
  12. #define _SUN8I_UI_LAYER_H_
  13. #include <drm/drm_plane.h>
  14. #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(base, layer) \
  15. ((base) + 0x20 * (layer) + 0x0)
  16. #define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(base, layer) \
  17. ((base) + 0x20 * (layer) + 0x4)
  18. #define SUN8I_MIXER_CHAN_UI_LAYER_COORD(base, layer) \
  19. ((base) + 0x20 * (layer) + 0x8)
  20. #define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(base, layer) \
  21. ((base) + 0x20 * (layer) + 0xc)
  22. #define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(base, layer) \
  23. ((base) + 0x20 * (layer) + 0x10)
  24. #define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(base, layer) \
  25. ((base) + 0x20 * (layer) + 0x14)
  26. #define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(base, layer) \
  27. ((base) + 0x20 * (layer) + 0x18)
  28. #define SUN8I_MIXER_CHAN_UI_TOP_HADDR(base) \
  29. ((base) + 0x80)
  30. #define SUN8I_MIXER_CHAN_UI_BOT_HADDR(base) \
  31. ((base) + 0x84)
  32. #define SUN8I_MIXER_CHAN_UI_OVL_SIZE(base) \
  33. ((base) + 0x88)
  34. #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN BIT(0)
  35. #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1)
  36. #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 8)
  37. #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET 8
  38. #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK GENMASK(31, 24)
  39. struct sun8i_mixer;
  40. struct sun8i_ui_layer {
  41. struct drm_plane plane;
  42. struct sun8i_mixer *mixer;
  43. int channel;
  44. int overlay;
  45. };
  46. static inline struct sun8i_ui_layer *
  47. plane_to_sun8i_ui_layer(struct drm_plane *plane)
  48. {
  49. return container_of(plane, struct sun8i_ui_layer, plane);
  50. }
  51. struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
  52. struct sun8i_mixer *mixer,
  53. int index);
  54. #endif /* _SUN8I_UI_LAYER_H_ */