Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795975670; b=YJjKrCavY1eEHLtxFQ8HNSnFdB87Sc6lXZJK1/FtBosn/+rV6uvSh0jVBviMoodtoqKW U9sKNVbokse6XIpR1NPO5VOe5agxgcPXT7fS1DOPPcmOnBHbyBDNXhcyKuGqhbuoVSlfq sXrnSTO1karjt7Di52/c8qbn7WxylUMWOnU2zK+f8b8S3sJPFMVrbfCUJWIMJMXfdhABx 0jAVgcEswOGSXBB7sRbA76noohe+ZLvT2gHjitK6qyMeysEC7k5zsNQpYVdv53Xf2NMrY 7cO/tkZoem2ZzUT1fDCT4V1Va3ZxTSBvDXE90/07ddRPierGf0abrY6NqQOI8hTROHg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795975670; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=Zzg2F3/m3lZDxwptPEvYRO1/FkyxV4f2F2aEsE/WXLo=; b=qPdZiTpJrp/K2iIPfG5CJB0jV4pkNIcKGQIZlp5Q4PgSsFArr49C/EPABaML49yfJKRv Ywkz50Ly/3bO3NCh/PBwMIErex0+6fQ0XOISaExkStFCI50sbsg1bTJMIhUN+n32Grn9g 8PoLfCQMv08Wa3PqN3/b7G8UkC8UVhl+PW0FqqJTK9IaSIdublfqvhvYk8DfPCtcCgowI JvVYhUP/2qOFdwsChXbcbBTUqLdKAUCa5CDEq7UP9pvHaYS2rWOJNkhDfdqcpKOpj8peY A+d3OHhqnSf7obKIr+IIaBW0yum4V/1drbP4bGsehh9AfG1v+XOvLryueeGgJIOvJDQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=AKqz6cZV; arc=none smtp.remote-ip=209.85.218.43 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AE5B606A33F for ; Sun, 29 Nov 2026 18:07:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1AE5B606A33F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=AKqz6cZV Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-c50ac25cdd4so1203762666b.1 for ; Sun, 29 Nov 2026 10:07:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795975668; x=1796580468; darn=vger.kernel.org; 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:content-type; bh=Zzg2F3/m3lZDxwptPEvYRO1/FkyxV4f2F2aEsE/WXLo=; b=AKqz6cZVyl2IYZe3cPEMUuwWLa8r9aAt1z4CNu+kpvO6V1Wg1dZSsNm/dKYfDQMKUK kNAEJmVCNgm6lZ5T5D/0VFVM9O/8NpFa9zrMRf/kYIfdIB/fD3ZU4DS8EAvG+eoqhdVN G1Ru2YxUWqoaZQK4OujoZZLY9Apwi61tzo0trE1FkswQWqgq6LcdhtMAN90mYekSRY7X 3KQwEkgcs6+1jGnjrRHsOwfdnKJIt504gyXHYL1ba62qq2FofXtYoFQGWyNdbhQTSLrQ 05yjSksExdT/YlA7vY+FUETYLXkje1XQILHe2gO7rl0alMR0Ywjaz8KpA0tdWbpLIXNG S5tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795975668; x=1796580468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Zzg2F3/m3lZDxwptPEvYRO1/FkyxV4f2F2aEsE/WXLo=; b=0ZNcdc5lIOBxYhxw1sYcgb4lHqBa4iVmag09/8/li1sDeujqOgIbeAqlGzZO5Lu3rh C2nsWVG3G4Jd1GK438aTYfTLtJUeWY/5IUi6VB5FAweWznR7iafbFoxlNsTACAG5v4ET JR1rGvhh6tV3twe82VLicFSMCNM8sJyLFEWnsUp8Q91Is1/85SVod6bJKFq9LphdJ/X2 MDypP/a9j+Knt7Yhhsj3Gq/X447yW6Hi+PTsoNyedGL+kwXEAit9sdZlpsfS0zWGsYAX 734J4GgSNpZCoWhi+q3MnOf9Y8sRJtkNzsl9i0HmsTWty8K0SkHaqL1jI2xZJIFP8Aoy B/LA== X-Forwarded-Encrypted: i=1; AL+hErHN7Rju6t55JJEToR0HJUiYYmuwDrAkFNqc4XQOWkKe76b8DqeG5SwrMvucap4REHXqXjiEO3BHth+bXw==@vger.kernel.org X-Gm-Message-State: APuU4Z9mL+QOoGiah4oFD9i+6wDTqtb8dSVJ4Acc3C3XXARiPtOkY5LE AKHJfH+llH6UV6MHJMkZydk5KkYRqRnDlH/PQLeCbH02nFZqvx7kL9c0 X-Gm-Gg: AZFdTZd2sV1m9SSoXKPQYeDxKpuQRjrHU6+IQA2muNs89U/VjS2zjrneVsQJRM6DK3R ypDnNZyw8EWq3X7UzqIp6re23bhmWQj2doM1RTKmMKNrx+t99U5c4es6ujjiasUZ1LRMfF5bdCg HtweWOic+CbzN6LAHAr5QEBKkIKaj4ywQaAbNZ0LVJCaDVrDByPIfoHe7L9WrjthD7KPnkLYGDa rtUXycHI94Cj4NdwOhbkAYxoAtxQIsV9BkTUas+TFk6KWVyNNifFVz1K2d4ehTWrRRtWJJUER+v szk0HhaXDTedPd0BRJa8rrZdR2K2KEHqO+BiqSATIk1EP0WtjPml752LXlXSMrlSu6hSgIm1PG/ EFvsdEBjEpm/4srVkQdgujTE8WxVFdL9GwqrAMbUefpuy6b5e/0d47Iz2Pidjg3iASdEU35qk5n +Uw4fxwECjcOjPVReznsUhu7dXfC+7dyzWLbanwr7rwE2lBHgxSsWzh4U87ykU0d+NIA4NSw1a+ w4MmmYAvNQiK8/EdzIiL/oZxhTdD5M3Bak8fHrAHdqxHxwAmDyvruDWLYeOh6FoHpdK1VEfzPUq +A6arqj3A2VJWoYJWZdWpHRW5gfFwa9saQVK7qFR7tj26heoa0Zci3WOHLJiZR/NtPam53eEht8 Lk6715hbDgNOQLo4uWpZgl5DlIFib6wk= X-Received: by 2002:a17:906:4ece:b0:c51:94f:f155 with SMTP id a640c23a62f3a-c513a811eccmr1903397466b.19.1795975668456; Sun, 29 Nov 2026 10:07:48 -0800 (PST) Received: from xeon ([188.163.112.54]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae8ce16sm1061518266b.37.2026.11.29.10.07.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 10:07:47 -0800 (PST) From: Svyatoslav Ryhel To: Mauro Carvalho Chehab , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Greg Kroah-Hartman , Svyatoslav Ryhel , Hans Verkuil , Mikko Perttunen Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v2 05/15] media: tegra-video: vi: Build bitmap of formats compatible with CSI/VIP instead of source Date: Sun, 29 Nov 2026 20:07:12 +0200 Message-ID: <20261129180722.142186-6-clamor95@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261129180722.142186-1-clamor95@gmail.com> References: <20261129180722.142186-1-clamor95@gmail.com> X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Tegra VI supports media bus formats that map to the same pixel format entry (mostly YUV formats). This is required for supporting both CSI and VIP. Since vidioc_enum_fmt_vid_cap() exposes pixel formats, it cannot expose the same format for multiple media bus codes. Enumerate pixel formats matching those supported by the attached CSI or VIP bridge. Remove tegra_channel_set_subdev_active_fmt() so channel format enumeration no longer depends on subdevice media bus enumeration during graph completion. Signed-off-by: Svyatoslav Ryhel --- .../media/platform/nvidia/tegra-video/vi.c | 39 +------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/drivers/media/platform/nvidia/tegra-video/vi.c b/drivers/media/platform/nvidia/tegra-video/vi.c index af66002541f0c..2a0ffdd3896f6 100644 --- a/drivers/media/platform/nvidia/tegra-video/vi.c +++ b/drivers/media/platform/nvidia/tegra-video/vi.c @@ -504,39 +504,6 @@ static int tegra_channel_set_format(struct file *file, void *fh, return 0; } -static int tegra_channel_set_subdev_active_fmt(struct tegra_vi_channel *chan) -{ - int ret, index; - struct v4l2_subdev *subdev; - struct v4l2_subdev_format fmt = { - .which = V4L2_SUBDEV_FORMAT_ACTIVE, - }; - - /* - * Initialize channel format to the sub-device active format if there - * is corresponding match in the Tegra supported video formats. - */ - subdev = tegra_channel_get_remote_source_subdev(chan); - ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); - if (ret) - return ret; - - index = tegra_get_format_idx_by_code(chan->vi, fmt.format.code, 0); - if (index < 0) - return -EINVAL; - - chan->fmtinfo = &chan->vi->soc->video_formats[index]; - v4l2_fill_pix_format(&chan->format, &fmt.format); - chan->format.pixelformat = chan->fmtinfo->fourcc; - chan->format.bytesperline = chan->format.width * chan->fmtinfo->bpp; - chan->format.sizeimage = chan->format.bytesperline * - chan->format.height; - chan->vi->ops->vi_fmt_align(&chan->format, chan->fmtinfo->bpp); - tegra_channel_update_gangports(chan); - - return 0; -} - static int tegra_channel_subscribe_event(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub) @@ -752,7 +719,7 @@ static int vi_fmts_bitmap_init(struct tegra_vi_channel *chan) * available media bus formats of sub-device and the pre-defined Tegra * supported video formats. */ - subdev = tegra_channel_get_remote_source_subdev(chan); + subdev = tegra_channel_get_remote_bridge_subdev(chan); while (1) { ret = v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, &code); @@ -786,9 +753,6 @@ static int vi_fmts_bitmap_init(struct tegra_vi_channel *chan) bitmap_set(chan->fmts_bitmap, index, 1); } - /* initialize channel format to the sub-device active format */ - tegra_channel_set_subdev_active_fmt(chan); - return 0; } @@ -838,6 +802,7 @@ static int tegra_channel_init(struct tegra_vi_channel *chan) chan->format.bytesperline = TEGRA_DEF_WIDTH * chan->fmtinfo->bpp; chan->format.sizeimage = chan->format.bytesperline * TEGRA_DEF_HEIGHT; vi->ops->vi_fmt_align(&chan->format, chan->fmtinfo->bpp); + tegra_channel_update_gangports(chan); ret = vi->ops->channel_host1x_syncpt_init(chan); if (ret) -- 2.53.0