From patchwork Thu Dec 7 11:11:11 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 10098467
Return-Path:
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id
73D3F60329 for ;
Thu, 7 Dec 2017 11:11:22 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD1F29EA1
for ;
Thu, 7 Dec 2017 11:11:22 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id 6141F2A3F6; Thu, 7 Dec 2017 11:11:22 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI
autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFCA029EC9
for ;
Thu, 7 Dec 2017 11:11:21 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1752861AbdLGLLU (ORCPT
);
Thu, 7 Dec 2017 06:11:20 -0500
Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:43021 "EHLO
metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK)
by vger.kernel.org with ESMTP id S1752851AbdLGLLU (ORCPT
);
Thu, 7 Dec 2017 06:11:20 -0500
Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]
helo=dude.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.84_2)
(envelope-from )
id 1eMu5G-0000LI-L3; Thu, 07 Dec 2017 12:11:18 +0100
From: Philipp Zabel
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab ,
Michael Tretter ,
kernel@pengutronix.de, Philipp Zabel
Subject: [PATCH] [media] coda: fix capture TRY_FMT for YUYV with
non-MB-aligned widths
Date: Thu, 7 Dec 2017 12:11:11 +0100
Message-Id: <20171207111111.6110-1-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.11.0
X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de);
SAEximRunCond expanded to false
X-PTX-Original-Recipient: linux-media@vger.kernel.org
Sender: linux-media-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: linux-media@vger.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
Since bytesperline always fulfills VDOA width requirements, detile the
whole buffer instead of limiting to visible width. This stops TRY_FMT
from returning -EINVAL for YUYV capture buffers that are not a multiple
of 16 wide.
An alternative would be to always round up width to stride, as we report
the valid image rectange via G_SELECTION (V4L2_SEL_TGT_COMPOSE_DEFAULT),
but that would require all applications to handle the compose default
rectangle properly.
Signed-off-by: Philipp Zabel
---
drivers/media/platform/coda/coda-common.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 46a628a548d9f..e8a7554a61d24 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -486,8 +486,8 @@ static int coda_try_fmt_vdoa(struct coda_ctx *ctx, struct v4l2_format *f,
return 0;
}
- err = vdoa_context_configure(NULL, f->fmt.pix.width, f->fmt.pix.height,
- f->fmt.pix.pixelformat);
+ err = vdoa_context_configure(NULL, round_up(f->fmt.pix.width, 16),
+ f->fmt.pix.height, f->fmt.pix.pixelformat);
if (err) {
*use_vdoa = false;
return 0;
@@ -730,7 +730,8 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f,
if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP &&
!coda_try_fmt_vdoa(ctx, f, &ctx->use_vdoa) &&
ctx->use_vdoa)
- vdoa_context_configure(ctx->vdoa, f->fmt.pix.width,
+ vdoa_context_configure(ctx->vdoa,
+ round_up(f->fmt.pix.width, 16),
f->fmt.pix.height,
f->fmt.pix.pixelformat);
else