Subversion Repositories Kolibri OS

Rev

Rev 6936 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6936 Rev 7143
Line 303... Line 303...
303
 * @active: whether the CRTC is actively displaying (used for DPMS)
303
 * @active: whether the CRTC is actively displaying (used for DPMS)
304
 * @planes_changed: planes on this crtc are updated
304
 * @planes_changed: planes on this crtc are updated
305
 * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
305
 * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
306
 * @active_changed: crtc_state->active has been toggled.
306
 * @active_changed: crtc_state->active has been toggled.
307
 * @connectors_changed: connectors to this crtc have been updated
307
 * @connectors_changed: connectors to this crtc have been updated
-
 
308
 * @color_mgmt_changed: color management properties have changed (degamma or
-
 
309
 *	gamma LUT or CSC matrix)
308
 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
310
 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
309
 * @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors
311
 * @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors
-
 
312
 * @encoder_mask: bitmask of (1 << drm_encoder_index(encoder)) of attached encoders
310
 * @last_vblank_count: for helpers and drivers to capture the vblank of the
313
 * @last_vblank_count: for helpers and drivers to capture the vblank of the
311
 * 	update to ensure framebuffer cleanup isn't done too early
314
 * 	update to ensure framebuffer cleanup isn't done too early
312
 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
315
 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
313
 * @mode: current mode timings
316
 * @mode: current mode timings
-
 
317
 * @degamma_lut: Lookup table for converting framebuffer pixel data
-
 
318
 *	before apply the conversion matrix
-
 
319
 * @ctm: Transformation matrix
-
 
320
 * @gamma_lut: Lookup table for converting pixel data after the
-
 
321
 *	conversion matrix
314
 * @event: optional pointer to a DRM event to signal upon completion of the
322
 * @event: optional pointer to a DRM event to signal upon completion of the
315
 * 	state update
323
 * 	state update
316
 * @state: backpointer to global drm_atomic_state
324
 * @state: backpointer to global drm_atomic_state
317
 *
325
 *
318
 * Note that the distinction between @enable and @active is rather subtile:
326
 * Note that the distinction between @enable and @active is rather subtile:
Line 330... Line 338...
330
	/* computed state bits used by helpers and drivers */
338
	/* computed state bits used by helpers and drivers */
331
	bool planes_changed : 1;
339
	bool planes_changed : 1;
332
	bool mode_changed : 1;
340
	bool mode_changed : 1;
333
	bool active_changed : 1;
341
	bool active_changed : 1;
334
	bool connectors_changed : 1;
342
	bool connectors_changed : 1;
-
 
343
	bool color_mgmt_changed : 1;
Line 335... Line 344...
335
 
344
 
336
	/* attached planes bitmask:
345
	/* attached planes bitmask:
337
	 * WARNING: transitional helpers do not maintain plane_mask so
346
	 * WARNING: transitional helpers do not maintain plane_mask so
338
	 * drivers not converted over to atomic helpers should not rely
347
	 * drivers not converted over to atomic helpers should not rely
339
	 * on plane_mask being accurate!
348
	 * on plane_mask being accurate!
340
	 */
349
	 */
Line 341... Line 350...
341
	u32 plane_mask;
350
	u32 plane_mask;
-
 
351
 
Line 342... Line 352...
342
 
352
	u32 connector_mask;
343
	u32 connector_mask;
353
	u32 encoder_mask;
Line 344... Line 354...
344
 
354
 
Line 351... Line 361...
351
	struct drm_display_mode mode;
361
	struct drm_display_mode mode;
Line 352... Line 362...
352
 
362
 
353
	/* blob property to expose current mode to atomic userspace */
363
	/* blob property to expose current mode to atomic userspace */
Line -... Line 364...
-
 
364
	struct drm_property_blob *mode_blob;
-
 
365
 
-
 
366
	/* blob property to expose color management to userspace */
-
 
367
	struct drm_property_blob *degamma_lut;
