lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1600658722-35945-3-git-send-email-tiantao6@hisilicon.com>
Date:   Mon, 21 Sep 2020 11:25:21 +0800
From:   Tian Tao <tiantao6@...ilicon.com>
To:     <airlied@...ux.ie>, <daniel@...ll.ch>, <tzimmermann@...e.de>,
        <kraxel@...hat.com>, <alexander.deucher@....com>,
        <tglx@...utronix.de>, <dri-devel@...ts.freedesktop.org>,
        <xinliang.liu@...aro.org>, <linux-kernel@...r.kernel.org>
CC:     <linuxarm@...wei.com>
Subject: [PATCH drm/hisilicon 2/3] drm/hisilicon: Features to support reading resolutions from EDID

Use drm_get_edid to get the resolution, if that fails, set it to
a fixed resolution.

Signed-off-by: Tian Tao <tiantao6@...ilicon.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);
+	}
 
-	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;
+
+	ret = hibmc_ddc_create(hibmc_connector);
+	if (ret) {
+		drm_err(dev, "failed to create connector: %d\n", ret);
+		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);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