VirtualBox

Changeset 59180 in vbox


Ignore:
Timestamp:
Dec 18, 2015 11:17:06 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104797
Message:

bugref:8087: Additions/x11: support non-root X server: switch our method of loading our GL library to simply overriding the system one. If our 3D library is loaded by the X server (we check this by seeing if the DISPLAY environment variable is unset; we cannot do anything useful in this case anyway), we load the original system library using deep binding, as the default X server GLX module is tied to the Mesa GL implementation.

Location:
trunk/src/VBox/Additions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/crOpenGL/load.c

    r59165 r59180  
    11231123    return bRc;
    11241124}
     1125
     1126#if defined(Linux) && !defined(VBOXOGL_FAKEDRI)
     1127# include <dlfcn.h>
     1128/* We only support being used by GLX clients.  If the X server GLX extension
     1129 * tries to use our OpenGL library it will fail, as it is written specifically
     1130 * against Mesa.  So we detect this with the assumption that the server will
     1131 * not have the DISPLAY variable set, and a client will do or we can't do much
     1132 * with it anyway.  This is only needed on Linux, as Solaris lets us replace
     1133 * the client library only.  To avoid complications with iprt initialisation
     1134 * we use native system/C library APIs.
     1135 * We do this in a very naive way, not even checking for failure (not much we
     1136 * can do, better for GLX to fail than the whole X server).  To keep things as
     1137 * simple and fail-safe as possible, we use a fixed path to the system GL
     1138 * library. */
     1139void __attribute__ ((constructor)) checkServerGLX(void)
     1140{
     1141    char *pszDisplay = getenv("DISPLAY");
     1142
     1143    if (!pszDisplay || !*pszDisplay)
     1144    {
     1145        dlopen("/tmp/VBoxOGL/system/libGL.so.1", RTLD_LAZY | RTLD_GLOBAL | RTLD_DEEPBIND);
     1146    }
     1147}
     1148#endif
    11251149
    11261150/* Sigh -- we can't do initialization at load time, since Windows forbids
  • trunk/src/VBox/Additions/linux/Makefile.kmk

    r57969 r59180  
    134134        VBoxOGLpackspu.so \
    135135        VBoxOGLpassthroughspu.so \
    136         VBoxOGL.so
     136        VBoxOGL.so \
     137        VBoxEGL.so
    137138endif
    138139
  • trunk/src/VBox/Additions/linux/installer/vboxadd.sh

    r58838 r59180  
    4545  i[3456789]86|x86)
    4646    cpu="x86"
     47    ldconfig_arch="(libc6)"
    4748    lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib"
    4849    ;;
    4950  x86_64|amd64)
    5051    cpu="amd64"
     52    ldconfig_arch="(libc6,x86-64)"
    5153    lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib"
    5254    ;;
     
    209211    # This is needed as X.Org Server 1.13 does not auto-load the module.
    210212    running_vboxvideo || $MODPROBE vboxvideo > /dev/null 2>&1
     213    rm -rf /etc/ld.so.conf.d/00vboxvideo.conf
     214    ldconfig
     215    if /usr/bin/VBoxClient --check3d; then
     216        rm -r /tmp/VBoxOGL
     217        mkdir -m 0755 /tmp/VBoxOGL
     218        mkdir -m 0755 /tmp/VBoxOGL/system
     219        ldconfig -p | while read -r line; do
     220            case "${line}" in "libGL.so.1 ${ldconfig_arch} => "*)
     221                ln -s "${line#libGL.so.1 ${ldconfig_arch} => }" /tmp/VBoxOGL/system/libGL.so.1
     222                break
     223            esac
     224        done
     225        echo "/tmp/VBoxOGL" > /etc/ld.so.conf.d/00vboxvideo.conf
     226        ln -s "${INSTALL_DIR}/lib/VBoxOGL.so" /tmp/VBoxOGL/libGL.so.1
     227        ln -s "${INSTALL_DIR}/lib/VBoxEGL.so" /tmp/VBoxOGL/libEGL.so.1
     228        ldconfig
     229    fi
    211230
    212231    # Mount all shared folders from /etc/fstab. Normally this is done by some
     
    222241{
    223242    begin "Stopping VirtualBox Additions" console;
     243    if test -r /etc/ld.so.conf.d/00vboxvideo.conf; then
     244        rm /etc/ld.so.conf.d/00vboxvideo.conf
     245        ldconfig
     246    fi
    224247    if ! umount -a -t vboxsf 2>/dev/null; then
    225248        fail "Cannot unmount vboxsf folders"
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette