Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm: fix allocation of dumb buffers for non-RGB formats

Several users (including IGT kms_getfb tests) allocate DUMB buffers for
YUV data. Commit 538fa012cbdb ("drm/msm: Compute dumb-buffer sizes with
drm_mode_size_dumb()") broke that usecase, since in those cases
drm_driver_color_mode_format() returns DRM_FORMAT_INVALID.

Handle the YUV usecase, aligning to 32-bit pixels.

Fixes: 538fa012cbdb ("drm/msm: Compute dumb-buffer sizes with drm_mode_size_dumb()")
Closes: https://lore.kernel.org/all/vptw5tquup34e3jen62znnw26qe76f3pys4lpsal5g3czwev6y@2q724ibos7by/
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/685197/
Message-ID: <20251103-drm-msm-fix-nv12-v2-1-75103b64576e@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>

authored by

Dmitry Baryshkov and committed by
Rob Clark
227ec962 cb9f145f

+10 -7
+10 -7
drivers/gpu/drm/msm/msm_gem.c
··· 701 701 struct drm_mode_create_dumb *args) 702 702 { 703 703 u32 fourcc; 704 - const struct drm_format_info *info; 705 704 u64 pitch_align; 706 705 int ret; 707 706 ··· 710 711 * Use the result as pitch alignment. 711 712 */ 712 713 fourcc = drm_driver_color_mode_format(dev, args->bpp); 713 - if (fourcc == DRM_FORMAT_INVALID) 714 - return -EINVAL; 715 - info = drm_format_info(fourcc); 716 - if (!info) 717 - return -EINVAL; 718 - pitch_align = drm_format_info_min_pitch(info, 0, SZ_32); 714 + if (fourcc != DRM_FORMAT_INVALID) { 715 + const struct drm_format_info *info; 716 + 717 + info = drm_format_info(fourcc); 718 + if (!info) 719 + return -EINVAL; 720 + pitch_align = drm_format_info_min_pitch(info, 0, 32); 721 + } else { 722 + pitch_align = round_up(args->width, 32) * DIV_ROUND_UP(args->bpp, SZ_8); 723 + } 719 724 if (!pitch_align || pitch_align > U32_MAX) 720 725 return -EINVAL; 721 726 ret = drm_mode_size_dumb(dev, args, pitch_align, 0);