Why the GTK+ wayland backend can't be enabled in linux distros, at all
Pierre-Loup A. Griffais
pgriffais at nvidia.com
Tue Mar 27 18:00:55 PDT 2012
Thanks for your interest in the NVIDIA driver; please allow me to try to clarify
the situation. You're right that we're not building with -fPIC for performance
reasons, but that only applies to the x86 platform. No text relocations should
be present in our x86_64 libraries thanks to PIC being free on that platform.
Our driver also has a number of relative relocations in the data sections, where
our dispatch tables are. This is a side-effect of supporting a lot of
functionality combined with a number of different hardware architectures; this
applies to both x86 and x86_64 architectures.
The former currently incurs a penalty of about 18M of private memory, while the
latter is ~4M on x86 and ~6M on x86_64.
There exists a utility called 'prelink' that can be used to pro-actively
relocate shared objects on the system (or a single shared object to an arbitrary
base address), removing the need for the loader to apply relocations if used
properly. Prelinking libnvidia-glcore at a fixed, free address allows memory
that would otherwise by dirtied by the loader when relocating to remain shared
cleanly between processes.
However, the linux ELF loader currently has a bug that causes the second type of
relocation to be overwritten even if prelink had already initialized them to the
correct value. This causes the memory in the relocation sections to get dirtied
without anything being changed, which contradicts our goal.
Attached is a proof-of-concept patch which fixes this issue for the x86_64 Linux
ELF loader. By both applying this patch to the loader and prelinking
libnvidia-glcore.so, distros can reduce the memory overhead of linking an
application against the NVIDIA libGL to just a few kB:
7fc001b2a000-7fc002309000 rwxp 0192a000 08:01 1591924
Size: 8060 kB
Rss: 6592 kB
Pss: 6592 kB
Shared_Clean: 0 kB
Shared_Dirty: 0 kB
Private_Clean: 6544 kB
Private_Dirty: 48 kB
Referenced: 6592 kB
Anonymous: 48 kB
AnonHugePages: 0 kB
Swap: 0 kB
KernelPageSize: 4 kB
MMUPageSize: 4 kB
Locked: 0 kB
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 707 bytes
Desc: not available
More information about the wayland-devel