Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using the intel driver #3500

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions chroot-etc/xorg-intel-sna.conf

This file was deleted.

36 changes: 24 additions & 12 deletions targets/xiwi
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,34 @@ CHROOTETC='xbindkeysrc.scm xiwi.conf xorg-dummy.conf xserverrc xserverrc-xiwi xs
### Append to prepare.sh:
XMETHOD="${XMETHOD:-xiwi}"

ltspackages=''
# On non-ARM precise, install lts-trusty xorg server for compatibility with xorg
# if kernel version != 3.4 (lts-trusty mesa requires version >=3.6)
if [ "${ARCH#arm}" = "$ARCH" ] && release -eq precise \
&& ! uname -r | grep -q "^3.4."; then
# We still install xorg later to pull in its dependencies
ltspackages='-lts-trusty'
install --minimal "xserver-xorg$ltspackages" "libgl1-mesa-glx$ltspackages"
# Pull in backported Xorg when possible on precise to support newer hardware
backport=''
if release -eq precise; then
if [ "${ARCH#arm}" = "$ARCH" ]; then
backport='-lts-trusty'
else
# ARM only offers quantal backport at the moment
backport='-lts-quantal'
fi
elif release -eq trusty; then
backport='-lts-xenial'
fi

# Avoid issues when jumping backports
if [ "${DISTROAKA:-"$DISTRO"}" = 'debian' -a -n "$backport" ]; then
apt-mark unhold xserver-xorg-video-dummy || true 2>/dev/null
fi

# Unhold xserver-xorg-video-dummy to make sure deps are pulled in
if [ "${DISTROAKA:-"$DISTRO"}" = 'debian' ]; then
apt-mark unhold xserver-xorg-video-dummy$ltspackages || true 2>/dev/null
apt-mark unhold xserver-xorg-video-dummy$backport || true 2>/dev/null
fi

install xorg xserver-xorg-video-dummy$ltspackages
if [ -n "$backport" ]; then
install --minimal "xserver-xorg$backport" "xserver-xorg-core$backport" \
"libgl1-mesa-glx$backport"
fi
install xorg xserver-xorg-video-dummy$backport
install --minimal i3

# Remove some unsupported options on old versions of i3
Expand Down Expand Up @@ -61,7 +73,7 @@ wget $superinsecure -O "$DUMMYBUILDTMP/dummy.tar.gz" \
"$urlbase/xf86-video-dummy-0.3.8.tar.gz"

install --minimal --asdeps patch gcc libc-dev pkg-config \
xserver-xorg-dev$ltspackages x11proto-xf86dga-dev
xserver-xorg-dev$backport x11proto-xf86dga-dev

