drm-set-default-noedid-res.patch
Subsystems (2)
cover drm-set-default-noedid-res.patch
Hi,
Some monitors and, more often, kvm switches do not provide working EDID data. KMS based X configurations in recent server versions no longer allow to override the screen resolution which makes it impossible to correctly adapt the screen resolution to the monitor in use.
This patch allows to define the fallback screen resolution to something else than the default 1024x768.
Carsten.
PATCH 1/1 drm-set-default-noedid-res.patch
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
--- 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(-)
drivers/gpu/drm/drm_crtc_helper.c +13 -1
@@ -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);
drivers/gpu/drm/drm_stub.c +5 -0
@@ -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;
include/drm/drmP.h +1 -0
@@ -1356,6 +1356,7 @@ extern int drm_get_dev(struct pci_dev *pextern 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;
Dave Airlie
maintainerQuoted 9 lines · Carsten Emde
Hi,
Some monitors and, more often, kvm switches do not provide working EDID data. KMS based X configurations in recent server versions no longer allow to override the screen resolution which makes it impossible to correctly adapt the screen resolution to the monitor in use.
This patch allows to define the fallback screen resolution to something else than the default 1024x768.
Does video=800x600 not work for you?
Dave.
Dave,
Quoted 7 lines
Quoted 6 lines
Some monitors and, more often, kvm switches do not provide working EDID data. KMS based X configurations in recent server versions no longer allow to override the screen resolution which makes it impossible to correctly adapt the screen resolution to the monitor in use. This patch allows to define the fallback screen resolution to something else than the default 1024x768.
Does video=800x600 not work for you?
No, this only sets the tty resolution; the resolution of the X server appears to be limited to the maximum as specified at line 123 in drivers/gpu/drm/drm_crtc_helper.c:
drm_add_modes_noedid(connector, x, y);
kernel parameter TTY resolution Max. X resolution
- 640x480 1024x768 vga=0x31b 1280x1024 1024x768 video=1280x1024 1280x1024 1024x768 video=1280x1024 vga=0x31b 1280x1024 1024x768 drm.noedidres 1280x1024 1280x1024 drm.noedidres vga=0x31b 1280x1024 1280x1024
X.Org X Server 1.7.6
Build ID: xorg-x11-server 1.7.6-4.fc12
Carsten.
Dave,
Quoted 7 lines
Quoted 6 lines
Some monitors and, more often, kvm switches do not provide working EDID data. KMS based X configurations in recent server versions no longer allow to override the screen resolution which makes it impossible to correctly adapt the screen resolution to the monitor in use. This patch allows to define the fallback screen resolution to something else than the default 1024x768.
Does video=800x600 not work for you?
I did a lot more tests; apparently, things are even more difficult than expected.
These are my observations (all with Radeon X1950 and radeon driver):
- On the monitor side:
In addition to the known quirks, the EDID data may not be accessible or erroneous. The original patch only solved the situation of unavailable EDID data. A frequent reason of erroneous or unavailable EDID data is the use of suboptimally designed KVM switches that are unable to probe the connected monitor and send no or fantasy EDID data.
- On the Xorg side:
Older radeon drivers recognize the options "IgnoreEDID" and "NoDDC". Using this trick, Xorg can be forced to disregard any EDID data and use the resolution as specified in xorg.conf.
Less old radeon drivers still recognize the option "IgnoreEDID", but this does not work any longer, since the option "NoDDC" has been abandoned. Such drivers rely on correct EDID data.
Current radeon drivers should have the option "CustomEDID" to override the probed EDID data (at least this is what the manual says), but I couldn't get it working. The log file insists on saying that the option "CustomEDID" is not used. These drivers also rely on correct EDID data.
My conclusion is, that the right place to solve the situation is in the kernel. The attached patch makes the sysfs edid entry writable. If the name of an existing binary EDID data file in /lib/firmware is supplied such as
cd /sys/devices/pci0000:00/0000:00:07.0/0000:05:00.0/drm/card0 echo dvi_0.bin >card0-DVI-I-1/edid
the related connector will be set to these EDID data. Any probing is then disabled. To restore the previous behavior and to re-enable monitor probing, an empty string or a single line delimiter must be sent:
echo >card0-DVI-I-1/edid
I have tested the patch successfully in a number of different configurations. When userspace setup tools such as gnome-display-properties are used, the name and resolution data of the provided (fake) EDID data are correctly decoded.
When compared to the various X hacks I tried, I find this solution better, since it solves the problem at a place where it belongs. This is in line with the observation that EDID related functionality appears to fade out of X drivers.
Does this make sense?
Carsten.
Use the firmware interface to load binary EDID data from a file and use them to assign monitor data to a video connector.
--- drivers/gpu/drm/drm_crtc_helper.c | 7 ++++ drivers/gpu/drm/drm_edid.c | 5 +++ drivers/gpu/drm/drm_sysfs.c | 63 +++++++++++++++++++++++++++++++++++++- include/drm/drm_crtc.h | 1 4 files changed, 75 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_crtc_helper.c +7 -0
@@ -87,6 +87,13 @@ int drm_helper_probe_single_connector_moint mode_flags =0 ;DRM_DEBUG_KMS ("%s\n" ,drm_get_connector_name (connector)); + +if (connector->edid_pinned) { +list_for_each_entry (mode, &connector->modes, head) + count++; +return count; + } +/* set all modes to the unverified state */ list_for_each_entry_safe (mode, t, &connector->modes, head) mode->status =MODE_UNVERIFIED ;
drivers/gpu/drm/drm_edid.c +5 -0
@@ -1214,6 +1214,11 @@ struct edid *drm_get_edid(struct drm_conint ret;struct edid *edid; +if (connector->edid_pinned) { + edid = (struct edid *) connector->display_info.raw_edid; + goto end; + } + edid =kmalloc (EDID_LENGTH * (DRM_MAX_EDID_EXT_NUM +1 ),GFP_KERNEL );if (edid ==NULL ) {
drivers/gpu/drm/drm_sysfs.c +62 -1
86 lines not on this page · raw message
include/drm/drm_crtc.h +1 -0
@@ -508,6 +508,7 @@ struct drm_connector {struct list_head user_modes;struct drm_property_blob *edid_blob_ptr; +int edid_pinned;u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY ];uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY ];
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel