Log in

Hans de Goede
Recently I've been working on improving hybrid graphics support for the upcoming Fedora 25 release. Although Fedora 25 Workstation will use Wayland by default for its GNOME 3 desktop, my work has been on hybrid gfx support under X11 (Xorg) as GNOME 3 on Wayland does not yet support hybrid gfx,

So no Wayland, still there are a lot of noticable hybrid gfx support and users of laptops with hybrid gfx using the open-source drivers should have a much smoother userexperience then before. Here is an (incomplete) list of generic improvements:

  • Fix the discrete GPU not suspending after using an external monitor, halving laptop battery life

  • xrandr --listproviders no longer shows 3 devices instead of 2 on laptops with 2 GPUs

  • Hardware cursor support when both GPUs have active video outputs, previously X would fallback to software cursor rendering in this case which would typically lead to a flickering, or entirely invisible cursor at the top of the screen

Besides this a lot of work has been done on fixing hybrid gfx issues in the modesetting driver, this is important since with Fedora we use the modesetting driver on Skylake and newer Intel integrated gfx as well as on Maxwell and newer Nvidia discrete GPUs, the following issues have been fixed in the modesetting driver (and thus on laptops with a Skylake CPU and/or a Maxwell or newer GPU):

  • Hide HW cursor on init, this fixes 2 cursors showing on some setups

  • Make the modesetting driver support DRI_PRIME=1 render offloading when the secondary GPU is using the modesetting driver

  • Fix misrendering (tiled vs linear) when using DRI_PRIME=1 render offloading and the primary GPU is using the modesetting driver

  • Fix GL apps running at 1 fps when shown on a video-output of the secondary GPU and the primary GPU is using the modesetting driver

  • Fix secondary GPU video output partial screen updates (part of the screen showing a previous frame) when the discrete GPU is the secondary GPU and the primary GPU is using the modesetting driver

  • Fix secondary GPU video output updates lagging (or sometimes the last frame simply not being shown at all because no further rendering is happening) when the discrete GPU is the secondary GPU and the primary GPU is using the modesetting driver

Note coming Thursday (November 3th) we're having a Fedora Better Switchable Graphics Test Day, if you have a laptop with hybrid gfx please join us to help further improving hybrid gfx support.
Hans de Goede
So I've a RK3188 tablet which accelerometer calibration was completely off. I've spend quite some time figuring out how to fix this so I wanted to share the fix. Note this will only work on some tablets. First lets see if this fix will work for your tablet, from an adb shell do:

cat /proc/acc_info

If that file exists it will contain something like this:

root@rk31board:/ # cat /proc/acc_info                                        
offset:8 0 -4

If it does not exist, the this fix will not work for you. If the numbers after offset are all close to 0 like above, then likely you do not need this fix, but you can still try it.

So rockchip tablets with this particular file store accelerometer calibration data in something which rockchip calls the "sys sector" of nand, if you look in dmesg you will see "rknand_sys_storage_ioctl" messages there. The problem with this approach is that the "sys sector" data survives a factory reset so once the calibration data is off, it stays off, unless we manually force a recalibrate.

Note the next steps need root, make sure that the tablet is flat on a level service, and that it is not sleeping
(otherwise it will not calibrate until you wake it up, registering the powerbutton press during the calibrate)
then do:

echo 1 > /proc/acc_cal

Now run "dmesg | grep acc", you should see something like this:

<4>[ 1497.846716] acc calibrating 1
<4>[ 1497.875330] acc new offset 8 0 0

If you do congrats, you've successfully recalibrated your tablet.
Hans de Goede
All modern laptops have a gpu integrated into their processor (the igpu), some models also have a more powerful dedicated gpu (dgpu), this is called switchable graphics.

By default all apps will run on the more energy efficient igpu and the OS can choose to switch to the dgpu when more gpu-power is necessary, trading battery time for graphics performance. On most laptops the default gpu can be changed to the dgpu so that everything will always run on the dgpu.

Linux support for switchable graphics currently is not very good. E.g. on many laptops some of the external connectors are only connected to the dgpu and to be able to use those external connectors without issues users need to change the default gpu to the dgpu, resulting in a hot running laptop and the battery draining much faster.

So I will be working on improving switchable graphics support under Linux, allowing the igpu to be used as default, allowing maximum batter life, while keeping everthing working normally. Specifically the following should all work: external outputs, suspend / resume (including suspend/resume with external monitors connected / while docked) and suspending the dgpu when not used.

Some fixes for this have already landed in Fedora 24, if you've a laptop with switchable graphics, please give Fedora 24 a try. Make sure you've all updates installed, and that you're running a 4.6.x kernel (from updates-testing). Then everything should just work, specifically recently I've fixed several issues with external connectors which are only connected to the dgpu, including the dgpu not suspending after a monitor is unplugged from the external connector.

If you're still having issues using Fedora 24 (with the default open source drivers) on a laptop with switchable graphics, please file a bug and put me in the Cc, or if you already have a bug open, just put me in the Cc.

