display_parent_interface.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* SPDX-License-Identifier: MIT */
  2. /* Copyright © 2025 Intel Corporation x*/
  3. #ifndef __DISPLAY_PARENT_INTERFACE_H__
  4. #define __DISPLAY_PARENT_INTERFACE_H__
  5. #include <linux/types.h>
  6. struct dma_fence;
  7. struct drm_crtc;
  8. struct drm_device;
  9. struct drm_framebuffer;
  10. struct drm_gem_object;
  11. struct drm_plane_state;
  12. struct drm_scanout_buffer;
  13. struct i915_vma;
  14. struct intel_hdcp_gsc_context;
  15. struct intel_initial_plane_config;
  16. struct intel_panic;
  17. struct intel_stolen_node;
  18. struct ref_tracker;
  19. /* Keep struct definitions sorted */
  20. struct intel_display_hdcp_interface {
  21. ssize_t (*gsc_msg_send)(struct intel_hdcp_gsc_context *gsc_context,
  22. void *msg_in, size_t msg_in_len,
  23. void *msg_out, size_t msg_out_len);
  24. bool (*gsc_check_status)(struct drm_device *drm);
  25. struct intel_hdcp_gsc_context *(*gsc_context_alloc)(struct drm_device *drm);
  26. void (*gsc_context_free)(struct intel_hdcp_gsc_context *gsc_context);
  27. };
  28. struct intel_display_initial_plane_interface {
  29. void (*vblank_wait)(struct drm_crtc *crtc);
  30. struct drm_gem_object *(*alloc_obj)(struct drm_device *drm, struct intel_initial_plane_config *plane_config);
  31. int (*setup)(struct drm_plane_state *plane_state, struct intel_initial_plane_config *plane_config,
  32. struct drm_framebuffer *fb, struct i915_vma *vma);
  33. void (*config_fini)(struct intel_initial_plane_config *plane_configs);
  34. };
  35. struct intel_display_irq_interface {
  36. bool (*enabled)(struct drm_device *drm);
  37. void (*synchronize)(struct drm_device *drm);
  38. };
  39. struct intel_display_panic_interface {
  40. struct intel_panic *(*alloc)(void);
  41. int (*setup)(struct intel_panic *panic, struct drm_scanout_buffer *sb);
  42. void (*finish)(struct intel_panic *panic);
  43. };
  44. struct intel_display_pc8_interface {
  45. void (*block)(struct drm_device *drm);
  46. void (*unblock)(struct drm_device *drm);
  47. };
  48. struct intel_display_rpm_interface {
  49. struct ref_tracker *(*get)(const struct drm_device *drm);
  50. struct ref_tracker *(*get_raw)(const struct drm_device *drm);
  51. struct ref_tracker *(*get_if_in_use)(const struct drm_device *drm);
  52. struct ref_tracker *(*get_noresume)(const struct drm_device *drm);
  53. void (*put)(const struct drm_device *drm, struct ref_tracker *wakeref);
  54. void (*put_raw)(const struct drm_device *drm, struct ref_tracker *wakeref);
  55. void (*put_unchecked)(const struct drm_device *drm);
  56. bool (*suspended)(const struct drm_device *drm);
  57. void (*assert_held)(const struct drm_device *drm);
  58. void (*assert_block)(const struct drm_device *drm);
  59. void (*assert_unblock)(const struct drm_device *drm);
  60. };
  61. struct intel_display_rps_interface {
  62. void (*boost_if_not_started)(struct dma_fence *fence);
  63. void (*mark_interactive)(struct drm_device *drm, bool interactive);
  64. void (*ilk_irq_handler)(struct drm_device *drm);
  65. };
  66. struct intel_display_stolen_interface {
  67. int (*insert_node_in_range)(struct intel_stolen_node *node, u64 size,
  68. unsigned int align, u64 start, u64 end);
  69. int (*insert_node)(struct intel_stolen_node *node, u64 size, unsigned int align); /* Optional */
  70. void (*remove_node)(struct intel_stolen_node *node);
  71. bool (*initialized)(struct drm_device *drm);
  72. bool (*node_allocated)(const struct intel_stolen_node *node);
  73. u64 (*node_offset)(const struct intel_stolen_node *node);
  74. u64 (*area_address)(struct drm_device *drm); /* Optional */
  75. u64 (*area_size)(struct drm_device *drm); /* Optional */
  76. u64 (*node_address)(const struct intel_stolen_node *node);
  77. u64 (*node_size)(const struct intel_stolen_node *node);
  78. struct intel_stolen_node *(*node_alloc)(struct drm_device *drm);
  79. void (*node_free)(const struct intel_stolen_node *node);
  80. };
  81. /**
  82. * struct intel_display_parent_interface - services parent driver provides to display
  83. *
  84. * The parent, or core, driver provides a pointer to this structure to display
  85. * driver when calling intel_display_device_probe(). The display driver uses it
  86. * to access services provided by the parent driver. The structure may contain
  87. * sub-struct pointers to group function pointers by functionality.
  88. *
  89. * All function and sub-struct pointers must be initialized and callable unless
  90. * explicitly marked as "optional" below. The display driver will only NULL
  91. * check the optional pointers.
  92. */
  93. struct intel_display_parent_interface {
  94. /** @hdcp: HDCP GSC interface */
  95. const struct intel_display_hdcp_interface *hdcp;
  96. /** @initial_plane: Initial plane interface */
  97. const struct intel_display_initial_plane_interface *initial_plane;
  98. /** @irq: IRQ interface */
  99. const struct intel_display_irq_interface *irq;
  100. /** @panic: Panic interface */
  101. const struct intel_display_panic_interface *panic;
  102. /** @pc8: PC8 interface. Optional. */
  103. const struct intel_display_pc8_interface *pc8;
  104. /** @rpm: Runtime PM functions */
  105. const struct intel_display_rpm_interface *rpm;
  106. /** @rps: RPS interface. Optional. */
  107. const struct intel_display_rps_interface *rps;
  108. /** @stolen: Stolen memory. */
  109. const struct intel_display_stolen_interface *stolen;
  110. /* Generic independent functions */
  111. struct {
  112. /** @fence_priority_display: Set display priority. Optional. */
  113. void (*fence_priority_display)(struct dma_fence *fence);
  114. /** @has_auxccs: Are AuxCCS formats supported by the parent. Optional. */
  115. bool (*has_auxccs)(struct drm_device *drm);
  116. /** @has_fenced_regions: Support legacy fencing? Optional. */
  117. bool (*has_fenced_regions)(struct drm_device *drm);
  118. /** @vgpu_active: Is vGPU active? Optional. */
  119. bool (*vgpu_active)(struct drm_device *drm);
  120. };
  121. };
  122. #endif