sti_plane.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) STMicroelectronics SA 2014
  3. * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
  4. * License terms: GNU General Public License (GPL), version 2
  5. */
  6. #ifndef _STI_PLANE_H_
  7. #define _STI_PLANE_H_
  8. #include <drm/drmP.h>
  9. #include <drm/drm_atomic_helper.h>
  10. #include <drm/drm_plane_helper.h>
  11. #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
  12. #define STI_PLANE_TYPE_SHIFT 8
  13. #define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1))
  14. enum sti_plane_type {
  15. STI_GDP = 1 << STI_PLANE_TYPE_SHIFT,
  16. STI_VDP = 2 << STI_PLANE_TYPE_SHIFT,
  17. STI_CUR = 3 << STI_PLANE_TYPE_SHIFT,
  18. STI_BCK = 4 << STI_PLANE_TYPE_SHIFT
  19. };
  20. enum sti_plane_id_of_type {
  21. STI_ID_0 = 0,
  22. STI_ID_1 = 1,
  23. STI_ID_2 = 2,
  24. STI_ID_3 = 3
  25. };
  26. enum sti_plane_desc {
  27. STI_GDP_0 = STI_GDP | STI_ID_0,
  28. STI_GDP_1 = STI_GDP | STI_ID_1,
  29. STI_GDP_2 = STI_GDP | STI_ID_2,
  30. STI_GDP_3 = STI_GDP | STI_ID_3,
  31. STI_HQVDP_0 = STI_VDP | STI_ID_0,
  32. STI_CURSOR = STI_CUR,
  33. STI_BACK = STI_BCK
  34. };
  35. enum sti_plane_status {
  36. STI_PLANE_READY,
  37. STI_PLANE_UPDATED,
  38. STI_PLANE_DISABLING,
  39. STI_PLANE_FLUSHING,
  40. STI_PLANE_DISABLED,
  41. };
  42. #define FPS_LENGTH 64
  43. struct sti_fps_info {
  44. bool output;
  45. unsigned int curr_frame_counter;
  46. unsigned int last_frame_counter;
  47. unsigned int curr_field_counter;
  48. unsigned int last_field_counter;
  49. ktime_t last_timestamp;
  50. char fps_str[FPS_LENGTH];
  51. char fips_str[FPS_LENGTH];
  52. };
  53. /**
  54. * STI plane structure
  55. *
  56. * @plane: drm plane it is bound to (if any)
  57. * @desc: plane type & id
  58. * @status: to know the status of the plane
  59. * @fps_info: frame per second info
  60. */
  61. struct sti_plane {
  62. struct drm_plane drm_plane;
  63. enum sti_plane_desc desc;
  64. enum sti_plane_status status;
  65. struct sti_fps_info fps_info;
  66. };
  67. const char *sti_plane_to_str(struct sti_plane *plane);
  68. void sti_plane_update_fps(struct sti_plane *plane,
  69. bool new_frame,
  70. bool new_field);
  71. void sti_plane_init_property(struct sti_plane *plane,
  72. enum drm_plane_type type);
  73. void sti_plane_reset(struct drm_plane *plane);
  74. #endif