One known issue is that plymouth (the boot splash screen) in Fedora 24 does not Work well with switchable-graphics, in some cases you may
get a black screen instead of the boot splash until the graphical login manager shows. This is esp. a problem if you've a crypted disk, because the dialog asking for the disk-crypt password will not show. You can press ESC to drop to text mode as a workaround. This is fixed in the Rawhide / Fedora 25 plymouth packages, but the changes are too invasive for an update. An alternative workaround is manually installing the F25 plymouth on F24.

A secondary goal of my work on this is to allow people to run graphically demanding programs on the dgpu by starting them with "DRI_PRIME=1 program", note that since we do not support dynamic reclocking of nvidia GPUs this will not always result in a performance improvement. Again if you're using this and it does not work properly, please file a bug and put me in the Cc.

Hans de Goede
Hello fellow Fedorians,

Good news, once you've gdm- (currently in updates-testing) and xorg-x11-server-Xorg-1.17.1-7.fc22 installed then if you start the X server (Xorg) by logging into gdm, or from startx then it will run as user by default. It still gets started via a suid root wrapper, so if you're relying on vesa graphics, or using a binary driver, then it will still run as root.


Tags: ,
Hans de Goede
Hi All,

As described here we've been working on making xorg-x11-drv-libinput the default input driver for the Xorg xserver under Fedora 22. All the necessary changes for this are in place for the GNOME and KDE desktops. So starting with the next Fedora 22 compose new Fedora 22 Workstation installations will be using xorg-x11-drv-libinput instead of the -evdev and -synaptics drivers.

For existing installations the move to libinput will not happen automatically, as  we have not added a hard dependency on xorg-x11-drv-libinput so the XFCE, LXDE, etc. spins can keep using the old drivers until they have adopted their mouse/touchpad configuration settings tools to also work with xorg-x11-drv-libinput.

If you're running F-22 with GNOME or KDE, please do the following to switch to the new driver:

"sudo dnf install xorg-x11-drv-libinput"

And let us know if you experience any issues while using the new driver.


Hans de Goede
I spend a significant amount of time to get $subject to work, so I thought I would share a step by step howto here for others who want to do the same:

  1. Download all the .src.rpm files found here

  2. Build all the src.rpm files

  3. Install all the build packages except for the debuginfo packages, note if you already have perl-IO-AIO you need to downgrade it to the version just build, squeezebox server does not work with the newer version in Fedora

  4. Edit /etc/yum.conf and /etc/dnf/dnf.conf and to both add a "excludes=per-IO-AIO" line

  5. Download the squeezeboxserver noarch rpm here and install it

  6. Note this rpm is not really noarch, it contains some perl modules which are written in C, it comes with precompiled .so files for many different perl and cpu flavors but not one which will work with F-21 ARM.

  7. We need to replace these with system installed CPAN modules, both those we've just build + some from the Fedora repos

  8. A second problem is that the CPAN dir included with the squeezeboxserver rpm comes first in its search-path, so the .pm files shipped with squeezeboxserver will get used, together with the .so files from the system packages, and unless the module versions match this will fail. So we will need to remove a bunch of .pm files from /usr/share/squeezeboxserver/CPAN, but only those for modules which we want to replace with system ones

  9. I've made a script installing the additional perl-* packages needed, as well as removing the .pm files which need to be removed, download it here

  10. Run the script as root by doing "sh squeezeboxserver-bin-deps"

  11. As root do: "systemctl stop squeezeboxserver.service; systemctl start squeezeboxserver.service"

  12. Now you can point your browser to http://ip-of-your-ARM-box:9000/

  13. Enjoy

Tags: ,
Hans de Goede
01 July 2014 @ 12:12 pm
If like me you find the Gnome 3 window title bars too large to your taste for windows not using the headerbar, then I've a quick fix for you, you just need to make some small changes to /usr/share/themes/Adwaita/metacity-1/metacity-theme-3.xml . I've prepared 2 versions of this file with the changes already applied one for Fedora-20 and one for Fedora-21. Simply download this file, copy it to /usr/share/themes/Adwaita/metacity-1/metacity-theme-3.xml, and do Alt+F2, r, enter, to get smaller titlebars.


Tags: ,
Hans de Goede
At the end of 2013 I've spend 2 full months working on getting XHCI streams support and the UAS driver in the Linux kernel, which uses streams into shape. With the release of the 3.15 kernel this work now is available for end users to use.

This is good news for anyone who cares about performance of USB connected harddisks / ssds. The old usb mass-storage protocol is well known for its poor performance. UAS however allows NCQ and thus allows effectively using the full USB-3 bandwidth. If you've an UAS capable harddisk enclosure then all you need is a 3.15 kernel build with the UAS driver enabled and you should instantly get better performance. Note that most harddisk enclosures, including USB-3 enclosures do not support UAS, so if you want to use UAS double check before buying a harddisk enclosure.

