@@ -266,7 +266,8 @@ int drm_fbdev_cma_create(struct drm_fb_helper *helper,
mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
- mode_cmd.pitches[0] = sizes->surface_width * bytes_per_pixel;
+ mode_cmd.pitches[0] = sizes->surface_pitch ?
+ sizes->surface_pitch : sizes->surface_width * bytes_per_pixel;
mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
sizes->surface_depth);
@@ -70,6 +70,7 @@ struct drm_fb_helper_surface_size {
u32 surface_height;
u32 surface_bpp;
u32 surface_depth;
+ u32 surface_pitch;
};
/**
Some hardware has pitch alignment requirements, but there is no way to set the pitch for CMA fbdev other than completely replacing drm_fbdev_cma_create. Add the pitch and allow drivers to adjust it before calling drm_fbdev_cma_create. Signed-off-by: Rob Herring <robh@kernel.org> --- drivers/gpu/drm/drm_fb_cma_helper.c | 3 ++- include/drm/drm_fb_helper.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)