sti_plane.h 2.0 KB

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