sun8i_vi_layer.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) Jernej Skrabec <jernej.skrabec@siol.net>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of
  7. * the License, or (at your option) any later version.
  8. */
  9. #ifndef _SUN8I_VI_LAYER_H_
  10. #define _SUN8I_VI_LAYER_H_
  11. #include <drm/drm_plane.h>
  12. #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch, layer) \
  13. (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x0)
  14. #define SUN8I_MIXER_CHAN_VI_LAYER_SIZE(ch, layer) \
  15. (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x4)
  16. #define SUN8I_MIXER_CHAN_VI_LAYER_COORD(ch, layer) \
  17. (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x8)
  18. #define SUN8I_MIXER_CHAN_VI_LAYER_PITCH(ch, layer, plane) \
  19. (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0xc + 4 * (plane))
  20. #define SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(ch, layer, plane) \
  21. (0x2000 + 0x1000 * (ch) + 0x30 * (layer) + 0x18 + 4 * (plane))
  22. #define SUN8I_MIXER_CHAN_VI_OVL_SIZE(ch) (0x2000 + 0x1000 * (ch) + 0xe8)
  23. #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN BIT(0)
  24. /* RGB mode should be set for RGB formats and cleared for YCbCr */
  25. #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE BIT(15)
  26. #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_OFFSET 8
  27. #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 8)
  28. struct sun8i_mixer;
  29. struct sun8i_vi_layer {
  30. struct drm_plane plane;
  31. struct sun8i_mixer *mixer;
  32. int channel;
  33. int overlay;
  34. };
  35. static inline struct sun8i_vi_layer *
  36. plane_to_sun8i_vi_layer(struct drm_plane *plane)
  37. {
  38. return container_of(plane, struct sun8i_vi_layer, plane);
  39. }
  40. struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
  41. struct sun8i_mixer *mixer,
  42. int index);
  43. #endif /* _SUN8I_VI_LAYER_H_ */