All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aaron Kling" <webgeek1234@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 3/4] drm/panel: visionox-vtdr6130: Modularize panel config
Date: Fri, 25 Sep 2026 07:15:39 +0000	[thread overview]
Message-ID: <20260925071540.569431F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260925-rp6-panel-v2-3-19c425e523de@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] drm/panel: shared global state mutation in DSC config
- [Medium] drm/panel: ignores num_modes and drops all but first display mode
- [Low] drm/panel: unused bpc field in panel descriptor
--

commit 9e3a1ea8fd3c45699472995a794b6b527ce2a3ff
Author: Aaron Kling <webgeek1234@gmail.com>

drm/panel: visionox-vtdr6130: Modularize panel config
    
The vtdr6130 is a DDIC, a common chip that is used by multiple panels.
Prepare the driver for more panels.

> diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
> index b66d6c7128c75..278f5acc2d661 100644
> --- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
> +++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
[ ... ]
> @@ -200,24 +213,48 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)
[ ... ]
> +static struct visionox_vtdr6130_desc visionox_vtdr6130_panel_desc = {
> +	.modes = visionox_vtdr6130_modes,
> +	.num_modes = ARRAY_SIZE(visionox_vtdr6130_modes),
> +	.bpc = 8,

[Severity: Low]
Does this code forget to propagate the bpc field? It looks like this field
is initialized here but never assigned to connector->display_info.bpc in the
visionox_vtdr6130_get_modes() callback.

> +	.lanes = 4,
> +	.format = MIPI_DSI_FMT_RGB888,
> +	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET |
> +		      MIPI_DSI_CLOCK_NON_CONTINUOUS,
> +	.init_sequence = visionox_vtdr6130_on,
> +	.dsc = {
> +		.dsc_version_major = 0x1,
> +		.dsc_version_minor = 0x2,
> +		.slice_height = 40,
> +		.slice_width = 540,
> +		.slice_count = 2,
> +		.bits_per_component = 8,
> +		.bits_per_pixel = 8 << 4,
> +		.block_pred_enable = true,
> +	},
>  };
>  
>  static int visionox_vtdr6130_get_modes(struct drm_panel *panel,
>  				       struct drm_connector *connector)
>  {
> +	struct visionox_vtdr6130 *ctx = to_visionox_vtdr6130(panel);
>  	struct drm_display_mode *mode;
>  
> -	mode = drm_mode_duplicate(connector->dev, &visionox_vtdr6130_mode);
> +	mode = drm_mode_duplicate(connector->dev, ctx->desc->modes);

[Severity: Medium]
Will this silently drop display modes if the panel has more than one?
Calling drm_mode_duplicate() directly on ctx->desc->modes without a loop
ignores ctx->desc->num_modes, which means only the first mode in the array
gets registered.

>  	if (!mode)
>  		return -ENOMEM;
>  
[ ... ]
> @@ -321,17 +358,11 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)
>  		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
>  				     "Failed to get reset-gpios\n");
>  
> +	ctx->desc = (struct visionox_vtdr6130_desc *)of_device_get_match_data(dev);

[Severity: High]
Does casting away const from of_device_get_match_data() create a risk of
global state corruption?

By embedding the dsc configuration in a static global struct and pointing
dsi->dsc to it:

	dsi->dsc = &ctx->desc->dsc;

it gets passed to the DSI host controller. Later, the
drm_dsc_compute_rc_parameters() function mutates dsi->dsc in-place.
Because it's a shared global struct, this can lead to data races and
corruption if multiple panels exist.

Should the dsc config be copied into per-instance data instead, and the
descriptor be made static const?

> +	if (!ctx->desc)
> +		return -ENODEV;
> +
>  	ctx->dsi = dsi;
>  	mipi_dsi_set_drvdata(dsi, ctx);
>  
> -	ctx->dsc.dsc_version_major = 0x1;
> -	ctx->dsc.dsc_version_minor = 0x2;
> -	ctx->dsc.slice_height = 40;
> -	ctx->dsc.slice_width = 540;
> -	ctx->dsc.slice_count = 2;
> -	ctx->dsc.bits_per_component = 8;
> -	ctx->dsc.bits_per_pixel = 8 << 4;
> -	ctx->dsc.block_pred_enable = true;
> -
> -	dsi->dsc = &ctx->dsc;
> -	dsi->lanes = 4;
> -	dsi->format = MIPI_DSI_FMT_RGB888;
> -	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET |
> -			  MIPI_DSI_CLOCK_NON_CONTINUOUS;
> +	dsi->dsc = &ctx->desc->dsc;
> +	dsi->lanes = ctx->desc->lanes;
> +	dsi->format = ctx->desc->format;
> +	dsi->mode_flags = ctx->desc->mode_flags;
>  	ctx->panel.prepare_prev_first = true;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260925-rp6-panel-v2-0-19c425e523de@gmail.com?part=3

  reply	other threads:[~2026-09-25  7:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  7:08 [PATCH v2 0/4] drm/panel: Support Retroid Pocket 6 panel Aaron Kling via B4 Relay
2026-09-25  7:08 ` Aaron Kling
2026-09-25  7:08 ` [PATCH v2 1/4] dt-bindings: display: visionox,vtdr6130: Add " Aaron Kling via B4 Relay
2026-09-25  7:08   ` Aaron Kling
2026-09-25  7:12   ` sashiko-bot
2026-09-25  7:08 ` [PATCH v2 2/4] drm/panel: visionox-vtdr6130: Add panel orientation support Aaron Kling via B4 Relay
2026-09-25  7:08   ` Aaron Kling
2026-09-25  7:08 ` [PATCH v2 3/4] drm/panel: visionox-vtdr6130: Modularize panel config Aaron Kling via B4 Relay
2026-09-25  7:08   ` Aaron Kling
2026-09-25  7:15   ` sashiko-bot [this message]
2026-09-25  8:48   ` Neil Armstrong
2026-09-25  7:08 ` [PATCH v2 4/4] drm/panel: visionox-vtdr6130: Add Retroid Pocket 6 panel Aaron Kling via B4 Relay
2026-09-25  7:08   ` Aaron Kling
2026-09-25  7:16   ` sashiko-bot
2026-10-02  9:16 ` [PATCH v2 0/4] drm/panel: Support " Neil Armstrong

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=20260925071540.569431F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=webgeek1234@gmail.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.