From: Daniel Vetter <daniel@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org, kraxel@redhat.com,
airlied@redhat.com, sam@ravnborg.org, emil.velikov@collabora.com
Subject: Re: [PATCH 1/7] drm/udl: Init connector before encoder and CRTC
Date: Thu, 28 Nov 2019 15:02:40 +0100 [thread overview]
Message-ID: <20191128140240.GV406127@phenom.ffwll.local> (raw)
In-Reply-To: <20191126134707.22385-2-tzimmermann@suse.de>
On Tue, Nov 26, 2019 at 02:47:01PM +0100, Thomas Zimmermann wrote:
> To mimic simple-pipe, we initialize the connector before the rest of
> the display pipeline.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/udl/udl_connector.c | 7 +++----
> drivers/gpu/drm/udl/udl_drv.h | 2 +-
> drivers/gpu/drm/udl/udl_modeset.c | 16 ++++++++++++++--
> 3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
> index b4ae3e89a7b4..68e113ae44f7 100644
> --- a/drivers/gpu/drm/udl/udl_connector.c
> +++ b/drivers/gpu/drm/udl/udl_connector.c
> @@ -123,14 +123,14 @@ static const struct drm_connector_funcs udl_connector_funcs = {
> .set_property = udl_connector_set_property,
> };
>
> -int udl_connector_init(struct drm_device *dev, struct drm_encoder *encoder)
> +struct drm_connector *udl_connector_init(struct drm_device *dev)
> {
> struct udl_drm_connector *udl_connector;
> struct drm_connector *connector;
>
> udl_connector = kzalloc(sizeof(struct udl_drm_connector), GFP_KERNEL);
> if (!udl_connector)
> - return -ENOMEM;
> + return ERR_PTR(-ENOMEM);
>
> connector = &udl_connector->connector;
> drm_connector_init(dev, connector, &udl_connector_funcs,
> @@ -138,9 +138,8 @@ int udl_connector_init(struct drm_device *dev, struct drm_encoder *encoder)
> drm_connector_helper_add(connector, &udl_connector_helper_funcs);
>
> drm_connector_register(connector);
While at it, might want to ditch this line, it's a no-op and only meant to
be called by drivers for hotplugged connectors. But kinda separate patch,
plus there's an entire pile of drivers which get this wrong.
> - drm_connector_attach_encoder(connector, encoder);
> connector->polled = DRM_CONNECTOR_POLL_HPD |
> DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
>
> - return 0;
> + return connector;
> }
> diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h
> index 66cbe04f832a..8dc04717abac 100644
> --- a/drivers/gpu/drm/udl/udl_drv.h
> +++ b/drivers/gpu/drm/udl/udl_drv.h
> @@ -78,7 +78,7 @@ struct udl_device {
> int udl_modeset_init(struct drm_device *dev);
> void udl_modeset_restore(struct drm_device *dev);
> void udl_modeset_cleanup(struct drm_device *dev);
> -int udl_connector_init(struct drm_device *dev, struct drm_encoder *encoder);
> +struct drm_connector *udl_connector_init(struct drm_device *dev);
>
> struct drm_encoder *udl_encoder_init(struct drm_device *dev);
>
> diff --git a/drivers/gpu/drm/udl/udl_modeset.c b/drivers/gpu/drm/udl/udl_modeset.c
> index 91af25caed64..5bb1522036c7 100644
> --- a/drivers/gpu/drm/udl/udl_modeset.c
> +++ b/drivers/gpu/drm/udl/udl_modeset.c
> @@ -421,7 +421,10 @@ static const struct drm_mode_config_funcs udl_mode_funcs = {
>
> int udl_modeset_init(struct drm_device *dev)
> {
> + struct drm_connector *connector;
> struct drm_encoder *encoder;
> + int ret;
> +
> drm_mode_config_init(dev);
>
> dev->mode_config.min_width = 640;
> @@ -435,13 +438,22 @@ int udl_modeset_init(struct drm_device *dev)
>
> dev->mode_config.funcs = &udl_mode_funcs;
>
> + connector = udl_connector_init(dev);
> + if (IS_ERR(connector)) {
> + ret = PTR_ERR(connector);
> + goto err_drm_mode_config_cleanup;
> + }
> +
> udl_crtc_init(dev);
>
> encoder = udl_encoder_init(dev);
> -
> - udl_connector_init(dev, encoder);
> + drm_connector_attach_encoder(connector, encoder);
>
> return 0;
> +
> +err_drm_mode_config_cleanup:
> + drm_mode_config_cleanup(dev);
> + return ret;
> }
>
> void udl_modeset_restore(struct drm_device *dev)
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> --
> 2.23.0
>
--
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
next prev parent reply other threads:[~2019-11-28 14:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 13:47 [PATCH 0/7] drm/udl: Convert to simple-pipe helpers and clean up Thomas Zimmermann
2019-11-26 13:47 ` [PATCH 1/7] drm/udl: Init connector before encoder and CRTC Thomas Zimmermann
2019-11-28 14:02 ` Daniel Vetter [this message]
2019-11-26 13:47 ` [PATCH 2/7] drm/udl: Convert to struct drm_simple_display_pipe Thomas Zimmermann
2019-11-28 14:09 ` Daniel Vetter
2019-11-26 13:47 ` [PATCH 3/7] drm/udl: Remove unused encoder and CRTC code Thomas Zimmermann
2019-11-28 14:10 ` Daniel Vetter
2019-11-26 13:47 ` [PATCH 4/7] drm/udl: Set preferred color depth to 16 bpp Thomas Zimmermann
2019-11-26 13:47 ` [PATCH 5/7] drm/udl: Convert to drm_atomic_helper_dirtyfb() Thomas Zimmermann
2019-11-28 14:13 ` Daniel Vetter
2019-11-29 18:04 ` Emil Velikov
2019-11-29 18:38 ` Daniel Vetter
2019-11-26 13:47 ` [PATCH 6/7] drm/udl: Remove struct udl_device.active_fb_16 Thomas Zimmermann
2019-11-28 14:14 ` Daniel Vetter
2019-11-26 13:47 ` [PATCH 7/7] drm/udl: Move udl_handle_damage() into udl_modeset.c Thomas Zimmermann
2019-11-28 14:15 ` Daniel Vetter
2019-12-02 9:27 ` Emil Velikov
2019-12-03 11:31 ` Thomas Zimmermann
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=20191128140240.GV406127@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.velikov@collabora.com \
--cc=kraxel@redhat.com \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
/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