From patchwork Sat Feb 11 20:54:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13137202 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BABA5C61DA4 for ; Sat, 11 Feb 2023 20:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbjBKUzE (ORCPT ); Sat, 11 Feb 2023 15:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbjBKUzD (ORCPT ); Sat, 11 Feb 2023 15:55:03 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 721C314492 for ; Sat, 11 Feb 2023 12:55:02 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id r2so8572322wrv.7 for ; Sat, 11 Feb 2023 12:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DYlxwB+2dIIFaYeb6W4/G/F7mYnyq57RNQAaa+ab3RY=; b=TXqR8ihihKPfYSdqm3+VnbBjYp4AFUntljh7vTiWF2vr8uUGi4cKRr/PuJMRDKF2nE AE0eaaCbw4+/dbHkw0VwHZHzDJvWFEB9LSS6iy4aUu+2MLcffvifFS600KUflho2gmeK 2TDjz1Un2rfGdY1DAOPTd8UZib2lg2NuCdufLM9IWrqAaS7IWDm5WoYJkyD8CwZ20dnD lKPtzqS9OQJXpmyteQZPsM9EcfF/9VmuF/5BVEvYGpC8B68083P1eF+MHpUmvUPBB0Lt 3fRAHpAO6lOJxxPhIBS/0+sqbmMom3yBrNN93xGb260cpghawuvZWpA2L3WVDgzRhJm4 /4Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DYlxwB+2dIIFaYeb6W4/G/F7mYnyq57RNQAaa+ab3RY=; b=wfqaTYxUr8gGm62JwHYepQGjTkcBcm+hM9zcm0E8Hg+A7HTDBqUIGZ+wf0171oqKRj F10xc+hDb2pCV3+FQx7dJ+LHfu7XJgxuiAOAMmKbkm/jUSZg7h5FKVYXp26X9+Rd3+yw xOgTEaoMi4q2DUmfKFUPDppraezkqQzZzThTxZfwHjK0pZAKifWKHJFrj/kGryOWCi9j aY4o718om1s9JYq09AO95MmNQr4E+rsx4tThGrAOt4IWa34Zh356GlJnY3vdvMrVJyk8 Pme3xRaWC/uF7hjNEWxZzbo0flBKg9agPt0TXHGJ30qWTwg1h9Fg1qaRuqWYKTbZ6kaz 8ptA== X-Gm-Message-State: AO0yUKUxsw/WLtV/SrisjznF1qssRHpRoUmsonWB+NQBVjAKl+2AkPf5 Abwgs/rK4D3zqXuTe2e0qSC+GA== X-Google-Smtp-Source: AK7set/6Dy7dWZa2AFGHa5pS99q/OkSJXEZ+caNDpDjIedejlhqYVwR6GZEASZPg5ILmCZThtpFG8Q== X-Received: by 2002:adf:fd02:0:b0:2c5:4c7f:c91 with SMTP id e2-20020adffd02000000b002c54c7f0c91mr4134363wrr.66.1676148901022; Sat, 11 Feb 2023 12:55:01 -0800 (PST) Received: from sleipner.berto.se (p54ac5802.dip0.t-ipconnect.de. [84.172.88.2]) by smtp.googlemail.com with ESMTPSA id q4-20020a05600000c400b002c54737e908sm5095531wrx.91.2023.02.11.12.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 12:55:00 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 1/2] media: rcar-vin: Gen3 can not scale NV12 Date: Sat, 11 Feb 2023 21:54:31 +0100 Message-Id: <20230211205432.493102-2-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211205432.493102-1-niklas.soderlund+renesas@ragnatech.se> References: <20230211205432.493102-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The VIN modules on Gen3 can not scale NV12, fail format validation if the user tries. Currently no frames are produced if this is attempted. Signed-off-by: Niklas Söderlund --- drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c index 98bfd445a649..cc6b59e5621a 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -1312,6 +1312,11 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, } if (rvin_scaler_needed(vin)) { + /* Gen3 can't scale NV12 */ + if (vin->info->model == RCAR_GEN3 && + vin->format.pixelformat == V4L2_PIX_FMT_NV12) + return -EPIPE; + if (!vin->scaler) return -EPIPE; } else { From patchwork Sat Feb 11 20:54:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 13137201 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93A07C6379F for ; Sat, 11 Feb 2023 20:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229778AbjBKUzE (ORCPT ); Sat, 11 Feb 2023 15:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjBKUzE (ORCPT ); Sat, 11 Feb 2023 15:55:04 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44850BDE7 for ; Sat, 11 Feb 2023 12:55:03 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id a2so8584404wrd.6 for ; Sat, 11 Feb 2023 12:55:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ragnatech-se.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1LEk+3I8tLTaJcTzxXh+sG2f5X4KnT3+1I9n4yLUKP4=; b=gPGlAtlCLpkwbgu6KX1FGlif0Vt/MnM54jAg6H6AfBAZXt6RYJ2bwSt4tSozDEKkxY O8EXzcZ8d8IPHGRE0oIUy6a8kdP4UERUdLJFbufqnRN4s9vDDP4RbiUUfv+h+RAtbL2c OaOySUuS6doBgU+DD/X2UQM/d60DcldOEEhKGNPycZuOquInPLrx9wUIIhiHEBYEB90D eFZOxb01BA+AwB16PJmHXXVBWHp06bORVPHLUMe96u9WW3zaeiv0H/3+B6YRfNKFFH0x NHym08yyruMrAWW22MpkBApemliZJwIVmTT8iTVmUA0UfzI6xnLCe/kVc4k2kPKiKxs/ v1Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1LEk+3I8tLTaJcTzxXh+sG2f5X4KnT3+1I9n4yLUKP4=; b=sU3NrBR0NrfNso/TaH+RNZ5WE75JkDeij3+30yUHEQzQbz2PFCbVnb1X1aYKN6ccXI Qb33qdav7MpxDQ4XOvYcA3Fhh9L4rggjSvt4QaEeJEwIX5KTCF8F8jc6T+CkiiXY16bT 628zoJ3TlhEaf/m2Q3Uv/lYAiXBqaqsUdN2ZK5G/yyuSAffKCxqlKPCcCwO/v8ECioEz biLCbSSZTocS1651pFoY2ynlNUfDvlETT6b7IoP4PX0jR+2HsTu/O/kzp2BE/D9WOTcB qqMHwgCro1TSqaooheQMf5GTTudwCDMQdibOjFR486zHaRrOrZ3dxCx2TlunEYRqHvmV J+hg== X-Gm-Message-State: AO0yUKVkSKsmK89XoPJF9JE1gWYoUwJD+1N908LxB1bLwe0Pvnye0yGK KyRZi5D5Et5Ney4mbMlU4KU5Xw== X-Google-Smtp-Source: AK7set/SPxJdaPEVT34o1esbXMidIX4ml1sMI487Iz13STGy1XB5OPtllzO6FfcXDTKL5YOhwRmbAA== X-Received: by 2002:a5d:6601:0:b0:2bf:eec5:3912 with SMTP id n1-20020a5d6601000000b002bfeec53912mr15505005wru.34.1676148901842; Sat, 11 Feb 2023 12:55:01 -0800 (PST) Received: from sleipner.berto.se (p54ac5802.dip0.t-ipconnect.de. [84.172.88.2]) by smtp.googlemail.com with ESMTPSA id q4-20020a05600000c400b002c54737e908sm5095531wrx.91.2023.02.11.12.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 12:55:01 -0800 (PST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 2/2] media: rcar-vin: Fix NV12 size alignment Date: Sat, 11 Feb 2023 21:54:32 +0100 Message-Id: <20230211205432.493102-3-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211205432.493102-1-niklas.soderlund+renesas@ragnatech.se> References: <20230211205432.493102-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org When doing format validation for NV12 the width and height should be aligned to 32 pixels. Signed-off-by: Niklas Söderlund --- drivers/media/platform/renesas/rcar-vin/rcar-dma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c index cc6b59e5621a..23598e22adc7 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-dma.c @@ -1320,9 +1320,15 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, if (!vin->scaler) return -EPIPE; } else { - if (fmt.format.width != vin->format.width || - fmt.format.height != vin->format.height) - return -EPIPE; + if (vin->format.pixelformat == V4L2_PIX_FMT_NV12) { + if (ALIGN(fmt.format.width, 32) != vin->format.width || + ALIGN(fmt.format.height, 32) != vin->format.height) + return -EPIPE; + } else { + if (fmt.format.width != vin->format.width || + fmt.format.height != vin->format.height) + return -EPIPE; + } } if (fmt.format.code != vin->mbus_code)