drm/framebuffer: Pitch checks aren't valid for non-linear modifiers

Pitch has no meaning if the modifier isn't DRM_FORMAT_MOD_LINEAR
as there is no guarantee that the value passed follows the
pattern that pitch * height = size.

Remove that check from framebuffer_check.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
Dave Stevenson
2025-02-27 17:55:02 +00:00
committed by Dom Cobley
parent 69bc83d33e
commit e2d4573825

View File

@@ -190,7 +190,8 @@ static int framebuffer_check(struct drm_device *dev,
if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX)
return -ERANGE;
if (block_size && r->pitches[i] < min_pitch) {
if (r->modifier[i] == DRM_FORMAT_MOD_LINEAR && block_size &&
r->pitches[i] < min_pitch) {
drm_dbg_kms(dev, "bad pitch %u for plane %d\n", r->pitches[i], i);
return -EINVAL;
}