Subversion Repositories Kolibri OS

Rev

Rev 5270 | Rev 6936 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5270 Rev 6082
Line 29... Line 29...
29
#include 
29
#include 
30
#include 
30
#include 
31
#include 
31
#include 
32
#include 
32
#include 
33
#include 
33
#include 
-
 
34
#include 
34
#include 
35
#include 
35
#include 
36
#include 
36
#include 
37
#include 
Line 37... Line 38...
37
 
38
 
Line 50... Line 51...
50
#define DRM_MODE_OBJECT_MODE 0xdededede
51
#define DRM_MODE_OBJECT_MODE 0xdededede
51
#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
52
#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0
52
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
53
#define DRM_MODE_OBJECT_FB 0xfbfbfbfb
53
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
54
#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb
54
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
55
#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee
55
#define DRM_MODE_OBJECT_BRIDGE 0xbdbdbdbd
-
 
56
#define DRM_MODE_OBJECT_ANY 0
56
#define DRM_MODE_OBJECT_ANY 0
Line 57... Line 57...
57
 
57
 
58
struct drm_mode_object {
58
struct drm_mode_object {
59
	uint32_t id;
59
	uint32_t id;
60
	uint32_t type;
60
	uint32_t type;
61
	struct drm_object_properties *properties;
61
	struct drm_object_properties *properties;
Line 62... Line 62...
62
};
62
};
63
 
63
 
64
#define DRM_OBJECT_MAX_PROPERTY 24
64
#define DRM_OBJECT_MAX_PROPERTY 24
-
 
65
struct drm_object_properties {
-
 
66
	int count, atomic_count;
-
 
67
	/* NOTE: if we ever start dynamically destroying properties (ie.
-
 
68
	 * not at drm_mode_config_cleanup() time), then we'd have to do
-
 
69
	 * a better job of detaching property from mode objects to avoid
65
struct drm_object_properties {
70
	 * dangling property pointers:
-
 
71
	 */
-
 
72
	struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY];
-
 
73
	/* do not read/write values directly, but use drm_object_property_get_value()
66
	int count;
74
	 * and drm_object_property_set_value():
67
	uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
75
	 */
Line 68... Line 76...
68
	uint64_t values[DRM_OBJECT_MAX_PROPERTY];
76
	uint64_t values[DRM_OBJECT_MAX_PROPERTY];
69
};
77
};
Line 76... Line 84...
76
{
84
{
77
	return (uint64_t)*((uint64_t *)&val);
85
	return (uint64_t)*((uint64_t *)&val);
78
}
86
}
Line 79... Line 87...
79
 
87
 
-
 
88
/* rotation property bits */
80
/* rotation property bits */
89
#define DRM_ROTATE_MASK 0x0f
81
#define DRM_ROTATE_0	0
90
#define DRM_ROTATE_0	0
82
#define DRM_ROTATE_90	1
91
#define DRM_ROTATE_90	1
83
#define DRM_ROTATE_180	2
92
#define DRM_ROTATE_180	2
-
 
93
#define DRM_ROTATE_270	3
84
#define DRM_ROTATE_270	3
94
#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
85
#define DRM_REFLECT_X	4
95
#define DRM_REFLECT_X	4
Line 86... Line 96...
86
#define DRM_REFLECT_Y	5
96
#define DRM_REFLECT_Y	5
87
 
97
 
Line 129... Line 139...
129
	unsigned int bpc;
139
	unsigned int bpc;
Line 130... Line 140...
130
 
140
 
131
	enum subpixel_order subpixel_order;
141
	enum subpixel_order subpixel_order;
Line -... Line 142...
-
 
142
	u32 color_formats;
-
 
143
 
-
 
144
	const u32 *bus_formats;
132
	u32 color_formats;
145
	unsigned int num_bus_formats;
133
 
146
 
Line 134... Line 147...
134
	/* Mask of supported hdmi deep color modes */
147
	/* Mask of supported hdmi deep color modes */
135
	u8 edid_hdmi_dc_modes;
148
	u8 edid_hdmi_dc_modes;
Line 188... Line 201...
188
	struct list_head head;
201
	struct list_head head;
189
	struct drm_mode_object base;
202
	struct drm_mode_object base;
190
	const struct drm_framebuffer_funcs *funcs;
203
	const struct drm_framebuffer_funcs *funcs;
191
	unsigned int pitches[4];
204
	unsigned int pitches[4];
192
	unsigned int offsets[4];
205
	unsigned int offsets[4];
-
 
206
	uint64_t modifier[4];
193
	unsigned int width;
207
	unsigned int width;
194
	unsigned int height;
208
	unsigned int height;
195
	/* depth can be 15 or 16 */
209
	/* depth can be 15 or 16 */
196
	unsigned int depth;
210
	unsigned int depth;
197
	int bits_per_pixel;
211
	int bits_per_pixel;
198
	int flags;
212
	int flags;
199
	uint32_t pixel_format; /* fourcc format */
213
	uint32_t pixel_format; /* fourcc format */
200
	struct list_head filp_head;
214
	struct list_head filp_head;
201
	/* if you are using the helper */
-
 
202
	void *helper_private;
-
 
203
};
215
};
Line 204... Line 216...
204
 
216
 
205
struct drm_property_blob {
217
struct drm_property_blob {
-
 
218
	struct drm_mode_object base;
-
 
219
	struct drm_device *dev;
-
 
220
	struct kref refcount;
206
	struct drm_mode_object base;
221
	struct list_head head_global;
207
	struct list_head head;
222
	struct list_head head_file;
208
	size_t length;
223
	size_t length;
209
	unsigned char data[];
224
	unsigned char data[];
Line 210... Line 225...
210
};
225
};
Line 235... Line 250...
235
struct drm_bridge;
250
struct drm_bridge;
236
struct drm_atomic_state;
251
struct drm_atomic_state;
Line 237... Line 252...
237
 
252
 
238
/**
253
/**
-
 
254
 * struct drm_crtc_state - mutable CRTC state
239
 * struct drm_crtc_state - mutable CRTC state
255
 * @crtc: backpointer to the CRTC
-
 
256
 * @enable: whether the CRTC should be enabled, gates all other state
-
 
257
 * @active: whether the CRTC is actively displaying (used for DPMS)
240
 * @enable: whether the CRTC should be enabled, gates all other state
258
 * @planes_changed: planes on this crtc are updated
-
 
259
 * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
-
 
260
 * @active_changed: crtc_state->active has been toggled.
241
 * @mode_changed: for use by helpers and drivers when computing state updates
261
 * @connectors_changed: connectors to this crtc have been updated
242
 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
262
 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
243
 * @last_vblank_count: for helpers and drivers to capture the vblank of the
263
 * @last_vblank_count: for helpers and drivers to capture the vblank of the
244
 * 	update to ensure framebuffer cleanup isn't done too early
-
 
245
 * @planes_changed: for use by helpers and drivers when computing state updates
264
 * 	update to ensure framebuffer cleanup isn't done too early
246
 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
265
 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
247
 * @mode: current mode timings
266
 * @mode: current mode timings
248
 * @event: optional pointer to a DRM event to signal upon completion of the
267
 * @event: optional pointer to a DRM event to signal upon completion of the
249
 * 	state update
268
 * 	state update
-
 
269
 * @state: backpointer to global drm_atomic_state
-
 
270
 *
-
 
271
 * Note that the distinction between @enable and @active is rather subtile:
-
 
272
 * Flipping @active while @enable is set without changing anything else may
-
 
273
 * never return in a failure from the ->atomic_check callback. Userspace assumes
-
 
274
 * that a DPMS On will always succeed. In other words: @enable controls resource
250
 * @state: backpointer to global drm_atomic_state
275
 * assignment, @active controls the actual hardware state.
251
 */
276
 */
-
 
277
struct drm_crtc_state {
-
 
278
	struct drm_crtc *crtc;
252
struct drm_crtc_state {
279
 
-
 
280
	bool enable;
Line 253... Line 281...
253
	bool enable;
281
	bool active;
254
 
282
 
255
	/* computed state bits used by helpers and drivers */
283
	/* computed state bits used by helpers and drivers */
-
 
284
	bool planes_changed : 1;
-
 
285
	bool mode_changed : 1;
Line 256... Line 286...
256
	bool planes_changed : 1;
286
	bool active_changed : 1;
257
	bool mode_changed : 1;
287
	bool connectors_changed : 1;
258
 
288
 
259
	/* attached planes bitmask:
289
	/* attached planes bitmask:
Line 269... Line 299...
269
	/* adjusted_mode: for use by helpers and drivers */
299
	/* adjusted_mode: for use by helpers and drivers */
270
	struct drm_display_mode adjusted_mode;
300
	struct drm_display_mode adjusted_mode;
Line 271... Line 301...
271
 
301
 
Line -... Line 302...
-
 
302
	struct drm_display_mode mode;
-
 
303
 
-
 
304
	/* blob property to expose current mode to atomic userspace */
272
	struct drm_display_mode mode;
305
	struct drm_property_blob *mode_blob;
Line 273... Line 306...
273
 
306
 
274
	struct drm_pending_vblank_event *event;
307
	struct drm_pending_vblank_event *event;
Line 290... Line 323...
290
 * @set_config: apply a new CRTC configuration
323
 * @set_config: apply a new CRTC configuration
291
 * @page_flip: initiate a page flip
324
 * @page_flip: initiate a page flip
292
 * @atomic_duplicate_state: duplicate the atomic state for this CRTC
325
 * @atomic_duplicate_state: duplicate the atomic state for this CRTC
293
 * @atomic_destroy_state: destroy an atomic state for this CRTC
326
 * @atomic_destroy_state: destroy an atomic state for this CRTC
294
 * @atomic_set_property: set a property on an atomic state for this CRTC
327
 * @atomic_set_property: set a property on an atomic state for this CRTC
-
 
328
 *    (do not call directly, use drm_atomic_crtc_set_property())
-
 
329
 * @atomic_get_property: get a property on an atomic state for this CRTC
-
 
330
 *    (do not call directly, use drm_atomic_crtc_get_property())
295
 *
331
 *
296
 * The drm_crtc_funcs structure is the central CRTC management structure
332
 * The drm_crtc_funcs structure is the central CRTC management structure
297
 * in the DRM.  Each CRTC controls one or more connectors (note that the name
333
 * in the DRM.  Each CRTC controls one or more connectors (note that the name
298
 * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
334
 * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
299
 * connectors, not just CRTs).
335
 * connectors, not just CRTs).
Line 349... Line 385...
349
				     struct drm_crtc_state *state);
385
				     struct drm_crtc_state *state);
350
	int (*atomic_set_property)(struct drm_crtc *crtc,
386
	int (*atomic_set_property)(struct drm_crtc *crtc,
351
				   struct drm_crtc_state *state,
387
				   struct drm_crtc_state *state,
352
				   struct drm_property *property,
388
				   struct drm_property *property,
353
				   uint64_t val);
389
				   uint64_t val);
-
 
390
	int (*atomic_get_property)(struct drm_crtc *crtc,
-
 
391
				   const struct drm_crtc_state *state,
-
 
392
				   struct drm_property *property,
-
 
393
				   uint64_t *val);
354
};
394
};
Line 355... Line 395...
355
 
395
 
356
/**
396
/**
357
 * struct drm_crtc - central CRTC control structure
397
 * struct drm_crtc - central CRTC control structure
Line 365... Line 405...
365
 * @cursor_x: current x position of the cursor, used for universal cursor planes
405
 * @cursor_x: current x position of the cursor, used for universal cursor planes
366
 * @cursor_y: current y position of the cursor, used for universal cursor planes
406
 * @cursor_y: current y position of the cursor, used for universal cursor planes
367
 * @enabled: is this CRTC enabled?
407
 * @enabled: is this CRTC enabled?
368
 * @mode: current mode timings
408
 * @mode: current mode timings
369
 * @hwmode: mode timings as programmed to hw regs
409
 * @hwmode: mode timings as programmed to hw regs
370
 * @invert_dimensions: for purposes of error checking crtc vs fb sizes,
-
 
371
 *    invert the width/height of the crtc.  This is used if the driver
-
 
372
 *    is performing 90 or 270 degree rotated scanout
-
 
373
 * @x: x position on screen
410
 * @x: x position on screen
374
 * @y: y position on screen
411
 * @y: y position on screen
375
 * @funcs: CRTC control functions
412
 * @funcs: CRTC control functions
376
 * @gamma_size: size of gamma ramp
413
 * @gamma_size: size of gamma ramp
377
 * @gamma_store: gamma ramp values
414
 * @gamma_store: gamma ramp values
378
 * @framedur_ns: precise frame timing
-
 
379
 * @linedur_ns: precise line timing
-
 
380
 * @pixeldur_ns: precise pixel timing
-
 
381
 * @helper_private: mid-layer private data
415
 * @helper_private: mid-layer private data
382
 * @properties: property tracking for this CRTC
416
 * @properties: property tracking for this CRTC
383
 * @state: current atomic state for this CRTC
417
 * @state: current atomic state for this CRTC
384
 * @acquire_ctx: per-CRTC implicit acquire context used by atomic drivers for
418
 * @acquire_ctx: per-CRTC implicit acquire context used by atomic drivers for
385
 * 	legacy ioctls
419
 * 	legacy ioctls
Line 419... Line 453...
419
	/* Programmed mode in hw, after adjustments for encoders,
453
	/* Programmed mode in hw, after adjustments for encoders,
420
	 * crtc, panel scaling etc. Needed for timestamping etc.
454
	 * crtc, panel scaling etc. Needed for timestamping etc.
421
	 */
455
	 */
422
	struct drm_display_mode hwmode;
456
	struct drm_display_mode hwmode;
Line 423... Line -...
423
 
-
 
424
	bool invert_dimensions;
-
 
425
 
457
 
426
	int x, y;
458
	int x, y;
Line 427... Line 459...
427
	const struct drm_crtc_funcs *funcs;
459
	const struct drm_crtc_funcs *funcs;
428
 
460
 
429
	/* CRTC gamma size for reporting to userspace */
461
	/* CRTC gamma size for reporting to userspace */
Line 430... Line -...
430
	uint32_t gamma_size;
-
 
431
	uint16_t *gamma_store;
-
 
432
 
-
 
433
	/* Constants needed for precise vblank and swap timestamping. */
462
	uint32_t gamma_size;
434
	int framedur_ns, linedur_ns, pixeldur_ns;
