From: Thomas Zimmermann <tzimmermann@suse.de>
To: Tian Tao <tiantao6@hisilicon.com>,
airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com,
alexander.deucher@amd.com, tglx@linutronix.de,
dri-devel@lists.freedesktop.org, xinliang.liu@linaro.org,
linux-kernel@vger.kernel.org
Cc: linuxarm@huawei.com
Subject: Re: [PATCH drm/hisilicon 2/3] drm/hisilicon: Features to support reading resolutions from EDID
Date: Mon, 21 Sep 2020 09:25:19 +0200 [thread overview]
Message-ID: <839cdb82-9611-6279-8ee7-38c92ede4460@suse.de> (raw)
In-Reply-To: <1600658722-35945-3-git-send-email-tiantao6@hisilicon.com>
[-- Attachment #1.1: Type: text/plain, Size: 3449 bytes --]
Hi
Am 21.09.20 um 05:25 schrieb Tian Tao:
> Use drm_get_edid to get the resolution, if that fails, set it to
> a fixed resolution.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 35 ++++++++++++++++++++----
> 1 file changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index 376a05d..e84d381 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -20,13 +20,24 @@
>
> static int hibmc_connector_get_modes(struct drm_connector *connector)
> {
> - int count;
> + int count = 0;
> + void *edid;
> + struct hibmc_connector *hibmc_connector = to_hibmc_connector(connector);
> +
> + edid = drm_get_edid(connector, &hibmc_connector->adapter);
> + if (edid) {
> + drm_connector_update_edid_property(connector, edid);
> + count = drm_add_edid_modes(connector, edid);
There's nothing wrong here, but i think it might be more readable if you do
if (count)
goto out;
within this branch. The out label would be just before the kfree. With
this change, the code with drm_add_modes_noedid() would remain the same.
> + }
>
> - count = drm_add_modes_noedid(connector,
> + if (!edid || count == 0) {
> + count = drm_add_modes_noedid(connector,
> connector->dev->mode_config.max_width,
> connector->dev->mode_config.max_height);
> - drm_set_preferred_mode(connector, 1024, 768);
> + drm_set_preferred_mode(connector, 1024, 768);
> + }
>
> + kfree(edid);
> return count;
> }
>
> @@ -77,10 +88,19 @@ static const struct drm_encoder_funcs hibmc_encoder_funcs = {
> int hibmc_vdac_init(struct hibmc_drm_private *priv)
> {
> struct drm_device *dev = priv->dev;
> + struct hibmc_connector *hibmc_connector = &priv->connector;
> struct drm_encoder *encoder = &priv->encoder;
> - struct drm_connector *connector = &priv->connector;
> + struct drm_connector *connector = &hibmc_connector->base;
> int ret;
>
> + hibmc_connector->dev = dev;
As mentioned, this dev field should be removed.
> +
> + ret = hibmc_ddc_create(hibmc_connector);
> + if (ret) {
> + drm_err(dev, "failed to create connector: %d\n", ret);
The error message appears to be incorrect. (?)
> + return ret;
> + }
> +
> encoder->possible_crtcs = 0x1;
> ret = drm_encoder_init(dev, encoder, &hibmc_encoder_funcs,
> DRM_MODE_ENCODER_DAC, NULL);
> @@ -91,12 +111,15 @@ int hibmc_vdac_init(struct hibmc_drm_private *priv)
>
> drm_encoder_helper_add(encoder, &hibmc_encoder_helper_funcs);
>
> - ret = drm_connector_init(dev, connector, &hibmc_connector_funcs,
> - DRM_MODE_CONNECTOR_VGA);
> + ret = drm_connector_init_with_ddc(dev, connector,
> + &hibmc_connector_funcs,
> + DRM_MODE_CONNECTOR_VGA,
> + &hibmc_connector->adapter);
> if (ret) {
> drm_err(dev, "failed to init connector: %d\n", ret);
> return ret;
> }
> +
> drm_connector_helper_add(connector, &hibmc_connector_helper_funcs);
>
> drm_connector_attach_encoder(connector, encoder);
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 516 bytes --]
next prev parent reply other threads:[~2020-09-21 7:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-21 3:25 [PATCH drm/hisilicon 0/3] " Tian Tao
2020-09-21 3:25 ` [PATCH drm/hisilicon 1/3] drm/hisilicon: Support i2c driver algorithms for bit-shift adapters Tian Tao
2020-09-21 7:20 ` Thomas Zimmermann
2020-09-21 3:25 ` [PATCH drm/hisilicon 2/3] drm/hisilicon: Features to support reading resolutions from EDID Tian Tao
2020-09-21 7:25 ` Thomas Zimmermann [this message]
2020-09-21 3:25 ` [PATCH drm/hisilicon 3/3] drm/hisilicon: Releasing Resources in the Destroy callback Function Tian Tao
2020-09-21 7:26 ` 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=839cdb82-9611-6279-8ee7-38c92ede4460@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=tglx@linutronix.de \
--cc=tiantao6@hisilicon.com \
--cc=xinliang.liu@linaro.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
all inboxes | Powered by JetHome®