Commit e43f2c33 authored by Tomi Valkeinen's avatar Tomi Valkeinen

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: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 5cd57a46
...@@ -267,13 +267,15 @@ static int omap_connect_dssdevs(void) ...@@ -267,13 +267,15 @@ static int omap_connect_dssdevs(void)
} }
static int omap_modeset_create_crtc(struct drm_device *dev, int id, static int omap_modeset_create_crtc(struct drm_device *dev, int id,
enum omap_channel channel) enum omap_channel channel,
u32 possible_crtcs)
{ {
struct omap_drm_private *priv = dev->dev_private; struct omap_drm_private *priv = dev->dev_private;
struct drm_plane *plane; struct drm_plane *plane;
struct drm_crtc *crtc; struct drm_crtc *crtc;
plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_PRIMARY); plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_PRIMARY,
possible_crtcs);
if (IS_ERR(plane)) if (IS_ERR(plane))
return PTR_ERR(plane); return PTR_ERR(plane);
...@@ -309,6 +311,7 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -309,6 +311,7 @@ static int omap_modeset_init(struct drm_device *dev)
int num_crtcs; int num_crtcs;
int i, id = 0; int i, id = 0;
int ret; int ret;
u32 possible_crtcs;
drm_mode_config_init(dev); drm_mode_config_init(dev);
...@@ -325,6 +328,7 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -325,6 +328,7 @@ static int omap_modeset_init(struct drm_device *dev)
* We use the num_crtc argument to limit the number of crtcs we create. * We use the num_crtc argument to limit the number of crtcs we create.
*/ */
num_crtcs = min3(num_crtc, num_mgrs, num_ovls); num_crtcs = min3(num_crtc, num_mgrs, num_ovls);
possible_crtcs = (1 << num_crtcs) - 1;
dssdev = NULL; dssdev = NULL;
...@@ -388,7 +392,8 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -388,7 +392,8 @@ static int omap_modeset_init(struct drm_device *dev)
* allocated crtc, we create a new crtc for it * allocated crtc, we create a new crtc for it
*/ */
if (!channel_used(dev, channel)) { if (!channel_used(dev, channel)) {
ret = omap_modeset_create_crtc(dev, id, channel); ret = omap_modeset_create_crtc(dev, id, channel,
possible_crtcs);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev, dev_err(dev->dev,
"could not create CRTC (channel %u)\n", "could not create CRTC (channel %u)\n",
...@@ -418,7 +423,8 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -418,7 +423,8 @@ static int omap_modeset_init(struct drm_device *dev)
return -ENOMEM; return -ENOMEM;
} }
ret = omap_modeset_create_crtc(dev, id, i); ret = omap_modeset_create_crtc(dev, id, i,
possible_crtcs);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev, dev_err(dev->dev,
"could not create CRTC (channel %u)\n", i); "could not create CRTC (channel %u)\n", i);
...@@ -432,7 +438,8 @@ static int omap_modeset_init(struct drm_device *dev) ...@@ -432,7 +438,8 @@ static int omap_modeset_init(struct drm_device *dev)
for (; id < num_ovls; id++) { for (; id < num_ovls; id++) {
struct drm_plane *plane; struct drm_plane *plane;
plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_OVERLAY); plane = omap_plane_init(dev, id, DRM_PLANE_TYPE_OVERLAY,
possible_crtcs);
if (IS_ERR(plane)) if (IS_ERR(plane))
return PTR_ERR(plane); return PTR_ERR(plane);
......
...@@ -157,7 +157,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, ...@@ -157,7 +157,8 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
int omap_crtc_wait_pending(struct drm_crtc *crtc); int omap_crtc_wait_pending(struct drm_crtc *crtc);
struct drm_plane *omap_plane_init(struct drm_device *dev, struct drm_plane *omap_plane_init(struct drm_device *dev,
int id, enum drm_plane_type type); int id, enum drm_plane_type type,
u32 possible_crtcs);
void omap_plane_install_properties(struct drm_plane *plane, void omap_plane_install_properties(struct drm_plane *plane,
struct drm_mode_object *obj); struct drm_mode_object *obj);
......
...@@ -356,9 +356,9 @@ static const uint32_t error_irqs[] = { ...@@ -356,9 +356,9 @@ static const uint32_t error_irqs[] = {
/* initialize plane */ /* initialize plane */
struct drm_plane *omap_plane_init(struct drm_device *dev, struct drm_plane *omap_plane_init(struct drm_device *dev,
int id, enum drm_plane_type type) int id, enum drm_plane_type type,
u32 possible_crtcs)
{ {
struct omap_drm_private *priv = dev->dev_private;
struct drm_plane *plane; struct drm_plane *plane;
struct omap_plane *omap_plane; struct omap_plane *omap_plane;
int ret; int ret;
...@@ -381,7 +381,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev, ...@@ -381,7 +381,7 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
omap_plane->error_irq.irq = omap_plane_error_irq; omap_plane->error_irq.irq = omap_plane_error_irq;
omap_irq_register(dev, &omap_plane->error_irq); omap_irq_register(dev, &omap_plane->error_irq);
ret = drm_universal_plane_init(dev, plane, (1 << priv->num_crtcs) - 1, ret = drm_universal_plane_init(dev, plane, possible_crtcs,
&omap_plane_funcs, omap_plane->formats, &omap_plane_funcs, omap_plane->formats,
omap_plane->nformats, type, NULL); omap_plane->nformats, type, NULL);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment