From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> To: dri-devel@lists.freedesktop.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2 17/23] drm/rcar-du: Fix buffer pitch alignment for R8A7790 DU Date: Wed, 31 Jul 2013 13:22:01 +0000 [thread overview] Message-ID: <1375276927-20181-18-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw) In-Reply-To: <1375276927-20181-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> The R8A7790 DU seems to require a 128 bytes pitch alignment, even though the documentation only mentions a 16 pixels alignement as for the R8A7779 DU. Make this configurable through a device flag. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 + drivers/gpu/drm/rcar-du/rcar_du_kms.c | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 381dbad..3cd9815 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -221,7 +221,7 @@ static const struct rcar_du_device_info rcar_du_r8a7779_info = { }; static const struct rcar_du_device_info rcar_du_r8a7790_info = { - .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK, + .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_ALIGN_128B, }; static const struct platform_device_id rcar_du_id_table[] = { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index 5b57a2f..072e28e 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h @@ -26,6 +26,7 @@ struct drm_device; struct rcar_du_device; #define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */ +#define RCAR_DU_FEATURE_ALIGN_128B (1 << 1) /* Align pitches to 128 bytes */ /* * struct rcar_du_device_info - DU model-specific information diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 845bcb3..418d902 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -111,11 +111,18 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc) int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { + struct rcar_du_device *rcdu = dev->dev_private; unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); unsigned int align; - /* The pitch must be aligned to a 16 pixels boundary. */ - align = 16 * args->bpp / 8; + /* The R8A7779 DU requires a 16 pixels pitch alignment as documented, + * but the R8A7790 DU seems to require a 128 bytes pitch alignment. + */ + if (rcar_du_has(rcdu, RCAR_DU_FEATURE_ALIGN_128B)) + align = 128; + else + align = 16 * args->bpp / 8; + args->pitch = roundup(max(args->pitch, min_pitch), align); return drm_gem_cma_dumb_create(file, dev, args); @@ -125,6 +132,7 @@ static struct drm_framebuffer * rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd) { + struct rcar_du_device *rcdu = dev->dev_private; const struct rcar_du_format_info *format; unsigned int align; @@ -135,7 +143,10 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, return ERR_PTR(-EINVAL); } - align = 16 * format->bpp / 8; + if (rcar_du_has(rcdu, RCAR_DU_FEATURE_ALIGN_128B)) + align = 128; + else + align = 16 * format->bpp / 8; if (mode_cmd->pitches[0] & (align - 1) || mode_cmd->pitches[0] >= 8192) { -- 1.8.1.5
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> To: dri-devel@lists.freedesktop.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2 17/23] drm/rcar-du: Fix buffer pitch alignment for R8A7790 DU Date: Wed, 31 Jul 2013 15:22:01 +0200 [thread overview] Message-ID: <1375276927-20181-18-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw) In-Reply-To: <1375276927-20181-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> The R8A7790 DU seems to require a 128 bytes pitch alignment, even though the documentation only mentions a 16 pixels alignement as for the R8A7779 DU. Make this configurable through a device flag. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 + drivers/gpu/drm/rcar-du/rcar_du_kms.c | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 381dbad..3cd9815 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -221,7 +221,7 @@ static const struct rcar_du_device_info rcar_du_r8a7779_info = { }; static const struct rcar_du_device_info rcar_du_r8a7790_info = { - .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK, + .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_ALIGN_128B, }; static const struct platform_device_id rcar_du_id_table[] = { diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index 5b57a2f..072e28e 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h @@ -26,6 +26,7 @@ struct drm_device; struct rcar_du_device; #define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */ +#define RCAR_DU_FEATURE_ALIGN_128B (1 << 1) /* Align pitches to 128 bytes */ /* * struct rcar_du_device_info - DU model-specific information diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 845bcb3..418d902 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c @@ -111,11 +111,18 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc) int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { + struct rcar_du_device *rcdu = dev->dev_private; unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8); unsigned int align; - /* The pitch must be aligned to a 16 pixels boundary. */ - align = 16 * args->bpp / 8; + /* The R8A7779 DU requires a 16 pixels pitch alignment as documented, + * but the R8A7790 DU seems to require a 128 bytes pitch alignment. + */ + if (rcar_du_has(rcdu, RCAR_DU_FEATURE_ALIGN_128B)) + align = 128; + else + align = 16 * args->bpp / 8; + args->pitch = roundup(max(args->pitch, min_pitch), align); return drm_gem_cma_dumb_create(file, dev, args); @@ -125,6 +132,7 @@ static struct drm_framebuffer * rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd) { + struct rcar_du_device *rcdu = dev->dev_private; const struct rcar_du_format_info *format; unsigned int align; @@ -135,7 +143,10 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv, return ERR_PTR(-EINVAL); } - align = 16 * format->bpp / 8; + if (rcar_du_has(rcdu, RCAR_DU_FEATURE_ALIGN_128B)) + align = 128; + else + align = 16 * format->bpp / 8; if (mode_cmd->pitches[0] & (align - 1) || mode_cmd->pitches[0] >= 8192) { -- 1.8.1.5
next prev parent reply other threads:[~2013-07-31 13:22 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-31 13:21 [PATCH v2 00/23] R-Car DU DRM support for R8A7790 Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 01/23] drm/rcar-du: Add missing alpha plane register definitions Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 02/23] drm/rcar-du: Use devm_ioremap_resource() Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 03/23] drm/rcar-du: Add platform module device table Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 04/23] drm/rcar-du: Support per-CRTC clock and IRQ Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 05/23] drm/rcar-du: Clarify comment regarding plane Y source coordinate Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 06/23] drm/rcar-du: Split LVDS encoder and connector Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 07/23] drm/rcar-du: Split VGA " Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 08/23] drm/rcar-du: Merge LVDS and VGA encoder code Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 09/23] drm/rcar-du: Rename platform data fields to match what they describe Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 10/23] drm/rcar-du: Create rcar_du_planes structure Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 11/23] drm/rcar-du: Rename rcar_du_plane_(init|register) to rcar_du_planes_* Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 12/23] drm/rcar-du: Introduce CRTCs groups Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 13/23] drm/rcar-du: Use dynamic number of CRTCs instead of CRTCs array size Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 14/23] drm/rcar-du: Remove register definitions for the second channel Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:21 ` [PATCH v2 15/23] drm/rcar-du: Move output routing configuration to group Laurent Pinchart 2013-07-31 13:21 ` Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 16/23] drm/rcar-du: Add support for the R8A7790 DU Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart [this message] 2013-07-31 13:22 ` [PATCH v2 17/23] drm/rcar-du: Fix buffer pitch alignment for " Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 18/23] drm/rcar-du: Add support for multiple groups Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 19/23] drm/rcar-du: Add support for DEFR8 register Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 20/23] drm/rcar-du: Rework output routing support Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 21/23] drm/rcar-du: Configure RGB output routing to DPAD0 Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 22/23] drm/rcar-du: Add internal LVDS encoder support Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart 2013-07-31 13:22 ` [PATCH v2 23/23] drm/rcar-du: Add FBDEV emulation support Laurent Pinchart 2013-07-31 13:22 ` Laurent Pinchart
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=1375276927-20181-18-git-send-email-laurent.pinchart+renesas@ideasonboard.com \ --to=laurent.pinchart+renesas@ideasonboard.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-sh@vger.kernel.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.