One use-case of UAS I love is to have a 2.5" ssd with a full Fedora rawhide install with me so that when people ask me about hardware compatilibty issues they are having, I can simply plug in the ssd to there laptop boot rawhide and see if having the latest kernel + xorg fixes things. For a decently priced UAS capable 2.5" hdd enclosure search ebay for: "sedna usb 3.0 2.5 inch hdd enclosure". when shopping for UAS enabled devices, always check that the device description mentions UAS or UASP.

Besides UAS support, the 3.15 kernel also features support for using USB-3 bulk streams from userspace through usbfs. To use this you need the just released libusb-1.0.19 release. One use case of USB-3 bulk streams from userspace is using these for usb-redirection in qemu. With the upcoming 2.1 qemu release this will be supported allowing the use if usb-3 redirection with uas devices from within a qemu vm. This will be supported with both qemu's host usb redirection, as well as spice's network usb redirection. This means that starting with qemu-2.1 qemu's USB redirection features full USB-3.0 compatibility.
Hans de Goede
Xorg without root rights is now available in Fedora rawhide. Currently the suid root wrapper which is intended for ums compatbility is configured to run the server as root by default even on kms using setups, because starting Xorg as a normal user requires the display manager to set up its session and tty as it can no longer do that itself, and non of the display managers are ready to do this yet.

Still you can test running Xorg as user if you want, create a file called /etc/X11/Xwrapper.config with the following line in there: "needs_root_rights = auto" the default for "needs_root_rights" currently is "yes" rather then "auto" because of the display managers not being ready yet. Then switch to a text console (ctrl + alt + F2) log in as a regular user and run: "startx". Now do "ps aux" and you should see a (second) Xorg process running as a normal user.

If you're running rawhide and have some time to spare I would appreciate it if you can give this a try, and let me know if you see any issues running Xorg as normal user. Don't forget to remove the /etc/X11/Xwrapper.config file you've created after testing so that you don't break your graphical login screen.
Hans de Goede
06 May 2014 @ 02:02 pm
The last few months I've been working on making Xorg run without root rights. Xorg has traditionally always been suid root because it needed direct hardware access. With the advent of kms all hardware access is done by the kernel, so the primary reason for the X server running with root rights is no longer relevant.

Yet the current xserver still need root rights for 3 reasons:

1. Access to /dev/input/event* and /dev/dri/card*

Wayland needs this to, so a while ago systemd-logind has grown an API to allow a process inside a session to become the session controller, and get filedescriptors for these device nodes over dbus.

Some people may think that this is overkill and that simply opening up the permissions on the device nodes would be enough, but that is not true. For /dev/input/event* nodes we want a manager process to revoke the access of a session becoming inactive, so that it cannot stick around and snoop input events destined for another session. And for /dev/dri/card* nodes root rights are necessary to become the drm master.

2. Setting up a session and a tty, ie VT_SETMODE VTPROCESS

Since creating a new session requires root rights this is left to the process starting the X server, usually the display manager. When the X server is started from a text login on a virtual terminal using startx, it simply takes over the existing session on that vt. As for VT_SETMODE VTPROCESS that will work as a normal user too as long as that user owns the tty (and setting tty ownership is part of setting up a proper session).

3. Logging to /var/log/Xorg.#.log

Xorg 1.16 will log to ~/.local/share/xorg/Xorg.#.log when started as non root.

Driver changes

With systemd-logind now managing device node access, we also need a bunch of driver changes as many Xorg drivers used to directly open device nodes themselves. Xorg 1.16 introduces server-managed fds, when:

  1. the X server is compiled with systemd-logind support; and

  2. systemd-logind is available; and

  3. the driver used supports server-managed fds

Then the server will manage the filedescriptor for the relevant /dev/... device node, and pass it into the driver at init time. The necessary driver changes are quite minimal, see this video driver example and this input driver example.

VT switching

For switching away (vt-leave) from the VT on which the X server is running, the X server will keep using the VT_PROCESS VT mode, so everything can be shutdown safely before the VT switch happens. For server-managed fds the server will do a DRM_DROP_MASTER for video devices, and close the fd for input devices.

When switching back to the X server VT, systemd-logind will pass in new fds for input devices and call DRM_SET_MASTER for video devices asynchronously from the VT enter. So when systemd-logind is used the VT enter sequence is a bit differently, the VT enter signal the X server receives is ignored. Instead the X server waits till systemd-logind has signalled it is the drm master again for all the server-managed video device nodes. Filedescriptors received before the server is drm master again are cached, and the input devices are activated immediately after the video nodes are, fds received after this are activated immediately.

User-space modesetting (UMS) compatibility

When the Xorg binary is no longer suid root, UMS drivers will not work. To solve this there is a new suid-wrapper called Xorg.wrap which is suid root, when installed this wrapper will get called in stead of the real X server, and it will check if there are KMS capable cards in the system, if KMS capable cards are found it will drop all elevated rights and execute the X server as a normal user. If no KMS capable cards are found it will execute the X server with root rights, allowing old UMS drivers, such as the proprietary drivers for some cards, or the vesa driver to work.

Use of this wrapper is optional and security concious users who have a KMS capable system will be able to do "yum remove xorg-x11-server-wrapper", or their distro's equivalent.
Tags: , ,