struct drm_mode_create_dumb *args)
{
u32 fourcc;
- const struct drm_format_info *info;
u64 pitch_align;
int ret;
* Use the result as pitch alignment.
*/
fourcc = drm_driver_color_mode_format(dev, args->bpp);
- if (fourcc == DRM_FORMAT_INVALID)
- return -EINVAL;
- info = drm_format_info(fourcc);
- if (!info)
- return -EINVAL;
- pitch_align = drm_format_info_min_pitch(info, 0, SZ_32);
+ if (fourcc != DRM_FORMAT_INVALID) {
+ const struct drm_format_info *info;
+
+ info = drm_format_info(fourcc);
+ if (!info)
+ return -EINVAL;
+ pitch_align = drm_format_info_min_pitch(info, 0, 32);
+ } else {
+ pitch_align = round_up(args->width, 32) * DIV_ROUND_UP(args->bpp, SZ_8);
+ }
if (!pitch_align || pitch_align > U32_MAX)
return -EINVAL;
ret = drm_mode_size_dumb(dev, args, pitch_align, 0);