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