Till devs do not find a real solution I made a BLOODY BRUTAL workaround which 
helps me.
PLEASE understand what my program is doing and decide if it is suits you or not.

I found "cpulimit" (can be installed from software center - at least in Ubuntu 
15.10) which slows down a particular thread.
No, "nice" does not do the work, because "nice" just gives priorities and here 
we want that CPUs do not do "anything".

I wrote a small python script which
- checks if screen lock OR screensaver became active, if yes, it limits that 
thread with "cpulimit"
- checks if screen lock OR screensaver became inactive, if yes, ir removes all 
limitation

Again, it slows down compiz so violently as possible.
With my system the keyboard lock (Alt-Ctrl-L) fades out for 5-10 secs...
when I enter my password dots has 1 sec lag...

Screensaver part is added to eliminate this lock-screen delay.
Under "normal use" screensaver deactivates earlier, so compiz became much more 
responsive.

If your programs use compiz during screen lock, it is VERY LIKELY that
this script will slow down or somehow affect those programs as well, so
use it wisely!

For the script running you have to install python-dbus if you did not do it so 
far:
sudo apt-get install python-dbus

The python script itself:

#!/usr/bin/env python
import gobject
import dbus
import os
from dbus.mainloop.glib import DBusGMainLoop

def lock_and_screensaver_filter(bus, message):
  EventMember =message.get_member()
  if EventMember == "EventEmitted":
    args = message.get_args_list()
    if args[0] == "desktop-lock":
      os.system("cpulimit -b -P /usr/bin/compiz -l 1")
    elif args[0] == "desktop-unlock":
      os.system("pkill cpulimit")
  elif EventMember == "ActiveChanged":
    args = message.get_args_list()
    if args[0] == True:
      os.system("cpulimit -b -P /usr/bin/compiz -l 1")
    else:
      os.system("pkill cpulimit")

DBusGMainLoop(set_as_default=True)
bus = dbus.SessionBus()
bus.add_match_string("type='signal',interface='com.ubuntu.Upstart0_6'")
bus.add_match_string("type='signal',interface='org.gnome.ScreenSaver'")
bus.add_message_filter(lock_and_screensaver_filter)
mainloop = gobject.MainLoop()
mainloop.run()

-- 
You received this bug notification because you are a member of compiz
packagers, which is subscribed to compiz in Ubuntu.
https://bugs.launchpad.net/bugs/1322751

Title:
  Compiz running on Intel Haswell GPU has 100% CPU usage when computer
  is locked

To manage notifications about this bug go to:
https://bugs.launchpad.net/compiz/+bug/1322751/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~compiz
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~compiz
More help   : https://help.launchpad.net/ListHelp

Reply via email to