aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-12-02 09:07:11 -0500
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-12-08 06:42:57 -0500
commite43f2c3395fd36ec9f8d069af07bcd3eae5fde17 (patch)
treea7d194d0ad26eb310c9ec1566c69455f37b41a33 /drivers/gpu
parent5cd57a46e3e3dc088b50bbfcdc85d9e0d9c22159 (diff)
drm/omap: fix primary-plane's possible_crtcs
We set the possible_crtc for all planes to "(1 << priv->num_crtcs) - 1", which is fine as the HW planes can be used fro all crtcs. However, when we're doing that, we are still incrementing 'num_crtcs', and we'll end up with bad possible_crtcs, preventing the use of the primary planes. This patch passes a possible_crtcs mask to plane init function so that we get correct possible_crtc. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.c17
-rw-r--r--drivers/gpu/drm/omapdrm/omap_drv.h3
-rw-r--r--drivers/gpu/drm/omapdrm/omap_plane.c6
3 files changed, 17 insertions, 9 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 39c5312b466c..fdc83cbcde61 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -267,13 +267,15 @@ cleanup:
267} 267}
268 268
269static int omap_modeset_create_crtc(struct drm_device *dev, int id, 269static int omap_modeset_create_crtc(struct drm_device *dev, int id,
270 enum omap_channel channel) 270 enum omap_channel channel,
271 u32 possible_crtcs)
271{ 272{
272 struct omap_drm_private *priv = dev->dev_private; 273 struct omap_drm_private *priv = dev->dev_private;
273 struct drm_plane *plane; 274 struct drm_plane *plane;
274 struct drm_crtc *crtc; 275 struct drm_crtc *crtc;
275 276
276 plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_PRIMARY); 277 plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_PRIMARY,
278 possible_crtcs);
277 if (IS_ERR(plane)) 279 if (IS_ERR(plane))
278 return PTR_ERR(plane); 280 return PTR_ERR(plane);
279 281
@@ -309,6 +311,7 @@ static int omap_modeset_init(struct drm_device *dev)
309 int num_crtcs; 311 int num_crtcs;
310 int i, id = 0; 312 int i, id = 0;
311 int ret; 313 int ret;
314 u32 possible_crtcs;
312 315
313 drm_mode_config_init(dev); 316 drm_mode_config_init(dev);
314 317
@@ -325,6 +328,7 @@ static int omap_modeset_init(struct drm_device *dev)
325 * We use the num_crtc argument to limit the number of crtcs we create. 328 * We use the num_crtc argument to limit the number of crtcs we create.
326 */ 329 */
327 num_crtcs = min3(num_crtc, num_mgrs, num_ovls); 330 num_crtcs = min3(num_crtc, num_mgrs, num_ovls);
331 possible_crtcs = (1 << num_crtcs) - 1;
328 332
329 dssdev = NULL; 333 dssdev = NULL;
330 334
@@ -388,7 +392,8 @@ static int omap_modeset_init(struct drm_device *dev)
388 * allocated crtc, we create a new crtc for it 392 * allocated crtc, we create a new crtc for it
389 */ 393 */
390 if (!channel_used(dev, channel)) { 394 if (!channel_used(dev, channel)) {
391 ret = omap_modeset_create_crtc(dev, id, channel); 395 ret = omap_modeset_create_crtc(dev, id, channel,
396 possible_crtcs);
392 if (ret < 0) { 397 if (ret < 0) {
393 dev_err(dev->dev, 398 dev_err(dev->dev,
394 "could not create CRTC (channel %u)\n", 399 "could not create CRTC (channel %u)\n",
@@ -418,7 +423,8 @@ static int omap_modeset_init(struct drm_device *dev)
418 return -ENOMEM; 423 return -ENOMEM;
419 } 424 }
420 425
421 ret = omap_modeset_create_crtc(dev, id, i); 426 ret = omap_modeset_create_crtc(dev, id, i,
427 possible_crtcs);
422 if (ret < 0) { 428 if (ret < 0) {
423 dev_err(dev->dev, 429 dev_err(dev->dev,
424 "could not create CRTC (channel %u)\n", i); 430 "could not create CRTC (channel %u)\n", i);
@@ -432,7 +438,8 @@ static int omap_modeset_init(struct drm_device *dev)
432 for (; id < num_ovls; id++) { 438 for (; id < num_ovls; id++) {
433 struct drm_plane *plane; 439 struct drm_plane *plane;
434 440
435 plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_OVERLAY); 441 plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_OVERLAY,
442 possible_crtcs);
436 if (IS_ERR(plane)) 443 if (IS_ERR(plane))
437 return PTR_ERR(plane); 444 return PTR_ERR(plane);
438 445
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 4c51135eb9a6..7d9dd5400cef 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -157,7 +157,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
157int omap_crtc_wait_pending(struct drm_crtc *crtc); 157int omap_crtc_wait_pending(struct drm_crtc *crtc);
158 158
159struct drm_plane *omap_plane_init(struct drm_device *dev, 159struct drm_plane *omap_plane_init(struct drm_device *dev,
160 int id, enum drm_plane_type type); 160 int id, enum drm_plane_type type,
161 u32 possible_crtcs);
161void omap_plane_install_properties(struct drm_plane *plane, 162void omap_plane_install_properties(struct drm_plane *plane,
162 struct drm_mode_object *obj); 163 struct drm_mode_object *obj);
163 164
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 9c43cb481e62..82b2c23d6769 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -356,9 +356,9 @@ static const uint32_t error_irqs[] = {
356 356
357/* initialize plane */ 357/* initialize plane */
358struct drm_plane *omap_plane_init(struct drm_device *dev, 358struct drm_plane *omap_plane_init(struct drm_device *dev,
359 int id, enum drm_plane_type type) 359 int id, enum drm_plane_type type,
360 u32 possible_crtcs)
360{ 361{
361 struct omap_drm_private *priv = dev->dev_private;
362 struct drm_plane *plane; 362 struct drm_plane *plane;
363 struct omap_plane *omap_plane; 363 struct omap_plane *omap_plane;
364 int ret; 364 int ret;
@@ -381,7 +381,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
381 omap_plane->error_irq.irq = omap_plane_error_irq; 381 omap_plane->error_irq.irq = omap_plane_error_irq;
382 omap_irq_register(dev, &omap_plane->error_irq); 382 omap_irq_register(dev, &omap_plane->error_irq);
383 383
384 ret = drm_universal_plane_init(dev, plane, (1 << priv->num_crtcs) - 1, 384 ret = drm_universal_plane_init(dev, plane, possible_crtcs,
385 &omap_plane_funcs, omap_plane->formats, 385 &omap_plane_funcs, omap_plane->formats,
386 omap_plane->nformats, type, NULL); 386 omap_plane->nformats, type, NULL);
387 if (ret < 0) 387 if (ret < 0)