-
 
368
	struct drm_property_blob *ctm;
354
	struct drm_property_blob *mode_blob;
369
	struct drm_property_blob *gamma_lut;
Line 355... Line 370...
355
 
370
 
356
	struct drm_pending_vblank_event *event;
371
	struct drm_pending_vblank_event *event;
Line 753... Line 768...
753
	struct drm_display_mode hwmode;
768
	struct drm_display_mode hwmode;
Line 754... Line 769...
754
 
769
 
755
	int x, y;
770
	int x, y;
Line 756... Line 771...
756
	const struct drm_crtc_funcs *funcs;
771
	const struct drm_crtc_funcs *funcs;
757
 
772
 
758
	/* CRTC gamma size for reporting to userspace */
773
	/* Legacy FB CRTC gamma size for reporting to userspace */
Line 759... Line 774...
759
	uint32_t gamma_size;
774
	uint32_t gamma_size;
760
	uint16_t *gamma_store;
775
	uint16_t *gamma_store;
Line 1580... Line 1595...
1580
	 * &drm_encoder it's called right before the encoder's ->disable(),
1595
	 * &drm_encoder it's called right before the encoder's ->disable(),
1581
	 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1596
	 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1582
	 *
1597
	 *
1583
	 * The bridge can assume that the display pipe (i.e. clocks and timing
1598
	 * The bridge can assume that the display pipe (i.e. clocks and timing
1584
	 * signals) feeding it is still running when this callback is called.
1599
	 * signals) feeding it is still running when this callback is called.
-
 
1600
	 *
-
 
1601
	 * The disable callback is optional.
1585
	 */
1602
	 */
1586
	void (*disable)(struct drm_bridge *bridge);
1603
	void (*disable)(struct drm_bridge *bridge);
Line 1587... Line 1604...
1587
 
1604
 
1588
	/**
1605
	/**
Line 1596... Line 1613...
1596
	 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1613
	 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1597
	 *
1614
	 *
1598
	 * The bridge must assume that the display pipe (i.e. clocks and timing
1615
	 * The bridge must assume that the display pipe (i.e. clocks and timing
1599
	 * singals) feeding it is no longer running when this callback is
1616
	 * singals) feeding it is no longer running when this callback is
1600
	 * called.
1617
	 * called.
-
 
1618
	 *
-
 
1619
	 * The post_disable callback is optional.
1601
	 */
1620
	 */
1602
	void (*post_disable)(struct drm_bridge *bridge);
1621
	void (*post_disable)(struct drm_bridge *bridge);
Line 1603... Line 1622...
1603
 
1622
 
1604
	/**
1623
	/**
Line 1624... Line 1643...
1624
	 *
1643
	 *
1625
	 * The display pipe (i.e. clocks and timing signals) feeding this bridge
1644
	 * The display pipe (i.e. clocks and timing signals) feeding this bridge
1626
	 * will not yet be running when this callback is called. The bridge must
1645
	 * will not yet be running when this callback is called. The bridge must
1627
	 * not enable the display link feeding the next bridge in the chain (if
1646
	 * not enable the display link feeding the next bridge in the chain (if
1628
	 * there is one) when this callback is called.
1647
	 * there is one) when this callback is called.
-
 
1648
	 *
-
 
1649
	 * The pre_enable callback is optional.
1629
	 */
1650
	 */
1630
	void (*pre_enable)(struct drm_bridge *bridge);
1651
	void (*pre_enable)(struct drm_bridge *bridge);
Line 1631... Line 1652...
1631
 
1652
 
1632
	/**
1653
	/**
Line 1641... Line 1662...
1641
	 *
1662
	 *
1642
	 * The bridge can assume that the display pipe (i.e. clocks and timing
1663
	 * The bridge can assume that the display pipe (i.e. clocks and timing
1643
	 * signals) feeding it is running when this callback is called. This
1664
	 * signals) feeding it is running when this callback is called. This
1644
	 * callback must enable the display link feeding the next bridge in the
1665
	 * callback must enable the display link feeding the next bridge in the
1645
	 * chain if there is one.
1666
	 * chain if there is one.
-
 
1667
	 *
-
 
1668
	 * The enable callback is optional.
1646
	 */
