Fixing XRANDR Caused High Latency with KDE4 - Display Flickering - Freezing Videos

If you're using KDE4 you might be disappointed by a bug that causes high latencies and or a flickering (second) display. Here's a really easy explanation how to permanently fix that right now.

Go to System Settings, Advanced, System Services.


Then in the bottom uncheck "Detecting RANDR (monitor) changes", then press Stop on the bottom right. The problem disappears immediately now.

You may read more about the bug here and here. Thanks to Electricroo for the fix. By the way, you know you have this bug, if DDC EDID probes ("(II) intel(0): Printing DDC gathered Modelines, (II) intel(0): EDID vendor") keep showing up in tail -f /var/log/Xorg.0.log and you know it's fixed once they disappear. If you don't have that message in your X log, your most likely don't have this issue.

Note that this will stop KDE from automatically detecting when you plug in an external monitor. But as the configuration doesn't yet work well anyway I think there's no detriment. And of course there will be other causes for latency, but this one was the only real problem for me.

Update:
Unfortunately it seems like the fix does not (currently) work for KDE 4.2. If you don't find the service in the list in KDE 4.1.x, this might be a good sign and show that it's already disabled. If you still find the messages in Xorg.0.log, the please post a comment and let's try to find a way around it. If there's no way to disable it, all you can do is file a bug for your distribution and refer to the here mentioned information.

The bug has already been reported for KDE 4.1 at the kde bugzilla. Please participate there if you see this problem in KDE 4.2. You might also help to get a fix by voting for it. Until that time you can probably use my previously posted dirty hack that works around the kde session management service (ksmserver) by starting the KDE4 environment manually - please let me know if this works for KDE 4.2 as well.

You can also try to manually disable all outputs you don't need in Xorg, but the instructions vary significantly between different graphics cards, setups, distributions etc. And of course that won't help you if you're using a dual screen setup. If you find instructions on how to do that, please let me know in the comments.

Update2:
For KDE 4.2, check your config file:
grep polling ~/.local/screen-configurations.xml
If it says polling false and after upgrading KDE to 4.2 you suddenly get the messages described above in Xorg.log, especially if the fix above worked for you before, then there's a bug somewhere in KDE. If you get polling true, you can try to reconfigure KDE to make it stop polling. (You can just edit the file and change true to false.)

Related: Automatically switch to connected External Display on Boot with XRandR shows you how to automatically set up your displays without just a single screen, so that you can disable xrandr.

15 comments:

  1. I've checked both madriva cooker and fedora 10, both fully updated, and cannot find "Detecting RANDR" listed in System Settings. What version of kde4 are you using and which distro?

    ReplyDelete
  2. This does not work since 4.2. The KDE RANDR service is now an on-demand service and it appears in the upper list of services, which cannot be disabled.

    I have a dual-monitor setup and the external monitor supports HDMI but I am forced to use it in VGA mode (and loss of sharpness) because in HDMI mode, the abovementioned service causes the monitor to flicker miserably.

    I sincerely believe it should be moved to user-controllable list of services.

    Cheers.

    ReplyDelete
  3. @Patrick: I'm using Ubuntu Intrepid with KDE 4.1.4.

    @KenP: That's too bad. AFAIK the latency there is not as big a problem, but there should still be a way to disable it. Maybe if you find the kde randr library and rename it?

    Yes, the service really should still be "disableble" :)
    Have you filed a bug report? Might still make it into the next 4.2.x release. If someone has an idea, please post a comment!

    ReplyDelete
  4. I am using Kubuntu with KDE 4.2.1. I don't see this service in eeither lists in Service Manager. I do though see the "DDC EDID probes" messages in
    tail -f /var/log/Xorg.0.log

    ReplyDelete
  5. Thanks, cedarlab. That's was to be expected, unfortunately.
    Has anyone tried the dirty hack? If you're interested like I could make the "installation" a bit easier.

    ReplyDelete
  6. @cedarlab: The service now appears as "KDED-module for screen management" under "Load on demand services" when you go to System Settings -> Advanced -> Service Manager.

    @D.: what dirty hack?

    @linux-tipps: Yes, I have re-opened the earlier bug# 170920 and updated with my comments.

    ReplyDelete
  7. @KenP: Thanks for the tip, unfortunately, that list is not accessible, yet!

    @D.: No I haven't yet. Tell you the truth, I don't notice any delay/flickering issues on my laptop. I am trying not to mess what I have and keep it exactly as it updates from the repositories without any hacks. but I will be building another for testing. If you could make the hack easier I will enticed.

    Thanks

    ReplyDelete
  8. @cedarlab: Could you tell us more about your setup? Especially what Xorg version, what grahpics driver?

    In KDE 4.2.x the flickering/hanging/stuttering would only be noticed once every few minutes (every time a new DDC message shows up in the log). If it doesn't, you're lucky! Your graphics card driver might have a work around for the issue.

    ReplyDelete
  9. D.
    Sorry about the dealy.
    ------------------------------
    X.Org X Server 1.5.2
    Release Date: 10 October 2008
    X Protocol Version 11, Revision 0
    Build Operating System: Linux 2.6.24-24-xen i686 Ubuntu
    Current Operating System: Linux abe-kde4b2 2.6.27-14-generic #1 SMP Fri Mar 13 18:00:20 UTC 2009 i686
    Build Date: 26 March 2009 03:47:28PM
    xorg-server 2:1.5.2-2ubuntu3.1+ppa2 (buildd@rothera.buildd)
    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
    Module Loader present
    ------------------------------------
    *-display:1 UNCLAIMED
    description: Display controller
    product: Mobile GM965/GL960 Integrated Graphics Controller
    vendor: Intel Corporation
    physical id: 2.1
    bus info: pci@0000:00:02.1
    version: 0c
    width: 64 bits
    clock: 33MHz
    capabilities: pm bus_master cap_list
    configuration: latency=0

    ReplyDelete
  10. Unfortunately the fix didn't make it into 4.2.2 it seems. cedarlab, could you post your ~/.local/screen-configurations.xml. It might be related to "kephal" in KDE 4.2, but I didn't find much information about that. Basically the KDE developers are now arguing that it might be a video driver issue.

    If people here are all using the intel driver that might well be the problem, at least for 4.2.x. But it's still weird that the symptoms seem to be exactly the same...

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. Linux-tipps:

    The posting processor doesn't like server scripts. So I replaced the < with ? to make it acceptable.

    ReplyDelete
  13. Okay, then there definitely is a bug somewhere. Are you running any certain/non-kde applications when the bug starts? You definitely should comment on the kde bug report.

    Could you post the output of this, than I can delete the long comment: grep polling ~/.local/screen-configurations.xml

    ReplyDelete
  14. Again, I change left angle with ?.

    ?polling>false?/polling>

    ReplyDelete
  15. cedarlab, please report your problem here:
    http://bugs.kde.org/show_bug.cgi?id=170920

    you should note the xorg.log entries and the polling section of the config file, as well as what applications you run and the xorg driver. Thanks!

    ReplyDelete

I appreciate comments. Feel free to write anything you wish. Selected comments and questions will be published.