From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.51 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795975670; b=xS9MXDk9Ff99SGep7YiP4Zze7yVHxG9B+nqnNOiJmMMHS1MOO+M0YF5RGZvPDcOq08zQ GasMFGVfIRxhZei1AxDaszlhg9YnQG5BzoQ5iJAqeoTOdMfiaGpQLnWD82f7d692FCzZ9 yKrEpquGM5N6Y3R0IBYIFKfnxQXlWxNUSKrB6A3aItn95sToN9wN9EEsvCZ6Cw1HpdzC5 1ZLFwbVnm3XYkpXeaCA9CwDQRXzOTLTsA/frb9oB4c6HWRMTem2j8mwOAoVG5/PpBo61c MECKFwYJGhgbH+XL1mETpAGdhSZ7w0cfSl+CYpEkgYkJRksy8++8OwlI3BgX89jQkQg== 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-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=eqZOhuXCCfmXnFjxTBYIyLQqs8r+qrokFb4XzrdyBbW+xoNBGCDHHKY+PGnRAli6oTV8 +4rDqVtyVC6F9gBauT8qeBf4rT2mesbS8CBvpnbyN0fbO4jwUk5J7XcXtAYuGKdVzxyLs P3NEf+hMCrYuw+AB1YsvNgXPjDMXrcLQBmVXekOtrhjceBT5h2HG1LPEaYr6FnE6V+tsN hoU4NY1rI9Z0PuQSirdVmmPiRnELARjLeBmaTEk9Z+mKsA+h3uZ06PLGiLQqsvRipSjXf z+ZBjxkVwPrQ0GC6bUo9c/9ywqtSFkvgo7q0bp7qPpDJPVDaSRz6CPhK7lzNq8H0OOQ== 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.51 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (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 22257606A6A1 for ; Sun, 29 Nov 2026 18:07:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 22257606A6A1 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-f51.google.com with SMTP id a640c23a62f3a-c5127c7abd5so1476139166b.3 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=pfEtY9KylihA1zz1grc5foCHQcoE+pFf9R3/A7cLIpa5ndEdK2SpKXJqyXbxXLVlsQ xmp4GdIAOD7zNBwSbEItjo/LK35ad+X6WmHxUkTMeT0pnZY5lJ6zeWHzGqIaAIxiBoTK N1Y+IhM4OARksJqI59q3FeDoG+HEkh/MZb+hqKw6gk6VM+LaiuwLGiDViwOHpswgc5Hw 6M9+Bmj3szkE8qLSYclG6U4uURy+vuHbRJEaGwyCdhWm1StatuzALTWchhNoFKzLvH6V YmHOLqtkr8J68U6bS4xFEjpinUG2KFQJx9en+ptQ2IMSb2Eta2MRCqbXND/KgSCXdaCt zdzg== X-Gm-Message-State: APuU4Z9pG30G3aJAttJ3mBL4Hg2pkFEHFAi2l0vvtwNr9UJRoH3rUf6b /MOGD+rtaEmdwFz46/89FmJviiKd+aeyc+HRKI70UJm6oh85e8/pGBiC X-Gm-Gg: AZFdTZfENue7EVc2NKUVODpX1sQQkPKl8xK5L9nhAuxBJNXKkT3CrHXvMFeBP7/L/jz Mmvpk/RoWBsltQ+G2HWKuyBmevuBZLASxLE0ZBRb/X4oYmzJzVlKbVL9FHV239llKh0WVUTRFBY ry5J0xzN41s0Ild8QhpefD/EkHE6Rj1yOQkNOU94XjmcjA0aU5J4zeMZvme8gLrXx7BrpH2RgLB lQrYn171ykP4RyaWam7J60a+qiuDRpLiLE3Cqth9yBPDy6pBSUsKe7rOyupf5r+r/i8v+45Smlw wNSUN9eW3P4PuFa1qUl2s/ugOV/leNCYSs9VB96cM+jamYmKiouzTgIXq5lJJr7QrlAcmmeXuen ljPzNINq2ctf4XKCDuzToYgt2xEmVb2+Xn97hPgeqRDYXIUDqalXN6Dgnyqv26Qt2OAUL1LF02X MrZIiSdcHCwc7Hhaj4HQsQ9BoeTkoc8PLsYdum3AVEUcr+3WLQOx77aUQ8QzSW2CVglZzRPlm6j aBLbB7q2DpSf4LuFsReb3uIB+Qh71/UFBAa/Pdk9m326jiJlTKhE/nJKWxB46Ys6p/08uZOvNyd srr2mmRXMusl7x4639QGB3IvuXaCu5hwiIyyNqSkvcy/hUXgkx7ZFfHVLaaWE4+AOI+29XIPGLZ y4xXJcl7Fj7uytcSw/SrKcONZptrzNu4= 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-kernel@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