The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Liviu Dudau <liviu.dudau@arm.com>
To: Raveendra Talabattula <raveendra.talabattula@arm.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
	james.qian.wang@arm.com, vincenzo.frascino@arm.com,
	nayden.kanchev@arm.com, charvi.mehta@arm.com,
	Asad Malik <asad.malik@arm.com>
Subject: Re: [PATCH 2/2] drm/komeda: Initialize encoder possible_clones
Date: Tue, 28 Jul 2026 15:20:03 +0100	[thread overview]
Message-ID: <ami6kzBg7zGi4WLs@e142607> (raw)
In-Reply-To: <20260721135227.439413-3-raveendra.talabattula@arm.com>

On Tue, Jul 21, 2026 at 02:52:27PM +0100, Raveendra Talabattula wrote:
> Komeda leaves encoder->possible_clones unset, so it stays at 0 for every
> encoder. When userspace asks for writeback, the DRM atomic checks

Can you tell me more about this? What are you trying to do with the writeback?

Please note that there is a patch series that changes the way encoders get
created for the writeback connectors, so that can potentially affect your
use case.

> reject the configuration because no encoder is marked as clone-compatible,
> leading to errors such as:
> 
> 	crtc96 failed valid clone check for mask 0x5

The error you're seeing here is due to the encoder having a non-zero "possible_clones"
which shows there is an error in your setup earlier and nothing to do with komeda.

> 
> Komeda does not impose per-encoder clone restrictions, [...]

Komeda doesn't care about the encoders at all as it is meant to be agnostic
to whatever encoder is used.

> [...] so initialize
> possible_clones for all registered encoders to the full encoder mask
> after encoder creation. This fixes writeback validation.
> 
> Signed-off-by: Asad Malik <asad.malik@arm.com>
> Signed-off-by: Raveendra Talabattula <raveendra.talabattula@arm.com>
> ---
>  .../gpu/drm/arm/display/komeda/komeda_kms.c   | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> index 6ed504099188..0dcc8c05e86b 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> @@ -276,7 +276,10 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
>  {
>  	struct komeda_kms_dev *kms;
>  	struct drm_device *drm;
> +	struct drm_encoder *encoder;
>  	int err;
> +	/* Bitmap of all encoders, assigned to each encoder's possible_clones. */
> +	u32 clone_mask = 0;
>  
>  	kms = devm_drm_dev_alloc(mdev->dev, &komeda_kms_driver,
>  				 struct komeda_kms_dev, base);
> @@ -311,6 +314,23 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
>  
>  	drm_mode_config_reset(drm);
>  
> +	/*
> +	 * Build the full possible_clones mask once. drm_encoder_index()
> +	 * returns the bit position assigned to each encoder and BIT() converts
> +	 * that index into the corresponding mask value.
> +	 *
> +	 * Komeda does not have per-encoder clone restrictions, so every encoder
> +	 * gets the same mask and is advertised as clone-compatible with all
> +	 * other registered encoders.
> +	 */
> +	drm_for_each_encoder(encoder, drm) {
> +		clone_mask |= BIT(drm_encoder_index(encoder));
> +	}
> +
> +	drm_for_each_encoder(encoder, drm) {
> +		encoder->possible_clones = clone_mask;
> +	}

You're modifying all the encoders in the system here which is not the right thing.

Best regards,
Liviu

> +
>  	err = devm_request_irq(drm->dev, mdev->irq,
>  			       komeda_kms_irq_handler, IRQF_SHARED,
>  			       drm->driver->name, drm);
> -- 
> 2.43.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

  reply	other threads:[~2026-07-28 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 13:52 [PATCH 0/2] drm/komeda: Fix GLB_CORE_ID parsing and initialize encoder clone masks Raveendra Talabattula
2026-07-21 13:52 ` [PATCH 1/2] drm/komeda: Fix bits parsing of GLB_CORE_ID Raveendra Talabattula
2026-07-28 14:06   ` Liviu Dudau
2026-07-21 13:52 ` [PATCH 2/2] drm/komeda: Initialize encoder possible_clones Raveendra Talabattula
2026-07-28 14:20   ` Liviu Dudau [this message]
2026-07-30 13:43     ` Raveendra Talabattula
2026-07-31 14:08       ` Liviu Dudau

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=ami6kzBg7zGi4WLs@e142607 \
    --to=liviu.dudau@arm.com \
    --cc=airlied@gmail.com \
    --cc=asad.malik@arm.com \
    --cc=charvi.mehta@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=james.qian.wang@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nayden.kanchev@arm.com \
    --cc=raveendra.talabattula@arm.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=vincenzo.frascino@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox