A default resolution of 1024x768 is used, if there are no
EDID data. However, this may not always be appropriate.

This patch introduces the kernel parameter drm.noedidres
that has the format "<width>x<height>". If specified, it will
override the default.

Example: drm.noedidres=1280x1024

Signed-off-by: Carsten Emde <c.e...@osadl.org>

---
 drivers/gpu/drm/drm_crtc_helper.c |   14 +++++++++++++-
 drivers/gpu/drm/drm_stub.c        |    5 +++++
 include/drm/drmP.h                |    1 +
 3 files changed, 19 insertions(+), 1 deletion(-)

Index: head/drivers/gpu/drm/drm_crtc_helper.c
===================================================================
--- head.orig/drivers/gpu/drm/drm_crtc_helper.c
+++ head/drivers/gpu/drm/drm_crtc_helper.c
@@ -110,9 +110,21 @@ int drm_helper_probe_single_connector_mo
 
        count = (*connector_funcs->get_modes)(connector);
        if (!count) {
-               count = drm_add_modes_noedid(connector, 1024, 768);
+               unsigned long x = 1024, y = 768;
+
+               if (drm_noedidres != NULL) {
+                       unsigned long nx, ny;
+
+                       if (sscanf(drm_noedidres, "%lux%lu", &nx, &ny) == 2) {
+                               x = nx;
+                               y = ny;
+                       }
+               }
+               count = drm_add_modes_noedid(connector, x, y);
                if (!count)
                        return 0;
+               DRM_DEBUG_KMS("no EDID, added mode %lux%lu to connector %s\n",
+                   x, y, drm_get_connector_name(connector));
        }
 
        drm_mode_connector_list_update(connector);
Index: head/drivers/gpu/drm/drm_stub.c
===================================================================
--- head.orig/drivers/gpu/drm/drm_stub.c
+++ head/drivers/gpu/drm/drm_stub.c
@@ -40,12 +40,17 @@
 unsigned int drm_debug = 0;    /* 1 to enable debug output */
 EXPORT_SYMBOL(drm_debug);
 
+char *drm_noedidres;           /* screen "<width>x<height>", if no EDID data */
+EXPORT_SYMBOL(drm_noedidres);
+
 MODULE_AUTHOR(CORE_AUTHOR);
 MODULE_DESCRIPTION(CORE_DESC);
 MODULE_LICENSE("GPL and additional rights");
 MODULE_PARM_DESC(debug, "Enable debug output");
+MODULE_PARM_DESC(noedidres, "Screen \"<width>x<height>\", if no EDID data");
 
 module_param_named(debug, drm_debug, int, 0600);
+module_param_named(noedidres, drm_noedidres, charp, 0600);
 
 struct idr drm_minors_idr;
 
Index: head/include/drm/drmP.h
===================================================================
--- head.orig/include/drm/drmP.h
+++ head/include/drm/drmP.h
@@ -1356,6 +1356,7 @@ extern int drm_get_dev(struct pci_dev *p
 extern void drm_put_dev(struct drm_device *dev);
 extern int drm_put_minor(struct drm_minor **minor);
 extern unsigned int drm_debug;
+extern char *drm_noedidres;
 
 extern struct class *drm_class;
 extern struct proc_dir_entry *drm_proc_root;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to