Skip to content

Running KDE4 with KWin/Plasma compositing effects on the HP 2133 mini-note

Wednesday, 15 April 2009  |  richard dale

I've read various stories about how people are having problems with the KDE4 compositing effects. So for a change, I thought I should describe how I'm a very happy KDE4 user, after I got KWin and Plasma effects to run pretty satisfactorily on the low end VIA7 cpu/gpu combination in my HP 2133 mini laptop.

Although it took a fair amount of effort in messing around with USB stick installs, after I finally got Kubuntu installed with KDE 4.2 on the netbook it has worked just great. I did a kind of laptop vs. netbook shootout for a couple of months by keeping both my Macbook and the HP 2133 on my desk and using whichever one I felt like using. Here's how it went:

  1. Started with just Quassel and Kopete on the HP and everything else on the Mac
  2. Found Firefox and Konqueror were quite usuable on the HP, apart from some fonts too small occasionally
  3. Moved KMail onto the HP before setting off to FOSDEM
  4. Upgraded to the Via 2D driver following the instructions on the Ubuntu HP 2133 Wiki, for my talk about Wt::Ruby at FOSDEM. VGA output worked fine
  5. Began to do some hacking at FOSDEM on the HP, found Kate and Konsole were just as usable as on the Mac
  6. Bought a copy of Mac OS X Leopard, installed it on the MacBook and relegated it to 'spare machine' status.
  7. Two months into the shootout. Game over, HP mini notebook wins.

In the space of just these two months my perception of what is a 'portable computer' as opposed to what is a 'luggable computer' has changed. I now think anything over about 1.3 Kg is too heavy to carry everywhere. My 2.4 Kg Macbook is just about portable, and those 'laptops' which weigh nearly 4 Kg and have battery lives of less than 2 hours, just seem like museum pieces - why bother with them?

The only thing I hadn't got working on the little HP was the 3D video driver, and so I spent pretty much an entire weekend having 'X-Window setup graphics fun' a few weeks ago. I started out looking at the Ubuntu HP 2133 Wiki pages where they have some instructions for getting Compiz working with Gnome. I copied the recommend xorg.conf file, built the Open Chrome 3D driver from the sources on the VIA site and installed it.

The KDE compositing preferences have the gpus they know about hard coded, and so I needed to patch the code to add the VIA gpu:


Index: workspace/kwin/compositingprefs.cpp
===================================================================
--- workspace/kwin/compositingprefs.cpp (revision 953295)
+++ workspace/kwin/compositingprefs.cpp (working copy)
@@ -262,6 +262,11 @@
         mDriver = "radeon";
         mVersion = Version( mGLRenderer.split(" ")[ 3 ] );
         }
+    else if( mGLRenderer.startsWith( "S3/VIA Graphics" ))
+        {
+        mDriver = "via";
+        mVersion = Version( mGLVersion.split(" ").first());
+        }
     else if( mGLRenderer == "Software Rasterizer" )
         {
         mDriver = "software";
@@ -330,6 +335,11 @@
             mEnableCompositing = true;
             }
         }
+    else if( mDriver == "via" )
+        {
+        kDebug( 1212 ) << "via, enabling compositing";
+        mEnableCompositing = true;
+        }
     }

Once KWin knows about your gpu it will try and do tests of its capabilities and log the results in ~/.xsession-errors. I read the KWin docs looking for suggested xorg.conf tweaks and tried each one out, and looked in the log for the ones which seemed to work. Here is the xorg.conf I ended up with:


# xorg.conf (X.Org X Window System server configuration file)
#
# This file was based on one generated by dexconf.
# Lots of testing was done by Jonathan Austin (Who) 
# Thanks to mikez's docs and examples for teaching me!
# Bits of the Suse Xorg.conf were used too.
#
# This is very much a work in progress. I accept no responsibility
# for any damage to you, your hardware, or your mental state that
# this configuration file may cause. Provided As Is, like Ubuntu is

Section "ServerFlags"
        #Change the default server layout from "main" to 
        #"randry" if you want to use RandR. Compiz isn't well supported in randry
        Option          "DefaultServerLayout"   "main"

        Option          "AllowMouseOpenFail"    "on"
        Option          "Pixmap"                "32"
        Option "AIGLX"
EndSection


Section "Device"
        Identifier      "Main Video Device"

        Driver "via"
        VendorName  "VIA Tech"
        BoardName   "via"

        #required to make the resolution correct without RandR
        Option "ActiveDevice" "LCD"  
        #SUSE uses this, seems not to be reqd
        Option "PanelID" "12"                           
        Option "ReDrawColorkey" "TRUE" # testing
        #Option "DeviceSwitchHotkey"  #Kills HwCursor! 
        #How weird Possibly necessary if ActiveDevice set to LCD,CRT
        #Option "HQVManualSwitch" # No idea what this does   

