All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aradhya Bhatia <a-bhatia1@ti.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Tomi Valkeinen <tomba@kernel.org>, Jyri Sarha <jyri.sarha@iki.fi>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.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>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Francesco Dolcini <francesco@dolcini.it>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	DRI Development List <dri-devel@lists.freedesktop.org>,
	Linux Kernel List <linux-kernel@vger.kernel.org>,
	Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>,
	Devarsh Thakkar <devarsht@ti.com>,
	Jayesh Choudhary <j-choudhary@ti.com>
Subject: Re: [PATCH] drm/bridge: tc358767: Support input format negotiation hook
Date: Tue, 7 Nov 2023 01:17:03 +0530	[thread overview]
Message-ID: <7ddf0edb-2925-4b7c-ad07-27c030dd0232@ti.com> (raw)
In-Reply-To: <20231106123800.GC47195@ravnborg.org>

Hi Sam,

Thank you for the suggestion!

On 06-Nov-23 18:08, Sam Ravnborg wrote:
> Hi Aradhya,
> 
> On Tue, Oct 31, 2023 at 12:58:46AM +0530, Aradhya Bhatia wrote:
>> With new connector model, tc358767 will not create the connector, when
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and display-controller driver will
>> rely on format negotiation to setup the encoder format.
>>
>> Add the missing input-format negotiation hook in the
>> drm_bridge_funcs to complete DRM_BRIDGE_ATTACH_NO_CONNECTOR support.
>>
>> Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is
>> the case with older model.
>>
>> Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
>> Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com>
>> ---
>>
>> Notes:
>>
>>   * Since I do not have hardware with me, this was just build tested. I would
>>     appreciate it if someone could test and review it, especically somebody, who
>>     uses the bridge for DPI/DSI to eDP format conversion.
>>
>>   * The Toshiba TC358767 bridge is not enabled in arm64 defconfig by default,
>>     when it should be. Hence, I sent a quick patch[0] earlier.
>>
>> [0]: https://lore.kernel.org/all/20231030152834.18450-1-a-bhatia1@ti.com/
>>
>>  drivers/gpu/drm/bridge/tc358767.c | 25 +++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
>> index ef2e373606ba..0affcefdeb1c 100644
>> --- a/drivers/gpu/drm/bridge/tc358767.c
>> +++ b/drivers/gpu/drm/bridge/tc358767.c
>> @@ -1751,6 +1751,30 @@ tc_dpi_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
>>  	return input_fmts;
>>  }
>>  
>> +static u32 *
>> +tc_edp_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/DPI-end bus format */
>> +	input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
>> +	*num_input_fmts = 1;
>> +
>> +	return input_fmts;
>> +}
> 
> You could benefit from using the helper:
> drm_atomic_helper_bridge_propagate_bus_fmt()

You are right!

Upon taking a second look, I realize that the bridge chain works with
MEDIA_BUS_FMT_FIXED bus format, when tc358767 is being used in DPI/DSI
to eDP mode (because the panel-bridge does not have a get_output_bus_fmt
hook, and uses the same helper for its get_input_bus_fmt hook). My patch
creates a deviation from that, by forcing MEDIA_BUS_FMT_RGB888_1X24 even
when eDP is involved.

Using the helper here, will certainly address this deviation.

However, for the DPI/DSI to DP mode, MEDIA_BUS_FMT_RGB888_1X24 bus
format is required, and *just* using the helper as its get_input_bus_fmt
hook, might not be enough.

Since tc358767 is the last bridge in DPI/DSI to DP mode, the
output_fmt parameter get defaulted to MEDIA_BUS_FMT_FIXED too, as there
is no get_output_bus_fmt hook present in the driver. If we simply us
the helper here, the input_fmt will also get set to MEDIA_BUS_FMT_FIXED.
This too is an unwanted deviation.

It seems like the right way to address both the cases, would be by
adding the get_output_bus_fmt hook that sets output_fmt to
MEDIA_BUS_FMT_RGB888_1X24, as well as using the helper as the
get_input_bus_fmt hook.

If this seems good to you too, I will send a new version of Tomi's
series[0] which incorporates this patch.


Regards
Aradhya

[0]:
https://lore.kernel.org/all/20231031-tc358767-v1-0-392081ad9f4b@ideasonboard.com/

WARNING: multiple messages have this Message-ID (diff)
From: Aradhya Bhatia <a-bhatia1@ti.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>,
	Devarsh Thakkar <devarsht@ti.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	DRI Development List <dri-devel@lists.freedesktop.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Robert Foss <rfoss@kernel.org>,
	Francesco Dolcini <francesco@dolcini.it>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Jonas Karlman <jonas@kwiboo.se>,
	Maxime Ripard <mripard@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Jayesh Choudhary <j-choudhary@ti.com>,
	Tomi Valkeinen <tomba@kernel.org>,
	Linux Kernel List <linux-kernel@vger.kernel.org>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Jyri Sarha <jyri.sarha@iki.fi>
Subject: Re: [PATCH] drm/bridge: tc358767: Support input format negotiation hook
Date: Tue, 7 Nov 2023 01:17:03 +0530	[thread overview]
Message-ID: <7ddf0edb-2925-4b7c-ad07-27c030dd0232@ti.com> (raw)
In-Reply-To: <20231106123800.GC47195@ravnborg.org>

