drm_crtc_internal.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. /*
  2. * Copyright © 2006 Keith Packard
  3. * Copyright © 2007-2008 Dave Airlie
  4. * Copyright © 2007-2008 Intel Corporation
  5. * Jesse Barnes <jesse.barnes@intel.com>
  6. * Copyright © 2014 Intel Corporation
  7. * Daniel Vetter <daniel.vetter@ffwll.ch>
  8. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining a
  11. * copy of this software and associated documentation files (the "Software"),
  12. * to deal in the Software without restriction, including without limitation
  13. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  14. * and/or sell copies of the Software, and to permit persons to whom the
  15. * Software is furnished to do so, subject to the following conditions:
  16. *
  17. * The above copyright notice and this permission notice shall be included in
  18. * all copies or substantial portions of the Software.
  19. *
  20. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  21. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  22. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  23. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  24. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  25. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  26. * OTHER DEALINGS IN THE SOFTWARE.
  27. */
  28. /*
  29. * This header file contains mode setting related functions and definitions
  30. * which are only used within the drm module as internal implementation details
  31. * and are not exported to drivers.
  32. */
  33. #ifndef __DRM_CRTC_INTERNAL_H__
  34. #define __DRM_CRTC_INTERNAL_H__
  35. #include <linux/err.h>
  36. #include <linux/types.h>
  37. enum drm_color_encoding;
  38. enum drm_color_range;
  39. enum drm_connector_force;
  40. enum drm_mode_status;
  41. struct cea_sad;
  42. struct drm_atomic_state;
  43. struct drm_bridge;
  44. struct drm_connector;
  45. struct drm_crtc;
  46. struct drm_device;
  47. struct drm_display_mode;
  48. struct drm_edid;
  49. struct drm_file;
  50. struct drm_framebuffer;
  51. struct drm_mode_create_dumb;
  52. struct drm_mode_fb_cmd2;
  53. struct drm_mode_fb_cmd;
  54. struct drm_mode_object;
  55. struct drm_mode_set;
  56. struct drm_plane;
  57. struct drm_plane_state;
  58. struct drm_printer;
  59. struct drm_property;
  60. struct edid;
  61. struct fwnode_handle;
  62. struct kref;
  63. struct seq_file;
  64. struct work_struct;
  65. /* drm_crtc.c */
  66. int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
  67. struct drm_property *property,
  68. uint64_t value);
  69. int drm_crtc_check_viewport(const struct drm_crtc *crtc,
  70. int x, int y,
  71. const struct drm_display_mode *mode,
  72. const struct drm_framebuffer *fb);
  73. int drm_crtc_register_all(struct drm_device *dev);
  74. void drm_crtc_unregister_all(struct drm_device *dev);
  75. int drm_crtc_force_disable(struct drm_crtc *crtc);
  76. struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
  77. struct drm_property *
  78. drm_create_scaling_filter_prop(struct drm_device *dev,
  79. unsigned int supported_filters);
  80. /* IOCTLs */
  81. int drm_mode_getcrtc(struct drm_device *dev,
  82. void *data, struct drm_file *file_priv);
  83. int drm_mode_setcrtc(struct drm_device *dev,
  84. void *data, struct drm_file *file_priv);
  85. /* drm_mode_config.c */
  86. int drm_modeset_register_all(struct drm_device *dev);
  87. void drm_modeset_unregister_all(struct drm_device *dev);
  88. void drm_mode_config_validate(struct drm_device *dev);
  89. /* drm_modes.c */
  90. const char *drm_get_mode_status_name(enum drm_mode_status status);
  91. /* IOCTLs */
  92. int drm_mode_getresources(struct drm_device *dev,
  93. void *data, struct drm_file *file_priv);
  94. /* drm_dumb_buffers.c */
  95. int drm_mode_create_dumb(struct drm_device *dev,
  96. struct drm_mode_create_dumb *args,
  97. struct drm_file *file_priv);
  98. int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
  99. struct drm_file *file_priv);
  100. /* IOCTLs */
  101. int drm_mode_create_dumb_ioctl(struct drm_device *dev,
  102. void *data, struct drm_file *file_priv);
  103. int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
  104. void *data, struct drm_file *file_priv);
  105. int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
  106. void *data, struct drm_file *file_priv);
  107. /* drm_color_mgmt.c */
  108. const char *drm_get_color_encoding_name(enum drm_color_encoding encoding);
  109. const char *drm_get_color_range_name(enum drm_color_range range);
  110. /* IOCTLs */
  111. int drm_mode_gamma_get_ioctl(struct drm_device *dev,
  112. void *data, struct drm_file *file_priv);
  113. int drm_mode_gamma_set_ioctl(struct drm_device *dev,
  114. void *data, struct drm_file *file_priv);
  115. /* drm_property.c */
  116. void drm_property_destroy_user_blobs(struct drm_device *dev,
  117. struct drm_file *file_priv);
  118. bool drm_property_change_valid_get(struct drm_property *property,
  119. uint64_t value,
  120. struct drm_mode_object **ref);
  121. void drm_property_change_valid_put(struct drm_property *property,
  122. struct drm_mode_object *ref);
  123. /* IOCTL */
  124. int drm_mode_getproperty_ioctl(struct drm_device *dev,
  125. void *data, struct drm_file *file_priv);
  126. int drm_mode_getblob_ioctl(struct drm_device *dev,
  127. void *data, struct drm_file *file_priv);
  128. int drm_mode_createblob_ioctl(struct drm_device *dev,
  129. void *data, struct drm_file *file_priv);
  130. int drm_mode_destroyblob_ioctl(struct drm_device *dev,
  131. void *data, struct drm_file *file_priv);
  132. /* drm_mode_object.c */
  133. int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
  134. uint32_t obj_type, bool register_obj,
  135. void (*obj_free_cb)(struct kref *kref));
  136. int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
  137. uint32_t obj_type);
  138. void drm_mode_object_register(struct drm_device *dev,
  139. struct drm_mode_object *obj);
  140. struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
  141. struct drm_file *file_priv,
  142. uint32_t id, uint32_t type);
  143. void drm_mode_object_unregister(struct drm_device *dev,
  144. struct drm_mode_object *object);
  145. int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
  146. uint32_t __user *prop_ptr,
  147. uint64_t __user *prop_values,
  148. uint32_t *arg_count_props);
  149. struct drm_property *drm_mode_obj_find_prop_id(struct drm_mode_object *obj,
  150. uint32_t prop_id);
  151. /* IOCTL */
  152. int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
  153. struct drm_file *file_priv);
  154. int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
  155. struct drm_file *file_priv);
  156. /* drm_encoder.c */
  157. int drm_encoder_register_all(struct drm_device *dev);
  158. void drm_encoder_unregister_all(struct drm_device *dev);
  159. /* IOCTL */
  160. int drm_mode_getencoder(struct drm_device *dev,
  161. void *data, struct drm_file *file_priv);
  162. /* drm_connector.c */
  163. void drm_connector_ida_init(void);
  164. void drm_connector_ida_destroy(void);
  165. void drm_connector_unregister_all(struct drm_device *dev);
  166. int drm_connector_register_all(struct drm_device *dev);
  167. int drm_connector_set_obj_prop(struct drm_mode_object *obj,
  168. struct drm_property *property,
  169. uint64_t value);
  170. int drm_connector_create_standard_properties(struct drm_device *dev);
  171. const char *drm_get_connector_force_name(enum drm_connector_force force);
  172. void drm_connector_free_work_fn(struct work_struct *work);
  173. struct drm_connector *drm_connector_find_by_fwnode(struct fwnode_handle *fwnode);
  174. /* IOCTL */
  175. int drm_connector_property_set_ioctl(struct drm_device *dev,
  176. void *data, struct drm_file *file_priv);
  177. int drm_mode_getconnector(struct drm_device *dev,
  178. void *data, struct drm_file *file_priv);
  179. /* drm_framebuffer.c */
  180. struct drm_framebuffer *
  181. drm_internal_framebuffer_create(struct drm_device *dev,
  182. const struct drm_mode_fb_cmd2 *r,
  183. struct drm_file *file_priv);
  184. void drm_framebuffer_free(struct kref *kref);
  185. int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
  186. uint32_t src_w, uint32_t src_h,
  187. const struct drm_framebuffer *fb);
  188. void drm_fb_release(struct drm_file *file_priv);
  189. int drm_mode_addfb(struct drm_device *dev, struct drm_mode_fb_cmd *or,
  190. struct drm_file *file_priv);
  191. int drm_mode_addfb2(struct drm_device *dev,
  192. void *data, struct drm_file *file_priv);
  193. int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
  194. struct drm_file *file_priv);
  195. /* IOCTL */
  196. int drm_mode_addfb_ioctl(struct drm_device *dev,
  197. void *data, struct drm_file *file_priv);
  198. int drm_mode_addfb2_ioctl(struct drm_device *dev,
  199. void *data, struct drm_file *file_priv);
  200. int drm_mode_rmfb_ioctl(struct drm_device *dev,
  201. void *data, struct drm_file *file_priv);
  202. int drm_mode_closefb_ioctl(struct drm_device *dev,
  203. void *data, struct drm_file *file_priv);
  204. int drm_mode_getfb(struct drm_device *dev,
  205. void *data, struct drm_file *file_priv);
  206. int drm_mode_getfb2_ioctl(struct drm_device *dev,
  207. void *data, struct drm_file *file_priv);
  208. int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
  209. void *data, struct drm_file *file_priv);
  210. /* drm_atomic.c */
  211. #ifdef CONFIG_DEBUG_FS
  212. struct drm_minor;
  213. void drm_atomic_debugfs_init(struct drm_device *dev);
  214. #endif
  215. int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
  216. struct drm_plane_state *plane_state);
  217. int __drm_atomic_helper_set_config(struct drm_mode_set *set,
  218. struct drm_atomic_state *state);
  219. void drm_atomic_print_new_state(const struct drm_atomic_state *state,
  220. struct drm_printer *p);
  221. /* drm_atomic_uapi.c */
  222. int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
  223. struct drm_connector *connector,
  224. int mode);
  225. int drm_atomic_set_property(struct drm_atomic_state *state,
  226. struct drm_file *file_priv,
  227. struct drm_mode_object *obj,
  228. struct drm_property *prop,
  229. u64 prop_value, bool async_flip);
  230. int drm_atomic_get_property(struct drm_mode_object *obj,
  231. struct drm_property *property, uint64_t *val);
  232. /* IOCTL */
  233. int drm_mode_atomic_ioctl(struct drm_device *dev,
  234. void *data, struct drm_file *file_priv);
  235. /* drm_plane.c */
  236. int drm_plane_register_all(struct drm_device *dev);
  237. void drm_plane_unregister_all(struct drm_device *dev);
  238. struct drm_mode_rect *
  239. __drm_plane_get_damage_clips(const struct drm_plane_state *state);
  240. /* drm_bridge.c */
  241. void drm_bridge_detach(struct drm_bridge *bridge);
  242. /* IOCTL */
  243. int drm_mode_getplane_res(struct drm_device *dev, void *data,
  244. struct drm_file *file_priv);
  245. int drm_mode_getplane(struct drm_device *dev,
  246. void *data, struct drm_file *file_priv);
  247. int drm_mode_setplane(struct drm_device *dev,
  248. void *data, struct drm_file *file_priv);
  249. int drm_mode_cursor_ioctl(struct drm_device *dev,
  250. void *data, struct drm_file *file_priv);
  251. int drm_mode_cursor2_ioctl(struct drm_device *dev,
  252. void *data, struct drm_file *file_priv);
  253. int drm_mode_page_flip_ioctl(struct drm_device *dev,
  254. void *data, struct drm_file *file_priv);
  255. /* drm_edid.c */
  256. void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
  257. int drm_edid_override_show(struct drm_connector *connector, struct seq_file *m);
  258. int drm_edid_override_set(struct drm_connector *connector, const void *edid, size_t size);
  259. int drm_edid_override_reset(struct drm_connector *connector);
  260. const u8 *drm_edid_find_extension(const struct drm_edid *drm_edid,
  261. int ext_id, int *ext_index);
  262. void drm_edid_cta_sad_get(const struct cea_sad *cta_sad, u8 *sad);
  263. void drm_edid_cta_sad_set(struct cea_sad *cta_sad, const u8 *sad);
  264. ssize_t drm_edid_connector_property_show(struct drm_connector *connector,
  265. char *buf, loff_t off, size_t count);
  266. /* drm_edid_load.c */
  267. #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
  268. const struct drm_edid *drm_edid_load_firmware(struct drm_connector *connector);
  269. #else
  270. static inline const struct drm_edid *
  271. drm_edid_load_firmware(struct drm_connector *connector)
  272. {
  273. return ERR_PTR(-ENOENT);
  274. }
  275. #endif
  276. /* drm_panic.c */
  277. #ifdef CONFIG_DRM_PANIC
  278. bool drm_panic_is_enabled(struct drm_device *dev);
  279. void drm_panic_register(struct drm_device *dev);
  280. void drm_panic_unregister(struct drm_device *dev);
  281. void drm_panic_init(void);
  282. void drm_panic_exit(void);
  283. #else
  284. static inline bool drm_panic_is_enabled(struct drm_device *dev) { return false; }
  285. static inline void drm_panic_register(struct drm_device *dev) {}
  286. static inline void drm_panic_unregister(struct drm_device *dev) {}
  287. static inline void drm_panic_init(void) {}
  288. static inline void drm_panic_exit(void) {}
  289. #endif
  290. #endif /* __DRM_CRTC_INTERNAL_H__ */