From: Carsten Emde Subject: [PATCH 1/1] drm-set-default-noedid-res.patch Date: Mon, 17 May 2010 01:38:17 +0200 Message-ID: <20100516234834.547858110@osadl.org> References: <20100516233816.204382607@osadl.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from toro.web-alm.net (toro.web-alm.net [62.245.132.31]) by gabe.freedesktop.org (Postfix) with ESMTP id 286949E762 for ; Sun, 16 May 2010 17:26:30 -0700 (PDT) Content-Disposition: inline; filename=drm-set-default-noedid-res.patch List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: David Airlie Cc: DRI , Carsten Emde List-Id: dri-devel@lists.freedesktop.org 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 "x". If specified, it will override the default. Example: drm.noedidres=1280x1024 Signed-off-by: Carsten Emde --- 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 "x", 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 \"x\", 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;