diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-02 22:40:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-02 22:40:34 -0400 |
commit | 20a2078ce7705a6e0722ef5184336eb8657a58d8 (patch) | |
tree | 5b927c96516380aa0ecd68d8a609f7cd72120ad5 /drivers/gpu/drm/omapdrm/omap_drv.c | |
parent | 0279b3c0ada1d78882f24acf94ac4595bd657a89 (diff) | |
parent | 307b9c022720f9de90d58e51743e01e9a42aec59 (diff) |
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie:
"This is the main drm pull request for 3.10.
Wierd bits:
- OMAP drm changes required OMAP dss changes, in drivers/video, so I
took them in here.
- one more fbcon fix for font handover
- VT switch avoidance in pm code
- scatterlist helpers for gpu drivers - have acks from akpm
Highlights:
- qxl kms driver - driver for the spice qxl virtual GPU
Nouveau:
- fermi/kepler VRAM compression
- GK110/nvf0 modesetting support.
Tegra:
- host1x core merged with 2D engine support
i915:
- vt switchless resume
- more valleyview support
- vblank fixes
- modesetting pipe config rework
radeon:
- UVD engine support
- SI chip tiling support
- GPU registers initialisation from golden values.
exynos:
- device tree changes
- fimc block support
Otherwise:
- bunches of fixes all over the place."
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (513 commits)
qxl: update to new idr interfaces.
drm/nouveau: fix build with nv50->nvc0
drm/radeon: fix handling of v6 power tables
drm/radeon: clarify family checks in pm table parsing
drm/radeon: consolidate UVD clock programming
drm/radeon: fix UPLL_REF_DIV_MASK definition
radeon: add bo tracking debugfs
drm/radeon: add new richland pci ids
drm/radeon: add some new SI PCI ids
drm/radeon: fix scratch reg handling for UVD fence
drm/radeon: allocate SA bo in the requested domain
drm/radeon: fix possible segfault when parsing pm tables
drm/radeon: fix endian bugs in atom_allocate_fb_scratch()
OMAPDSS: TFP410: return EPROBE_DEFER if the i2c adapter not found
OMAPDSS: VENC: Add error handling for venc_probe_pdata
OMAPDSS: HDMI: Add error handling for hdmi_probe_pdata
OMAPDSS: RFBI: Add error handling for rfbi_probe_pdata
OMAPDSS: DSI: Add error handling for dsi_probe_pdata
OMAPDSS: SDI: Add error handling for sdi_probe_pdata
OMAPDSS: DPI: Add error handling for dpi_probe_pdata
...
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_drv.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 165 |
1 files changed, 133 insertions, 32 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 079c54c6f94c..9c53c25e5201 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -74,54 +74,53 @@ static int get_connector_type(struct omap_dss_device *dssdev) | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | static bool channel_used(struct drm_device *dev, enum omap_channel channel) | ||
78 | { | ||
79 | struct omap_drm_private *priv = dev->dev_private; | ||
80 | int i; | ||
81 | |||
82 | for (i = 0; i < priv->num_crtcs; i++) { | ||
83 | struct drm_crtc *crtc = priv->crtcs[i]; | ||
84 | |||
85 | if (omap_crtc_channel(crtc) == channel) | ||
86 | return true; | ||
87 | } | ||
88 | |||
89 | return false; | ||
90 | } | ||
91 | |||
77 | static int omap_modeset_init(struct drm_device *dev) | 92 | static int omap_modeset_init(struct drm_device *dev) |
78 | { | 93 | { |
79 | struct omap_drm_private *priv = dev->dev_private; | 94 | struct omap_drm_private *priv = dev->dev_private; |
80 | struct omap_dss_device *dssdev = NULL; | 95 | struct omap_dss_device *dssdev = NULL; |
81 | int num_ovls = dss_feat_get_num_ovls(); | 96 | int num_ovls = dss_feat_get_num_ovls(); |
82 | int id; | 97 | int num_mgrs = dss_feat_get_num_mgrs(); |
98 | int num_crtcs; | ||
99 | int i, id = 0; | ||
83 | 100 | ||
84 | drm_mode_config_init(dev); | 101 | drm_mode_config_init(dev); |
85 | 102 | ||
86 | omap_drm_irq_install(dev); | 103 | omap_drm_irq_install(dev); |
87 | 104 | ||
88 | /* | 105 | /* |
89 | * Create private planes and CRTCs for the last NUM_CRTCs overlay | 106 | * We usually don't want to create a CRTC for each manager, at least |
90 | * plus manager: | 107 | * not until we have a way to expose private planes to userspace. |
108 | * Otherwise there would not be enough video pipes left for drm planes. | ||
109 | * We use the num_crtc argument to limit the number of crtcs we create. | ||
91 | */ | 110 | */ |
92 | for (id = 0; id < min(num_crtc, num_ovls); id++) { | 111 | num_crtcs = min3(num_crtc, num_mgrs, num_ovls); |
93 | struct drm_plane *plane; | ||
94 | struct drm_crtc *crtc; | ||
95 | |||
96 | plane = omap_plane_init(dev, id, true); | ||
97 | crtc = omap_crtc_init(dev, plane, pipe2chan(id), id); | ||
98 | 112 | ||
99 | BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs)); | 113 | dssdev = NULL; |
100 | priv->crtcs[id] = crtc; | ||
101 | priv->num_crtcs++; | ||
102 | |||
103 | priv->planes[id] = plane; | ||
104 | priv->num_planes++; | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Create normal planes for the remaining overlays: | ||
109 | */ | ||
110 | for (; id < num_ovls; id++) { | ||
111 | struct drm_plane *plane = omap_plane_init(dev, id, false); | ||
112 | |||
113 | BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)); | ||
114 | priv->planes[priv->num_planes++] = plane; | ||
115 | } | ||
116 | 114 | ||
117 | for_each_dss_dev(dssdev) { | 115 | for_each_dss_dev(dssdev) { |
118 | struct drm_connector *connector; | 116 | struct drm_connector *connector; |
119 | struct drm_encoder *encoder; | 117 | struct drm_encoder *encoder; |
118 | enum omap_channel channel; | ||
120 | 119 | ||
121 | if (!dssdev->driver) { | 120 | if (!dssdev->driver) { |
122 | dev_warn(dev->dev, "%s has no driver.. skipping it\n", | 121 | dev_warn(dev->dev, "%s has no driver.. skipping it\n", |
123 | dssdev->name); | 122 | dssdev->name); |
124 | return 0; | 123 | continue; |
125 | } | 124 | } |
126 | 125 | ||
127 | if (!(dssdev->driver->get_timings || | 126 | if (!(dssdev->driver->get_timings || |
@@ -129,7 +128,7 @@ static int omap_modeset_init(struct drm_device *dev) | |||
129 | dev_warn(dev->dev, "%s driver does not support " | 128 | dev_warn(dev->dev, "%s driver does not support " |
130 | "get_timings or read_edid.. skipping it!\n", | 129 | "get_timings or read_edid.. skipping it!\n", |
131 | dssdev->name); | 130 | dssdev->name); |
132 | return 0; | 131 | continue; |
133 | } | 132 | } |
134 | 133 | ||
135 | encoder = omap_encoder_init(dev, dssdev); | 134 | encoder = omap_encoder_init(dev, dssdev); |
@@ -157,16 +156,118 @@ static int omap_modeset_init(struct drm_device *dev) | |||
157 | 156 | ||
158 | drm_mode_connector_attach_encoder(connector, encoder); | 157 | drm_mode_connector_attach_encoder(connector, encoder); |
159 | 158 | ||
159 | /* | ||
160 | * if we have reached the limit of the crtcs we are allowed to | ||
161 | * create, let's not try to look for a crtc for this | ||
162 | * panel/encoder and onwards, we will, of course, populate the | ||
163 | * the possible_crtcs field for all the encoders with the final | ||
164 | * set of crtcs we create | ||
165 | */ | ||
166 | if (id == num_crtcs) | ||
167 | continue; | ||
168 | |||
169 | /* | ||
170 | * get the recommended DISPC channel for this encoder. For now, | ||
171 | * we only try to get create a crtc out of the recommended, the | ||
172 | * other possible channels to which the encoder can connect are | ||
173 | * not considered. | ||
174 | */ | ||
175 | channel = dssdev->output->dispc_channel; | ||
176 | |||
177 | /* | ||
178 | * if this channel hasn't already been taken by a previously | ||
179 | * allocated crtc, we create a new crtc for it | ||
180 | */ | ||
181 | if (!channel_used(dev, channel)) { | ||
182 | struct drm_plane *plane; | ||
183 | struct drm_crtc *crtc; | ||
184 | |||
185 | plane = omap_plane_init(dev, id, true); | ||
186 | crtc = omap_crtc_init(dev, plane, channel, id); | ||
187 | |||
188 | BUG_ON(priv->num_crtcs >= ARRAY_SIZE(priv->crtcs)); | ||
189 | priv->crtcs[id] = crtc; | ||
190 | priv->num_crtcs++; | ||
191 | |||
192 | priv->planes[id] = plane; | ||
193 | priv->num_planes++; | ||
194 | |||
195 | id++; | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * we have allocated crtcs according to the need of the panels/encoders, | ||
201 | * adding more crtcs here if needed | ||
202 | */ | ||
203 | for (; id < num_crtcs; id++) { | ||
204 | |||
205 | /* find a free manager for this crtc */ | ||
206 | for (i = 0; i < num_mgrs; i++) { | ||
207 | if (!channel_used(dev, i)) { | ||
208 | struct drm_plane *plane; | ||
209 | struct drm_crtc *crtc; | ||
210 | |||
211 | plane = omap_plane_init(dev, id, true); | ||
212 | crtc = omap_crtc_init(dev, plane, i, id); | ||
213 | |||
214 | BUG_ON(priv->num_crtcs >= | ||
215 | ARRAY_SIZE(priv->crtcs)); | ||
216 | |||
217 | priv->crtcs[id] = crtc; | ||
218 | priv->num_crtcs++; | ||
219 | |||
220 | priv->planes[id] = plane; | ||
221 | priv->num_planes++; | ||
222 | |||
223 | break; | ||
224 | } else { | ||
225 | continue; | ||
226 | } | ||
227 | } | ||
228 | |||
229 | if (i == num_mgrs) { | ||
230 | /* this shouldn't really happen */ | ||
231 | dev_err(dev->dev, "no managers left for crtc\n"); | ||
232 | return -ENOMEM; | ||
233 | } | ||
234 | } | ||
235 | |||
236 | /* | ||
237 | * Create normal planes for the remaining overlays: | ||
238 | */ | ||
239 | for (; id < num_ovls; id++) { | ||
240 | struct drm_plane *plane = omap_plane_init(dev, id, false); | ||
241 | |||
242 | BUG_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)); | ||
243 | priv->planes[priv->num_planes++] = plane; | ||
244 | } | ||
245 | |||
246 | for (i = 0; i < priv->num_encoders; i++) { | ||
247 | struct drm_encoder *encoder = priv->encoders[i]; | ||
248 | struct omap_dss_device *dssdev = | ||
249 | omap_encoder_get_dssdev(encoder); | ||
250 | |||
160 | /* figure out which crtc's we can connect the encoder to: */ | 251 | /* figure out which crtc's we can connect the encoder to: */ |
161 | encoder->possible_crtcs = 0; | 252 | encoder->possible_crtcs = 0; |
162 | for (id = 0; id < priv->num_crtcs; id++) { | 253 | for (id = 0; id < priv->num_crtcs; id++) { |
163 | enum omap_dss_output_id supported_outputs = | 254 | struct drm_crtc *crtc = priv->crtcs[id]; |
164 | dss_feat_get_supported_outputs(pipe2chan(id)); | 255 | enum omap_channel crtc_channel; |
256 | enum omap_dss_output_id supported_outputs; | ||
257 | |||
258 | crtc_channel = omap_crtc_channel(crtc); | ||
259 | supported_outputs = | ||
260 | dss_feat_get_supported_outputs(crtc_channel); | ||
261 | |||
165 | if (supported_outputs & dssdev->output->id) | 262 | if (supported_outputs & dssdev->output->id) |
166 | encoder->possible_crtcs |= (1 << id); | 263 | encoder->possible_crtcs |= (1 << id); |
167 | } | 264 | } |
168 | } | 265 | } |
169 | 266 | ||
267 | DBG("registered %d planes, %d crtcs, %d encoders and %d connectors\n", | ||
268 | priv->num_planes, priv->num_crtcs, priv->num_encoders, | ||
269 | priv->num_connectors); | ||
270 | |||
170 | dev->mode_config.min_width = 32; | 271 | dev->mode_config.min_width = 32; |
171 | dev->mode_config.min_height = 32; | 272 | dev->mode_config.min_height = 32; |
172 | 273 | ||
@@ -303,7 +404,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data, | |||
303 | return ret; | 404 | return ret; |
304 | } | 405 | } |
305 | 406 | ||
306 | struct drm_ioctl_desc ioctls[DRM_COMMAND_END - DRM_COMMAND_BASE] = { | 407 | static struct drm_ioctl_desc ioctls[DRM_COMMAND_END - DRM_COMMAND_BASE] = { |
307 | DRM_IOCTL_DEF_DRV(OMAP_GET_PARAM, ioctl_get_param, DRM_UNLOCKED|DRM_AUTH), | 408 | DRM_IOCTL_DEF_DRV(OMAP_GET_PARAM, ioctl_get_param, DRM_UNLOCKED|DRM_AUTH), |
308 | DRM_IOCTL_DEF_DRV(OMAP_SET_PARAM, ioctl_set_param, DRM_UNLOCKED|DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 409 | DRM_IOCTL_DEF_DRV(OMAP_SET_PARAM, ioctl_set_param, DRM_UNLOCKED|DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
309 | DRM_IOCTL_DEF_DRV(OMAP_GEM_NEW, ioctl_gem_new, DRM_UNLOCKED|DRM_AUTH), | 410 | DRM_IOCTL_DEF_DRV(OMAP_GEM_NEW, ioctl_gem_new, DRM_UNLOCKED|DRM_AUTH), |
@@ -567,7 +668,7 @@ static const struct dev_pm_ops omapdrm_pm_ops = { | |||
567 | }; | 668 | }; |
568 | #endif | 669 | #endif |
569 | 670 | ||
570 | struct platform_driver pdev = { | 671 | static struct platform_driver pdev = { |
571 | .driver = { | 672 | .driver = { |
572 | .name = DRIVER_NAME, | 673 | .name = DRIVER_NAME, |
573 | .owner = THIS_MODULE, | 674 | .owner = THIS_MODULE, |