Hi Sam,

Thank you for the suggestion!

On 06-Nov-23 18:08, Sam Ravnborg wrote:
> Hi Aradhya,
> 
> On Tue, Oct 31, 2023 at 12:58:46AM +0530, Aradhya Bhatia wrote:
>> With new connector model, tc358767 will not create the connector, when
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and display-controller driver will
>> rely on format negotiation to setup the encoder format.
>>
>> Add the missing input-format negotiation hook in the
>> drm_bridge_funcs to complete DRM_BRIDGE_ATTACH_NO_CONNECTOR support.
>>
>> Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is
>> the case with older model.
>>
>> Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
>> Signed-off-by: Aradhya Bhatia <a-bhatia1@ti.com>
>> ---
>>
>> Notes:
>>
>>   * Since I do not have hardware with me, this was just build tested. I would
>>     appreciate it if someone could test and review it, especically somebody, who
>>     uses the bridge for DPI/DSI to eDP format conversion.
>>
>>   * The Toshiba TC358767 bridge is not enabled in arm64 defconfig by default,
>>     when it should be. Hence, I sent a quick patch[0] earlier.
>>
>> [0]: https://lore.kernel.org/all/20231030152834.18450-1-a-bhatia1@ti.com/
>>
>>  drivers/gpu/drm/bridge/tc358767.c | 25 +++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
>> index ef2e373606ba..0affcefdeb1c 100644
>> --- a/drivers/gpu/drm/bridge/tc358767.c
>> +++ b/drivers/gpu/drm/bridge/tc358767.c
>> @@ -1751,6 +1751,30 @@ tc_dpi_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
>>  	return input_fmts;
>>  }
>>  
>> +static u32 *
>> +tc_edp_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/DPI-end bus format */
>> +	input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
>> +	*num_input_fmts = 1;
>> +
>> +	return input_fmts;
>> +}
> 
> You could benefit from using the helper:
> drm_atomic_helper_bridge_propagate_bus_fmt()

You are right!

Upon taking a second look, I realize that the bridge chain works with
MEDIA_BUS_FMT_FIXED bus format, when tc358767 is being used in DPI/DSI
to eDP mode (because the panel-bridge does not have a get_output_bus_fmt
hook, and uses the same helper for its get_input_bus_fmt hook). My patch
creates a deviation from that, by forcing MEDIA_BUS_FMT_RGB888_1X24 even
when eDP is involved.

Using the helper here, will certainly address this deviation.

However, for the DPI/DSI to DP mode, MEDIA_BUS_FMT_RGB888_1X24 bus
format is required, and *just* using the helper as its get_input_bus_fmt
hook, might not be enough.

Since tc358767 is the last bridge in DPI/DSI to DP mode, the
output_fmt parameter get defaulted to MEDIA_BUS_FMT_FIXED too, as there
is no get_output_bus_fmt hook present in the driver. If we simply us
the helper here, the input_fmt will also get set to MEDIA_BUS_FMT_FIXED.
This too is an unwanted deviation.

It seems like the right way to address both the cases, would be by
adding the get_output_bus_fmt hook that sets output_fmt to
MEDIA_BUS_FMT_RGB888_1X24, as well as using the helper as the
get_input_bus_fmt hook.

If this seems good to you too, I will send a new version of Tomi's
series[0] which incorporates this patch.


Regards
Aradhya

[0]:
https://lore.kernel.org/all/20231031-tc358767-v1-0-392081ad9f4b@ideasonboard.com/

  reply	other threads:[~2023-11-06 19:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 19:28 [PATCH] drm/bridge: tc358767: Support input format negotiation hook Aradhya Bhatia
2023-10-30 19:28 ` Aradhya Bhatia
2023-10-31  6:24 ` Jan Kiszka
2023-10-31  6:24   ` Jan Kiszka
2023-10-31 10:53   ` Tomi Valkeinen
2023-10-31 10:53     ` Tomi Valkeinen
2023-10-31 12:18     ` Jan Kiszka
2023-10-31 12:18       ` Jan Kiszka
2023-10-31 13:06       ` Tomi Valkeinen
2023-10-31 13:06         ` Tomi Valkeinen
2023-11-06 12:38 ` Sam Ravnborg
2023-11-06 12:38   ` Sam Ravnborg
2023-11-06 19:47   ` Aradhya Bhatia [this message]
2023-11-06 19:47     ` Aradhya Bhatia
2023-11-07 15:41     ` Sam Ravnborg
2023-11-07 15:41       ` Sam Ravnborg
2023-11-07 18:31       ` Aradhya Bhatia
2023-11-07 18:31         ` Aradhya Bhatia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ddf0edb-2925-4b7c-ad07-27c030dd0232@ti.com \
    --to=a-bhatia1@ti.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=boris.brezillon@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devarsht@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=francesco@dolcini.it \
    --cc=j-choudhary@ti.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=jyri.sarha@iki.fi \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=nm@ti.com \
    --cc=rfoss@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tomba@kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.