From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
Or should we just outright fail the object initializatio perhaps?
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com --- drivers/gpu/drm/drm_connector.c | 3 +++ drivers/gpu/drm/drm_crtc.c | 3 +++ drivers/gpu/drm/drm_encoder.c | 3 +++ drivers/gpu/drm/drm_plane.c | 3 +++ 4 files changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..9278a81c5d54 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -211,6 +211,9 @@ int drm_connector_init(struct drm_device *dev, connector->index = ret; ret = 0;
+ /* we have 32bit connector bitmasks */ + WARN_ON(connector->index >= 32); + connector->connector_type = connector_type; connector->connector_type_id = ida_simple_get(connector_ida, 1, 0, GFP_KERNEL); diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..e27ffa3561af 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -318,6 +318,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, list_add_tail(&crtc->head, &config->crtc_list); crtc->index = config->num_crtc++;
+ /* we have 32bit crtc bitmasks */ + WARN_ON(crtc->index >= 32); + crtc->primary = primary; crtc->cursor = cursor; if (primary && !primary->possible_crtcs) diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..66d0cdd217fa 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -136,6 +136,9 @@ int drm_encoder_init(struct drm_device *dev, list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++;
+ /* we have 32bit encoder bitmasks */ + WARN_ON(encoder->index >= 32); + out_put: if (ret) drm_mode_object_unregister(dev, &encoder->base); diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..0a8d807603c1 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -242,6 +242,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, list_add_tail(&plane->head, &config->plane_list); plane->index = config->num_total_plane++;
+ /* we have 32bit plane bitmasks */ + WARN_ON(plane->index >= 32); + drm_object_attach_property(&plane->base, config->plane_type_property, plane->type);
On 2018-01-24 01:37 PM, Ville Syrjala wrote:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
Or should we just outright fail the object initializatio perhaps?
This would make sense in my opinion. index >= 32 looks like it would lead to completely undefined behavior when trying to attach objects to each other.
Harry
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 +++ drivers/gpu/drm/drm_crtc.c | 3 +++ drivers/gpu/drm/drm_encoder.c | 3 +++ drivers/gpu/drm/drm_plane.c | 3 +++ 4 files changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..9278a81c5d54 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -211,6 +211,9 @@ int drm_connector_init(struct drm_device *dev, connector->index = ret; ret = 0;
- /* we have 32bit connector bitmasks */
- WARN_ON(connector->index >= 32);
- connector->connector_type = connector_type; connector->connector_type_id = ida_simple_get(connector_ida, 1, 0, GFP_KERNEL);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..e27ffa3561af 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -318,6 +318,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, list_add_tail(&crtc->head, &config->crtc_list); crtc->index = config->num_crtc++;
- /* we have 32bit crtc bitmasks */
- WARN_ON(crtc->index >= 32);
- crtc->primary = primary; crtc->cursor = cursor; if (primary && !primary->possible_crtcs)
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..66d0cdd217fa 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -136,6 +136,9 @@ int drm_encoder_init(struct drm_device *dev, list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++;
- /* we have 32bit encoder bitmasks */
- WARN_ON(encoder->index >= 32);
out_put: if (ret) drm_mode_object_unregister(dev, &encoder->base); diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..0a8d807603c1 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -242,6 +242,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, list_add_tail(&plane->head, &config->plane_list); plane->index = config->num_total_plane++;
- /* we have 32bit plane bitmasks */
- WARN_ON(plane->index >= 32);
- drm_object_attach_property(&plane->base, config->plane_type_property, plane->type);
On Wed, Jan 24, 2018 at 04:01:18PM -0500, Harry Wentland wrote:
On 2018-01-24 01:37 PM, Ville Syrjala wrote:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
Or should we just outright fail the object initializatio perhaps?
This would make sense in my opinion. index >= 32 looks like it would lead to completely undefined behavior when trying to attach objects to each other.
I suppose. The counter argument is that this is basically the developer shooting themselves in the foot intentionally, so it's a bit hard to justify complicating the runtime error handling for this.
The connector case might be well justified though since the index there comes from ida, and with MST connectors can come and go as they please. So it might not be entirely impossible to overflow the bits there.
Harry
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 +++ drivers/gpu/drm/drm_crtc.c | 3 +++ drivers/gpu/drm/drm_encoder.c | 3 +++ drivers/gpu/drm/drm_plane.c | 3 +++ 4 files changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..9278a81c5d54 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -211,6 +211,9 @@ int drm_connector_init(struct drm_device *dev, connector->index = ret; ret = 0;
- /* we have 32bit connector bitmasks */
- WARN_ON(connector->index >= 32);
- connector->connector_type = connector_type; connector->connector_type_id = ida_simple_get(connector_ida, 1, 0, GFP_KERNEL);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..e27ffa3561af 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -318,6 +318,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, list_add_tail(&crtc->head, &config->crtc_list); crtc->index = config->num_crtc++;
- /* we have 32bit crtc bitmasks */
- WARN_ON(crtc->index >= 32);
- crtc->primary = primary; crtc->cursor = cursor; if (primary && !primary->possible_crtcs)
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..66d0cdd217fa 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -136,6 +136,9 @@ int drm_encoder_init(struct drm_device *dev, list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++;
- /* we have 32bit encoder bitmasks */
- WARN_ON(encoder->index >= 32);
out_put: if (ret) drm_mode_object_unregister(dev, &encoder->base); diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..0a8d807603c1 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -242,6 +242,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, list_add_tail(&plane->head, &config->plane_list); plane->index = config->num_total_plane++;
- /* we have 32bit plane bitmasks */
- WARN_ON(plane->index >= 32);
- drm_object_attach_property(&plane->base, config->plane_type_property, plane->type);
On 2018-01-24 04:24 PM, Ville Syrjälä wrote:
On Wed, Jan 24, 2018 at 04:01:18PM -0500, Harry Wentland wrote:
On 2018-01-24 01:37 PM, Ville Syrjala wrote:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
Or should we just outright fail the object initializatio perhaps?
This would make sense in my opinion. index >= 32 looks like it would lead to completely undefined behavior when trying to attach objects to each other.
I suppose. The counter argument is that this is basically the developer shooting themselves in the foot intentionally, so it's a bit hard to justify complicating the runtime error handling for this.
True, if this needs extensive runtime error handling a WARN_ON is probably better.
The connector case might be well justified though since the index there comes from ida, and with MST connectors can come and go as they please. So it might not be entirely impossible to overflow the bits there.
Right, I was trying to think of a real-life case where this might happen. MST is a good one (although still quite rare in the vast majority of cases).
Harry
Harry
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 +++ drivers/gpu/drm/drm_crtc.c | 3 +++ drivers/gpu/drm/drm_encoder.c | 3 +++ drivers/gpu/drm/drm_plane.c | 3 +++ 4 files changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..9278a81c5d54 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -211,6 +211,9 @@ int drm_connector_init(struct drm_device *dev, connector->index = ret; ret = 0;
- /* we have 32bit connector bitmasks */
- WARN_ON(connector->index >= 32);
- connector->connector_type = connector_type; connector->connector_type_id = ida_simple_get(connector_ida, 1, 0, GFP_KERNEL);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..e27ffa3561af 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -318,6 +318,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, list_add_tail(&crtc->head, &config->crtc_list); crtc->index = config->num_crtc++;
- /* we have 32bit crtc bitmasks */
- WARN_ON(crtc->index >= 32);
- crtc->primary = primary; crtc->cursor = cursor; if (primary && !primary->possible_crtcs)
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..66d0cdd217fa 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -136,6 +136,9 @@ int drm_encoder_init(struct drm_device *dev, list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++;
- /* we have 32bit encoder bitmasks */
- WARN_ON(encoder->index >= 32);
out_put: if (ret) drm_mode_object_unregister(dev, &encoder->base); diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..0a8d807603c1 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -242,6 +242,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, list_add_tail(&plane->head, &config->plane_list); plane->index = config->num_total_plane++;
- /* we have 32bit plane bitmasks */
- WARN_ON(plane->index >= 32);
- drm_object_attach_property(&plane->base, config->plane_type_property, plane->type);
On Wed, Jan 24, 2018 at 11:24:05PM +0200, Ville Syrjälä wrote:
On Wed, Jan 24, 2018 at 04:01:18PM -0500, Harry Wentland wrote:
On 2018-01-24 01:37 PM, Ville Syrjala wrote:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
Or should we just outright fail the object initializatio perhaps?
This would make sense in my opinion. index >= 32 looks like it would lead to completely undefined behavior when trying to attach objects to each other.
I suppose. The counter argument is that this is basically the developer shooting themselves in the foot intentionally, so it's a bit hard to justify complicating the runtime error handling for this.
And after giving this one second of actual though I figured it won't actually complicate anything if we do it early enough. These functions can't be safely called concurrently anyway, and so we can ignore any races that sort of thing would bring.
The connector case might be well justified though since the index there comes from ida, and with MST connectors can come and go as they please. So it might not be entirely impossible to overflow the bits there.
Harry
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 +++ drivers/gpu/drm/drm_crtc.c | 3 +++ drivers/gpu/drm/drm_encoder.c | 3 +++ drivers/gpu/drm/drm_plane.c | 3 +++ 4 files changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..9278a81c5d54 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -211,6 +211,9 @@ int drm_connector_init(struct drm_device *dev, connector->index = ret; ret = 0;
- /* we have 32bit connector bitmasks */
- WARN_ON(connector->index >= 32);
- connector->connector_type = connector_type; connector->connector_type_id = ida_simple_get(connector_ida, 1, 0, GFP_KERNEL);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..e27ffa3561af 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -318,6 +318,9 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, list_add_tail(&crtc->head, &config->crtc_list); crtc->index = config->num_crtc++;
- /* we have 32bit crtc bitmasks */
- WARN_ON(crtc->index >= 32);
- crtc->primary = primary; crtc->cursor = cursor; if (primary && !primary->possible_crtcs)
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..66d0cdd217fa 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -136,6 +136,9 @@ int drm_encoder_init(struct drm_device *dev, list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++;
- /* we have 32bit encoder bitmasks */
- WARN_ON(encoder->index >= 32);
out_put: if (ret) drm_mode_object_unregister(dev, &encoder->base); diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..0a8d807603c1 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -242,6 +242,9 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, list_add_tail(&plane->head, &config->plane_list); plane->index = config->num_total_plane++;
- /* we have 32bit plane bitmasks */
- WARN_ON(plane->index >= 32);
- drm_object_attach_property(&plane->base, config->plane_type_property, plane->type);
-- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com --- drivers/gpu/drm/drm_connector.c | 3 ++- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..f4a689ab990a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,7 +205,8 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL); + /* connector index is used with 32bit bitmasks */ + ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL); if (ret < 0) goto out_put; connector->index = ret; diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
+ /* crtc index is used with 32bit bitmasks */ + if (WARN_ON(config->num_crtc >= 32)) + return -EINVAL; + crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
+ /* encoder index is used with 32bit bitmasks */ + if (WARN_ON(dev->mode_config.num_encoder >= 32)) + return -EINVAL; + ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
+ /* plane index is used with 32bit bitmasks */ + if (WARN_ON(config->num_total_plane >= 32)) + return -EINVAL; + ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
Op 24-01-18 om 22:47 schreef Ville Syrjala:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 ++- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..f4a689ab990a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,7 +205,8 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL);
- /* connector index is used with 32bit bitmasks */
- ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL); if (ret < 0) goto out_put; connector->index = ret;
Could we also put a DRM_DEBUG_KMS in here if allocation fails? Since it's more likely to happen now..
Otherwise looks good so with that change: Reviewed-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
- /* crtc index is used with 32bit bitmasks */
- if (WARN_ON(config->num_crtc >= 32))
return -EINVAL;
- crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
- /* encoder index is used with 32bit bitmasks */
- if (WARN_ON(dev->mode_config.num_encoder >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret;
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
- /* plane index is used with 32bit bitmasks */
- if (WARN_ON(config->num_total_plane >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
On Thu, Jan 25, 2018 at 10:17:21AM +0100, Maarten Lankhorst wrote:
Op 24-01-18 om 22:47 schreef Ville Syrjala:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 ++- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..f4a689ab990a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,7 +205,8 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL);
- /* connector index is used with 32bit bitmasks */
- ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL); if (ret < 0) goto out_put; connector->index = ret;
Could we also put a DRM_DEBUG_KMS in here if allocation fails? Since it's more likely to happen now..
I was actually pondering using DRM_ERROR(), or maybe even WARN(). It shouldn't be directly user triggerable so I think we want to get the bugreport if we do run out of bits.
Otherwise looks good so with that change: Reviewed-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
- /* crtc index is used with 32bit bitmasks */
- if (WARN_ON(config->num_crtc >= 32))
return -EINVAL;
- crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
- /* encoder index is used with 32bit bitmasks */
- if (WARN_ON(dev->mode_config.num_encoder >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret;
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
- /* plane index is used with 32bit bitmasks */
- if (WARN_ON(config->num_total_plane >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
On Thu, Jan 25, 2018 at 01:27:27PM +0200, Ville Syrjälä wrote:
On Thu, Jan 25, 2018 at 10:17:21AM +0100, Maarten Lankhorst wrote:
Op 24-01-18 om 22:47 schreef Ville Syrjala:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 3 ++- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..f4a689ab990a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,7 +205,8 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL);
- /* connector index is used with 32bit bitmasks */
- ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL); if (ret < 0) goto out_put; connector->index = ret;
Could we also put a DRM_DEBUG_KMS in here if allocation fails? Since it's more likely to happen now..
I was actually pondering using DRM_ERROR(), or maybe even WARN(). It shouldn't be directly user triggerable so I think we want to get the bugreport if we do run out of bits.
OTOH we are likely to get the "my screen don't work" bugreport anyway, so maybe a debug print is enough.
Otherwise looks good so with that change: Reviewed-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
- /* crtc index is used with 32bit bitmasks */
- if (WARN_ON(config->num_crtc >= 32))
return -EINVAL;
- crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
- /* encoder index is used with 32bit bitmasks */
- if (WARN_ON(dev->mode_config.num_encoder >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret;
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
- /* plane index is used with 32bit bitmasks */
- if (WARN_ON(config->num_total_plane >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
-- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry) v3: Print a debug message so that we know what happened (Maarten)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Reviewed-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com --- drivers/gpu/drm/drm_connector.c | 9 +++++++-- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..16b9c3810af2 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,9 +205,14 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL); - if (ret < 0) + /* connector index is used with 32bit bitmasks */ + ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL); + if (ret < 0) { + DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n", + drm_connector_enum_list[connector_type].name, + ret); goto out_put; + } connector->index = ret; ret = 0;
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
+ /* crtc index is used with 32bit bitmasks */ + if (WARN_ON(config->num_crtc >= 32)) + return -EINVAL; + crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
+ /* encoder index is used with 32bit bitmasks */ + if (WARN_ON(dev->mode_config.num_encoder >= 32)) + return -EINVAL; + ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
+ /* plane index is used with 32bit bitmasks */ + if (WARN_ON(config->num_total_plane >= 32)) + return -EINVAL; + ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
On 2018-01-25 08:30 AM, Ville Syrjala wrote:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry) v3: Print a debug message so that we know what happened (Maarten)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Reviewed-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
Reviewed-by: Harry Wentland harry.wentland@amd.com
Harry
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 9 +++++++-- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..16b9c3810af2 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,9 +205,14 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL);
- if (ret < 0)
- /* connector index is used with 32bit bitmasks */
- ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL);
- if (ret < 0) {
DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
drm_connector_enum_list[connector_type].name,
goto out_put;ret);
- } connector->index = ret; ret = 0;
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
- /* crtc index is used with 32bit bitmasks */
- if (WARN_ON(config->num_crtc >= 32))
return -EINVAL;
- crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
- /* encoder index is used with 32bit bitmasks */
- if (WARN_ON(dev->mode_config.num_encoder >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret;
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
- /* plane index is used with 32bit bitmasks */
- if (WARN_ON(config->num_total_plane >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
On Thu, Jan 25, 2018 at 10:12:52AM -0500, Harry Wentland wrote:
On 2018-01-25 08:30 AM, Ville Syrjala wrote:
From: Ville Syrjälä ville.syrjala@linux.intel.com
We use 32bit bitmasks to track planes/crtcs/encoders/connectors. Naturally we can only do that if the index of those objects stays below 32. Issue a warning whenever we exceed that limit, hopefully prompting someone to fix the problem.
For connectors the issue is a bit more complicated as they can be created/destroyed at runtime due to MST. So the problem is no longer a purely theoretical programmer error. As the connector indexes are allocated via ida, we can simply limit the maximum value the ida is allowed to hand out. The error handling is already in place.
v2: Return an error to the caller (Harry) v3: Print a debug message so that we know what happened (Maarten)
Cc: Harry Wentland harry.wentland@amd.com Cc: Maarten Lankhorst maarten.lankhorst@linux.intel.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Reviewed-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
Reviewed-by: Harry Wentland harry.wentland@amd.com
Thanks for the review. Pushed to drm-misc-next.
Harry
Signed-off-by: Ville Syrjälä ville.syrjala@linux.intel.com
drivers/gpu/drm/drm_connector.c | 9 +++++++-- drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b85a7749709d..16b9c3810af2 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -205,9 +205,14 @@ int drm_connector_init(struct drm_device *dev, connector->dev = dev; connector->funcs = funcs;
- ret = ida_simple_get(&config->connector_ida, 0, 0, GFP_KERNEL);
- if (ret < 0)
- /* connector index is used with 32bit bitmasks */
- ret = ida_simple_get(&config->connector_ida, 0, 32, GFP_KERNEL);
- if (ret < 0) {
DRM_DEBUG_KMS("Failed to allocate %s connector index: %d\n",
drm_connector_enum_list[connector_type].name,
goto out_put;ret);
- } connector->index = ret; ret = 0;
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f0556e654116..5b4be382a1d7 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -282,6 +282,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, WARN_ON(primary && primary->type != DRM_PLANE_TYPE_PRIMARY); WARN_ON(cursor && cursor->type != DRM_PLANE_TYPE_CURSOR);
- /* crtc index is used with 32bit bitmasks */
- if (WARN_ON(config->num_crtc >= 32))
return -EINVAL;
- crtc->dev = dev; crtc->funcs = funcs;
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 59e0ebe733f8..273e1c59c54a 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -110,6 +110,10 @@ int drm_encoder_init(struct drm_device *dev, { int ret;
- /* encoder index is used with 32bit bitmasks */
- if (WARN_ON(dev->mode_config.num_encoder >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); if (ret) return ret;
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 2c90519576a3..22b54663b6e7 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -173,6 +173,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned int format_modifier_count = 0; int ret;
- /* plane index is used with 32bit bitmasks */
- if (WARN_ON(config->num_total_plane >= 32))
return -EINVAL;
- ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret;
dri-devel@lists.freedesktop.org