463
	uint16_t *gamma_store;
Line 435... Line 464...
435
 
464
 
Line 436... Line 465...
436
	/* if you are using the helper */
465
	/* if you are using the helper */
Line 447... Line 476...
447
	struct drm_modeset_acquire_ctx *acquire_ctx;
476
	struct drm_modeset_acquire_ctx *acquire_ctx;
448
};
477
};
Line 449... Line 478...
449
 
478
 
450
/**
479
/**
-
 
480
 * struct drm_connector_state - mutable connector state
451
 * struct drm_connector_state - mutable connector state
481
 * @connector: backpointer to the connector
452
 * @crtc: CRTC to connect connector to, NULL if disabled
482
 * @crtc: CRTC to connect connector to, NULL if disabled
453
 * @best_encoder: can be used by helpers and drivers to select the encoder
483
 * @best_encoder: can be used by helpers and drivers to select the encoder
454
 * @state: backpointer to global drm_atomic_state
484
 * @state: backpointer to global drm_atomic_state
455
 */
485
 */
-
 
486
struct drm_connector_state {
-
 
487
	struct drm_connector *connector;
456
struct drm_connector_state {
488
 
Line 457... Line 489...
457
	struct drm_crtc *crtc;  /* do not write directly, use drm_atomic_set_crtc_for_connector() */
489
	struct drm_crtc *crtc;  /* do not write directly, use drm_atomic_set_crtc_for_connector() */
Line 458... Line 490...
458
 
490
 
459
	struct drm_encoder *best_encoder;
491
	struct drm_encoder *best_encoder;
Line 460... Line 492...
460
 
492
 
461
	struct drm_atomic_state *state;
493
	struct drm_atomic_state *state;
462
};
494
};
463
 
495
 
464
/**
496
/**
465
 * struct drm_connector_funcs - control connectors on a given device
497
 * struct drm_connector_funcs - control connectors on a given device
466
 * @dpms: set power state (see drm_crtc_funcs above)
498
 * @dpms: set power state
467
 * @save: save connector state
499
 * @save: save connector state
Line 473... Line 505...
473
 * @destroy: make object go away
505
 * @destroy: make object go away
474
 * @force: notify the driver that the connector is forced on
506
 * @force: notify the driver that the connector is forced on
475
 * @atomic_duplicate_state: duplicate the atomic state for this connector
507
 * @atomic_duplicate_state: duplicate the atomic state for this connector
476
 * @atomic_destroy_state: destroy an atomic state for this connector
508
 * @atomic_destroy_state: destroy an atomic state for this connector
477
 * @atomic_set_property: set a property on an atomic state for this connector
509
 * @atomic_set_property: set a property on an atomic state for this connector
-
 
510
 *    (do not call directly, use drm_atomic_connector_set_property())
-
 
511
 * @atomic_get_property: get a property on an atomic state for this connector
-
 
512
 *    (do not call directly, use drm_atomic_connector_get_property())
478
 *
513
 *
479
 * Each CRTC may have one or more connectors attached to it.  The functions
514
 * Each CRTC may have one or more connectors attached to it.  The functions
480
 * below allow the core DRM code to control connectors, enumerate available modes,
515
 * below allow the core DRM code to control connectors, enumerate available modes,
481
 * etc.
516
 * etc.
482
 */
517
 */
483
struct drm_connector_funcs {
518
struct drm_connector_funcs {
484
	void (*dpms)(struct drm_connector *connector, int mode);
519
	int (*dpms)(struct drm_connector *connector, int mode);
485
	void (*save)(struct drm_connector *connector);
520
	void (*save)(struct drm_connector *connector);
486
	void (*restore)(struct drm_connector *connector);
521
	void (*restore)(struct drm_connector *connector);
487
	void (*reset)(struct drm_connector *connector);
522
	void (*reset)(struct drm_connector *connector);
Line 488... Line 523...
488
 
523
 
Line 506... Line 541...
506
				     struct drm_connector_state *state);
541
				     struct drm_connector_state *state);
507
	int (*atomic_set_property)(struct drm_connector *connector,
542
	int (*atomic_set_property)(struct drm_connector *connector,
508
				   struct drm_connector_state *state,
543
				   struct drm_connector_state *state,
509
				   struct drm_property *property,
544
				   struct drm_property *property,
510
				   uint64_t val);
545
				   uint64_t val);
-
 
546
	int (*atomic_get_property)(struct drm_connector *connector,
-
 
547
				   const struct drm_connector_state *state,
-
 
548
				   struct drm_property *property,
-
 
549
				   uint64_t *val);
511
};
550
};
Line 512... Line 551...
512
 
551
 
513
/**
552
/**
514
 * struct drm_encoder_funcs - encoder controls
553
 * struct drm_encoder_funcs - encoder controls
Line 552... Line 591...
552
	uint32_t possible_clones;
591
	uint32_t possible_clones;
Line 553... Line 592...
553
 
592
 
554
	struct drm_crtc *crtc;
593
	struct drm_crtc *crtc;
555
	struct drm_bridge *bridge;
594
	struct drm_bridge *bridge;
556
	const struct drm_encoder_funcs *funcs;
595
	const struct drm_encoder_funcs *funcs;
557
	void *helper_private;
596
	const void *helper_private;
Line 558... Line 597...
558
};
597
};
559
 
598
 
560
/* should we poll this connector for connects and disconnects */
599
/* should we poll this connector for connects and disconnects */
Line 603... Line 642...
603
 * @latency_present: AV delay info from ELD, if found
642
 * @latency_present: AV delay info from ELD, if found
604
 * @video_latency: video latency info from ELD, if found
643
 * @video_latency: video latency info from ELD, if found
605
 * @audio_latency: audio latency info from ELD, if found
644
 * @audio_latency: audio latency info from ELD, if found
606
 * @null_edid_counter: track sinks that give us all zeros for the EDID
645
 * @null_edid_counter: track sinks that give us all zeros for the EDID
607
 * @bad_edid_counter: track sinks that give us an EDID with invalid checksum
646
 * @bad_edid_counter: track sinks that give us an EDID with invalid checksum
-
 
647
 * @edid_corrupt: indicates whether the last read EDID was corrupt
608
 * @debugfs_entry: debugfs directory for this connector
648
 * @debugfs_entry: debugfs directory for this connector
609
 * @state: current atomic state for this connector
649
 * @state: current atomic state for this connector
610
 * @has_tile: is this connector connected to a tiled monitor
650
 * @has_tile: is this connector connected to a tiled monitor
611
 * @tile_group: tile group for the connected monitor
651
 * @tile_group: tile group for the connected monitor
612
 * @tile_is_single_monitor: whether the tile is one monitor housing
652
 * @tile_is_single_monitor: whether the tile is one monitor housing
Line 656... Line 696...
656
	uint8_t polled; /* DRM_CONNECTOR_POLL_* */
696
	uint8_t polled; /* DRM_CONNECTOR_POLL_* */
Line 657... Line 697...
657
 
697
 
658
	/* requested DPMS state */
698
	/* requested DPMS state */
Line 659... Line 699...
659
	int dpms;
699
	int dpms;
Line 660... Line 700...
660
 
700
 
661
	void *helper_private;
701
	const void *helper_private;
662
 
702
 
663
	/* forced on connector */
703
	/* forced on connector */
Line 675... Line 715...
675
	int video_latency[2];	/* [0]: progressive, [1]: interlaced */
715
	int video_latency[2];	/* [0]: progressive, [1]: interlaced */
676
	int audio_latency[2];
716
	int audio_latency[2];
677
	int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
717
	int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
678
	unsigned bad_edid_counter;
718
	unsigned bad_edid_counter;
Line -... Line 719...
-
 
719
 
-
 
720
	/* Flag for raw EDID header corruption - used in Displayport
-
 
721
	 * compliance testing - * Displayport Link CTS Core 1.2 rev1.1 4.2.2.6
-
 
722
	 */
-
 
723
	bool edid_corrupt;
679
 
724
 
Line 680... Line 725...
680
	struct dentry *debugfs_entry;
725
	struct dentry *debugfs_entry;
Line 681... Line 726...
681
 
726
 
Line 691... Line 736...
691
	uint16_t tile_h_size, tile_v_size;
736
	uint16_t tile_h_size, tile_v_size;
692
};
737
};
Line 693... Line 738...
693
 
738
 
694
/**
739
/**
-
 
740
 * struct drm_plane_state - mutable plane state
695
 * struct drm_plane_state - mutable plane state
741
 * @plane: backpointer to the plane
696
 * @crtc: currently bound CRTC, NULL if disabled
742
 * @crtc: currently bound CRTC, NULL if disabled
697
 * @fb: currently bound framebuffer
743
 * @fb: currently bound framebuffer
698
 * @fence: optional fence to wait for before scanning out @fb
744
 * @fence: optional fence to wait for before scanning out @fb
699
 * @crtc_x: left position of visible portion of plane on crtc
745
 * @crtc_x: left position of visible portion of plane on crtc
Line 707... Line 753...
707
 * @src_w: width of visible portion of plane (in 16.16)
753
 * @src_w: width of visible portion of plane (in 16.16)
708
 * @src_h: height of visible portion of plane (in 16.16)
754
 * @src_h: height of visible portion of plane (in 16.16)
709
 * @state: backpointer to global drm_atomic_state
755
 * @state: backpointer to global drm_atomic_state
710
 */
756
 */