(
cd "$DUMMYBUILDTMP"
Expand Down Expand Up @@ -404,7 +416,7 @@ EOF

if [ "${DISTROAKA:-"$DISTRO"}" = 'debian' ]; then
# Hold xserver-xorg-video-dummy to make sure the driver does not get erased
apt-mark hold xserver-xorg-video-dummy$ltspackages
apt-mark hold xserver-xorg-video-dummy$backport
fi

TIPS="$TIPS"'
Expand Down
165 changes: 22 additions & 143 deletions targets/xorg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ REQUIRES='audio'
PROVIDES='x11'
DESCRIPTION='X.Org X11 backend. Enables GPU acceleration on supported platforms.'
CHROOTBIN='croutoncycle croutontriggerd croutonxinitrc-wrapper setres xinit'
CHROOTETC='xbindkeysrc.scm xorg-intel-sna.conf xserverrc xserverrc-xorg xserverrc-local.example'
CHROOTETC='xbindkeysrc.scm xserverrc xserverrc-xorg xserverrc-local.example'
if [ -z "$TARGETNOINSTALL" -a -f "/sys/class/tty/tty0/active" ]; then
error 99 "xorg target is only supported on Freon-based systems."
fi
. "${TARGETSDIR:="$PWD"}/common"

### Append to prepare.sh:
Expand All @@ -18,53 +21,28 @@ rm -f '/etc/crouton/xserverrc-x11'

# Figure out what we need on this system

# Freon?
freon=''
if [ ! -f "/sys/class/tty/tty0/active" ]; then
freon='y'
fi

# Pull in backported Xorg when possible on precise to support newer hardware
backport=''
if release -eq precise; then
if [ "${ARCH#arm}" = "$ARCH" ]; then
# Note: lts-trusty mesa requires kernel version >=3.6
if ! uname -r | grep -q "^3.4."; then
backport='-lts-trusty'
fi
backport='-lts-trusty'
else
# ARM only offers quantal backport at the moment
backport='-lts-quantal'
fi
elif release -eq trusty; then
backport='-lts-xenial'
fi

# Avoid issues when jumping backports
if [ "${DISTROAKA:-"$DISTRO"}" = 'debian' -a -n "$backport" ]; then
apt-mark unhold xserver-xorg-video-dummy || true 2>/dev/null
fi

# Intel?
inteldriver=''
intelhasfbc=''
pinmesa=''
intelfbcsupport='y'
if [ "${ARCH#arm}" = "$ARCH" ]; then
inteldriver="xserver-xorg-video-intel$backport"

# If the system has an Intel FBC-capable video card but has too old a driver
# to support the chipset, we'll need to disable hardware acceleration.
if grep -q 1 '/sys/module/i915/parameters/i915_enable_fbc' 2>/dev/null; then
intelhasfbc=y
if release -le wheezy -le sana; then
intelfbcsupport=''
fi
fi

# On saucy onwards, if kernel version is 3.4, manually pin down old mesa
# libraries, as new ones require version >=3.6 (see issue #704).
# This is only required on non-Atom Intel chipsets (Atom uses i915 dri driver)
if release -ge saucy && uname -r | grep -q "^3.4." &&
! grep -q 0xa0 /sys/class/graphics/fb0/device/device; then
pinmesa='y'
fi

# Unhold xserver-xorg-video-intel, modification will be reapplied later.
apt-mark unhold "$inteldriver" 2>/dev/null || true
fi

# Catalog relevant and irrelevant video drivers
Expand All @@ -77,95 +55,18 @@ else
modesetting=''
fi

installvideodrivers=''
removevideodrivers=''
if [ -n "$freon" ]; then
installvideodrivers="$modesetting"
removevideodrivers="$fbdev"
else
installvideodrivers="$fbdev"
fi
if [ -n "$inteldriver" ]; then
# If we need SNA (for fbc) but don't have it, don't install intel
if [ -z "$intelhasfbc" -o -n "$intelfbcsupport" ]; then
installvideodrivers="$installvideodrivers $inteldriver"
else
removevideodrivers="$removevideodrivers $inteldriver"
fi
fi
installvideodrivers="$modesetting"
removevideodrivers="$fbdev $inteldriver"


# On Freon, we need crazy xorg hacks
if [ -n "$freon" ]; then
compile freon '-ldl -ldrm -I/usr/include/libdrm' so libdrm-dev
fi
# Compile crazy xorg hacks
compile freon '-ldl -ldrm -I/usr/include/libdrm' so libdrm-dev

# Pin precise's version of mesa if necessary
# No systems use kernel 3.4 anymore, so remove the mesa hack
pinfile='/etc/apt/preferences.d/precise-mesa-pin'
pinlist='/etc/apt/sources.list.d/precise.list'
pindummypkg='libwayland-egl1-dummy'
if [ -n "$pinmesa" ]; then
# Create a dummy libwayland-egl1 package, to satisfy dependencies
# (the libraries are actually provided by libegl1-mesa-drivers in precise)
install --minimal --asdeps equivs

DEBTMP="`mktemp -d crouton.XXXXXX --tmpdir=/tmp`"
addtrap "rm -rf --one-file-system '$DEBTMP'"

( cd "$DEBTMP"; equivs-build - ) <<END
Section: misc
Priority: optional
Standards-Version: 3.9.2

Package: $pindummypkg
Version: 8.0.4
Depends: libegl1-mesa-drivers
Provides: libwayland-egl1
Description: Dummy package providing libwayland-egl1
END

# Add precise package sources
mirror="`detect_mirror`"

cat > "$pinlist" <<END
deb $mirror precise main
deb $mirror precise-updates main
deb $mirror precise-security main
END

cat > "$pinfile" <<END
# Do not install any packages from precise by default
Package: *
Pin: release n=precise
Pin-Priority: -10

# Install mesa packages and their dependencies from precise
Package: libegl1-mesa:* libegl1-mesa-dbg:* libegl1-mesa-dev:* \
libegl1-mesa-drivers:* libegl1-mesa-drivers-dbg:* \
libgl1-mesa-dev:* libgl1-mesa-dri:* libgl1-mesa-dri-dbg:* \
libgl1-mesa-glx:* libgl1-mesa-glx-dbg:* \
libglapi-mesa:* libglapi-mesa-dbg:* \
libgles1-mesa:* libgles1-mesa-dbg:* libgles1-mesa-dev:* \
libgles2-mesa:* libgles2-mesa-dbg:* libgles2-mesa-dev:* \
libdrm-nouveau1a:* libllvm3.0:* libudev0:*
Pin: release n=precise
Pin-Priority: 1100
END

# Fetch new package sources
apt-get update || true

# Forcibly replace libwayland-egl1-mesa by libwayland-egl1-dummy
# (dpkg -r does not fail if package does not exist)
dpkg -r --force-depends libwayland-egl1-mesa libwayland-egl1-mesa:i386
dpkg -i --force-depends "$DEBTMP"/libwayland-egl1-dummy_*_all.deb

# Downgrade packages, -f is needed as dependencies are broken
# This happens to install python2.7-minimal as well, pulled in by a wrong
# dependency of ubuntu-minimal-1.267 (precise), which we did not install.
# Looks like an apt bug, I guess we can live with that.
apt-get -y --force-yes --no-install-recommends dist-upgrade -f
elif [ -f "$pinfile" -o -f "$pinlist" ]; then
if [ -f "$pinfile" -o -f "$pinlist" ]; then
# No longer need the pin; remove it
rm -f "$pinfile" "$pinlist"
apt-get update || true
Expand All @@ -176,7 +77,8 @@ fi
# Install backported xorg instead of the default one
if [ -n "$backport" ]; then
# We still install xorg later to pull in its dependencies
install --minimal "xserver-xorg$backport" "libgl1-mesa-glx$backport" \
install --minimal "xserver-xorg$backport" "xserver-xorg-core$backport" \
"libgl1-mesa-glx$backport" \
"libegl1-mesa$backport" "libgles2-mesa$backport" \
"xserver-xorg-input-synaptics$backport" $installvideodrivers
fi
Expand Down Expand Up @@ -207,35 +109,12 @@ if [ -n "$removevideodrivers" ]; then
remove $removevideodrivers
fi

# If this is a system with framebuffer compression, we need SNA+tearfree
xorgconf='/usr/share/X11/xorg.conf.d/20-crouton-intel-sna.conf'
if [ -n "$intelhasfbc" -a -n "$intelfbcsupport" ]; then
mkdir -p "${xorgconf%/*}"
ln -sfT /etc/crouton/xorg-intel-sna.conf "$xorgconf"
else
# In case this got moved to a different system, delete the config
rm -f "$xorgconf"
fi
# Remove old Intel SNA workaround
rm -f '/usr/share/X11/xorg.conf.d/20-crouton-intel-sna.conf'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any replacements for this workaround? It seems like bionic needs this workaround on my system (CBPro) with gnome/kde to fix #3988 / #3933


# Fix launching X11 from inside crosh (user doesn't own a TTY)
echo 'allowed_users=anybody' > '/etc/X11/Xwrapper.config'

inteldrv='/usr/lib/xorg/modules/drivers/intel_drv.so'
if [ -n "$freon" -a -e "$inteldrv" ]; then
# Modify the Intel driver to call getuid0 (provided by croutonfreon.so)
# instead of geteuid, to force DRM master setting/dropping.
offset="`grep -F -m 1 -boa 'geteuid' "$inteldrv" 2>/dev/null || true`"
if [ -n "$offset" ]; then
echo -n 'getuid0' | dd seek="${offset%:*}" bs=1 of="$inteldrv" \
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove getuid0 from freon.c?

conv=notrunc,nocreat 2>/dev/null
fi

if grep -F -q -a 'getuid0' "$inteldrv" 2>/dev/null; then
# Hold xserver-xorg-video-intel to make sure that the modification
# (which may have been made in a previous update) does not get erased.
apt-mark hold "$inteldriver"
fi
fi

TIPS="$TIPS
You can flip through your running chroot desktops and Chromium OS by hitting
Expand Down