@@ -276,11 +276,10 @@ Various hold-ups:
- Need to switch to drm_fbdev_generic_setup(), otherwise a lot of the custom fb
setup code can't be deleted.
-- Many drivers wrap drm_gem_fb_create() only to check for valid formats. For
- atomic drivers we could check for valid formats by calling
- drm_plane_check_pixel_format() against all planes, and pass if any plane
- supports the format. For non-atomic that's not possible since like the format
- list for the primary plane is fake and we'd therefor reject valid formats.
+- Need to switch to drm_gem_fb_create(), as now framebuffer_check() checks for
+ valid formats for atomic drivers.
+
+- Add an addfb format validation for non-atomic drivers.
- Many drivers subclass drm_framebuffer, we'd need a embedding compatible
version of the varios drm_gem_fb_create functions. Maybe called
@@ -280,6 +280,14 @@ static int framebuffer_check(struct drm_device *dev,
}
}
+ /* Verify that the modifier is supported. */
+ if (r->modifier[0] && drm_drv_uses_atomic_modeset(dev) &&
+ !drm_any_plane_has_format(dev, r->pixel_format, r->modifier[0])) {
+ drm_dbg_kms(dev, "Unsupported pixel format %p4cc / modifier 0x%llx\n",
+ &r->pixel_format, r->modifier[0]);
+ return -EINVAL;
+ }
+
return 0;
}