drm_simple_kms_helper.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2016 Noralf Trønnes
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H
  10. #define __LINUX_DRM_SIMPLE_KMS_HELPER_H
  11. struct drm_simple_display_pipe;
  12. /**
  13. * struct drm_simple_display_pipe_funcs - helper operations for a simple
  14. * display pipeline
  15. */
  16. struct drm_simple_display_pipe_funcs {
  17. /**
  18. * @enable:
  19. *
  20. * This function should be used to enable the pipeline.
  21. * It is called when the underlying crtc is enabled.
  22. * This hook is optional.
  23. */
  24. void (*enable)(struct drm_simple_display_pipe *pipe,
  25. struct drm_crtc_state *crtc_state);
  26. /**
  27. * @disable:
  28. *
  29. * This function should be used to disable the pipeline.
  30. * It is called when the underlying crtc is disabled.
  31. * This hook is optional.
  32. */
  33. void (*disable)(struct drm_simple_display_pipe *pipe);
  34. /**
  35. * @check:
  36. *
  37. * This function is called in the check phase of an atomic update,
  38. * specifically when the underlying plane is checked.
  39. * The simple display pipeline helpers already check that the plane is
  40. * not scaled, fills the entire visible area and is always enabled
  41. * when the crtc is also enabled.
  42. * This hook is optional.
  43. *
  44. * RETURNS:
  45. *
  46. * 0 on success, -EINVAL if the state or the transition can't be
  47. * supported, -ENOMEM on memory allocation failure and -EDEADLK if an
  48. * attempt to obtain another state object ran into a &drm_modeset_lock
  49. * deadlock.
  50. */
  51. int (*check)(struct drm_simple_display_pipe *pipe,
  52. struct drm_plane_state *plane_state,
  53. struct drm_crtc_state *crtc_state);
  54. /**
  55. * @update:
  56. *
  57. * This function is called when the underlying plane state is updated.
  58. * This hook is optional.
  59. */
  60. void (*update)(struct drm_simple_display_pipe *pipe,
  61. struct drm_plane_state *plane_state);
  62. };
  63. /**
  64. * struct drm_simple_display_pipe - simple display pipeline
  65. * @crtc: CRTC control structure
  66. * @plane: Plane control structure
  67. * @encoder: Encoder control structure
  68. * @connector: Connector control structure
  69. * @funcs: Pipeline control functions (optional)
  70. *
  71. * Simple display pipeline with plane, crtc and encoder collapsed into one
  72. * entity. It should be initialized by calling drm_simple_display_pipe_init().
  73. */
  74. struct drm_simple_display_pipe {
  75. struct drm_crtc crtc;
  76. struct drm_plane plane;
  77. struct drm_encoder encoder;
  78. struct drm_connector *connector;
  79. const struct drm_simple_display_pipe_funcs *funcs;
  80. };
  81. int drm_simple_display_pipe_init(struct drm_device *dev,
  82. struct drm_simple_display_pipe *pipe,
  83. const struct drm_simple_display_pipe_funcs *funcs,
  84. const uint32_t *formats, unsigned int format_count,
  85. struct drm_connector *connector);
  86. #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */