dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH 2/2] drm/cma: allow adjusting the pitch for CMA fbdev
Date: Wed, 12 Aug 2015 15:52:14 -0500	[thread overview]
Message-ID: <1439412734-8651-3-git-send-email-robh@kernel.org> (raw)
In-Reply-To: <1439412734-8651-1-git-send-email-robh@kernel.org>

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(-)

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;
 };
 
 /**
-- 
2.1.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-08-12 20:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-12 20:52 [PATCH 0/2] drm: CMA fbdev stride adjustment Rob Herring
2015-08-12 20:52 ` [PATCH 1/2] drm/cma: allow custom fb helper functions Rob Herring
2015-08-12 20:52 ` Rob Herring [this message]
2015-08-13  6:58 ` [PATCH 0/2] drm: CMA fbdev stride adjustment Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439412734-8651-3-git-send-email-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox