xref: /dragonfly/sys/dev/drm/drm_crtc_internal.h (revision 3f2dd94a)
1ba55f2f5SFrançois Tigeot /*
2ba55f2f5SFrançois Tigeot  * Copyright © 2006 Keith Packard
3ba55f2f5SFrançois Tigeot  * Copyright © 2007-2008 Dave Airlie
4ba55f2f5SFrançois Tigeot  * Copyright © 2007-2008 Intel Corporation
5ba55f2f5SFrançois Tigeot  *   Jesse Barnes <jesse.barnes@intel.com>
6ba55f2f5SFrançois Tigeot  * Copyright © 2014 Intel Corporation
7ba55f2f5SFrançois Tigeot  *   Daniel Vetter <daniel.vetter@ffwll.ch>
8ba55f2f5SFrançois Tigeot  *
9ba55f2f5SFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
10ba55f2f5SFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
11ba55f2f5SFrançois Tigeot  * to deal in the Software without restriction, including without limitation
12ba55f2f5SFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13ba55f2f5SFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
14ba55f2f5SFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
15ba55f2f5SFrançois Tigeot  *
16ba55f2f5SFrançois Tigeot  * The above copyright notice and this permission notice shall be included in
17ba55f2f5SFrançois Tigeot  * all copies or substantial portions of the Software.
18ba55f2f5SFrançois Tigeot  *
19ba55f2f5SFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20ba55f2f5SFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21ba55f2f5SFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22ba55f2f5SFrançois Tigeot  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
23ba55f2f5SFrançois Tigeot  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24ba55f2f5SFrançois Tigeot  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25ba55f2f5SFrançois Tigeot  * OTHER DEALINGS IN THE SOFTWARE.
26ba55f2f5SFrançois Tigeot  */
27ba55f2f5SFrançois Tigeot 
28ba55f2f5SFrançois Tigeot /*
29ba55f2f5SFrançois Tigeot  * This header file contains mode setting related functions and definitions
30ba55f2f5SFrançois Tigeot  * which are only used within the drm module as internal implementation details
31ba55f2f5SFrançois Tigeot  * and are not exported to drivers.
32ba55f2f5SFrançois Tigeot  */
33ba55f2f5SFrançois Tigeot 
341dedbd3bSFrançois Tigeot 
351dedbd3bSFrançois Tigeot /* drm_crtc.c */
361dedbd3bSFrançois Tigeot int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
371dedbd3bSFrançois Tigeot 			       struct drm_property *property,
381dedbd3bSFrançois Tigeot 			       uint64_t value);
391dedbd3bSFrançois Tigeot int drm_crtc_check_viewport(const struct drm_crtc *crtc,
401dedbd3bSFrançois Tigeot 			    int x, int y,
411dedbd3bSFrançois Tigeot 			    const struct drm_display_mode *mode,
421dedbd3bSFrançois Tigeot 			    const struct drm_framebuffer *fb);
434be47400SFrançois Tigeot int drm_crtc_register_all(struct drm_device *dev);
444be47400SFrançois Tigeot void drm_crtc_unregister_all(struct drm_device *dev);
451dedbd3bSFrançois Tigeot 
464be47400SFrançois Tigeot struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
471dedbd3bSFrançois Tigeot 
484be47400SFrançois Tigeot /* IOCTLs */
494be47400SFrançois Tigeot int drm_mode_getcrtc(struct drm_device *dev,
504be47400SFrançois Tigeot 		     void *data, struct drm_file *file_priv);
514be47400SFrançois Tigeot int drm_mode_setcrtc(struct drm_device *dev,
524be47400SFrançois Tigeot 		     void *data, struct drm_file *file_priv);
534be47400SFrançois Tigeot 
544be47400SFrançois Tigeot 
554be47400SFrançois Tigeot /* drm_mode_config.c */
564be47400SFrançois Tigeot int drm_modeset_register_all(struct drm_device *dev);
574be47400SFrançois Tigeot void drm_modeset_unregister_all(struct drm_device *dev);
584be47400SFrançois Tigeot 
594be47400SFrançois Tigeot /* IOCTLs */
604be47400SFrançois Tigeot int drm_mode_getresources(struct drm_device *dev,
614be47400SFrançois Tigeot 			  void *data, struct drm_file *file_priv);
624be47400SFrançois Tigeot 
634be47400SFrançois Tigeot 
644be47400SFrançois Tigeot /* drm_dumb_buffers.c */
654be47400SFrançois Tigeot /* IOCTLs */
661dedbd3bSFrançois Tigeot int drm_mode_create_dumb_ioctl(struct drm_device *dev,
671dedbd3bSFrançois Tigeot 			       void *data, struct drm_file *file_priv);
681dedbd3bSFrançois Tigeot int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
691dedbd3bSFrançois Tigeot 			     void *data, struct drm_file *file_priv);
701dedbd3bSFrançois Tigeot int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
711dedbd3bSFrançois Tigeot 				void *data, struct drm_file *file_priv);
721dedbd3bSFrançois Tigeot 
731dedbd3bSFrançois Tigeot /* drm_color_mgmt.c */
741dedbd3bSFrançois Tigeot 
751dedbd3bSFrançois Tigeot /* IOCTLs */
761dedbd3bSFrançois Tigeot int drm_mode_gamma_get_ioctl(struct drm_device *dev,
771dedbd3bSFrançois Tigeot 			     void *data, struct drm_file *file_priv);
781dedbd3bSFrançois Tigeot int drm_mode_gamma_set_ioctl(struct drm_device *dev,
791dedbd3bSFrançois Tigeot 			     void *data, struct drm_file *file_priv);
801dedbd3bSFrançois Tigeot 
811dedbd3bSFrançois Tigeot /* drm_property.c */
821dedbd3bSFrançois Tigeot void drm_property_destroy_user_blobs(struct drm_device *dev,
831dedbd3bSFrançois Tigeot 				     struct drm_file *file_priv);
841dedbd3bSFrançois Tigeot bool drm_property_change_valid_get(struct drm_property *property,
851dedbd3bSFrançois Tigeot 				   uint64_t value,
861dedbd3bSFrançois Tigeot 				   struct drm_mode_object **ref);
871dedbd3bSFrançois Tigeot void drm_property_change_valid_put(struct drm_property *property,
881dedbd3bSFrançois Tigeot 				   struct drm_mode_object *ref);
891dedbd3bSFrançois Tigeot 
901dedbd3bSFrançois Tigeot /* IOCTL */
911dedbd3bSFrançois Tigeot int drm_mode_getproperty_ioctl(struct drm_device *dev,
921dedbd3bSFrançois Tigeot 			       void *data, struct drm_file *file_priv);
931dedbd3bSFrançois Tigeot int drm_mode_getblob_ioctl(struct drm_device *dev,
941dedbd3bSFrançois Tigeot 			   void *data, struct drm_file *file_priv);
951dedbd3bSFrançois Tigeot int drm_mode_createblob_ioctl(struct drm_device *dev,
961dedbd3bSFrançois Tigeot 			      void *data, struct drm_file *file_priv);
971dedbd3bSFrançois Tigeot int drm_mode_destroyblob_ioctl(struct drm_device *dev,
981dedbd3bSFrançois Tigeot 			       void *data, struct drm_file *file_priv);
991dedbd3bSFrançois Tigeot 
1001dedbd3bSFrançois Tigeot /* drm_mode_object.c */
101a85cb24fSFrançois Tigeot int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
102a85cb24fSFrançois Tigeot 			  uint32_t obj_type, bool register_obj,
1031dedbd3bSFrançois Tigeot 			  void (*obj_free_cb)(struct kref *kref));
104a85cb24fSFrançois Tigeot int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
105a85cb24fSFrançois Tigeot 			uint32_t obj_type);
1061dedbd3bSFrançois Tigeot void drm_mode_object_register(struct drm_device *dev,
1071dedbd3bSFrançois Tigeot 			      struct drm_mode_object *obj);
1081dedbd3bSFrançois Tigeot struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
109*3f2dd94aSFrançois Tigeot 					       struct drm_file *file_priv,
1101dedbd3bSFrançois Tigeot 					       uint32_t id, uint32_t type);
1118621f407SFrançois Tigeot void drm_mode_object_unregister(struct drm_device *dev,
112ba55f2f5SFrançois Tigeot 				struct drm_mode_object *object);
1131dedbd3bSFrançois Tigeot int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
1141dedbd3bSFrançois Tigeot 				   uint32_t __user *prop_ptr,
1151dedbd3bSFrançois Tigeot 				   uint64_t __user *prop_values,
1161dedbd3bSFrançois Tigeot 				   uint32_t *arg_count_props);
1171dedbd3bSFrançois Tigeot struct drm_property *drm_mode_obj_find_prop_id(struct drm_mode_object *obj,
1181dedbd3bSFrançois Tigeot 					       uint32_t prop_id);
1191dedbd3bSFrançois Tigeot 
1201dedbd3bSFrançois Tigeot /* IOCTL */
1211dedbd3bSFrançois Tigeot 
1221dedbd3bSFrançois Tigeot int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
1231dedbd3bSFrançois Tigeot 				      struct drm_file *file_priv);
1241dedbd3bSFrançois Tigeot int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1251dedbd3bSFrançois Tigeot 				    struct drm_file *file_priv);
1261dedbd3bSFrançois Tigeot 
1271dedbd3bSFrançois Tigeot /* drm_encoder.c */
1281dedbd3bSFrançois Tigeot int drm_encoder_register_all(struct drm_device *dev);
1291dedbd3bSFrançois Tigeot void drm_encoder_unregister_all(struct drm_device *dev);
1301dedbd3bSFrançois Tigeot 
1311dedbd3bSFrançois Tigeot /* IOCTL */
1321dedbd3bSFrançois Tigeot int drm_mode_getencoder(struct drm_device *dev,
1331dedbd3bSFrançois Tigeot 			void *data, struct drm_file *file_priv);
1341dedbd3bSFrançois Tigeot 
1351dedbd3bSFrançois Tigeot /* drm_connector.c */
1361dedbd3bSFrançois Tigeot void drm_connector_ida_init(void);
1371dedbd3bSFrançois Tigeot void drm_connector_ida_destroy(void);
1381dedbd3bSFrançois Tigeot void drm_connector_unregister_all(struct drm_device *dev);
1391dedbd3bSFrançois Tigeot int drm_connector_register_all(struct drm_device *dev);
1401dedbd3bSFrançois Tigeot int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
1411dedbd3bSFrançois Tigeot 				    struct drm_property *property,
1421dedbd3bSFrançois Tigeot 				    uint64_t value);
1431dedbd3bSFrançois Tigeot int drm_connector_create_standard_properties(struct drm_device *dev);
144a85cb24fSFrançois Tigeot const char *drm_get_connector_force_name(enum drm_connector_force force);
145*3f2dd94aSFrançois Tigeot void drm_connector_free_work_fn(struct work_struct *work);
1461dedbd3bSFrançois Tigeot 
1471dedbd3bSFrançois Tigeot /* IOCTL */
1481dedbd3bSFrançois Tigeot int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
1491dedbd3bSFrançois Tigeot 					  void *data, struct drm_file *file_priv);
1501dedbd3bSFrançois Tigeot int drm_mode_getconnector(struct drm_device *dev,
1511dedbd3bSFrançois Tigeot 			  void *data, struct drm_file *file_priv);
1521dedbd3bSFrançois Tigeot 
1531dedbd3bSFrançois Tigeot /* drm_framebuffer.c */
1541dedbd3bSFrançois Tigeot struct drm_framebuffer *
1551dedbd3bSFrançois Tigeot drm_internal_framebuffer_create(struct drm_device *dev,
1561dedbd3bSFrançois Tigeot 				const struct drm_mode_fb_cmd2 *r,
1571dedbd3bSFrançois Tigeot 				struct drm_file *file_priv);
1581dedbd3bSFrançois Tigeot void drm_framebuffer_free(struct kref *kref);
1591dedbd3bSFrançois Tigeot int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
1601dedbd3bSFrançois Tigeot 				     uint32_t src_w, uint32_t src_h,
1611dedbd3bSFrançois Tigeot 				     const struct drm_framebuffer *fb);
1624be47400SFrançois Tigeot void drm_fb_release(struct drm_file *file_priv);
1634be47400SFrançois Tigeot 
1641dedbd3bSFrançois Tigeot 
1651dedbd3bSFrançois Tigeot /* IOCTL */
1661dedbd3bSFrançois Tigeot int drm_mode_addfb(struct drm_device *dev,
1671dedbd3bSFrançois Tigeot 		   void *data, struct drm_file *file_priv);
1681dedbd3bSFrançois Tigeot int drm_mode_addfb2(struct drm_device *dev,
1691dedbd3bSFrançois Tigeot 		    void *data, struct drm_file *file_priv);
1701dedbd3bSFrançois Tigeot int drm_mode_rmfb(struct drm_device *dev,
1711dedbd3bSFrançois Tigeot 		  void *data, struct drm_file *file_priv);
1721dedbd3bSFrançois Tigeot int drm_mode_getfb(struct drm_device *dev,
1731dedbd3bSFrançois Tigeot 		   void *data, struct drm_file *file_priv);
1741dedbd3bSFrançois Tigeot int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
1751dedbd3bSFrançois Tigeot 			   void *data, struct drm_file *file_priv);
176ba55f2f5SFrançois Tigeot 
1772c9916cdSFrançois Tigeot /* drm_atomic.c */
178a85cb24fSFrançois Tigeot #ifdef CONFIG_DEBUG_FS
179a85cb24fSFrançois Tigeot struct drm_minor;
180a85cb24fSFrançois Tigeot int drm_atomic_debugfs_init(struct drm_minor *minor);
181a85cb24fSFrançois Tigeot #endif
182a85cb24fSFrançois Tigeot 
183*3f2dd94aSFrançois Tigeot int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
184*3f2dd94aSFrançois Tigeot 				     struct drm_connector *connector,
185*3f2dd94aSFrançois Tigeot 				     int mode);
186*3f2dd94aSFrançois Tigeot int drm_atomic_set_property(struct drm_atomic_state *state,
187*3f2dd94aSFrançois Tigeot 			    struct drm_mode_object *obj,
188*3f2dd94aSFrançois Tigeot 			    struct drm_property *prop,
189*3f2dd94aSFrançois Tigeot 			    uint64_t prop_value);
1902c9916cdSFrançois Tigeot int drm_atomic_get_property(struct drm_mode_object *obj,
1912c9916cdSFrançois Tigeot 			    struct drm_property *property, uint64_t *val);
1922c9916cdSFrançois Tigeot int drm_mode_atomic_ioctl(struct drm_device *dev,
1932c9916cdSFrançois Tigeot 			  void *data, struct drm_file *file_priv);
1942c9916cdSFrançois Tigeot 
1951dedbd3bSFrançois Tigeot 
1961dedbd3bSFrançois Tigeot /* drm_plane.c */
1971dedbd3bSFrançois Tigeot int drm_plane_register_all(struct drm_device *dev);
1981dedbd3bSFrançois Tigeot void drm_plane_unregister_all(struct drm_device *dev);
1991dedbd3bSFrançois Tigeot int drm_plane_check_pixel_format(const struct drm_plane *plane,
2001dedbd3bSFrançois Tigeot 				 u32 format);
2011dedbd3bSFrançois Tigeot 
202a85cb24fSFrançois Tigeot /* drm_bridge.c */
203a85cb24fSFrançois Tigeot void drm_bridge_detach(struct drm_bridge *bridge);
204a85cb24fSFrançois Tigeot 
2051dedbd3bSFrançois Tigeot /* IOCTL */
2061dedbd3bSFrançois Tigeot int drm_mode_getplane_res(struct drm_device *dev, void *data,
2071dedbd3bSFrançois Tigeot 			  struct drm_file *file_priv);
2081dedbd3bSFrançois Tigeot int drm_mode_getplane(struct drm_device *dev,
2091dedbd3bSFrançois Tigeot 		      void *data, struct drm_file *file_priv);
2101dedbd3bSFrançois Tigeot int drm_mode_setplane(struct drm_device *dev,
2111dedbd3bSFrançois Tigeot 		      void *data, struct drm_file *file_priv);
2121dedbd3bSFrançois Tigeot int drm_mode_cursor_ioctl(struct drm_device *dev,
2131dedbd3bSFrançois Tigeot 			  void *data, struct drm_file *file_priv);
2141dedbd3bSFrançois Tigeot int drm_mode_cursor2_ioctl(struct drm_device *dev,
2151dedbd3bSFrançois Tigeot 			   void *data, struct drm_file *file_priv);
2161dedbd3bSFrançois Tigeot int drm_mode_page_flip_ioctl(struct drm_device *dev,
2171dedbd3bSFrançois Tigeot 			     void *data, struct drm_file *file_priv);
218a85cb24fSFrançois Tigeot 
219a85cb24fSFrançois Tigeot /* drm_edid.c */
220a85cb24fSFrançois Tigeot void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
221