Subversion Repositories Kolibri OS

Rev

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

Rev 6937 Rev 7144
Line 102... Line 102...
102
 */
102
 */
103
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
103
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
104
{
104
{
105
	struct drm_device *dev = fb_helper->dev;
105
	struct drm_device *dev = fb_helper->dev;
106
	struct drm_connector *connector;
106
	struct drm_connector *connector;
107
	int i;
107
	int i, ret;
Line 108... Line 108...
108
 
108
 
109
	if (!drm_fbdev_emulation)
109
	if (!drm_fbdev_emulation)
Line 110... Line 110...
110
		return 0;
110
		return 0;
111
 
111
 
112
	mutex_lock(&dev->mode_config.mutex);
112
	mutex_lock(&dev->mode_config.mutex);
Line 113... Line -...
113
	drm_for_each_connector(connector, dev) {
-
 
114
		struct drm_fb_helper_connector *fb_helper_connector;
113
	drm_for_each_connector(connector, dev) {
115
 
114
		ret = drm_fb_helper_add_one_connector(fb_helper, connector);
116
		fb_helper_connector = kzalloc(sizeof(struct drm_fb_helper_connector), GFP_KERNEL);
-
 
117
		if (!fb_helper_connector)
-
 
118
			goto fail;
-
 
119
 
115
 
120
		fb_helper_connector->connector = connector;
116
		if (ret)
121
		fb_helper->connector_info[fb_helper->connector_count++] = fb_helper_connector;
117
			goto fail;
122
	}
118
	}
123
	mutex_unlock(&dev->mode_config.mutex);
119
	mutex_unlock(&dev->mode_config.mutex);
Line 128... Line 124...
128
		fb_helper->connector_info[i] = NULL;
124
		fb_helper->connector_info[i] = NULL;
129
	}
125
	}
130
	fb_helper->connector_count = 0;
126
	fb_helper->connector_count = 0;
131
	mutex_unlock(&dev->mode_config.mutex);
127
	mutex_unlock(&dev->mode_config.mutex);
Line 132... Line 128...
132
 
128
 
133
	return -ENOMEM;
129
	return ret;
134
}
130
}
Line 135... Line 131...
135
EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors);
131
EXPORT_SYMBOL(drm_fb_helper_single_add_all_connectors);
136
 
132
 
Line 1674... Line 1670...
1674
	DRM_DEBUG_KMS("\n");
1670
	DRM_DEBUG_KMS("\n");
Line 1675... Line 1671...
1675
 
1671
 
1676
	width = dev->mode_config.max_width;
1672
	width = dev->mode_config.max_width;
Line 1677... Line 1673...
1677
	height = dev->mode_config.max_height;
1673
	height = dev->mode_config.max_height;
1678
 
1674
 
