[2/2] drm/cma: allow adjusting the pitch for CMA fbdev
diff mbox

Message ID 1439412734-8651-3-git-send-email-robh@kernel.org
State New
Headers show

Commit Message

Rob Herring Aug. 12, 2015, 8:52 p.m. UTC
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(-)

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index f7751a2..b393e5c 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -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);
 
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 0dfd94def..8072c4f 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -70,6 +70,7 @@  struct drm_fb_helper_surface_size {
 	u32 surface_height;
 	u32 surface_bpp;
 	u32 surface_depth;
+	u32 surface_pitch;
 };
 
 /**