Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AC14C4743C for ; Mon, 21 Jun 2021 12:30:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E21A360FE7 for ; Mon, 21 Jun 2021 12:30:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E21A360FE7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 620B989FC8; Mon, 21 Jun 2021 12:30:48 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 735F089FC8 for ; Mon, 21 Jun 2021 12:30:47 +0000 (UTC) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 61E0B21A4; Mon, 21 Jun 2021 14:30:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1624278645; bh=mhytmudEVSKLIN6PcacXPcOzqxtrDlHXCQzrQAXWxeE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o5DdlrbCKKR2Eou9cupXA86i8szATwT6A5yuV+j+0uUDQk8OPMOcc8SHwigaHlZZa +oB8olF3RSMvxgSoiPDArTq1pGhVNUHYQSX3RIXNfF9AGEkUdzzRN1O0uT4GC/rOF5 RzkD4x4FbU4mkL+yUhrPVhN+Oc141ogDYMCm8c2s= Date: Mon, 21 Jun 2021 15:30:19 +0300 From: Laurent Pinchart To: Marek Vasut Subject: Re: [PATCH] drm/bridge: ti-sn65dsi83: Replace connector format patching with atomic_get_input_bus_fmts Message-ID: References: <20210620224208.184719-1-marex@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210620224208.184719-1-marex@denx.de> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Loic Poulain , ch@denx.de, Adam Ford , Douglas Anderson , Robert Foss , Frieder Schrempf , Philippe Schenker , dri-devel@lists.freedesktop.org, Valentin Raevsky , Stephen Boyd , Sam Ravnborg , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi Marek, Thank you for the patch. On Mon, Jun 21, 2021 at 12:42:08AM +0200, Marek Vasut wrote: > Patching the connector format is causing various problematic > side effects. Implement .atomic_get_input_bus_fmts callback > instead, which sets up the input (DSI-end) format, and that > format can then be used in pipeline format negotiation between > the DSI-end of this bridge and the other component closer to > the scanout engine. > > Signed-off-by: Marek Vasut > Cc: Adam Ford > Cc: Douglas Anderson > Cc: Frieder Schrempf > Cc: Jagan Teki > Cc: Laurent Pinchart > Cc: Linus Walleij > Cc: Loic Poulain > Cc: Philippe Schenker > Cc: Robert Foss > Cc: Sam Ravnborg > Cc: Stephen Boyd > Cc: Valentin Raevsky > Cc: dri-devel@lists.freedesktop.org > --- > drivers/gpu/drm/bridge/ti-sn65dsi83.c | 35 ++++++++++++++++++++++++--- > 1 file changed, 31 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c > index 750f2172ef08..32bda20f5dda 100644 > --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c > +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c > @@ -517,7 +517,6 @@ static bool sn65dsi83_mode_fixup(struct drm_bridge *bridge, > struct drm_display_mode *adj) > { > struct sn65dsi83 *ctx = bridge_to_sn65dsi83(bridge); > - u32 input_bus_format = MEDIA_BUS_FMT_RGB888_1X24; > struct drm_encoder *encoder = bridge->encoder; > struct drm_device *ddev = encoder->dev; > struct drm_connector *connector; > @@ -550,14 +549,37 @@ static bool sn65dsi83_mode_fixup(struct drm_bridge *bridge, > connector->display_info.bus_formats[0]); > break; > } > - > - drm_display_info_set_bus_formats(&connector->display_info, > - &input_bus_format, 1); > } > > return true; > } > > +#define MAX_INPUT_SEL_FORMATS 1 > + > +static u32 * > +sn65dsi83_atomic_get_input_bus_fmts(struct drm_bridge *bridge, > + struct drm_bridge_state *bridge_state, > + struct drm_crtc_state *crtc_state, > + struct drm_connector_state *conn_state, > + u32 output_fmt, > + unsigned int *num_input_fmts) > +{ > + u32 *input_fmts; > + > + *num_input_fmts = 0; > + > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), > + GFP_KERNEL); > + if (!input_fmts) > + return NULL; > + > + /* This is the DSI-end bus format */ > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; > + *num_input_fmts = 1; > + > + return input_fmts; > +} Perfect :-) Reviewed-by: Laurent Pinchart > + > static const struct drm_bridge_funcs sn65dsi83_funcs = { > .attach = sn65dsi83_attach, > .pre_enable = sn65dsi83_pre_enable, > @@ -567,6 +589,11 @@ static const struct drm_bridge_funcs sn65dsi83_funcs = { > .mode_valid = sn65dsi83_mode_valid, > .mode_set = sn65dsi83_mode_set, > .mode_fixup = sn65dsi83_mode_fixup, > + > + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, > + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, > + .atomic_reset = drm_atomic_helper_bridge_reset, > + .atomic_get_input_bus_fmts = sn65dsi83_atomic_get_input_bus_fmts, > }; > > static int sn65dsi83_parse_dt(struct sn65dsi83 *ctx, enum sn65dsi83_model model) -- Regards, Laurent Pinchart