EndSection

Section "Device"
        Identifier      "RandR Video Device"

        Driver "via"
        VendorName  "VIA Tech"
        BoardName   "via"

        #not sure of effect with randr (someone want to test this?) 
        #Setting it to LCD,CRT doesn't seem to help in getting external display 
        #work with randr. If you set LCD,CRT you need to set DeviceSwitchHotkey
        Option "ActiveDevice" "LCD"
        #SUSE uses this, seems not to be reqd                     
        Option "PanelID" "12"                           

        Option "UseRandR12"  # I WANT to use this (it works, almost)
        #Option "HWCursor" # Doesn't restore cursor, but it does work withOUT RandR
        Option "SWCursor" # Does restore cursor, BUT leaves distortion with Compiz      
        #Option "DeBlockingEnable" # No visible impact, doesn't fix HWCursor 
        #Option "HQVManualSwitch" # leaves SW cursor intact, 
        # no visible improvement, doesn't fix HWcursor
        #Option "DeviceSwitchHotkey"  #Necessary if ActiveDevice set to LCD,CRT
EndSection


Section "Monitor"
        Identifier "Main LCD"
        DisplaySize 250 150 # WARNING: Screws RandR
        HorizSync    28-50
        ModelName    "1280X768@60HZ"
        Option       "DPMS"
        VendorName   "HP 2133 Internal Display"
        VertRefresh  50-61
        UseModes     "2133-Modes"
EndSection

Section "Monitor"
        Identifier "RandR LCD"
        #DisplaySize 250 150 # WARNING: Screws RandR
        HorizSync    28-50
        ModelName    "1280X768@60HZ"
        Option       "DPMS"
        VendorName   "HP 2133 Internal Display"
        VertRefresh  50-61
        UseModes     "2133-Modes"
EndSection

Section "Screen"
        Identifier      "Main Screen"

        Monitor  "Main LCD"
        SubSection "Display"
                Modes  "1280x768" 
                Virtual 1280 768
                Depth  24
        EndSubSection
        Device          "Main Video Device"
        Option          "ForceLCD"              "true"
        Option          "ActiveDevice"          "LCD"
        Option          "VideoOnDevice"         "LCD"   
        Option          "SetMpegFBNumber"       "true"
        # distorts Compiz lots. Helps video with Metacity compositor
        #Option         "ShadowFB"              "true" 
        Option          "NoDDCValue"            "on"
EndSection

Section "Screen"
        Identifier      "RandR Screen"

        Monitor  "RandR LCD"
        SubSection "Display"
                Modes  "1280x768" 
                Virtual 1280 768
                Depth  24
        EndSubSection

        Device          "RandR Video Device"
        Option          "ForceLCD"              "true" #Doesn't seem to be necessary?
        Option          "VideoOnDevice"         "LCD"   
        Option          "SetMpegFBNumber"       "true"
        Option          "NoDDCValue"            "on" #Test what this does!!
EndSection

Section "Module"
        Load  "glx"
        Load  "dri"
        Load  "extmod"

  Load         "v4l"
EndSection

Section "DRI"
        Group 0
        Mode 0666
EndSection

Section "ServerLayout"
        Option "RandR" "False"
        Identifier "main"
        Screen "Main Screen"
EndSection

Section "ServerLayout"
        Identifier "randry"
        Screen "RandR Screen"
EndSection

