From patchwork Mon Jun 19 10:52:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 13284335 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 057A8EB64D9 for ; Mon, 19 Jun 2023 10:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232164AbjFSKzM (ORCPT ); Mon, 19 Jun 2023 06:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232304AbjFSKyk (ORCPT ); Mon, 19 Jun 2023 06:54:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4063B1FD9 for ; Mon, 19 Jun 2023 03:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687171945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oJzbySpxHI1OX7uElkdSfOccFY/zZ/4OxZh0D81v/nY=; b=PKkXQu15ba1lsCNPzd21UoI4x8tsCTobKdcIcEZvX6M4mKxGHicgFA49Uv/ATF5BprSrbG Q+7T4KlFgWHaI9wWLMTveh4qWiEH+bI58gL5gItulEZU/f21iMVNqDzc+9YW765AsKOuIT jZmpdoPZZNZnjLrHum1SDaqpTEh5tR0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-dlgHnvzMO4icVYUaibeujg-1; Mon, 19 Jun 2023 06:52:19 -0400 X-MC-Unique: dlgHnvzMO4icVYUaibeujg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 517BB185A78E; Mon, 19 Jun 2023 10:52:19 +0000 (UTC) Received: from x1.localdomain.com (unknown [10.39.193.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id B398D112132C; Mon, 19 Jun 2023 10:52:17 +0000 (UTC) From: Hans de Goede To: Mauro Carvalho Chehab , Sakari Ailus Cc: Hans de Goede , Tsuchiya Yuto , Andy Shevchenko , Yury Luneff , Nable , andrey.i.trufanov@gmail.com, Fabio Aiuto , Kate Hsuan , linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH 3/7] media: atomisp: Clamp width to max 1920 pixels when in ATOMISP_RUN_MODE_PREVIEW Date: Mon, 19 Jun 2023 12:52:08 +0200 Message-Id: <20230619105212.303653-3-hdegoede@redhat.com> In-Reply-To: <20230619105212.303653-1-hdegoede@redhat.com> References: <20230619105212.303653-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pipeline firmware-binaries used in previed mode have ia_css_binary_xinfo.output.max_width set to 1920. This causes ia_css_binary_find() to fail when trying to set a higher resolution resulting in the dump_stack() call in ia_css_binary_find() triggering and resulting in the try_fmt() or set_fmt() IOCTL failing. Fix this by clamping the width to max 1920 when in preview mode. Signed-off-by: Hans de Goede --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index cbbf6f728f57..64456aedbf00 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3808,6 +3808,10 @@ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, return -EINVAL; } + /* The preview pipeline does not support width > 1920 */ + if (asd->run_mode->val == ATOMISP_RUN_MODE_PREVIEW) + f->width = min_t(u32, f->width, 1920); + /* * atomisp_set_fmt() will set the sensor resolution to the requested * resolution + padding. Add padding here and remove it again after