All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH 1/3] rcar-vin: align format width with hardware limits
Date: Fri, 14 Sep 2018 04:13:43 +0200	[thread overview]
Message-ID: <20180914021345.9277-2-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20180914021345.9277-1-niklas.soderlund+renesas@ragnatech.se>

The Gen3 datasheets lists specific alignment restrictions compared to
Gen2. This was overlooked when adding Gen3 support as no problematic
configuration was encountered. However when adding support for Gen3 Up
Down Scaler (UDS) strange issues could be observed for odd widths
without taking this limit into consideration.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index dc77682b47857c97..2fc2a05eaeacb134 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -673,6 +673,21 @@ static void rvin_mc_try_format(struct rvin_dev *vin,
 	pix->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, pix->colorspace,
 							  pix->ycbcr_enc);
 
+	switch (vin->format.pixelformat) {
+	case V4L2_PIX_FMT_NV16:
+		pix->width = ALIGN(pix->width, 0x80);
+		break;
+	case V4L2_PIX_FMT_YUYV:
+	case V4L2_PIX_FMT_UYVY:
+	case V4L2_PIX_FMT_RGB565:
+	case V4L2_PIX_FMT_XRGB555:
+		pix->width = ALIGN(pix->width, 0x40);
+		break;
+	default:
+		pix->width = ALIGN(pix->width, 0x20);
+		break;
+	}
+
 	rvin_format_align(vin, pix);
 }
 
-- 
2.18.0

  reply	other threads:[~2018-09-14  7:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14  2:13 [PATCH 0/3] rcar-vin: add support for UDS (Up Down Scaler) Niklas Söderlund
2018-09-14  2:13 ` Niklas Söderlund [this message]
2018-09-14  8:47   ` [PATCH 1/3] rcar-vin: align format width with hardware limits Hans Verkuil
2018-10-04 20:01     ` Niklas Söderlund
2018-10-04 20:01       ` Niklas Söderlund
2018-09-14  2:13 ` [PATCH 2/3] rcar-vin: add support for UDS (Up Down Scaler) Niklas Söderlund
2018-09-14  2:13 ` [PATCH 3/3] rcar-vin: declare which VINs can use a Up Down Scaler (UDS) Niklas Söderlund

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=20180914021345.9277-2-niklas.soderlund+renesas@ragnatech.se \
    --to=niklas.soderlund+renesas@ragnatech.se \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@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: link
Be 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.