711
struct drm_plane_state {
757
struct drm_plane_state {
-
 
758
	struct drm_plane *plane;
-
 
759
 
712
	struct drm_crtc *crtc;   /* do not write directly, use drm_atomic_set_crtc_for_plane() */
760
	struct drm_crtc *crtc;   /* do not write directly, use drm_atomic_set_crtc_for_plane() */
713
	struct drm_framebuffer *fb;  /* do not write directly, use drm_atomic_set_fb_for_plane() */
761
	struct drm_framebuffer *fb;  /* do not write directly, use drm_atomic_set_fb_for_plane() */
714
	struct fence *fence;
762
	struct fence *fence;
Line 715... Line 763...
715
 
763
 
Line 719... Line 767...
719
 
767
 
720
	/* Source values are 16.16 fixed point */
768
	/* Source values are 16.16 fixed point */
721
	uint32_t src_x, src_y;
769
	uint32_t src_x, src_y;
Line -... Line 770...
-
 
770
	uint32_t src_h, src_w;
-
 
771
 
-
 
772
	/* Plane rotation */
722
	uint32_t src_h, src_w;
773
	unsigned int rotation;
723
 
774
 
Line 724... Line 775...
724
	struct drm_atomic_state *state;
775
	struct drm_atomic_state *state;
Line 733... Line 784...
733
 * @reset: reset plane after state has been invalidated (e.g. resume)
784
 * @reset: reset plane after state has been invalidated (e.g. resume)
734
 * @set_property: called when a property is changed
785
 * @set_property: called when a property is changed
735
 * @atomic_duplicate_state: duplicate the atomic state for this plane
786
 * @atomic_duplicate_state: duplicate the atomic state for this plane
736
 * @atomic_destroy_state: destroy an atomic state for this plane
787
 * @atomic_destroy_state: destroy an atomic state for this plane
737
 * @atomic_set_property: set a property on an atomic state for this plane
788
 * @atomic_set_property: set a property on an atomic state for this plane
-
 
789
 *    (do not call directly, use drm_atomic_plane_set_property())
-
 
790
 * @atomic_get_property: get a property on an atomic state for this plane
-
 
791
 *    (do not call directly, use drm_atomic_plane_get_property())
738
 */
792
 */
739
struct drm_plane_funcs {
793
struct drm_plane_funcs {
740
	int (*update_plane)(struct drm_plane *plane,
794
	int (*update_plane)(struct drm_plane *plane,
741
			    struct drm_crtc *crtc, struct drm_framebuffer *fb,
795
			    struct drm_crtc *crtc, struct drm_framebuffer *fb,
742
			    int crtc_x, int crtc_y,
796
			    int crtc_x, int crtc_y,
Line 756... Line 810...
756
				     struct drm_plane_state *state);
810
				     struct drm_plane_state *state);
757
	int (*atomic_set_property)(struct drm_plane *plane,
811
	int (*atomic_set_property)(struct drm_plane *plane,
758
				   struct drm_plane_state *state,
812
				   struct drm_plane_state *state,
759
				   struct drm_property *property,
813
				   struct drm_property *property,
760
				   uint64_t val);
814
				   uint64_t val);
-
 
815
	int (*atomic_get_property)(struct drm_plane *plane,
-
 
816
				   const struct drm_plane_state *state,
-
 
817
				   struct drm_property *property,
-
 
818
				   uint64_t *val);
761
};
819
};
Line 762... Line 820...
762
 
820
 
763
enum drm_plane_type {
821
enum drm_plane_type {
764
	DRM_PLANE_TYPE_OVERLAY,
822
	DRM_PLANE_TYPE_OVERLAY,
Line 772... Line 830...
772
 * @head: for list management
830
 * @head: for list management
773
 * @base: base mode object
831
 * @base: base mode object
774
 * @possible_crtcs: pipes this plane can be bound to
832
 * @possible_crtcs: pipes this plane can be bound to
775
 * @format_types: array of formats supported by this plane
833
 * @format_types: array of formats supported by this plane
776
 * @format_count: number of formats supported
834
 * @format_count: number of formats supported
-
 
835
 * @format_default: driver hasn't supplied supported formats for the plane
777
 * @crtc: currently bound CRTC
836
 * @crtc: currently bound CRTC
778
 * @fb: currently bound fb
837
 * @fb: currently bound fb
779
 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
838
 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
780
 * 	drm_mode_set_config_internal() to implement correct refcounting.
839
 * 	drm_mode_set_config_internal() to implement correct refcounting.
781
 * @funcs: helper functions
840
 * @funcs: helper functions
Line 791... Line 850...
791
 
850
 
Line 792... Line 851...
792
	struct drm_mode_object base;
851
	struct drm_mode_object base;
793
 
852
 
794
	uint32_t possible_crtcs;
853
	uint32_t possible_crtcs;
-
 
854
	uint32_t *format_types;
Line 795... Line 855...
795
	uint32_t *format_types;
855
	unsigned int format_count;
796
	uint32_t format_count;
856
	bool format_default;
Line 797... Line 857...
797
 
857
 
Line 804... Line 864...
804
 
864
 
Line 805... Line 865...
805
	struct drm_object_properties properties;
865
	struct drm_object_properties properties;
Line 806... Line 866...
806
 
866
 
Line 807... Line 867...
807
	enum drm_plane_type type;
867
	enum drm_plane_type type;
808
 
868
 
Line 809... Line 869...
809
	void *helper_private;
869
	const void *helper_private;
810
 
870
 
-
 
871
	struct drm_plane_state *state;
811
	struct drm_plane_state *state;
872
};
812
};
873
 
813
 
874
/**
814
/**
875
 * struct drm_bridge_funcs - drm_bridge control functions
815
 * struct drm_bridge_funcs - drm_bridge control functions
876
 * @attach: Called during drm_bridge_attach
816
 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
877
 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
817
 * @disable: Called right before encoder prepare, disables the bridge
-
 
818
 * @post_disable: Called right after encoder prepare, for lockstepped disable
878
 * @disable: Called right before encoder prepare, disables the bridge
819
 * @mode_set: Set this mode to the bridge
879
 * @post_disable: Called right after encoder prepare, for lockstepped disable
-
 
880
 * @mode_set: Set this mode to the bridge
820
 * @pre_enable: Called right before encoder commit, for lockstepped commit
881
 * @pre_enable: Called right before encoder commit, for lockstepped commit
821
 * @enable: Called right after encoder commit, enables the bridge
882
 * @enable: Called right after encoder commit, enables the bridge
822
 * @destroy: make object go away
883
 */
823
 */
884
struct drm_bridge_funcs {
824
struct drm_bridge_funcs {
885
	int (*attach)(struct drm_bridge *bridge);
825
	bool (*mode_fixup)(struct drm_bridge *bridge,
886
	bool (*mode_fixup)(struct drm_bridge *bridge,
826
			   const struct drm_display_mode *mode,
887
			   const struct drm_display_mode *mode,
827
			   struct drm_display_mode *adjusted_mode);
888
			   struct drm_display_mode *adjusted_mode);
828
	void (*disable)(struct drm_bridge *bridge);
889
	void (*disable)(struct drm_bridge *bridge);
829
	void (*post_disable)(struct drm_bridge *bridge);
890
	void (*post_disable)(struct drm_bridge *bridge);
830
	void (*mode_set)(struct drm_bridge *bridge,
-
 
831
			 struct drm_display_mode *mode,
891
	void (*mode_set)(struct drm_bridge *bridge,
Line 832... Line 892...
832
			 struct drm_display_mode *adjusted_mode);
892
			 struct drm_display_mode *mode,
833
	void (*pre_enable)(struct drm_bridge *bridge);
893
			 struct drm_display_mode *adjusted_mode);
834
	void (*enable)(struct drm_bridge *bridge);
894
	void (*pre_enable)(struct drm_bridge *bridge);
-
 
895
	void (*enable)(struct drm_bridge *bridge);
835
	void (*destroy)(struct drm_bridge *bridge);
896
};
836
};
897
 
-
 
898
/**
837
 
899
 * struct drm_bridge - central DRM bridge control structure
838
/**
900
 * @dev: DRM device this bridge belongs to
839
 * struct drm_bridge - central DRM bridge control structure
901
 * @encoder: encoder to which this bridge is connected
840
 * @dev: DRM device this bridge belongs to
902
 * @next: the next bridge in the encoder chain
841
 * @head: list management
903
 * @of_node: device node pointer to the bridge
-
 
904
 * @list: to keep track of all added bridges
842
 * @base: base mode object
905
 * @funcs: control functions
-
 
906
 * @driver_private: pointer to the bridge driver's internal context
-
 
907
 */
843
 * @funcs: control functions
908
struct drm_bridge {
844
 * @driver_private: pointer to the bridge driver's internal context
909
	struct drm_device *dev;
Line 845... Line 910...
845
 */
910
	struct drm_encoder *encoder;
846
struct drm_bridge {
911
	struct drm_bridge *next;
847
	struct drm_device *dev;
912
#ifdef CONFIG_OF
Line 848... Line 913...
848
	struct list_head head;
913
	struct device_node *of_node;
849
 
914
#endif
850
	struct drm_mode_object base;
915
	struct list_head list;
851
 
916
 
-
 
917
	const struct drm_bridge_funcs *funcs;
852
	const struct drm_bridge_funcs *funcs;
918
	void *driver_private;
853
	void *driver_private;
919
};
854
};
920
 
855
 
921
/**
856
/**
922
 * struct drm_atomic_state - the global state object for atomic updates
Line 866... Line 932...
866
 * @connector_states: pointer to array of connector states pointers
932
 * @connector_states: pointer to array of connector states pointers
867
 * @acquire_ctx: acquire context for this atomic modeset state update
933
 * @acquire_ctx: acquire context for this atomic modeset state update
868
 */
934
 */
869
struct drm_atomic_state {
935
struct drm_atomic_state {
870
	struct drm_device *dev;
936
	struct drm_device *dev;
871
	uint32_t flags;
937
	bool allow_modeset : 1;
-
 
938
	bool legacy_cursor_update : 1;
872
	struct drm_plane **planes;
939
	struct drm_plane **planes;
873
	struct drm_plane_state **plane_states;
940
	struct drm_plane_state **plane_states;
874
	struct drm_crtc **crtcs;
941
	struct drm_crtc **crtcs;
875
	struct drm_crtc_state **crtc_states;
942
	struct drm_crtc_state **crtc_states;
876
	int num_connector;
943
	int num_connector;
Line 910... Line 977...
910
 
977
 
911
/**
978
/**
912
 * struct drm_mode_config_funcs - basic driver provided mode setting functions
979
 * struct drm_mode_config_funcs - basic driver provided mode setting functions
913
 * @fb_create: create a new framebuffer object
980
 * @fb_create: create a new framebuffer object
914
 * @output_poll_changed: function to handle output configuration changes
981
 * @output_poll_changed: function to handle output configuration changes
915
 * @atomic_check: check whether a give atomic state update is possible
982
 * @atomic_check: check whether a given atomic state update is possible
916
 * @atomic_commit: commit an atomic state update previously verified with
983
 * @atomic_commit: commit an atomic state update previously verified with
-
 
984
 * 	atomic_check()
-
 
985
 * @atomic_state_alloc: allocate a new atomic state
-
 
986
 * @atomic_state_clear: clear the atomic state
917
 * 	atomic_check()
987
 * @atomic_state_free: free the atomic state
918
 *
988
 *
919
 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
989
 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
920
 * involve drivers.
990
 * involve drivers.
921
 */
991
 */
Line 928... Line 998...
928
	int (*atomic_check)(struct drm_device *dev,
998
	int (*atomic_check)(struct drm_device *dev,
929
			    struct drm_atomic_state *a);
999
			    struct drm_atomic_state *a);
930
	int (*atomic_commit)(struct drm_device *dev,
1000
	int (*atomic_commit)(struct drm_device *dev,
931
			     struct drm_atomic_state *a,
1001
			     struct drm_atomic_state *a,
932
			     bool async);
1002
			     bool async);
933
};
-
 
934
 
-
 
935
/**
-
 
936
 * struct drm_mode_group - group of mode setting resources for potential sub-grouping
1003
	struct drm_atomic_state *(*atomic_state_alloc)(struct drm_device *dev);
937
 * @num_crtcs: CRTC count
-
 
938
 * @num_encoders: encoder count
-
 
939
 * @num_connectors: connector count
-
 
940
 * @num_bridges: bridge count
-
 
941
 * @id_list: list of KMS object IDs in this group
-
 
942
 *
-
 
943
 * Currently this simply tracks the global mode setting state.  But in the
-
 
944
 * future it could allow groups of objects to be set aside into independent
-
 
945
 * control groups for use by different user level processes (e.g. two X servers
-
 
946
 * running simultaneously on different heads, each with their own mode
1004
	void (*atomic_state_clear)(struct drm_atomic_state *state);
947
 * configuration and freedom of mode setting).
1005
	void (*atomic_state_free)(struct drm_atomic_state *state);
948
 */
-
 
949
struct drm_mode_group {
-
 
950
	uint32_t num_crtcs;
-
 
951
	uint32_t num_encoders;
-
 
952
	uint32_t num_connectors;
-
 
953
	uint32_t num_bridges;
-
 
954
 
-
 
955
	/* list of object IDs for this group */
-
 
956
	uint32_t *id_list;
-
 
957
};
1006
};
Line 958... Line 1007...
958
 
1007
 
959
/**
1008
/**
960
 * struct drm_mode_config - Mode configuration control structure
1009
 * struct drm_mode_config - Mode configuration control structure
Line 967... Line 1016...
967
 * @fb_lock: mutex to protect fb state and lists
1016
 * @fb_lock: mutex to protect fb state and lists
968
 * @num_fb: number of fbs available
1017
 * @num_fb: number of fbs available
969
 * @fb_list: list of framebuffers available
1018
 * @fb_list: list of framebuffers available
970
 * @num_connector: number of connectors on this device
1019
 * @num_connector: number of connectors on this device
971
 * @connector_list: list of connector objects
1020
 * @connector_list: list of connector objects
972
 * @num_bridge: number of bridges on this device
-
 
973
 * @bridge_list: list of bridge objects
-
 
974
 * @num_encoder: number of encoders on this device
1021
 * @num_encoder: number of encoders on this device
975
 * @encoder_list: list of encoder objects
1022
 * @encoder_list: list of encoder objects
976
 * @num_overlay_plane: number of overlay planes on this device
1023
 * @num_overlay_plane: number of overlay planes on this device
977
 * @num_total_plane: number of universal (i.e. with primary/curso) planes on this device
1024
 * @num_total_plane: number of universal (i.e. with primary/curso) planes on this device
978
 * @plane_list: list of plane objects
1025
 * @plane_list: list of plane objects
Line 987... Line 1034...
987
 * @fb_base: base address of the framebuffer
1034
 * @fb_base: base address of the framebuffer
988
 * @poll_enabled: track polling support for this device
1035
 * @poll_enabled: track polling support for this device
989
 * @poll_running: track polling status for this device
1036
 * @poll_running: track polling status for this device
990
 * @output_poll_work: delayed work for polling in process context
1037
 * @output_poll_work: delayed work for polling in process context
991
 * @property_blob_list: list of all the blob property objects
1038
 * @property_blob_list: list of all the blob property objects
-
 
1039
 * @blob_lock: mutex for blob property allocation and management
992
 * @*_property: core property tracking
1040
 * @*_property: core property tracking
993
 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
1041
 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
994
 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
1042
 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
995
 * @async_page_flip: does this device support async flips on the primary plane?
1043
 * @async_page_flip: does this device support async flips on the primary plane?
996
 * @cursor_width: hint to userspace for max cursor width
1044
 * @cursor_width: hint to userspace for max cursor width
Line 1013... Line 1061...
1013
	int num_fb;
1061
	int num_fb;
1014
	struct list_head fb_list;
1062
	struct list_head fb_list;
Line 1015... Line 1063...
1015
 
1063
 
1016
	int num_connector;
1064
	int num_connector;
1017
	struct list_head connector_list;
-
 
1018
	int num_bridge;
-
 
1019
	struct list_head bridge_list;
1065
	struct list_head connector_list;
1020
	int num_encoder;
1066
	int num_encoder;
Line 1021... Line 1067...
1021
	struct list_head encoder_list;
1067
	struct list_head encoder_list;
1022
 
1068
 
Line 1041... Line 1087...
1041
	resource_size_t fb_base;
1087
	resource_size_t fb_base;
Line 1042... Line 1088...
1042
 
1088
 
1043
	/* output poll support */
1089
	/* output poll support */
1044
	bool poll_enabled;
1090
	bool poll_enabled;
-
 
1091
	bool poll_running;
1045
	bool poll_running;
1092
	bool delayed_event;
Line -... Line 1093...
-
 
1093
	struct delayed_work output_poll_work;
-
 
1094
 
1046
	struct delayed_work output_poll_work;
1095
	struct mutex blob_lock;
1047
 
1096
 
1048
	/* pointers to standard properties */
1097
	/* pointers to standard properties */
1049
	struct list_head property_blob_list;
1098
	struct list_head property_blob_list;
1050
	struct drm_property *edid_property;
1099
	struct drm_property *edid_property;
1051
	struct drm_property *dpms_property;
1100
	struct drm_property *dpms_property;
1052
	struct drm_property *path_property;
1101
	struct drm_property *path_property;
1053
	struct drm_property *tile_property;
1102
	struct drm_property *tile_property;
-
 
1103
	struct drm_property *plane_type_property;
-
 
1104
	struct drm_property *rotation_property;
-
 
1105
	struct drm_property *prop_src_x;
-
 
1106
	struct drm_property *prop_src_y;
-
 
1107
	struct drm_property *prop_src_w;
-
 
1108
	struct drm_property *prop_src_h;
-
 
1109
	struct drm_property *prop_crtc_x;
-
 
1110
	struct drm_property *prop_crtc_y;
-
 
1111
	struct drm_property *prop_crtc_w;
-
 
1112
	struct drm_property *prop_crtc_h;
-
 
1113
	struct drm_property *prop_fb_id;
-
 
1114
	struct drm_property *prop_crtc_id;
Line 1054... Line 1115...
1054
	struct drm_property *plane_type_property;
1115
	struct drm_property *prop_active;
1055
	struct drm_property *rotation_property;
1116
	struct drm_property *prop_mode_id;
1056
 
1117
 
Line 1086... Line 1147...
1086
	uint32_t preferred_depth, prefer_shadow;
1147
	uint32_t preferred_depth, prefer_shadow;
Line 1087... Line 1148...
1087
 
1148
 
1088
	/* whether async page flip is supported or not */
1149
	/* whether async page flip is supported or not */
Line -... Line 1150...
-
 
1150
	bool async_page_flip;
-
 
1151
 
-
 
1152
	/* whether the driver supports fb modifiers */
1089
	bool async_page_flip;
1153
	bool allow_fb_modifiers;
1090
 
1154
 
1091
	/* cursor size */
1155
	/* cursor size */
Line 1092... Line 1156...
1092
	uint32_t cursor_width, cursor_height;
1156
	uint32_t cursor_width, cursor_height;
Line 1151... Line 1215...
1151
extern void drm_connector_cleanup(struct drm_connector *connector);
1215
extern void drm_connector_cleanup(struct drm_connector *connector);
1152
extern unsigned int drm_connector_index(struct drm_connector *connector);
1216
extern unsigned int drm_connector_index(struct drm_connector *connector);
1153
/* helper to unplug all connectors from sysfs for device */
1217
/* helper to unplug all connectors from sysfs for device */
1154
extern void drm_connector_unplug_all(struct drm_device *dev);
1218
extern void drm_connector_unplug_all(struct drm_device *dev);
Line -... Line 1219...
-
 
1219
 
-
 
1220
extern int drm_bridge_add(struct drm_bridge *bridge);
-
 
1221
extern void drm_bridge_remove(struct drm_bridge *bridge);
1155
 
1222
extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
-
 
1223
extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
-
 
1224
 
1156
extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge,
1225
bool drm_bridge_mode_fixup(struct drm_bridge *bridge,
-
 
1226
			const struct drm_display_mode *mode,
1157
			   const struct drm_bridge_funcs *funcs);
1227
			struct drm_display_mode *adjusted_mode);
-
 
1228
void drm_bridge_disable(struct drm_bridge *bridge);
-
 
1229
void drm_bridge_post_disable(struct drm_bridge *bridge);
-
 
1230
void drm_bridge_mode_set(struct drm_bridge *bridge,
-
 
1231
			struct drm_display_mode *mode,
-
 
1232
			struct drm_display_mode *adjusted_mode);
-
 
1233
void drm_bridge_pre_enable(struct drm_bridge *bridge);
Line 1158... Line 1234...
1158
extern void drm_bridge_cleanup(struct drm_bridge *bridge);
1234
void drm_bridge_enable(struct drm_bridge *bridge);
1159
 
1235
 
1160
extern int drm_encoder_init(struct drm_device *dev,
1236
extern int drm_encoder_init(struct drm_device *dev,
1161
			     struct drm_encoder *encoder,
1237
			    struct drm_encoder *encoder,
Line 1178... Line 1254...
1178
extern int drm_universal_plane_init(struct drm_device *dev,
1254
extern int drm_universal_plane_init(struct drm_device *dev,
1179
				    struct drm_plane *plane,
1255
				    struct drm_plane *plane,
1180
				    unsigned long possible_crtcs,
1256
				    unsigned long possible_crtcs,
1181
				    const struct drm_plane_funcs *funcs,
1257
				    const struct drm_plane_funcs *funcs,
1182
				    const uint32_t *formats,
1258
				    const uint32_t *formats,
1183
				    uint32_t format_count,
1259
				    unsigned int format_count,
1184
				    enum drm_plane_type type);
1260
				    enum drm_plane_type type);
1185
extern int drm_plane_init(struct drm_device *dev,
1261
extern int drm_plane_init(struct drm_device *dev,
1186
			  struct drm_plane *plane,
1262
			  struct drm_plane *plane,
1187
			  unsigned long possible_crtcs,
1263
			  unsigned long possible_crtcs,
1188
			  const struct drm_plane_funcs *funcs,
1264
			  const struct drm_plane_funcs *funcs,
1189
			  const uint32_t *formats, uint32_t format_count,
1265
			  const uint32_t *formats, unsigned int format_count,
1190
			  bool is_primary);
1266
			  bool is_primary);
1191
extern void drm_plane_cleanup(struct drm_plane *plane);
1267
extern void drm_plane_cleanup(struct drm_plane *plane);
1192
extern unsigned int drm_plane_index(struct drm_plane *plane);
1268
extern unsigned int drm_plane_index(struct drm_plane *plane);
-
 
1269
extern struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
1193
extern void drm_plane_force_disable(struct drm_plane *plane);
1270
extern void drm_plane_force_disable(struct drm_plane *plane);
-
 
1271
extern int drm_plane_check_pixel_format(const struct drm_plane *plane,
-
 
1272
					u32 format);
-
 
1273
extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
-
 
1274
				   int *hdisplay, int *vdisplay);
1194
extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
1275
extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
1195
				   int x, int y,
1276
				   int x, int y,
1196
				   const struct drm_display_mode *mode,
1277
				   const struct drm_display_mode *mode,
1197
				   const struct drm_framebuffer *fb);
1278
				   const struct drm_framebuffer *fb);
