Enable the connector's EDID property if edid_info contains valid
data. Exports the EDID via sysfs for user-space compositors.

EDID information is not always available. Depending on the system
and kernel configuration, it is either provided by the boot loader
or read by the kernel during early boot stages.

There's only one VESA display, so EDID data always belongs to this
output.

Signed-off-by: Thomas Zimmermann <tzimmerm...@suse.de>
---
 drivers/gpu/drm/sysfb/vesadrm.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/sysfb/vesadrm.c b/drivers/gpu/drm/sysfb/vesadrm.c
index 8a963057ffec..07f59880ce0f 100644
--- a/drivers/gpu/drm/sysfb/vesadrm.c
+++ b/drivers/gpu/drm/sysfb/vesadrm.c
@@ -13,6 +13,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
+#include <drm/drm_edid.h>
 #include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -22,6 +23,7 @@
 #include <drm/drm_modeset_helper_vtables.h>
 #include <drm/drm_probe_helper.h>
 
+#include <video/edid.h>
 #include <video/pixel_format.h>
 
 #include "drm_sysfb_helper.h"
@@ -280,6 +282,10 @@ static struct vesadrm_device *vesadrm_device_create(struct 
drm_driver *drv,
        drm_dbg(dev, "framebuffer format=%p4cc, size=%dx%d, stride=%d bytes\n",
                &format->format, width, height, stride);
 
+#ifdef CONFIG_X86
+       if (drm_edid_header_is_valid(edid_info.dummy) == 8)
+               sysfb->edid = edid_info.dummy;
+#endif
        sysfb->fb_mode = drm_sysfb_mode(width, height, 0, 0);
        sysfb->fb_format = format;
        sysfb->fb_pitch = stride;
@@ -374,6 +380,8 @@ static struct vesadrm_device *vesadrm_device_create(struct 
drm_driver *drv,
        drm_connector_set_panel_orientation_with_quirk(connector,
                                                       
DRM_MODE_PANEL_ORIENTATION_UNKNOWN,
                                                       width, height);
+       if (sysfb->edid)
+               drm_connector_attach_edid_property(connector);
 
        ret = drm_connector_attach_encoder(connector, encoder);
        if (ret)
-- 
2.48.1

Reply via email to