1669
	 */
1647
	void (*enable)(struct drm_bridge *bridge);
1670
	void (*enable)(struct drm_bridge *bridge);
1648
};
1671
};
Line 1649... Line 1672...
1649
 
1672
 
Line 1673... Line 1696...
1673
/**
1696
/**
1674
 * struct drm_atomic_state - the global state object for atomic updates
1697
 * struct drm_atomic_state - the global state object for atomic updates
1675
 * @dev: parent DRM device
1698
 * @dev: parent DRM device
1676
 * @allow_modeset: allow full modeset
1699
 * @allow_modeset: allow full modeset
1677
 * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
1700
 * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
-
 
1701
 * @legacy_set_config: Disable conflicting encoders instead of failing with -EINVAL.
1678
 * @planes: pointer to array of plane pointers
1702
 * @planes: pointer to array of plane pointers
1679
 * @plane_states: pointer to array of plane states pointers
1703
 * @plane_states: pointer to array of plane states pointers
1680
 * @crtcs: pointer to array of CRTC pointers
1704
 * @crtcs: pointer to array of CRTC pointers
1681
 * @crtc_states: pointer to array of CRTC states pointers
1705
 * @crtc_states: pointer to array of CRTC states pointers
1682
 * @num_connector: size of the @connectors and @connector_states arrays
1706
 * @num_connector: size of the @connectors and @connector_states arrays
Line 1686... Line 1710...
1686
 */
1710
 */
