Update linux mesa drivers.

Creates a new package mesa_intel_driver_linux_22 for
version 22+ Mesa drivers, since Mesa dropped a large number
of "legacy" drivers in 22.0.

Bug: skia:13401
Change-Id: Ib0a2639a798a76f5d2a744ca37902efccd83737d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557586
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
This commit is contained in:
Joe Gregorio 2022-07-14 16:12:51 -04:00
parent 11f15a5e66
commit c83c345971
6 changed files with 177 additions and 1 deletions

View File

@ -0,0 +1,67 @@
# Creating the Mesa Intel Linux driver asset (which supports Vulkan)
Using the automated asset python scripts requires that Docker be installed.
$ sk asset upload mesa_intel_driver_linux_22
See below for steps on just building the driver.
## WARNING
This asset is `mesa_intel_driver_linux_22`.
There is also `mesa_intel_driver_linux`, which contains pre-version
22 copies of the Mesa drivers, that's because in v22 Mesa dropped support for
"legacy" drivers which covers many of our existing Intel jobs.
## Using Docker
It is easiest to just use the Dockerfile provided:
docker build -t mesa-driver-builder:latest ./mesa-driver-builder/
docker run --volume /tmp/out:/OUT --env MESA_VERSION=22.1.3 mesa-driver-builder:latest
You may change `/tmp/out` to be the desired output directory and `22.1.3` to be the desired
version of the mesa driver.
Finally, use `/tmp/out` as the input directory to the upload script.
## Testing
Testing both the Vulkan and GLX drivers is done via setting environment variables.
For example, if the above is run and the build drivers are in `/tmp/out/` then they can be tested via:
cd /tmp/out
LIBGL_DRIVERS_PATH=`pwd` glxinfo | grep -i Mesa
VK_ICD_FILENAMES="./intel_icd.x86_64.json" vulkaninfo | grep Mesa
N.B. Make sure to pick a version of Mesa that your desktop is not currently
using and then run both commands above both with and w/o the environment
variables set to confirm that the drivers are really being picked up. For example:
With the 22.1.3 drivers:
~~~console
chrome-bot@skia-e-linux-600:~/mesa/foo$ VK_ICD_FILENAMES="./intel_icd.x86_64.json" vulkaninfo | grep Mesa
VK_LAYER_MESA_overlay (Mesa Overlay layer) Vulkan version 1.3.211, layer version 1:
driverName = Intel open-source Mesa driver
driverInfo = Mesa 22.1.3
driverName = Intel open-source Mesa driver
driverInfo = Mesa 22.1.3
~~~
Compared to the installed 22.0.5 drivers:
~~~console
chrome-bot@skia-e-linux-600:~/mesa/foo$ vulkaninfo | grep Mesa
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
VK_LAYER_MESA_overlay (Mesa Overlay layer) Vulkan version 1.3.211, layer version 1:
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
driverName = Intel open-source Mesa driver
driverInfo = Mesa 22.0.5
driverName = Intel open-source Mesa driver
driverInfo = Mesa 22.0.5
driverInfo = Mesa 22.0.5 (LLVM 14.0.4)
driverInfo = Mesa 22.0.5 (LLVM 14.0.4)
~~~

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python
#
# Copyright 2022 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Create the mesa driver."""
import argparse
import subprocess
MESA_VERSION = '22.1.3'
def create_asset(target_dir):
"""Create the asset."""
cmd = [
'docker', 'build', '-t', 'mesa-driver-builder:latest',
'./mesa_intel_driver_linux_22/mesa-driver-builder',
]
print('Building container', cmd)
subprocess.check_output(cmd)
cmd = [
'docker', 'run', '--volume', '%s:/OUT' % target_dir,
'--env', 'MESA_VERSION=%s' % MESA_VERSION,
'mesa-driver-builder'
]
print('Running container', cmd)
subprocess.check_output(cmd)
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--target_dir', '-t', required=True)
args = parser.parse_args()
create_asset(args.target_dir)
if __name__ == '__main__':
main()

View File

@ -0,0 +1,20 @@
FROM debian:bookworm
ENV DEBIAN_FRONTEND noninteractive
# deb-src is not included by default in the docker image, so we duplicate every
# line in `sources.list` that begins with `deb` and create a new line that
# starts with `deb-src`.
RUN cp /etc/apt/sources.list /etc/apt/sources.list~ && \
sed -i 's/\(^deb\)\(.*\)$/\1\2\n\1-src \2/' /etc/apt/sources.list
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y wget curl clang meson rsync jq && \
apt-get build-dep -y mesa && \
rm -rf /var/lib/apt/lists/*
COPY ./build_mesa.sh /opt/build_mesa.sh
# Add entry point so we can run the container w/o having to specifying the
# script name.
ENTRYPOINT ["/opt/build_mesa.sh"]

View File

@ -0,0 +1,39 @@
#! /bin/bash
#
# Copyright 2018 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Builds the mesa driver and copies it to /OUT
# This script uses the environement variable $MESA_VERSION
# to dermine which version to download and build.
set -ex
if [[ -z "${MESA_VERSION}" ]]; then
printf "MESA_VERSION environment variable must be provided."
exit 1
fi
pushd /tmp
curl https://archive.mesa3d.org//mesa-${MESA_VERSION}.tar.xz -o mesa.tar.xz
tar xf mesa.tar.xz
cd mesa-${MESA_VERSION}/
ls -al
meson build/
meson configure --prefix="${PWD}/build/install" build/ -D 'dri-drivers-path=.'
ninja -C build/
ninja -C build/ install
# Copy all the .so files into one a single directory to make things simpler.
find build/install -name "*.so" | xargs -I{} -n1 cp {} /OUT
# Change "library_path" to "./libvulkan_intel.so" and write it out
# in the root of the /OUT directory.
jq < build/install/share/vulkan/icd.d/intel_icd.x86_64.json '.ICD.library_path="./libvulkan_intel.so"' > /OUT/intel_icd.x86_64.json
popd

View File

@ -1543,7 +1543,13 @@ func (b *taskBuilder) commonTestPerfAssets() {
b.asset("linux_vulkan_sdk")
}
if b.matchGpu("Intel") {
b.asset("mesa_intel_driver_linux")
if b.matchGpu("IrisXe") {
b.asset("mesa_intel_driver_linux_22")
} else {
// Use this for legacy drivers that were culled in v22 of Mesa.
// https://www.phoronix.com/scan.php?page=news_item&px=Mesa-22.0-Drops-OpenSWR
b.asset("mesa_intel_driver_linux")
}
}
}
}