sti_plane.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. extern struct drm_plane_funcs sti_plane_helpers_funcs;
  12. #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
  13. #define STI_PLANE_TYPE_SHIFT 8
  14. #define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1))
  15. enum sti_plane_type {
  16. STI_GDP = 1 << STI_PLANE_TYPE_SHIFT,
  17. STI_VDP = 2 << STI_PLANE_TYPE_SHIFT,
  18. STI_CUR = 3 << STI_PLANE_TYPE_SHIFT,
  19. STI_BCK = 4 << STI_PLANE_TYPE_SHIFT
  20. };
  21. enum sti_plane_id_of_type {
  22. STI_ID_0 = 0,
  23. STI_ID_1 = 1,
  24. STI_ID_2 = 2,
  25. STI_ID_3 = 3
  26. };
  27. enum sti_plane_desc {
  28. STI_GDP_0 = STI_GDP | STI_ID_0,
  29. STI_GDP_1 = STI_GDP | STI_ID_1,
  30. STI_GDP_2 = STI_GDP | STI_ID_2,
  31. STI_GDP_3 = STI_GDP | STI_ID_3,
  32. STI_HQVDP_0 = STI_VDP | STI_ID_0,
  33. STI_CURSOR = STI_CUR,
  34. STI_BACK = STI_BCK
  35. };
  36. enum sti_plane_status {
  37. STI_PLANE_READY,
  38. STI_PLANE_UPDATED,
  39. STI_PLANE_DISABLING,
  40. STI_PLANE_FLUSHING,
  41. STI_PLANE_DISABLED,
  42. };
  43. #define FPS_LENGTH 64
  44. struct sti_fps_info {
  45. bool output;
  46. unsigned int curr_frame_counter;
  47. unsigned int last_frame_counter;
  48. unsigned int curr_field_counter;
  49. unsigned int last_field_counter;
  50. struct timespec last_timestamp;
  51. char fps_str[FPS_LENGTH];
  52. char fips_str[FPS_LENGTH];
  53. };
  54. /**
  55. * STI plane structure
  56. *
  57. * @plane: drm plane it is bound to (if any)
  58. * @desc: plane type & id
  59. * @status: to know the status of the plane
  60. * @zorder: plane z-order
  61. * @fps_info: frame per second info
  62. */
  63. struct sti_plane {
  64. struct drm_plane drm_plane;
  65. enum sti_plane_desc desc;
  66. enum sti_plane_status status;
  67. int zorder;
  68. struct sti_fps_info fps_info;
  69. };
  70. const char *sti_plane_to_str(struct sti_plane *plane);
  71. void sti_plane_update_fps(struct sti_plane *plane,
  72. bool new_frame,
  73. bool new_field);
  74. void sti_plane_init_property(struct sti_plane *plane,
  75. enum drm_plane_type type);
  76. #endif