1687
struct drm_atomic_state {
1711
struct drm_atomic_state {
1688
	struct drm_device *dev;
1712
	struct drm_device *dev;
1689
	bool allow_modeset : 1;
1713
	bool allow_modeset : 1;
1690
	bool legacy_cursor_update : 1;
1714
	bool legacy_cursor_update : 1;
-
 
1715
	bool legacy_set_config : 1;
1691
	struct drm_plane **planes;
1716
	struct drm_plane **planes;
1692
	struct drm_plane_state **plane_states;
1717
	struct drm_plane_state **plane_states;
1693
	struct drm_crtc **crtcs;
1718
	struct drm_crtc **crtcs;
1694
	struct drm_crtc_state **crtc_states;
1719
	struct drm_crtc_state **crtc_states;
1695
	int num_connector;
1720
	int num_connector;
Line 2022... Line 2047...
2022
 * @poll_running: track polling status for this device
2047
 * @poll_running: track polling status for this device
2023
 * @output_poll_work: delayed work for polling in process context
2048
 * @output_poll_work: delayed work for polling in process context
2024
 * @property_blob_list: list of all the blob property objects
2049
 * @property_blob_list: list of all the blob property objects
2025
 * @blob_lock: mutex for blob property allocation and management
2050
 * @blob_lock: mutex for blob property allocation and management
2026
 * @*_property: core property tracking
2051
 * @*_property: core property tracking
-
 
2052
 * @degamma_lut_property: LUT used to convert the framebuffer's colors to linear
-
 
2053
 *	gamma
-
 
2054
 * @degamma_lut_size_property: size of the degamma LUT as supported by the
-
 
2055
 *	driver (read-only)
-
 
2056
 * @ctm_property: Matrix used to convert colors after the lookup in the
-
 
2057
 *	degamma LUT
-
 
2058
 * @gamma_lut_property: LUT used to convert the colors, after the CSC matrix, to
-
 
2059
 *	the gamma space of the connected screen (read-only)
-
 
2060
 * @gamma_lut_size_property: size of the gamma LUT as supported by the driver
2027
 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
2061
 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
2028
 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
2062
 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
2029
 * @async_page_flip: does this device support async flips on the primary plane?
2063
 * @async_page_flip: does this device support async flips on the primary plane?
2030
 * @cursor_width: hint to userspace for max cursor width
2064
 * @cursor_width: hint to userspace for max cursor width
2031
 * @cursor_height: hint to userspace for max cursor height
2065
 * @cursor_height: hint to userspace for max cursor height
Line 2124... Line 2158...
2124
	/* Optional properties */
2158
	/* Optional properties */
2125
	struct drm_property *scaling_mode_property;
2159
	struct drm_property *scaling_mode_property;
2126
	struct drm_property *aspect_ratio_property;
2160
	struct drm_property *aspect_ratio_property;
2127
	struct drm_property *dirty_info_property;
2161
	struct drm_property *dirty_info_property;
Line -... Line 2162...
-
 
2162
 
-
 
2163
	/* Optional color correction properties */
-
 
2164
	struct drm_property *degamma_lut_property;
-
 
2165
	struct drm_property *degamma_lut_size_property;
-
 
2166
	struct drm_property *ctm_property;
-
 
2167
	struct drm_property *gamma_lut_property;
-
 
2168
	struct drm_property *gamma_lut_size_property;
2128
 
2169
 
2129
	/* properties for virtual machine layout */
2170
	/* properties for virtual machine layout */
2130
	struct drm_property *suggested_x_property;
2171
	struct drm_property *suggested_x_property;
Line 2131... Line 2172...
2131
	struct drm_property *suggested_y_property;
2172
	struct drm_property *suggested_y_property;
Line 2153... Line 2194...
2153
 */
2194
 */
2154
#define drm_for_each_plane_mask(plane, dev, plane_mask) \
2195
#define drm_for_each_plane_mask(plane, dev, plane_mask) \
2155
	list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
2196
	list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
2156
		for_each_if ((plane_mask) & (1 << drm_plane_index(plane)))
2197
		for_each_if ((plane_mask) & (1 << drm_plane_index(plane)))
Line -... Line 2198...
-
 
2198
 
-
 
2199
/**
-
 
2200
 * drm_for_each_encoder_mask - iterate over encoders specified by bitmask
-
 
2201
 * @encoder: the loop cursor
-
 
2202
 * @dev: the DRM device
-
 
2203
 * @encoder_mask: bitmask of encoder indices
-
 
2204
 *
-
 
2205
 * Iterate over all encoders specified by bitmask.
-
 
2206
 */
-
 
2207
#define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \
-
 
2208
	list_for_each_entry((encoder), &(dev)->mode_config.encoder_list, head) \
Line 2157... Line 2209...
2157
 
2209
		for_each_if ((encoder_mask) & (1 << drm_encoder_index(encoder)))
2158
 
2210
 
2159
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
2211
#define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
2160
#define obj_to_connector(x) container_of(x, struct drm_connector, base)
2212
#define obj_to_connector(x) container_of(x, struct drm_connector, base)
Line 2229... Line 2281...
2229
extern __printf(5, 6)
2281
extern __printf(5, 6)
2230
int drm_encoder_init(struct drm_device *dev,
2282
int drm_encoder_init(struct drm_device *dev,
2231
			    struct drm_encoder *encoder,
2283
		     struct drm_encoder *encoder,
2232
			    const struct drm_encoder_funcs *funcs,
2284
		     const struct drm_encoder_funcs *funcs,
2233
		     int encoder_type, const char *name, ...);
2285
		     int encoder_type, const char *name, ...);
-
 
2286
extern unsigned int drm_encoder_index(struct drm_encoder *encoder);
Line 2234... Line 2287...
2234
 
2287
 
2235
/**
2288
/**
2236
 * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
2289
 * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
2237
 * @encoder: encoder to test
2290
 * @encoder: encoder to test
Line 2286... Line 2339...
2286
extern void drm_property_destroy_user_blobs(struct drm_device *dev,
2339
extern void drm_property_destroy_user_blobs(struct drm_device *dev,
2287
                                            struct drm_file *file_priv);
2340
                                            struct drm_file *file_priv);
2288
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
2341
extern bool drm_probe_ddc(struct i2c_adapter *adapter);
2289
extern struct edid *drm_get_edid(struct drm_connector *connector,
2342
extern struct edid *drm_get_edid(struct drm_connector *connector,
2290
				 struct i2c_adapter *adapter);
2343
				 struct i2c_adapter *adapter);
-
 
2344
extern struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
-
 
2345
					    struct i2c_adapter *adapter);
2291
extern struct edid *drm_edid_duplicate(const struct edid *edid);
2346
extern struct edid *drm_edid_duplicate(const struct edid *edid);
2292
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
2347
extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
2293
extern void drm_mode_config_init(struct drm_device *dev);
2348
extern void drm_mode_config_init(struct drm_device *dev);
2294
extern void drm_mode_config_reset(struct drm_device *dev);
2349
extern void drm_mode_config_reset(struct drm_device *dev);
2295
extern void drm_mode_config_cleanup(struct drm_device *dev);
2350
extern void drm_mode_config_cleanup(struct drm_device *dev);
Line 2486... Line 2541...
2486
				 int *bpp);
2541
				 int *bpp);
2487
extern int drm_format_num_planes(uint32_t format);
2542
extern int drm_format_num_planes(uint32_t format);
2488
extern int drm_format_plane_cpp(uint32_t format, int plane);
2543
extern int drm_format_plane_cpp(uint32_t format, int plane);
2489
extern int drm_format_horz_chroma_subsampling(uint32_t format);
2544
extern int drm_format_horz_chroma_subsampling(uint32_t format);
2490
extern int drm_format_vert_chroma_subsampling(uint32_t format);
2545
extern int drm_format_vert_chroma_subsampling(uint32_t format);
-
 
2546
extern int drm_format_plane_width(int width, uint32_t format, int plane);
-
 
2547
extern int drm_format_plane_height(int height, uint32_t format, int plane);
2491
extern const char *drm_get_format_name(uint32_t format);
2548
extern const char *drm_get_format_name(uint32_t format);
2492
extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
2549
extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
2493
							      unsigned int supported_rotations);
2550
							      unsigned int supported_rotations);
2494
extern unsigned int drm_rotation_simplify(unsigned int rotation,
2551
extern unsigned int drm_rotation_simplify(unsigned int rotation,
2495
					  unsigned int supported_rotations);
2552
					  unsigned int supported_rotations);
Line 2534... Line 2591...
2534
	struct drm_mode_object *mo;
2591
	struct drm_mode_object *mo;
2535
	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
2592
	mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
2536
	return mo ? obj_to_property(mo) : NULL;
2593
	return mo ? obj_to_property(mo) : NULL;
2537
}
2594
}
Line -... Line 2595...
-
 
2595
 
-
 
2596
/*
-
 
2597
 * Extract a degamma/gamma LUT value provided by user and round it to the
-
 
2598
 * precision supported by the hardware.
-
 
2599
 */
-
 
2600
static inline uint32_t drm_color_lut_extract(uint32_t user_input,
-
 
2601
					     uint32_t bit_precision)
-
 
2602
{
-
 
2603
	uint32_t val = user_input + (1 << (16 - bit_precision - 1));
-
 
2604
	uint32_t max = 0xffff >> (16 - bit_precision);
-
 
2605
 
-
 
2606
	val >>= 16 - bit_precision;
-
 
2607
 
-
 
2608
	return clamp_val(val, 0, max);
-
 
2609
}
2538
 
2610
 
2539
/* Plane list iterator for legacy (overlay only) planes. */
2611
/* Plane list iterator for legacy (overlay only) planes. */
2540
#define drm_for_each_legacy_plane(plane, dev) \
2612
#define drm_for_each_legacy_plane(plane, dev) \
2541
	list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
2613
	list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \