sun8i_ui_layer.h 2.2 KB

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