drm_crtc_internal.h 11 KB
Newer Older
1 2 3 4 5 6 7
/*
 * Copyright © 2006 Keith Packard
 * Copyright © 2007-2008 Dave Airlie
 * Copyright © 2007-2008 Intel Corporation
 *   Jesse Barnes <jesse.barnes@intel.com>
 * Copyright © 2014 Intel Corporation
 *   Daniel Vetter <daniel.vetter@ffwll.ch>
8
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

/*
 * This header file contains mode setting related functions and definitions
 * which are only used within the drm module as internal implementation details
 * and are not exported to drivers.
 */

35 36 37 38
#include <linux/types.h>

enum drm_color_encoding;
enum drm_color_range;
39
enum drm_connector_force;
40
enum drm_mode_status;
41

42
struct drm_atomic_state;
43
struct drm_bridge;
44 45 46 47 48 49 50 51 52 53
struct drm_connector;
struct drm_crtc;
struct drm_device;
struct drm_display_mode;
struct drm_file;
struct drm_framebuffer;
struct drm_mode_create_dumb;
struct drm_mode_fb_cmd2;
struct drm_mode_fb_cmd;
struct drm_mode_object;
54
struct drm_mode_set;
55
struct drm_plane;
56
struct drm_plane_state;
57
struct drm_property;
58
struct edid;
59
struct fwnode_handle;
60
struct kref;
61
struct seq_file;
62
struct work_struct;
Daniel Vetter's avatar
Daniel Vetter committed
63 64

/* drm_crtc.c */
65 66 67
int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
			       struct drm_property *property,
			       uint64_t value);
Daniel Vetter's avatar
Daniel Vetter committed
68 69 70 71
int drm_crtc_check_viewport(const struct drm_crtc *crtc,
			    int x, int y,
			    const struct drm_display_mode *mode,
			    const struct drm_framebuffer *fb);
72 73
int drm_crtc_register_all(struct drm_device *dev);
void drm_crtc_unregister_all(struct drm_device *dev);
74
int drm_crtc_force_disable(struct drm_crtc *crtc);
Daniel Vetter's avatar
Daniel Vetter committed
75

76
struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc);
77

78 79 80
struct drm_property *
drm_create_scaling_filter_prop(struct drm_device *dev,
			       unsigned int supported_filters);
Daniel Vetter's avatar
Daniel Vetter committed
81 82 83 84 85
/* IOCTLs */
int drm_mode_getcrtc(struct drm_device *dev,
		     void *data, struct drm_file *file_priv);
int drm_mode_setcrtc(struct drm_device *dev,
		     void *data, struct drm_file *file_priv);
86

87 88 89 90

/* drm_mode_config.c */
int drm_modeset_register_all(struct drm_device *dev);
void drm_modeset_unregister_all(struct drm_device *dev);
91
void drm_mode_config_validate(struct drm_device *dev);
92

93 94 95
/* drm_modes.c */
const char *drm_get_mode_status_name(enum drm_mode_status status);

96 97 98 99 100 101
/* IOCTLs */
int drm_mode_getresources(struct drm_device *dev,
			  void *data, struct drm_file *file_priv);


/* drm_dumb_buffers.c */
102 103 104 105 106 107
int drm_mode_create_dumb(struct drm_device *dev,
			 struct drm_mode_create_dumb *args,
			 struct drm_file *file_priv);
int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
			  struct drm_file *file_priv);

108 109 110 111 112 113 114 115
/* IOCTLs */
int drm_mode_create_dumb_ioctl(struct drm_device *dev,
			       void *data, struct drm_file *file_priv);
int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
			     void *data, struct drm_file *file_priv);
int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
				void *data, struct drm_file *file_priv);

116
/* drm_color_mgmt.c */
117 118
const char *drm_get_color_encoding_name(enum drm_color_encoding encoding);
const char *drm_get_color_range_name(enum drm_color_range range);
119 120

/* IOCTLs */
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
int drm_mode_gamma_get_ioctl(struct drm_device *dev,
			     void *data, struct drm_file *file_priv);
int drm_mode_gamma_set_ioctl(struct drm_device *dev,
			     void *data, struct drm_file *file_priv);

/* drm_property.c */
void drm_property_destroy_user_blobs(struct drm_device *dev,
				     struct drm_file *file_priv);
bool drm_property_change_valid_get(struct drm_property *property,
				   uint64_t value,
				   struct drm_mode_object **ref);
void drm_property_change_valid_put(struct drm_property *property,
				   struct drm_mode_object *ref);

/* IOCTL */
Daniel Vetter's avatar
Daniel Vetter committed
136 137 138 139 140 141 142 143
int drm_mode_getproperty_ioctl(struct drm_device *dev,
			       void *data, struct drm_file *file_priv);
int drm_mode_getblob_ioctl(struct drm_device *dev,
			   void *data, struct drm_file *file_priv);
int drm_mode_createblob_ioctl(struct drm_device *dev,
			      void *data, struct drm_file *file_priv);
int drm_mode_destroyblob_ioctl(struct drm_device *dev,
			       void *data, struct drm_file *file_priv);
144

145
/* drm_mode_object.c */
146 147 148 149 150
int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
			  uint32_t obj_type, bool register_obj,
			  void (*obj_free_cb)(struct kref *kref));
int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
			uint32_t obj_type);
151 152 153
void drm_mode_object_register(struct drm_device *dev,
			      struct drm_mode_object *obj);
struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
154
					       struct drm_file *file_priv,
155 156 157 158 159 160 161
					       uint32_t id, uint32_t type);
void drm_mode_object_unregister(struct drm_device *dev,
				struct drm_mode_object *object);
int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic,
				   uint32_t __user *prop_ptr,
				   uint64_t __user *prop_values,
				   uint32_t *arg_count_props);
162 163
struct drm_property *drm_mode_obj_find_prop_id(struct drm_mode_object *obj,
					       uint32_t prop_id);
164 165 166 167 168 169 170 171

/* IOCTL */

int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
				      struct drm_file *file_priv);
int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
				    struct drm_file *file_priv);

172 173 174 175 176 177 178 179
/* drm_encoder.c */
int drm_encoder_register_all(struct drm_device *dev);
void drm_encoder_unregister_all(struct drm_device *dev);

/* IOCTL */
int drm_mode_getencoder(struct drm_device *dev,
			void *data, struct drm_file *file_priv);

180 181 182 183 184
/* drm_connector.c */
void drm_connector_ida_init(void);
void drm_connector_ida_destroy(void);
void drm_connector_unregister_all(struct drm_device *dev);
int drm_connector_register_all(struct drm_device *dev);
185
int drm_connector_set_obj_prop(struct drm_mode_object *obj,
186 187 188
				    struct drm_property *property,
				    uint64_t value);
int drm_connector_create_standard_properties(struct drm_device *dev);
189
const char *drm_get_connector_force_name(enum drm_connector_force force);
190
void drm_connector_free_work_fn(struct work_struct *work);
191
struct drm_connector *drm_connector_find_by_fwnode(struct fwnode_handle *fwnode);
192 193

/* IOCTL */
194 195
int drm_connector_property_set_ioctl(struct drm_device *dev,
				     void *data, struct drm_file *file_priv);
196 197 198
int drm_mode_getconnector(struct drm_device *dev,
			  void *data, struct drm_file *file_priv);

199 200 201 202 203 204
/* drm_framebuffer.c */
struct drm_framebuffer *
drm_internal_framebuffer_create(struct drm_device *dev,
				const struct drm_mode_fb_cmd2 *r,
				struct drm_file *file_priv);
void drm_framebuffer_free(struct kref *kref);
205 206 207
int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
				     uint32_t src_w, uint32_t src_h,
				     const struct drm_framebuffer *fb);
208 209
void drm_fb_release(struct drm_file *file_priv);

210 211
int drm_mode_addfb(struct drm_device *dev, struct drm_mode_fb_cmd *or,
		   struct drm_file *file_priv);
