drm: Validate connector rotation has one bit set in the rotation property

Copy the same validation logic as from the plane rotation property.

Fixes: 8fec3ff870 ("drm: Add a rotation parameter to connectors.")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
Dave Stevenson
2024-12-12 11:59:52 +00:00
committed by Dom Cobley
parent e941bbe30b
commit be6b313f1f

View File

@@ -794,6 +794,12 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
} else if (property == connector->broadcast_rgb_property) { } else if (property == connector->broadcast_rgb_property) {
state->hdmi.broadcast_rgb = val; state->hdmi.broadcast_rgb = val;
} else if (property == connector->rotation_property) { } else if (property == connector->rotation_property) {
if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK)) {
drm_dbg_atomic(connector->dev,
"[CONNECTOR:%d:%s] bad rotation bitmask: 0x%llx\n",
connector->base.id, connector->name, val);
return -EINVAL;
}
state->rotation = val; state->rotation = val;
} else if (connector->funcs->atomic_set_property) { } else if (connector->funcs->atomic_set_property) {
return connector->funcs->atomic_set_property(connector, return connector->funcs->atomic_set_property(connector,