sti_plane.h 2.0 KB

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