I got tired of viewing diffs in a terminal with red and green text. I wanted to see diffs more comfortably, with syntax highlighting, segment highlighting (not just full lines), easy scrolling, searching, switching between files. I wanted to have something like Phabricator diff, Netbeans diff or PyCharm diff. So I finally spent 20 minutes (why do most annoyances take you 20 minutes to solve, but you delay them for years?) and found out that git now has a cool new command, git difftool. And it supports meld, a great graphical comparison program.
Let’s compare this:
Awesome, right?!! All you need to do is this:
$ git difftool --tool=meld -d <diffspec>
Option -d makes it work in directory mode, which works much better with meld. Of course this is too long to type every time, to let’s remember meld as the default diff tool, and even make an alias for it:
$ git config --global diff.tool meld $ git config --global alias.dt 'difftool -d'
(Also, don’t forget to enable syntax highlighting in meld preferences, it was disabled for me for some reason.)
And now, voila:
$ git dt master..develop
I’m very happy about the increased readability and productivity.
Linux seems to be finally becoming a viable gaming platform. That brings us into uncharted territories and we start to discover some deficiencies which were solved on other platforms a long time ago. One of those is GPU-based screen scaling.
What is GPU-based screen scaling?
If you want to display a non-native (lower) resolution on your monitor, you have several options how to do that:
- Center image – Display the image in the center using 1:1 pixel mapping (one pixel from the image is 1 pixel on the screen). Add black bars from all 4 sides to fill the rest of the screen. This produces smaller but perfectly sharp image.
- Scale image while keeping aspect ratio – Enlarge the image as much as possible, and (if the image has a different aspect ratio than the monitor) add black bars from the remaining 2 sides (usually top and bottom for movies, left and right for old games). This produces large but blurrier image.
- Scale image fully ignoring aspect ratio – Simply fill the whole screen. This produces full-sized, but blurrier and distorted image (e.g. text is stretched, human bodies have incorrect proportions, etc).
Some of this can be configured through your external monitor’s OSD menu. Centered image is usually not available, and aspect-based scaling is often available only for certain resolutions. Full scaling seems to be (sadly) both the default and the only option available in many cases. Because I’ve just recently bought a new monitor, I investigated a bit and even pricier monitors more often than not offer only the described limited set of options. That is of course unfortunate.
For that reason (and also to be able to configure scaling for fixed notebook screens), graphical drivers offer options to scale the image for you, any way you like. Instead of the monitor, the graphics card does it. This allows you to use any scaling mode that fits your purpose, not just those implemented by the manufacturer of your monitor.
Why do I need screen scaling?
I have described some reasons here. Usually it’s because of either old games (wrong aspect ratio) or too modern games (your hardware doesn’t keep up).
How can I configure GPU-based screen scaling?
For fixed notebook screens, you can do that through xrandr. See the properties of your monitor:
$ xrandr --prop Screen 0: minimum 320 x 200, current 1920 x 1968, maximum 8192 x 8192 LVDS1 connected 1366x768+289+1200 (normal left inverted right x axis y axis) 277mm x 156mm <snip> BACKLIGHT: 11 range: (0, 15) Backlight: 11 range: (0, 15) scaling mode: Full aspect supported: None, Full, Center, Full aspect 1366x768 60.10*+ 1024x768 60.00 800x600 60.32 56.25 640x480 59.94
The default seems to be Full aspect. If you set None, it means the image should be sent unaltered into your monitor. You can configure different scaling like this:
$ xrandr --output LVDS1 --set "scaling mode" "Center"
This setting seems to be reset on machine reboot, and I haven’t investigated how to keep it permanent yet. Also, I tested this just on Intel, but I assume all drivers should support it.
For external monitors, I have a bad news for you – you can’t do it (yet). This is the deficiency I was talking about. The properties are not visible through xrandr. The proprietary AMD and NVIDIA drivers have supported it for a long time (example), but it seems there haven’t been enough demand in open source drivers yet (at least intel and radeon drivers can’t do it, I haven’t tested nouveau). So, I requested this functionality as Freedesktop bug 80868 and to my surprise there’s a tentative patch already (thanks Alex Deucher). If you’re skilled with C and hardware development, any help would be highly welcome. IIUIC, the patch will enable this functionality only for radeon driver – there will need to be a similar patch for intel (and possibly nouveau) driver.
I have long been looking for a simple way to display the current FPS in games (without direct support in the game), similar to what FRAPS or other tools do in Windows. For Linux, I haven’t had too much luck. There are not many tools for this and usually there are some problems with them – either they are not packaged and complication is difficult, or they don’t work reliably, or they can’t display FPS overlay in the game, just log to a file. But this weekend, I have finally been lucky.
I have stumbled upon an older article from Phoronix: Gallium3D Gets A Heads-Up Display For Information. Gallium3D is a graphics acceleration framework that is currently used by radeon and nouveau drivers. By simply setting an environment variable, you can get a live on-screen overlay displaying lots of useful information:
This is pretty amazing and it does exactly what I was looking for. The usage is really simple – to see the available options, just run:
$ GALLIUM_HUD="help" glxgears Syntax: GALLIUM_HUD=name1[+name2][...][:value1][,nameI...][;nameJ...] Names are identifiers of data sources which will be drawn as graphs in panes. Multiple graphs can be drawn in the same pane. There can be multiple panes placed in rows and columns. '+' separates names which will share a pane. ':[value]' specifies the initial maximum value of the Y axis for the given pane. ',' creates a new pane below the last one. ';' creates a new pane at the top of the next column. Example: GALLIUM_HUD="cpu,fps;primitives-generated" Available names: fps cpu cpu0 cpu1 cpu2 cpu3 samples-passed
In Fedora 20, only basic options like fps and cpu are available. In Fedora Rawhide with newer graphics stack, there are many more options. But I’m fully content with just the basic ones. Now I can run games like this:
$ GALLIUM_HUD="fps,cpu+cpu0+cpu1+cpu2+cpu3:100" mygame
And I have pretty two graphs of FPS and CPU usage. You can run steam the same way, and then see the overlay on each game started from it. And, as a bonus, you can even run totem or vlc (with GL output) like this and see actual FPS of your video rendering :-)
I’m really excited about this. This is how I imagine a modern operating system to look like – useful features directly integrated into its core and very easily accessible (hell, it can’t get even easier than setting an environment variable!). Thanks Marek Olšák and AMD for implementing this. You really made my day.
The only drawback is that because it’s implemented in Gallium3D, it works only on Gallium3D-enabled drivers, which means opensource AMD and Nvidia drivers. No binary drivers and no Intel drivers can benefit from this. Marek explained that it had been very simple to implement this inside Gallium3D, but it would be very tricky to implement this on a level that would affect all the drivers. So there you have it, the opensource drivers now have a killer feature that proprietary drivers don’t :-) Just the Intel situation is unfortunate, maybe they’ll reconsider this some time in the future.
Last week I’ve written about my experience with AMD Radeon R9 270 card in Fedora 20. I have received much advice and feedback in the comments below and some people nudged me to try the latest opensource driver (it’s been a month since Fedora 20 release and OSS world clearly moves fast). So that’s what I did. This post is a follow-up to the previous one, just containing information about the latest changes in the RadeonSI driver. I haven’t tested Catalyst, because I already covered the latest version in the previous article and I don’t expect any major changes just by changing Fedora version.
I did all my testing on Fedora Rawhide (to be Fedora 21 in a distant future). In order to get newer OpenGL support, I used llvm 3.4 packages – those are not yet pushed to Rawhide’s repository, but they should be hopefully merged soon and are available in a special build tag for the moment. I used mesa git 2014-01-10, xorg-x11-drv-ati git 2014-01-12 and xorg-x11-glamor git 2014-01-15 (including a patch for faster gtk lines drawing) – all of this compiled on a machine with llvm 3.4. I was running on nodebug kernel 3.13 rc8 (beware of my mistakes). Packages for S3TC compression (libtxc_dxtn) were installed.
The changes in RadeonSI since Fedora 20
These are the major changes that I spotted in the short time:
- Dynamic power management is enabled automatically. You no longer need to adjust the kernel command line, the card scales its speed according to the load automatically. This is brought by kernel 3.13. One less thing to care about, great.
- GTK primitives rendering is much faster. The developers were very active in addressing the issue and provided several patches. They are not yet committed into the main branch, but one of them is now even included in Fedora packages by default. The rendering speed is not yet on par with other drivers (as you can see in the tests below), but it’s at least an order of magnitude faster. I have no problems with LibreOffice Calc or Motif-like GUIs anymore, everything runs perfectly. Many thanks to radeonsi developers.
- You’ll get OpenGL 3.1/3.0 version support instead of OpenGL 2.1. This is great news, because it allows more games to run, especially the commercial ones. There’s still a long way to go to the current OpenGL 4.4 specification, but this helps with compatibility a lot.
- There are some desktop rendering glitches. I’ve seen a small rendering issues with message tray icons in GNOME. Some of the icons sometimes became invisible (totally transparent). You could still click on them, but you could not see them. I’ve also seen others report this problem, so I assume it’s known and hopefully will be fixed soon. I haven’t seen this problem back on Fedora 20. There are also some other minor glitches, for example very occasionally there is a graphical artifact instead of some letter rendered on the web by Firefox. But that is very rare, can be fixed by highlighting the text and happens on Fedora 20 as well.
Update: The invisible icon bug seems to have been fixed the next day after I published this. I still see some issues, but they are most probably related to GNOME in general and not to radeonsi driver.
In general I’ve been very pleased by the recent development, the developers are responsive and they have improved the driver a lot recently.
I have some good news and some bad news. The good news is that the number of games that run and their performance have improved substantially. And I mean substantially. On Fedora 20 half of my Steam games crashed or there were some serious issues with them. Now only 10% crash (some of that might be caused by llvm 3.4, according to the crash messages) and another 15% are either slower or experience graphical issue. However, the majority now runs just fine. I attribute this mainly to the OpenGL 3.1/3.0 support. Here’s my updated list of Steam games I tested, compare Fedora 20 RadeonSI column with Fedora Rawhide RadeonSI column:
Performance-wise there have been some improvements as well, probably at around 10% or so in average. You can see the updated Phoronix Test Suite graphs below. The commercial games felt a bit better as well.
The bad news is that we’re still not there. The situation improved sharply, but there’s still a large percentage of games which can’t be played. The performance also varies wildly. For example Dota 2 was totally unplayable even with low quality settings, you could see 5-10 FPS easily in larger battles. On the other hand, Left 4 Dead 2 or Team Fortress 2 seemed very well playable (I spent max 5-10 minutes in these games, so the real gameplay results might vary).
If you want to play on Linux with an AMD graphics card and an opensource driver, you still need to be a modest gamer. You must not mind if some of your games run very slow or not at all. However, the recent progress has been very good and it seems that AMD together with community developers try real hard to provide a fully functional opensource driver. I’m very glad for that. Hopefully Linux users won’t need to choose between freedom (plus out-of-the-box functionality) and performance in the near future. By the way, I decided to keep the AMD card in order to support OSS-compatible companies.
I have a brand new AMD graphics card and I assume someone might be interested in how it works in Fedora 20. This post summarizes my experiences with it.
A week ago I’ve bough MSI Radeon R9 270 GAMING 2G. It’s an upper mid-range card and most new games should run on it reasonably well on high details. In Fedora there are two choices – you can either use the default open-source radeonsi driver, or you can install proprietary catalyst driver. I have tried general system functionality and also a lot of games (through Steam) on both drivers.
The GNOME desktop itself works without a glitch. Everything is fluent and I haven’t noticed any problems whatsoever. However, there are some other issues:
- You need to enable dynamic power management manually. Without DPM, the card runs at the lowest speed profile all the time. Enabling it is really simple, you just add radeon.dpm=1 to the kernel command line. From kernel 3.13 this should be enabled automatically. With DPM, the card automatically switches between low and high speed profiles depending on its utilization. DPM worked without problems for me. More information.
- GTK primitives rendering is extra slow. I stumbled upon this when I ran gtkperf test, gtk primitives (like lines and circles rendering) is 4 or 5 orders of magnitude (!!) slower than with catalyst (or the integrated Intel graphics card). Fortunately, these primitives are not used much. They were used in old GUI frameworks like Motif. However, you can still find it here and there, for example in some old software installers or in game settings dialogs (like Amnesia: The Dark Descent). Operating such interfaces is really slow. Unfortunately, there is one further example where GTK primitives are used, which is LibreOffice Calc. Even medium-sized spreadsheets are unusable with radeonsi driver :-( I might still find some other problematic software, but up to date, I’ve found only the LibreOffice Calc to be a quite show-stopper. Freedesktop bug 68524, freedesktop bug 71813.
- Fan speed is higher than with Catalyst. It seems that there are three ways how to affect graphics card fan speed – there is a profile in its vbios, there is another profile in the driver and then there can be a user defined profile. The vbios profile kicks in during computer start and boot, the driver profile kicks in during operating system video initialization (setting graphical mode) and user profile can be enabled by a custom application. Radeonsi doesn’t currently support driver or user defined profiles, so only the vbios profile is used. Unfortunately, the manufacturer (MSI) set the default idle fan speed to 40%, so with radeonsi your fan speed will never go below that, no matter how cool the card is. It’s not loud, but it’s audible. With catalyst driver, the fan speed in idle is 18%, which is truly inaudible. Quite a pity. Freedesktop bug 73338.
When it comes to gaming, the current state is very very sub-optimal. Even though the usual open source games available in Fedora repositories (like OpenArena and Xonotic) run very well, a lot of commercial games simply crash. I suppose they require some OpenGL extensions that are not implemented in the driver, or they simply hit some bugs in the driver. If they run, the performance is quite bad. I’ve tested quite a few games and compiled a list showing how well they run, it’s available here. Basically any modern 3D game didn’t run for me (crashed or performed poorly). I’ve also made some benchmarks, see below.
If you want to use the catalyst driver, prepare for some serious headaches:
- The driver is no longer available in RPMFusion. The maintainer orphaned the pacakge and no other volunteer appeared. That means you’ll need to download the official installer from AMD website and install it with every kernel update. You won’t receive new kernel modules automatically from RPMFusion, nor you will have have akmod (automatic module compilation) setup easily for you. FedoraForums discussion.
- GNOME doesn’t work with Catalyst in Fedora 20. GNOME shell and apps were compiled with Wayland support, which uses libEGL library. Catalyst currently doesn’t ship this library, so all the software crashes. At least that’s my understanding. You can either use Fedora 19, or some other desktop environment (I don’t know about KDE, but XFCE should work; however, you still can’t use any of affected apps even in a different environment), or download packages recompiled without wayland support from untrusted sources (not recommended, and of course it also prevents you from updating your system). This sucks really hard, it’s a show-stopper for most people . FedoraForums discussion, RPMFusion bug 2914, GNOME bug 712340, AMD bug 949, Phoronix discussion.
- You can’t switch from game to desktop. If you hit Alt+Tab during gameplay (in games which support it), you don’t see the regular switcher widget. When you hit Win key (in GNOME), you don’t see the overview. Everything actually happens (you can tell because your mouse cursor changes), but you see the game all the time (even though your keyboard input might control a completely different application). This means that you effectively can’t switch your game and your desktop/other apps (even though it actually happens), because the image does not redraw.
Update: With Catalyst 13.11 Beta 9.95 this works much better. If you hit Win key, you see the overview mode and can switch applications. If you hit Alt+Tab, you see the switcher widget, but you need to operate it with a mouse. Sometimes it’s quirky – in Dota 2 I needed to hold Alt+Tab for several seconds to manage to switch, in Amnesia I saw a black screen for 10 seconds after returning to game, and Champions of Regnum behaved like an always-on-top window. Also in the overview mode the game thumbnail is not correctly updated. But generally it works.
- Video overlays don’t work in Totem. If you watch a fullscreen video in Totem and wiggle your mouse, you don’t see any overlay widgets, even though you can click on them (blindly). So in order to jump forward or backward in the video, or adjust the volume, you need to unfullscreen it. I think this is connected to the previous problem, again it’s some kind of overlay over video/GL context and it is not rendered correctly. VLC works fine, though.
Update: This seems fixed with Catalyst 13.11 Beta 9.95.
- You can’t control your desktop over VNC. If you set up a VNC server and connect to it, you won’t receive any screen updates (even if you want to force them from the client). You can click on stuff, but you see just a still picture. If you reconnect, you see an updated (and again still) image. VNC is simply unusable. I tried only the GNOME integrated server, it might work better with other servers, I don’t know.
Gaming is much better with catalyst driver. Most games work, and their performance is good. According to some online benchmarks, the Linux performance is still lower than Windows performance, but the gap is definitely smaller than between radeonsi and catalyst. With a few games I had graphical glitches issues and in some games I saw some stuttering (FPS is high but you experience mini-lags every short while). But in general it simply works. Again, the list of games with some notes is here.
Phoronix Test Suite
Because I’m a benchmark freak, I tried to run some tests and compare the results between radeonsi, catalyst, and my integrated Intel graphics card. I was looking for some automated way of doing it and I’ve found Phoronix Test Suite. It’s a neat piece of software, packaged in Fedora, and allowed me to simply (in an automated fashion) run a series of tests and even drew graphs of the results for me. It’s simple to operate and I really recommend it. Of course it has some rough edges, but what doesn’t.
Most of the tests consist of open source software, and as I said before, the radeonsi driver performs really well with those and generally doesn’t crash. So these results look quite optimistic in this regard. In real life, however, most commercial apps don’t perform as well or crash immediately, as mentioned before. I didn’t benchmark those, because it seemed as too much manual work. I think the current test set is enough for a simple overview. If you see a missing item in the results, it means that either the test crashed on that driver, or was so slow that I couldn’t finish it in reasonable time (the GTK primitives rendering).
Here’s a trailer of the result graphs. Full results are here.
The situation is far from perfect. I really understand why Steam survey shows only 1% of Linux players in its user base. It’s hard to play in Linux with such graphical drivers. I bought an AMD card because I wanted to support them in releasing hardware documentation and hiring opensource driver developers (they do both, same as Intel, and unlike Nvidia). Nevertheless after my week-long experience (maybe I should say misery?) I really considered swapping the card for Nvidia GeForce GTX 660 (same price, same performance). Still, I’m reluctant to do it. I had bad experience with binary nvidia driver in the past, and I have had utterly abysmal experience with nouveau driver in recent years. I don’t know if the nvidia driver has some similar issues with alt+tab switching, video overlays in totem or vnc redraws (or some other issues, I would be very interested to hear that in the comments), but I know for sure that I don’t want to end up with nouveau if I ever discover a show-stopper in nvidia driver. Radeonsi driver is definitely light years ahead of nouveau. Nvidia announced they would help nouveau last fall, they released a single piece of basic documentation, and since then I’ve seen exactly nothing to happen. They don’t seem to keep their promise. With radeonsi, at least I can try to help the driver by submitting bug reports, because the developers are not kept in the dark. And Marek Olšák has been doing some amazing improvements and fixes lately. And for gaming, there’s always… ugh… Windows.
Update: Read my follow-up article with the most recent radeonsi driver here.
Some time ago I compared disk drivers performance in KVM. Today I compared different storage formats – raw and qcow2. Let’s have a look:
Test procedure: Create an empty 10 GB image, attach to VM using VirtIO driver, boot F20 Alpha Live x86_64, measure the time of installation. Repeat installation once again, this time reusing the existing image (instead of creating a new one). Do this for both formats.
raw 1st pass 2:36 raw 2nd pass 2:38 qcow2 1st pass 2:36 qcow2 2nd pass 2:44
As you can see, the results are very much the same. It seems it doesn’t matter much which format you use.
But, qcow2 format has some nice additional features, like copy-on-write cloning. If I need to test something very quickly in my existing VM and then revert the changes back, this is the easiest way:
$ cd /var/lib/libvirt/images $ mv f19.qcow2 f19.qcow2_orig $ qemu-img create -f qcow2 -b f19.qcow2_orig f19.qcow2 Formatting 'f19.qcow2', fmt=qcow2 size=10737418240 backing_file='f19.qcow2_orig' encryption=off cluster_size=65536 lazy_refcounts=off $ # Run the VM now and do your tasks $ mv f19.qcow2_orig f19.qcow2
I have just discovered GnomeOSTree (I’ve heard about it before, but never tried it). It allows you to run an absolutely fresh version of GNOME (checked out from git the very day) in a virtual machine. This is perfect for
- experimenting with new features
- checking whether a bug still exists in the development version
- checking whether a bug fix is correct, without waiting for a distribution package update
I’ve just played with it for 10 minutes, so I might be missing a lot of things, but this seems to be a very useful tool for anyone testing and reporting GNOME bugs. It’s extremely easy to set up, you just download a VM disk image and import it into virt-manager. Later you can update it from inside the system. Try it!