212 213
int drm_mode_addfb2(struct drm_device *dev,
		    void *data, struct drm_file *file_priv);
214 215 216
int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
		  struct drm_file *file_priv);

217 218

/* IOCTL */
219 220
int drm_mode_addfb_ioctl(struct drm_device *dev,
			 void *data, struct drm_file *file_priv);
221 222
int drm_mode_addfb2_ioctl(struct drm_device *dev,
			  void *data, struct drm_file *file_priv);
223 224
int drm_mode_rmfb_ioctl(struct drm_device *dev,
			void *data, struct drm_file *file_priv);
225 226
int drm_mode_getfb(struct drm_device *dev,
		   void *data, struct drm_file *file_priv);
Daniel Stone's avatar
Daniel Stone committed
227 228
int drm_mode_getfb2_ioctl(struct drm_device *dev,
			  void *data, struct drm_file *file_priv);
229 230 231
int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
			   void *data, struct drm_file *file_priv);

232
/* drm_atomic.c */
233 234
#ifdef CONFIG_DEBUG_FS
struct drm_minor;
235
void drm_atomic_debugfs_init(struct drm_minor *minor);
236 237
#endif

238 239 240 241 242
int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
				      struct drm_plane_state *plane_state);
int __drm_atomic_helper_set_config(struct drm_mode_set *set,
				   struct drm_atomic_state *state);

243 244
void drm_atomic_print_new_state(const struct drm_atomic_state *state,
		struct drm_printer *p);
245 246

/* drm_atomic_uapi.c */
247 248 249 250
int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
				     struct drm_connector *connector,
				     int mode);
int drm_atomic_set_property(struct drm_atomic_state *state,
251
			    struct drm_file *file_priv,
252 253 254
			    struct drm_mode_object *obj,
			    struct drm_property *prop,
			    uint64_t prop_value);
255
int drm_atomic_get_property(struct drm_mode_object *obj,
Daniel Vetter's avatar
Daniel Vetter committed
256
			    struct drm_property *property, uint64_t *val);
257 258

/* IOCTL */
259 260 261
int drm_mode_atomic_ioctl(struct drm_device *dev,
			  void *data, struct drm_file *file_priv);

262 263 264 265

/* drm_plane.c */
int drm_plane_register_all(struct drm_device *dev);
void drm_plane_unregister_all(struct drm_device *dev);
266 267
int drm_plane_check_pixel_format(struct drm_plane *plane,
				 u32 format, u64 modifier);
268 269
struct drm_mode_rect *
__drm_plane_get_damage_clips(const struct drm_plane_state *state);
270

271 272 273
/* drm_bridge.c */
void drm_bridge_detach(struct drm_bridge *bridge);

274 275 276 277 278 279 280 281 282 283 284 285 286
/* IOCTL */
int drm_mode_getplane_res(struct drm_device *dev, void *data,
			  struct drm_file *file_priv);
int drm_mode_getplane(struct drm_device *dev,
		      void *data, struct drm_file *file_priv);
int drm_mode_setplane(struct drm_device *dev,
		      void *data, struct drm_file *file_priv);
int drm_mode_cursor_ioctl(struct drm_device *dev,
			  void *data, struct drm_file *file_priv);
int drm_mode_cursor2_ioctl(struct drm_device *dev,
			   void *data, struct drm_file *file_priv);
int drm_mode_page_flip_ioctl(struct drm_device *dev,
			     void *data, struct drm_file *file_priv);
287 288 289

/* drm_edid.c */
void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
290
int drm_edid_override_show(struct drm_connector *connector, struct seq_file *m);
291 292
int drm_edid_override_set(struct drm_connector *connector, const void *edid, size_t size);
int drm_edid_override_reset(struct drm_connector *connector);
293 294 295 296 297 298 299 300 301 302 303

/* drm_edid_load.c */
#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
const struct drm_edid *drm_edid_load_firmware(struct drm_connector *connector);
#else
static inline const struct drm_edid *
drm_edid_load_firmware(struct drm_connector *connector)
{
	return ERR_PTR(-ENOENT);
}
#endif