Section "Modes"
        Identifier "All-Modes"
        ModeLine "720x480" 26.7 720 736 808 896 480 481 484 497
        ModeLine "720x576" 32.7 720 744 816 912 576 577 580 597
        ModeLine "800x480" 29.58 800 816 896 992 480 481 484 497
        ModeLine "848x480" 31.5 848 864 952 1056 480 481 484 497
        ModeLine "856x480" 31.7 856 872 960 1064 480 481 484 497
        ModeLine "960x600" 45.98 960 1000 1096 1232  600 601 604 622 -HSync +Vsync
        ModeLine "1000x600" 48.07 1000 1040 1144 1288 600 601 604 622 -HSync +Vsync
        ModeLine "1024x512" 41.3 1024 1056 1160 1296 512 513 516 531
        ModeLine "1088x612" 52.95 1088 1128 1240 1392 612 613 616 634 -HSync +Vsync
        ModeLine "1152x720" 67.32 1152 1208 1328 1504 720 721 724 746 -HSync +Vsync
        ModeLine "1200x720" 70.18 1200 1256 1384 1568 720 721 724 746 -HSync +Vsync
        ModeLine "1280x600" 61.50 1280 1336 1464 1648 600 601 604 622 -HSync +Vsync
        ModeLine "1280x720" 74.6 1280 1341 1474 1688 720 721 724 746
        ModeLine "1280x768" 80.1 1280 1344 1480 1680 768 769 772 795
        ModeLine "1360x768" 85.50 1360 1392 1712 1744 768 783 791 807 +HSync +Vsync
        ModeLine "1366x768" 85.86 1366 1440 1584 1800 768 769 772 795 -HSync +Vsync
        ModeLine "1440x900" 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
        ModeLine "1440x1050" 126.2 1440 1536 1688 1936 1050 1051 1054 1087
        ModeLine "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -HSync +Vsync
        ModeLine "1600x1024" 136.36 1600 1704 1872 2144 1024 1025 1028 1060 -HSync +Vsync
        ModeLine "1792x1344" 202.97 1792 1920 2112 2432 1344 1345 1348 1391 -HSync +Vsync
        ModeLine "1856x1392" 218.57 1856 1992 2192 2528 1392 1393 1396 1441 -HSync +Vsync
        ModeLine "1920x1080" 172.9 1920 2043 2249 2578 1080 1081 1084 1118
        ModeLine "2048x1536" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -HSync +Vsync
        ModeLine "720x480" 34.9 720 752 824 928 480 481 484 502
        ModeLine "720x576" 42.6 720 760 832 944 576 577 580 602
        ModeLine "848x480" 41.0 848 880 968 1088 480 481 484 502
        ModeLine "856x480" 41.3 856 888 976 1096 480 481 484 502
        ModeLine "1024x512" 53.3 1024 1072 1176 1328 512 513 516 535
        ModeLine "1280x768" 103.0 1280 1360 1496 1712 768 769 772 802
        ModeLine "1440x1050" 160.0 1440 1536 1696 1952 1050 1051 1054 1096
        ModeLine "1280x768" 118.5 1280 1368 1504 1728 768 769 772 807
        ModeLine "1440x1050" 184.5 1440 1544 1704 1968 1050 1051 1054 1103
        ModeLine "848x480" 47.4 848 888 976 1104 480 481 484 505
EndSection

Section "Modes"
        Identifier "2133-Modes"
        Modeline        "1280x768" 78.80 1280 1344 1480 1680 768 769 772 795
        Modeline        "1280x768" 77.37 1280 1344 1480 1680 768 769 772 794
        Modeline        "1024x768" 63.04 1024 1080 1184 1344 768 769 772 795
        Modeline        "1024x768" 61.89 1024 1080 1184 1344 768 769 772 794
        Modeline        "1280x600" 59.79 1280 1328 1456 1632 600 601 604 621
        Modeline        "1280x600" 58.78 1280 1328 1456 1632 600 601 604 621
        Modeline        "1024x600" 48.07 1024 1064 1168 1312 600 601 604 621
        Modeline        "1024x600" 47.26 1024 1064 1168 1312 600 601 604 621
        Modeline        "800x600" 37.52 800 832 912 1024 600 601 604 621
        Modeline        "800x600" 36.88 800 832 912 1024 600 601 604 621
        Modeline        "768x576" 34.32 768 792 872 976 576 577 580 596
        Modeline        "768x576" 33.74 768 792 872 976 576 577 580 596
        Modeline        "640x480" 23.46 640 656 720 800 480 481 484 497
        Modeline        "640x480" 23.06 640 656 720 800 480 481 484 497
        Modeline        "800x600" 38.22 800 832 912 1024 600 601 604 622
EndSection

Section "Extensions"
        Option "Composite" "Enable"
EndSection

Note all the comments (not from me) about 'what the hell does this feature do?'. Probably like the guy who wrote the comments, I really hope I never have to see one of those xorg.confs again. I think to actually get XRender working the the VGA output port I may well need to spend another weekend fiddling about, but for now it is really nice to have the various KDE 3D goodies working, they really do make using your machine more pleasant. Here is my kwinrc file with the settings I have:


[Compositing]
AnimationSpeed=3
Backend=XRender
DisableChecks=false
Enabled=true
GLDirect=true
GLMode=TFP
GLTextureFilter=1
GLVSync=true
HiddenPreviews=5
XRenderSmoothScale=false

So big thanks from me to the guys like Aaron Seigo and Lubos Lunak who are pushing this stuff forward in KDE4, and encouraging the hardware driver and xorg people to make their stuff solid enough for everyone to use.