Message ID | 20240222-kms-hdmi-connector-state-v7-29-8f4af575fce2@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-77108-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp129673dyb; Thu, 22 Feb 2024 10:29:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUpi7KEgyTVzQncRWtgwWGOqHCwCX32sQt7gdUGFleSVOjYWArxKeVfPSA7knwuc4ECu4QfyUe+C2oY7HR4GO4E6Dgmcg== X-Google-Smtp-Source: AGHT+IGqAEt54v//hhl/r9WlneqXMdI5lpBcV4VxOcCo/dk1E0ITTikf0qMqVl2/CYEB3qhh6Mes X-Received: by 2002:a05:6102:21ba:b0:46d:2d23:f500 with SMTP id i26-20020a05610221ba00b0046d2d23f500mr17587356vsb.18.1708626559202; Thu, 22 Feb 2024 10:29:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708626559; cv=pass; d=google.com; s=arc-20160816; b=CKsvVFw/Wf8X+XI4zFb0qJoLcTmnsrpATeZI3kD3VETAYV7W9FIdmpw7rytGvCVrpb Z+V9gjoVgc6bIGlRDldG6cC76KodDkXFpMRnrI7kSn1nHSy0yVVk1fTZWp8VKNJ4BuSB L/jK30exdIRd7N7VPpfYrUzjSlIRynVLLAiT5RqKtPhu+K+s4nOXFYxjYylRKhIWL9re MjlD2pJuY2vknxT96qtYzvcgC/a/jzejqFLbFybnJKDNb8LDZf7eZPcyloG6R2MTPz2f llToxpz2oGQEg9hify/3DaxF+S5QjPzYSjtWe59TLhaP2hZPiurqd79ukLmOo0vbV57k c2FQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=iE0M3K0dKqmF4t8VfCIP4HjbDJgrfjTnQJZcOKPhQag=; fh=7mnR4/DMo6zaWtUGaVI9DND4TR+QGflpVaaXOChu5h0=; b=X47IYx93cIbrbmLbwVVZhj/C6HPjEyvpAsyi1p2pP+5AB5ZVmONvrzZFfF1ZRTiONM //ceRG1mxfqEH0xzAHEdIevUoQvAyn6Zbt7RW7mk09Hqil8sNgF2LZUa0UIMjFJeCJoC Ttb1ogBIG8VtCLrHJ7QaXhJmN3a/cjF+ggeyNw9xKwh31qmWvOVmyJjtsWcqQwwjTzxt eWe/UBNDDvseuyjCz0ORaTSp8L9nenLHNMs0Xs7+pmtBNsW5Jd531eOClv6B2k8f845/ C8se05NiWUUElBFpRw6u35zjwFlBhhYUhgGn9SVtunn1yGeKSzy5ov1/cuIxm/4k33fP 6H1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EeLRUhX1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77108-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77108-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bu12-20020a056102524c00b00470575ec043si1419247vsb.552.2024.02.22.10.29.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 10:29:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77108-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EeLRUhX1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-77108-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77108-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E71281C22A90 for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 18:29:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B80AC14037D; Thu, 22 Feb 2024 18:15:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EeLRUhX1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E275E6E5EB; Thu, 22 Feb 2024 18:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625750; cv=none; b=p/kQXzQ9Ftfptu/o7VOIXadLBZgeUF5KtEENt9e/MFfQN4RH8v46eWymR9UTUAaYJM4Pui3MVwoZQey3uATvcCqpdYRnzeqLx6YMkMrbLqd7fqhdo4UAgEThM1NvctyVrLgEUqh+wYIIYXxTgXSsjbb1KZAvibVc+GNBStGPNGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708625750; c=relaxed/simple; bh=mEyVDQhhKVyw3edURYriU45qe55YIRK057j8zDEIx38=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hKmSatEi5+Fo68C5cJtpQmwLEu9/5GrnZzPCQpwRvsKIyeblrnvkQMpAVR/BBYtPrMN6A5CIl11SXigKbrL0+NALlKjABwzmCgNME+g6Ic6kXdMiN20P2LaLJTpX+7bYuQ94QSpCtn6MoaKTpz/yDdNIfUhJQVAQ1FMG7XLFqJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EeLRUhX1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7126CC433C7; Thu, 22 Feb 2024 18:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708625749; bh=mEyVDQhhKVyw3edURYriU45qe55YIRK057j8zDEIx38=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EeLRUhX1irC9WINz5LLmJoriChNAd1/BD3YjjxNGBgvSHuWaFOAk/5XFZbFrktSHg YfJgHs1YCK+7DRufwDSZ+GqUCTQAIbLOE4Lkwc/Qt5FA625mI0setcbhqxROlD1VTC 1nIN80Flz7/a4FMBnjhgTnS7O3cyjyYfpkiL0M/vWuFA+j2VF77kryKHO+fjlls/FY kQ9nBGX8VseRakyQyDSV/NiIvBJ3OLM1L1Mga/RX0llq8EgTuzAGblp2Gn14HE3ngr /yCj1a3TZSp3495bqhV1RQjB91MG7150m23m46fSZ5PAg6fbY2zuH1R+dOhM2P4nY8 BC6Di6X9PjZlg== From: Maxime Ripard <mripard@kernel.org> Date: Thu, 22 Feb 2024 19:14:15 +0100 Subject: [PATCH v7 29/36] drm/vc4: tests: Remove vc4_dummy_plane structure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240222-kms-hdmi-connector-state-v7-29-8f4af575fce2@kernel.org> References: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> In-Reply-To: <20240222-kms-hdmi-connector-state-v7-0-8f4af575fce2@kernel.org> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Jonathan Corbet <corbet@lwn.net>, Sandy Huang <hjc@rock-chips.com>, =?utf-8?q?Heiko_St=C3=BCbner?= <heiko@sntech.de>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org> Cc: Hans Verkuil <hverkuil@xs4all.nl>, Sebastian Wick <sebastian.wick@redhat.com>, =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= <ville.syrjala@linux.intel.com>, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, Maxime Ripard <mripard@kernel.org> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3334; i=mripard@kernel.org; h=from:subject:message-id; bh=mEyVDQhhKVyw3edURYriU45qe55YIRK057j8zDEIx38=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDKnX+34f/6mY1LbiW4qRWf+5bb84Gc/MfCe4Zqa++uXXA XJrJ4XzdpSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiBnYM/8MrGnfd2Vi52GDK 5kjJhsN+Gsq3HpgLbPh2Wnad7KPn2tEM/wvmiF1ZPbtGX3smH+fU8D0NFvVim9hMBLam9L9KeMt kxg4A X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791624802932225575 X-GMAIL-MSGID: 1791624802932225575 |
Series |
drm/connector: Create HDMI Connector infrastructure
|
|
Commit Message
Maxime Ripard
Feb. 22, 2024, 6:14 p.m. UTC
The vc4_dummy_plane structure is an exact equivalent to vc4_plane, so we
don't need it.
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
drivers/gpu/drm/vc4/tests/vc4_mock.c | 6 ++----
drivers/gpu/drm/vc4/tests/vc4_mock.h | 9 ++-------
drivers/gpu/drm/vc4/tests/vc4_mock_plane.c | 14 +++++---------
3 files changed, 9 insertions(+), 20 deletions(-)
Comments
On 2/22/24 15:14, Maxime Ripard wrote: > The vc4_dummy_plane structure is an exact equivalent to vc4_plane, so we Maybe I understood incorrectly, but isn't the vc4_dummy_plane structure equivalent to drm_plane? Best Regards, - Maíra > don't need it. > > Signed-off-by: Maxime Ripard <mripard@kernel.org> > --- > drivers/gpu/drm/vc4/tests/vc4_mock.c | 6 ++---- > drivers/gpu/drm/vc4/tests/vc4_mock.h | 9 ++------- > drivers/gpu/drm/vc4/tests/vc4_mock_plane.c | 14 +++++--------- > 3 files changed, 9 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tests/vc4_mock.c > index becb3dbaa548..0731a7d85d7a 100644 > --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c > +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c > @@ -109,16 +109,14 @@ static const struct vc4_mock_desc vc5_mock = > static int __build_one_pipe(struct kunit *test, struct drm_device *drm, > const struct vc4_mock_pipe_desc *pipe) > { > - struct vc4_dummy_plane *dummy_plane; > struct drm_plane *plane; > struct vc4_dummy_crtc *dummy_crtc; > struct drm_crtc *crtc; > unsigned int i; > > - dummy_plane = vc4_dummy_plane(test, drm, DRM_PLANE_TYPE_PRIMARY); > - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane); > + plane = vc4_dummy_plane(test, drm, DRM_PLANE_TYPE_PRIMARY); > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); > > - plane = &dummy_plane->plane.base; > dummy_crtc = vc4_mock_pv(test, drm, plane, pipe->data); > KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_crtc); > > diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.h b/drivers/gpu/drm/vc4/tests/vc4_mock.h > index 2d0b339bd9f3..002b6218960c 100644 > --- a/drivers/gpu/drm/vc4/tests/vc4_mock.h > +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.h > @@ -21,13 +21,8 @@ struct drm_crtc *vc4_find_crtc_for_encoder(struct kunit *test, > return NULL; > } > > -struct vc4_dummy_plane { > - struct vc4_plane plane; > -}; > - > -struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test, > - struct drm_device *drm, > - enum drm_plane_type type); > +struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm, > + enum drm_plane_type type); > > struct vc4_dummy_crtc { > struct vc4_crtc crtc; > diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c > index 62b18f5f41db..973f5f929097 100644 > --- a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c > +++ b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c > @@ -22,15 +22,12 @@ static const uint32_t vc4_dummy_plane_formats[] = { > DRM_FORMAT_XRGB8888, > }; > > -struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test, > - struct drm_device *drm, > - enum drm_plane_type type) > +struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm, > + enum drm_plane_type type) > { > - struct vc4_dummy_plane *dummy_plane; > struct drm_plane *plane; > > - dummy_plane = drmm_universal_plane_alloc(drm, > - struct vc4_dummy_plane, plane.base, > + plane = __drmm_universal_plane_alloc(drm, sizeof(struct drm_plane), 0, > 0, > &vc4_dummy_plane_funcs, > vc4_dummy_plane_formats, > @@ -38,10 +35,9 @@ struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test, > NULL, > DRM_PLANE_TYPE_PRIMARY, > NULL); > - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane); > + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); > > - plane = &dummy_plane->plane.base; > drm_plane_helper_add(plane, &vc4_dummy_plane_helper_funcs); > > - return dummy_plane; > + return plane; > } >
Hi Maíra, Thanks for you reviews! On Mon, Feb 26, 2024 at 09:29:32AM -0300, Maíra Canal wrote: > On 2/22/24 15:14, Maxime Ripard wrote: > > The vc4_dummy_plane structure is an exact equivalent to vc4_plane, so we > > Maybe I understood incorrectly, but isn't the vc4_dummy_plane structure > equivalent to drm_plane? Both statements are true :) vc4 itself uses vc4_plane to holds its plane-related content, but it turns out that there's nothing in that structure anymore and vc4_plane == drm_plane. In our mock driver, we have another structure meant to store the mock-plane-related content which doesn't have anything in it anymore, and is thus equivalent to vc4_plane. So, basically, vc4_dummy_plane == vc4_plane == drm_plane. This patch is only about getting rid of vc4_dummy_plane though. Is it clearer? Maxime
Hi Maxime, On 2/27/24 10:02, Maxime Ripard wrote: > Hi Maíra, > > Thanks for you reviews! > > On Mon, Feb 26, 2024 at 09:29:32AM -0300, Maíra Canal wrote: >> On 2/22/24 15:14, Maxime Ripard wrote: >>> The vc4_dummy_plane structure is an exact equivalent to vc4_plane, so we >> >> Maybe I understood incorrectly, but isn't the vc4_dummy_plane structure >> equivalent to drm_plane? > > Both statements are true :) > > vc4 itself uses vc4_plane to holds its plane-related content, but it > turns out that there's nothing in that structure anymore and vc4_plane > == drm_plane. > > In our mock driver, we have another structure meant to store the > mock-plane-related content which doesn't have anything in it anymore, > and is thus equivalent to vc4_plane. > > So, basically, vc4_dummy_plane == vc4_plane == drm_plane. > > This patch is only about getting rid of vc4_dummy_plane though. > > Is it clearer? > Yeah, with that pointed out, you can add my: Reviewed-by: Maíra Canal <mcanal@igalia.com> Best Regards, - Maíra > Maxime
On Tue, Feb 27, 2024 at 07:45:01PM -0300, Maíra Canal wrote: > Hi Maxime, > > On 2/27/24 10:02, Maxime Ripard wrote: > > Hi Maíra, > > > > Thanks for you reviews! > > > > On Mon, Feb 26, 2024 at 09:29:32AM -0300, Maíra Canal wrote: > > > On 2/22/24 15:14, Maxime Ripard wrote: > > > > The vc4_dummy_plane structure is an exact equivalent to vc4_plane, so we > > > > > > Maybe I understood incorrectly, but isn't the vc4_dummy_plane structure > > > equivalent to drm_plane? > > > > Both statements are true :) > > > > vc4 itself uses vc4_plane to holds its plane-related content, but it > > turns out that there's nothing in that structure anymore and vc4_plane > > == drm_plane. > > > > In our mock driver, we have another structure meant to store the > > mock-plane-related content which doesn't have anything in it anymore, > > and is thus equivalent to vc4_plane. > > > > So, basically, vc4_dummy_plane == vc4_plane == drm_plane. > > > > This patch is only about getting rid of vc4_dummy_plane though. > > > > Is it clearer? > > > > Yeah, with that pointed out, you can add my: I'll rephrase for the next version then > Reviewed-by: Maíra Canal <mcanal@igalia.com> Thanks! Maxime
Hi Maxime, Thanks for the review. > -----Original Message----- > From: Maxime Ripard <mripard@kernel.org> > Sent: Wednesday, February 28, 2024 7:30 AM > To: Klymenko, Anatoliy <Anatoliy.Klymenko@amd.com> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>; Maarten Lankhorst > <maarten.lankhorst@linux.intel.com>; Thomas Zimmermann > <tzimmermann@suse.de>; David Airlie <airlied@gmail.com>; Daniel Vetter > <daniel@ffwll.ch>; Simek, Michal <michal.simek@amd.com>; Andrzej Hajda > <andrzej.hajda@intel.com>; Neil Armstrong <neil.armstrong@linaro.org>; Robert > Foss <rfoss@kernel.org>; Jonas Karlman <jonas@kwiboo.se>; Jernej Skrabec > <jernej.skrabec@gmail.com>; dri-devel@lists.freedesktop.org; linux-arm- > kernel@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH 4/4] drm/atomic-helper: Add select_output_bus_format > callback > > Hi, > > On Mon, Feb 26, 2024 at 08:44:45PM -0800, Anatoliy Klymenko wrote: > > Add select_output_bus_format to CRTC atomic helpers callbacks. This > > callback Will allow CRTC to participate in media bus format > > negotiation over connected DRM bridge chain and impose CRTC-specific > restrictions. > > A good example is CRTC implemented as FPGA soft IP. This kind of CRTC > > will most certainly support a single output media bus format, as > > supporting multiple runtime options consumes extra FPGA resources. A > > variety of options for FPGA are usually achieved by synthesizing IP > > with different parameters. > > > > Incorporate select_output_bus_format callback into the format > > negotiation stage to fix the input bus format of the first DRM bridge in the > chain. > > > > Signed-off-by: Anatoliy Klymenko <anatoliy.klymenko@amd.com> > > --- > > drivers/gpu/drm/drm_bridge.c | 19 +++++++++++++++++-- > > include/drm/drm_modeset_helper_vtables.h | 31 > > +++++++++++++++++++++++++++++++ > > 2 files changed, 48 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_bridge.c > > b/drivers/gpu/drm/drm_bridge.c index 521a71c61b16..453ae3d174b4 100644 > > --- a/drivers/gpu/drm/drm_bridge.c > > +++ b/drivers/gpu/drm/drm_bridge.c > > @@ -32,6 +32,7 @@ > > #include <drm/drm_edid.h> > > #include <drm/drm_encoder.h> > > #include <drm/drm_file.h> > > +#include <drm/drm_modeset_helper_vtables.h> > > #include <drm/drm_of.h> > > #include <drm/drm_print.h> > > > > @@ -879,7 +880,8 @@ static int select_bus_fmt_recursive(struct drm_bridge > *first_bridge, > > unsigned int i, num_in_bus_fmts = 0; > > struct drm_bridge_state *cur_state; > > struct drm_bridge *prev_bridge; > > - u32 *in_bus_fmts; > > + struct drm_crtc *crtc = crtc_state->crtc; > > + u32 *in_bus_fmts, in_fmt; > > int ret; > > > > prev_bridge = drm_bridge_get_prev_bridge(cur_bridge); > > @@ -933,7 +935,20 @@ static int select_bus_fmt_recursive(struct drm_bridge > *first_bridge, > > return -ENOMEM; > > > > if (first_bridge == cur_bridge) { > > - cur_state->input_bus_cfg.format = in_bus_fmts[0]; > > + in_fmt = in_bus_fmts[0]; > > + if (crtc->helper_private && > > + crtc->helper_private->select_output_bus_format) { > > + in_fmt = crtc->helper_private- > >select_output_bus_format( > > + crtc, > > + crtc->state, > > + in_bus_fmts, > > + num_in_bus_fmts); > > + if (!in_fmt) { > > + kfree(in_bus_fmts); > > + return -ENOTSUPP; > > + } > > + } > > + cur_state->input_bus_cfg.format = in_fmt; > > I don't think we should start poking at the CRTC internals, but we should rather > provide a helper here. Makes sense, thank you. ACK. > > > cur_state->output_bus_cfg.format = out_bus_fmt; > > kfree(in_bus_fmts); > > return 0; > > diff --git a/include/drm/drm_modeset_helper_vtables.h > > b/include/drm/drm_modeset_helper_vtables.h > > index 881b03e4dc28..7c21ae1fe3ad 100644 > > --- a/include/drm/drm_modeset_helper_vtables.h > > +++ b/include/drm/drm_modeset_helper_vtables.h > > @@ -489,6 +489,37 @@ struct drm_crtc_helper_funcs { > > bool in_vblank_irq, int *vpos, int *hpos, > > ktime_t *stime, ktime_t *etime, > > const struct drm_display_mode *mode); > > + > > + /** > > + * @select_output_bus_format > > + * > > + * Called by the first connected DRM bridge to negotiate input media > > + * bus format. CRTC is expected to pick preferable media formats from > > + * the list supported by the DRM bridge chain. > > There's nothing restricting it to bridges here. Please rephrase this to remove the > bridge mention. The user is typically going to be the encoder, and bridges are just > an automagic implementation of an encoder. > OK. I'll fix than in the next version. > And generally speaking, I'd really like to have an implementation available before > merging this. > Well, 2 instances of this callback implementations exist as drafts, as this is the new API. A little bit of a chicken and egg problem. I'll try to groom at least one of them into upstreamable shape and attach it to the patch set. > Maxime -Anatoliy
Hi, On Wed, Feb 28, 2024 at 10:00:19PM +0000, Klymenko, Anatoliy wrote: > > > diff --git a/include/drm/drm_modeset_helper_vtables.h > > > b/include/drm/drm_modeset_helper_vtables.h > > > index 881b03e4dc28..7c21ae1fe3ad 100644 > > > --- a/include/drm/drm_modeset_helper_vtables.h > > > +++ b/include/drm/drm_modeset_helper_vtables.h > > > @@ -489,6 +489,37 @@ struct drm_crtc_helper_funcs { > > > bool in_vblank_irq, int *vpos, int *hpos, > > > ktime_t *stime, ktime_t *etime, > > > const struct drm_display_mode *mode); > > > + > > > + /** > > > + * @select_output_bus_format > > > + * > > > + * Called by the first connected DRM bridge to negotiate input media > > > + * bus format. CRTC is expected to pick preferable media formats from > > > + * the list supported by the DRM bridge chain. > > > > There's nothing restricting it to bridges here. Please rephrase this to remove the > > bridge mention. The user is typically going to be the encoder, and bridges are just > > an automagic implementation of an encoder. > > > > OK. I'll fix than in the next version. > > > And generally speaking, I'd really like to have an implementation available before > > merging this. > > > > Well, 2 instances of this callback implementations exist as drafts, as > this is the new API. A little bit of a chicken and egg problem. I'll > try to groom at least one of them into upstreamable shape and attach > it to the patch set. That's totally what I meant :) I basically don't want to have an interface that isn't used. If you provide an implementation in the same series, it's totally reasonable Maxime
diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.c b/drivers/gpu/drm/vc4/tests/vc4_mock.c index becb3dbaa548..0731a7d85d7a 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.c @@ -109,16 +109,14 @@ static const struct vc4_mock_desc vc5_mock = static int __build_one_pipe(struct kunit *test, struct drm_device *drm, const struct vc4_mock_pipe_desc *pipe) { - struct vc4_dummy_plane *dummy_plane; struct drm_plane *plane; struct vc4_dummy_crtc *dummy_crtc; struct drm_crtc *crtc; unsigned int i; - dummy_plane = vc4_dummy_plane(test, drm, DRM_PLANE_TYPE_PRIMARY); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane); + plane = vc4_dummy_plane(test, drm, DRM_PLANE_TYPE_PRIMARY); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); - plane = &dummy_plane->plane.base; dummy_crtc = vc4_mock_pv(test, drm, plane, pipe->data); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_crtc); diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock.h b/drivers/gpu/drm/vc4/tests/vc4_mock.h index 2d0b339bd9f3..002b6218960c 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock.h +++ b/drivers/gpu/drm/vc4/tests/vc4_mock.h @@ -21,13 +21,8 @@ struct drm_crtc *vc4_find_crtc_for_encoder(struct kunit *test, return NULL; } -struct vc4_dummy_plane { - struct vc4_plane plane; -}; - -struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test, - struct drm_device *drm, - enum drm_plane_type type); +struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm, + enum drm_plane_type type); struct vc4_dummy_crtc { struct vc4_crtc crtc; diff --git a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c index 62b18f5f41db..973f5f929097 100644 --- a/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c +++ b/drivers/gpu/drm/vc4/tests/vc4_mock_plane.c @@ -22,15 +22,12 @@ static const uint32_t vc4_dummy_plane_formats[] = { DRM_FORMAT_XRGB8888, }; -struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test, - struct drm_device *drm, - enum drm_plane_type type) +struct drm_plane *vc4_dummy_plane(struct kunit *test, struct drm_device *drm, + enum drm_plane_type type) { - struct vc4_dummy_plane *dummy_plane; struct drm_plane *plane; - dummy_plane = drmm_universal_plane_alloc(drm, - struct vc4_dummy_plane, plane.base, + plane = __drmm_universal_plane_alloc(drm, sizeof(struct drm_plane), 0, 0, &vc4_dummy_plane_funcs, vc4_dummy_plane_formats, @@ -38,10 +35,9 @@ struct vc4_dummy_plane *vc4_dummy_plane(struct kunit *test, NULL, DRM_PLANE_TYPE_PRIMARY, NULL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_plane); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, plane); - plane = &dummy_plane->plane.base; drm_plane_helper_add(plane, &vc4_dummy_plane_helper_funcs); - return dummy_plane; + return plane; }