1679
	crtcs = kcalloc(dev->mode_config.num_connector,
1675
	crtcs = kcalloc(fb_helper->connector_count,
1680
			sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
1676
			sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
1681
	modes = kcalloc(dev->mode_config.num_connector,
1677
	modes = kcalloc(fb_helper->connector_count,
1682
			sizeof(struct drm_display_mode *), GFP_KERNEL);
1678
			sizeof(struct drm_display_mode *), GFP_KERNEL);
1683
	offsets = kcalloc(dev->mode_config.num_connector,
1679
	offsets = kcalloc(fb_helper->connector_count,
1684
			  sizeof(struct drm_fb_offset), GFP_KERNEL);
1680
			  sizeof(struct drm_fb_offset), GFP_KERNEL);
1685
	enabled = kcalloc(dev->mode_config.num_connector,
1681
	enabled = kcalloc(fb_helper->connector_count,
1686
			  sizeof(bool), GFP_KERNEL);
1682
			  sizeof(bool), GFP_KERNEL);
1687
	if (!crtcs || !modes || !enabled || !offsets) {
1683
	if (!crtcs || !modes || !enabled || !offsets) {
1688
		DRM_ERROR("Memory allocation failed\n");
1684
		DRM_ERROR("Memory allocation failed\n");
Line 1694... Line 1690...
1694
 
1690
 
1695
	if (!(fb_helper->funcs->initial_config &&
1691
	if (!(fb_helper->funcs->initial_config &&
1696
	      fb_helper->funcs->initial_config(fb_helper, crtcs, modes,
1692
	      fb_helper->funcs->initial_config(fb_helper, crtcs, modes,
1697
					       offsets,
1693
					       offsets,
1698
					       enabled, width, height))) {
1694
					       enabled, width, height))) {
1699
		memset(modes, 0, dev->mode_config.num_connector*sizeof(modes[0]));
1695
		memset(modes, 0, fb_helper->connector_count*sizeof(modes[0]));
1700
		memset(crtcs, 0, dev->mode_config.num_connector*sizeof(crtcs[0]));
1696
		memset(crtcs, 0, fb_helper->connector_count*sizeof(crtcs[0]));
Line 1701... Line 1697...
1701
		memset(offsets, 0, dev->mode_config.num_connector*sizeof(offsets[0]));
1697
		memset(offsets, 0, fb_helper->connector_count*sizeof(offsets[0]));
1702
 
1698
 
1703
		if (!drm_target_cloned(fb_helper, modes, offsets,
1699
		if (!drm_target_cloned(fb_helper, modes, offsets,
1704
				       enabled, width, height) &&
1700
				       enabled, width, height) &&
Line 1776... Line 1772...
1776
 * the driver allocate and initialize the fbdev info structure and the drm
1772
 * the driver allocate and initialize the fbdev info structure and the drm
1777
 * framebuffer used to back the fbdev. drm_fb_helper_fill_var() and
1773
 * framebuffer used to back the fbdev. drm_fb_helper_fill_var() and
1778
 * drm_fb_helper_fill_fix() are provided as helpers to setup simple default
1774
 * drm_fb_helper_fill_fix() are provided as helpers to setup simple default
1779
 * values for the fbdev info structure.
1775
 * values for the fbdev info structure.
1780
 *
1776
 *
-
 
1777
 * HANG DEBUGGING:
-
 
1778
 *
-
 
1779
 * When you have fbcon support built-in or already loaded, this function will do
-
 
1780
 * a full modeset to setup the fbdev console. Due to locking misdesign in the
-
 
1781
 * VT/fbdev subsystem that entire modeset sequence has to be done while holding
-
 
1782
 * console_lock. Until console_unlock is called no dmesg lines will be sent out
-
 
1783
 * to consoles, not even serial console. This means when your driver crashes,
-
 
1784
 * you will see absolutely nothing else but a system stuck in this function,
-
 
1785
 * with no further output. Any kind of printk() you place within your own driver
-
 
1786
 * or in the drm core modeset code will also never show up.
-
 
1787
 *
-
 
1788
 * Standard debug practice is to run the fbcon setup without taking the
-
 
1789
 * console_lock as a hack, to be able to see backtraces and crashes on the
-
 
1790
 * serial line. This can be done by setting the fb.lockless_register_fb=1 kernel
-
 
1791
 * cmdline option.
-
 
1792
 *
-
 
1793
 * The other option is to just disable fbdev emulation since very likely the
-
 
1794
 * first modest from userspace will crash in the same way, and is even easier to
-
 
1795
 * debug. This can be done by setting the drm_kms_helper.fbdev_emulation=0
-
 
1796
 * kernel cmdline option.
-
 
1797
 *
1781
 * RETURNS:
1798
 * RETURNS:
1782
 * Zero if everything went ok, nonzero otherwise.
1799
 * Zero if everything went ok, nonzero otherwise.
1783
 */
1800
 */
1784
int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
1801
int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
1785
{
1802
{
Line 1830... Line 1847...
1830
int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1847
int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1831
{
1848
{
1832
	struct drm_device *dev = fb_helper->dev;
1849
	struct drm_device *dev = fb_helper->dev;
1833
	u32 max_width, max_height;
1850
	u32 max_width, max_height;
Line -... Line 1851...
-
 
1851
 
-
 
1852
ENTER();
1834
 
1853
 
1835
	if (!drm_fbdev_emulation)
1854
	if (!drm_fbdev_emulation)
Line 1836... Line 1855...
1836
		return 0;
1855
		return 0;
1837
 
1856
 
Line 1851... Line 1870...
1851
 
1870
 
1852
//   drm_modeset_lock_all(dev);
1871
//   drm_modeset_lock_all(dev);
1853
//   drm_setup_crtcs(fb_helper);
1872
//   drm_setup_crtcs(fb_helper);
1854
//   drm_modeset_unlock_all(dev);
1873
//   drm_modeset_unlock_all(dev);
-
 
1874
//   drm_fb_helper_set_par(fb_helper->fbdev);
1855
//   drm_fb_helper_set_par(fb_helper->fbdev);
1875
LEAVE();
1856
	return 0;
1876
	return 0;
1857
}
1877
}
Line 1858... Line 1878...
1858
EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
1878
EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
1859
 
1879
 
1860
/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT)
1880
/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT)
1861
 * but the module doesn't depend on any fb console symbols.  At least
1881
 * but the module doesn't depend on any fb console symbols.  At least
1862
 * attempt to load fbcon to avoid leaving the system without a usable console.
-
 
1863
 */
1882
 * attempt to load fbcon to avoid leaving the system without a usable console.
1864
#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
1883
 */
-
 
1884
int __init drm_fb_helper_modinit(void)
1865
static int __init drm_fb_helper_modinit(void)
1885
{
1866
{
1886
#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
Line 1867... Line 1887...
1867
	const char *name = "fbcon";
1887
	const char *name = "fbcon";
1868
	struct module *fbcon;
1888
	struct module *fbcon;
1869
 
1889
 
Line 1870... Line 1890...
1870
	mutex_lock(&module_mutex);
1890
	mutex_lock(&module_mutex);
1871
	fbcon = find_module(name);
1891
	fbcon = find_module(name);
-
 
1892
	mutex_unlock(&module_mutex);
1872
	mutex_unlock(&module_mutex);
1893
 
1873
 
1894
	if (!fbcon)
1874
	if (!fbcon)
-
 
1875
		request_module_nowait(name);
1895
		request_module_nowait(name);
1876
	return 0;
-