Line 1204... Line 1285...
1204
extern const char *drm_get_dvi_i_subconnector_name(int val);
1285
extern const char *drm_get_dvi_i_subconnector_name(int val);
1205
extern const char *drm_get_dvi_i_select_name(int val);
1286
extern const char *drm_get_dvi_i_select_name(int val);
1206
extern const char *drm_get_tv_subconnector_name(int val);
1287
extern const char *drm_get_tv_subconnector_name(int val);
1207
extern const char *drm_get_tv_select_name(int val);
1288
extern const char *drm_get_tv_select_name(int val);
1208
extern void drm_fb_release(struct drm_file *file_priv);
1289
extern void drm_fb_release(struct drm_file *file_priv);
1209
extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
-
 
1210
extern void drm_mode_group_destroy(struct drm_mode_group *group);
1290
extern void drm_property_destroy_user_blobs(struct drm_device *dev,
1211
extern void drm_reinit_primary_mode_group(struct drm_device *dev);
1291
                                            struct drm_file *file_priv);
1212
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
1292
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
1213
extern struct edid *drm_get_edid(struct drm_connector *connector,
1293
extern struct edid *drm_get_edid(struct drm_connector *connector,
1214
				 struct i2c_adapter *adapter);
1294
				 struct i2c_adapter *adapter);
1215
extern struct edid *drm_edid_duplicate(const struct edid *edid);
1295
extern struct edid *drm_edid_duplicate(const struct edid *edid);
1216
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
1296
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
Line 1222... Line 1302...
1222
						const char *path);
1302
						const char *path);
1223
int drm_mode_connector_set_tile_property(struct drm_connector *connector);
1303
int drm_mode_connector_set_tile_property(struct drm_connector *connector);
1224
extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
1304
extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
1225
						   const struct edid *edid);
1305
						   const struct edid *edid);
Line -... Line 1306...
-
 
1306
 
-
 
1307
extern int drm_display_info_set_bus_formats(struct drm_display_info *info,
-
 
1308
					    const u32 *formats,
-
 
1309
					    unsigned int num_formats);
1226
 
1310
 
1227
static inline bool drm_property_type_is(struct drm_property *property,
1311
static inline bool drm_property_type_is(struct drm_property *property,
1228
		uint32_t type)
1312
		uint32_t type)
1229
{
1313
{
1230
	/* instanceof for props.. handles extended type vs original types: */
1314
	/* instanceof for props.. handles extended type vs original types: */
Line 1277... Line 1361...
1277
struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
1361
struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
1278
					 int flags, const char *name,
1362
					 int flags, const char *name,
1279
					 int64_t min, int64_t max);
1363
					 int64_t min, int64_t max);
1280
struct drm_property *drm_property_create_object(struct drm_device *dev,
1364
struct drm_property *drm_property_create_object(struct drm_device *dev,
1281
					 int flags, const char *name, uint32_t type);
1365
					 int flags, const char *name, uint32_t type);
-
 
1366
struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags,
-
 
1367
					 const char *name);
-
 
1368
struct drm_property_blob *drm_property_create_blob(struct drm_device *dev,
-
 
1369
                                                   size_t length,
-
 
1370
                                                   const void *data);
-
 
1371
struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev,
-
 
1372
                                                   uint32_t id);
-
 
1373
struct drm_property_blob *drm_property_reference_blob(struct drm_property_blob *blob);
-
 
1374
void drm_property_unreference_blob(struct drm_property_blob *blob);
1282
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
1375
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
1283
extern int drm_property_add_enum(struct drm_property *property, int index,
1376
extern int drm_property_add_enum(struct drm_property *property, int index,
1284
				 uint64_t value, const char *name);
1377
				 uint64_t value, const char *name);
1285
extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1378
extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1286
extern int drm_mode_create_tv_properties(struct drm_device *dev,
1379
extern int drm_mode_create_tv_properties(struct drm_device *dev,
1287
					 unsigned int num_modes,
1380
					 unsigned int num_modes,
1288
					 char *modes[]);
1381
					 const char * const modes[]);
1289
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1382
extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1290
extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1383
extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1291
extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1384
extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1292
extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
1385
extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
-
 
1386
extern bool drm_property_change_valid_get(struct drm_property *property,
-
 
1387
					 uint64_t value, struct drm_mode_object **ref);
-
 
1388
extern void drm_property_change_valid_put(struct drm_property *property,
-
 
1389
		struct drm_mode_object *ref);
Line 1293... Line 1390...
1293
 
1390
 
1294
extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1391
extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1295
					     struct drm_encoder *encoder);
1392
					     struct drm_encoder *encoder);
1296
extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
1393
extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
Line 1332... Line 1429...
1332
 
1429
 
1333
extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
1430
extern int drm_mode_getproperty_ioctl(struct drm_device *dev,
1334
				      void *data, struct drm_file *file_priv);
1431
				      void *data, struct drm_file *file_priv);
1335
extern int drm_mode_getblob_ioctl(struct drm_device *dev,
1432
extern int drm_mode_getblob_ioctl(struct drm_device *dev,
-
 
1433
				  void *data, struct drm_file *file_priv);
-
 
1434
extern int drm_mode_createblob_ioctl(struct drm_device *dev,
-
 
1435
				     void *data, struct drm_file *file_priv);
-
 
1436
extern int drm_mode_destroyblob_ioctl(struct drm_device *dev,
1336
				  void *data, struct drm_file *file_priv);
1437
				      void *data, struct drm_file *file_priv);
1337
extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
1438
extern int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
1338
					      void *data, struct drm_file *file_priv);
1439
					      void *data, struct drm_file *file_priv);
1339
extern int drm_mode_getencoder(struct drm_device *dev,
1440
extern int drm_mode_getencoder(struct drm_device *dev,
1340
			       void *data, struct drm_file *file_priv);
1441
			       void *data, struct drm_file *file_priv);
Line 1353... Line 1454...
1353
				int hdisplay, int vdisplay);
1454
				int hdisplay, int vdisplay);
1354
extern void drm_set_preferred_mode(struct drm_connector *connector,
1455
extern void drm_set_preferred_mode(struct drm_connector *connector,
1355
				   int hpref, int vpref);
1456
				   int hpref, int vpref);
Line 1356... Line 1457...
1356
 
1457
 
1357
extern int drm_edid_header_is_valid(const u8 *raw_edid);
1458
extern int drm_edid_header_is_valid(const u8 *raw_edid);
-
 
1459
extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
1358
extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
1460
				 bool *edid_corrupt);
Line 1359... Line 1461...
1359
extern bool drm_edid_is_valid(struct edid *edid);
1461
extern bool drm_edid_is_valid(struct edid *edid);
1360
 
1462
 
1361
extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
1463
extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
Line 1379... Line 1481...
1379
extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1481
extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1380
					   struct drm_file *file_priv);
1482
					   struct drm_file *file_priv);
1381
extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
1483
extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
1382
				       struct drm_property *property,
1484
				       struct drm_property *property,
1383
				       uint64_t value);
1485
				       uint64_t value);
-
 
1486
extern int drm_mode_atomic_ioctl(struct drm_device *dev,
-
 
1487
				 void *data, struct drm_file *file_priv);
Line 1384... Line 1488...
1384
 
1488
 
1385
extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1489
extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1386
				 int *bpp);
1490
				 int *bpp);
1387
extern int drm_format_num_planes(uint32_t format);
1491
extern int drm_format_num_planes(uint32_t format);
Line 1434... Line 1538...
1434
	struct drm_mode_object *mo;
1538
	struct drm_mode_object *mo;
1435
	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
1539
	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
1436
	return mo ? obj_to_property(mo) : NULL;
1540
	return mo ? obj_to_property(mo) : NULL;
1437
}
1541
}
Line -... Line 1542...
-
 
1542
 
-
 
1543
/* Plane list iterator for legacy (overlay only) planes. */
-
 
1544
#define drm_for_each_legacy_plane(plane, dev) \
-
 
1545
	list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
-
 
1546
		if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-
 
1547
 
-
 
1548
#define drm_for_each_plane(plane, dev) \
-
 
1549
	list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
-
 
1550
 
-
 
1551
#define drm_for_each_crtc(crtc, dev) \
-
 
1552
	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
1438
 
1553
 
1439
static inline struct drm_property_blob *
1554
static inline void
1440
drm_property_blob_find(struct drm_device *dev, uint32_t id)
1555
assert_drm_connector_list_read_locked(struct drm_mode_config *mode_config)
-
 
1556
{
-
 
1557
	/*
-
 
1558
	 * The connector hotadd/remove code currently grabs both locks when
1441
{
1559
	 * updating lists. Hence readers need only hold either of them to be
-
 
1560
	 * safe and the check amounts to
1442
	struct drm_mode_object *mo;
1561
	 *
-
 
1562
	 * WARN_ON(not_holding(A) && not_holding(B)).
-
 
1563
	 */
1443
	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
1564
	WARN_ON(!mutex_is_locked(&mode_config->mutex) &&
1444
	return mo ? obj_to_blob(mo) : NULL;
1565
		!drm_modeset_is_locked(&mode_config->connection_mutex));
Line -... Line 1566...
-
 
1566
}
-
 
1567
 
-
 
1568
#define drm_for_each_connector(connector, dev) \
-
 
1569
	for (assert_drm_connector_list_read_locked(&(dev)->mode_config),	\
-
 
1570
	     connector = list_first_entry(&(dev)->mode_config.connector_list,	\
1445
}
1571
					  struct drm_connector, head);		\
-
 
1572
	     &connector->head != (&(dev)->mode_config.connector_list);		\
1446
 
1573
	     connector = list_next_entry(connector, head))
1447
/* Plane list iterator for legacy (overlay only) planes. */
1574
 
-
 
1575
#define drm_for_each_encoder(encoder, dev) \
-
 
1576
	list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head)
-
 
1577
 
-
 
1578
#define drm_for_each_fb(fb, dev) \
-
 
1579
	for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)),		\
1448
#define drm_for_each_legacy_plane(plane, planelist) \
1580
	     fb = list_first_entry(&(dev)->mode_config.fb_list,	\
-
 
1581
					  struct drm_framebuffer, head);	\
Line 1449... Line 1582...
1449
	list_for_each_entry(plane, planelist, head) \
1582
	     &fb->head != (&(dev)->mode_config.fb_list);			\