rcar_du_plane.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * rcar_du_plane.h -- R-Car Display Unit Planes
  3. *
  4. * Copyright (C) 2013 Renesas Corporation
  5. *
  6. * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #ifndef __RCAR_DU_PLANE_H__
  14. #define __RCAR_DU_PLANE_H__
  15. #include <linux/mutex.h>
  16. #include <drm/drmP.h>
  17. #include <drm/drm_crtc.h>
  18. struct rcar_du_format_info;
  19. struct rcar_du_group;
  20. /* The RCAR DU has 8 hardware planes, shared between KMS planes and CRTCs. As
  21. * using KMS planes requires at least one of the CRTCs being enabled, no more
  22. * than 7 KMS planes can be available. We thus create 7 KMS planes and
  23. * 9 software planes (one for each KMS planes and one for each CRTC).
  24. */
  25. #define RCAR_DU_NUM_KMS_PLANES 7
  26. #define RCAR_DU_NUM_HW_PLANES 8
  27. #define RCAR_DU_NUM_SW_PLANES 9
  28. struct rcar_du_plane {
  29. struct rcar_du_group *group;
  30. struct drm_crtc *crtc;
  31. bool enabled;
  32. int hwindex; /* 0-based, -1 means unused */
  33. unsigned int alpha;
  34. unsigned int colorkey;
  35. unsigned int zpos;
  36. const struct rcar_du_format_info *format;
  37. unsigned long dma[2];
  38. unsigned int pitch;
  39. unsigned int width;
  40. unsigned int height;
  41. unsigned int src_x;
  42. unsigned int src_y;
  43. unsigned int dst_x;
  44. unsigned int dst_y;
  45. };
  46. struct rcar_du_planes {
  47. struct rcar_du_plane planes[RCAR_DU_NUM_SW_PLANES];
  48. unsigned int free;
  49. struct mutex lock;
  50. struct drm_property *alpha;
  51. struct drm_property *colorkey;
  52. struct drm_property *zpos;
  53. };
  54. int rcar_du_planes_init(struct rcar_du_group *rgrp);
  55. int rcar_du_planes_register(struct rcar_du_group *rgrp);
  56. void rcar_du_plane_setup(struct rcar_du_plane *plane);
  57. void rcar_du_plane_update_base(struct rcar_du_plane *plane);
  58. void rcar_du_plane_compute_base(struct rcar_du_plane *plane,
  59. struct drm_framebuffer *fb);
  60. int rcar_du_plane_reserve(struct rcar_du_plane *plane,
  61. const struct rcar_du_format_info *format);
  62. void rcar_du_plane_release(struct rcar_du_plane *plane);
  63. #endif /* __RCAR_DU_PLANE_H__ */