dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/4] drm/simple_kms_helper: enable use of external encoder
Date: Thu, 7 Feb 2019 10:17:06 +0100	[thread overview]
Message-ID: <20190207091706.GQ3271@phenom.ffwll.local> (raw)
In-Reply-To: <20190207083647.20615-2-linus.walleij@linaro.org>

On Thu, Feb 07, 2019 at 09:36:44AM +0100, Linus Walleij wrote:
> This makes it possible to pass a connector with an already
> attached external encoder into the simple KMS helper.
> 
> This is helpful for my MCDE drivers, as it is pretty simple
> but uses DSI to communicate with the displays and bridges.
> DSI requires the use of the DSI bus which in turn requires
> us to set up a custom connector from the display driver.

So the idea was that you'd just use a bridge for this, if you need more
than a dummy encoder. I'm a bit worried about mission creep for the simple
helpers, sooner or later we'll add extensions and then we're back to full
kms, except it's a hairball of classic midlayer mistake ...

See drm_simple_display_pipe_attach_bridge().

Cheers, Daniel

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpu/drm/drm_simple_kms_helper.c | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 917812448d1b..e7499b939235 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -266,7 +266,7 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
>  			const uint64_t *format_modifiers,
>  			struct drm_connector *connector)
>  {
> -	struct drm_encoder *encoder = &pipe->encoder;
> +	struct drm_encoder *encoder;
>  	struct drm_plane *plane = &pipe->plane;
>  	struct drm_crtc *crtc = &pipe->crtc;
>  	int ret;
> @@ -289,10 +289,23 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
>  	if (ret)
>  		return ret;
>  
> -	encoder->possible_crtcs = drm_crtc_mask(crtc);
> -	ret = drm_encoder_init(dev, encoder, &drm_simple_kms_encoder_funcs,
> -			       DRM_MODE_ENCODER_NONE, NULL);
> -	if (ret || !connector)
> +	/* Other encoder already attached to the connector */
> +	if (connector->encoder_ids[0] != 0) {
> +		encoder = drm_encoder_find(connector->dev, NULL,
> +					   connector->encoder_ids[0]);
> +		encoder->possible_crtcs = drm_crtc_mask(crtc);
> +		DRM_INFO("an encoder is already attached to the connector\n");
> +	} else {
> +		encoder = &pipe->encoder;
> +		encoder->possible_crtcs = drm_crtc_mask(crtc);
> +		ret = drm_encoder_init(dev, encoder,
> +				       &drm_simple_kms_encoder_funcs,
> +				       DRM_MODE_ENCODER_NONE, NULL);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	if (!connector)
>  		return ret;
>  
>  	return drm_connector_attach_encoder(connector, encoder);
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-02-07  9:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-07  8:36 [PATCH 0/4] DRM driver for ST-Ericsson MCDE Linus Walleij
2019-02-07  8:36 ` [PATCH 1/4] drm/simple_kms_helper: enable use of external encoder Linus Walleij
2019-02-07  9:17   ` Daniel Vetter [this message]
2019-02-07 21:02     ` Linus Walleij
2019-02-07 21:43       ` Daniel Vetter
2019-02-07  8:36 ` [PATCH 2/4] drm/mcde: Add device tree bindings Linus Walleij
2019-02-25 22:31   ` Rob Herring
2019-02-07  8:36 ` [PATCH 3/4] drm/mcde: Add new driver for ST-Ericsson MCDE Linus Walleij
2019-02-07 22:22   ` Daniel Vetter
2019-02-07 22:28     ` Daniel Vetter
2019-02-08 19:31   ` Sam Ravnborg
2019-02-07  8:36 ` [PATCH 4/4] ARM: dts: Ux500: Add MCDE and Samsung display Linus Walleij

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=20190207091706.GQ3271@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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