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.

As of now, there's only one EFI display, so that EDID data always
belongs to this output. This might change if there's ever more than
one EFI display in the system.

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

diff --git a/drivers/gpu/drm/sysfb/efidrm.c b/drivers/gpu/drm/sysfb/efidrm.c
index 5c1876e34a04..af90064a4c04 100644
--- a/drivers/gpu/drm/sysfb/efidrm.c
+++ b/drivers/gpu/drm/sysfb/efidrm.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"
@@ -308,6 +310,10 @@ static struct efidrm_device *efidrm_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;
@@ -413,6 +419,8 @@ static struct efidrm_device *efidrm_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