summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-08-26 06:03:18 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-08-26 06:03:18 +0000
commitaf5e8f5366b05c3d4f8521f318c143a5c5dc3ea9 (patch)
treec5691445908b1beca9facf0e5e3c5d7f35f74228 /lib/mesa/src/gallium/drivers/panfrost
parent27c93456b58343162f7c4ad20ca6bea0c9a91646 (diff)
Merge Mesa 20.1.6
Diffstat (limited to 'lib/mesa/src/gallium/drivers/panfrost')
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/arm.config45
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/arm64.config82
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/create-rootfs.sh185
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/debian-install.sh125
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/deqp-runner.sh49
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/expected-failures.txt237
-rwxr-xr-xlib/mesa/src/gallium/drivers/panfrost/ci/generate_lava.py23
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/gitlab-ci.yml264
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja270
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/nir/nir_clamp_psiz.c75
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/nir/nir_undef_to_zero.c87
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_afbc.c127
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_bo_cache.c161
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_drm.c438
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_format.c250
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_format.h42
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_instancing.c344
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_invocation.c131
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_tiler.c295
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_tiler.h44
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_util.h43
-rw-r--r--lib/mesa/src/gallium/drivers/panfrost/pan_varyings.c410
22 files changed, 0 insertions, 3527 deletions
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/arm.config b/lib/mesa/src/gallium/drivers/panfrost/ci/arm.config
deleted file mode 100644
index 6bcc5a872..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/arm.config
+++ /dev/null
@@ -1,45 +0,0 @@
-CONFIG_LOCALVERSION="ccu"
-
-CONFIG_DEBUG_KERNEL=y
-
-CONFIG_DEVFREQ_GOV_PERFORMANCE=y
-CONFIG_DEVFREQ_GOV_POWERSAVE=y
-CONFIG_DEVFREQ_GOV_USERSPACE=y
-CONFIG_DEVFREQ_GOV_PASSIVE=y
-CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
-
-CONFIG_DRM=y
-CONFIG_DRM_ROCKCHIP=y
-CONFIG_DRM_PANFROST=y
-CONFIG_DRM_PANEL_SIMPLE=y
-CONFIG_PWM_CROS_EC=y
-CONFIG_BACKLIGHT_PWM=y
-
-CONFIG_ROCKCHIP_CDN_DP=n
-
-CONFIG_SPI_ROCKCHIP=y
-CONFIG_PWM_ROCKCHIP=y
-CONFIG_PHY_ROCKCHIP_DP=y
-CONFIG_DWMAC_ROCKCHIP=y
-
-CONFIG_MFD_RK808=y
-CONFIG_REGULATOR_RK808=y
-CONFIG_RTC_DRV_RK808=y
-CONFIG_COMMON_CLK_RK808=y
-
-CONFIG_REGULATOR_FAN53555=y
-CONFIG_REGULATOR=y
-
-CONFIG_REGULATOR_VCTRL=y
-
-CONFIG_KASAN=n
-CONFIG_KASAN_INLINE=n
-CONFIG_STACKTRACE=n
-
-CONFIG_TMPFS=y
-
-CONFIG_PROVE_LOCKING=n
-CONFIG_DEBUG_LOCKDEP=n
-CONFIG_SOFTLOCKUP_DETECTOR=n
-CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=n
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/arm64.config b/lib/mesa/src/gallium/drivers/panfrost/ci/arm64.config
deleted file mode 100644
index 80662541f..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/arm64.config
+++ /dev/null
@@ -1,82 +0,0 @@
-CONFIG_LOCALVERSION="ccu"
-
-CONFIG_DEBUG_KERNEL=y
-
-CONFIG_DEVFREQ_GOV_PERFORMANCE=y
-CONFIG_DEVFREQ_GOV_POWERSAVE=y
-CONFIG_DEVFREQ_GOV_USERSPACE=y
-CONFIG_DEVFREQ_GOV_PASSIVE=y
-
-CONFIG_DRM=y
-CONFIG_DRM_ROCKCHIP=y
-CONFIG_DRM_PANFROST=y
-CONFIG_DRM_PANEL_SIMPLE=y
-CONFIG_PWM_CROS_EC=y
-CONFIG_BACKLIGHT_PWM=y
-
-CONFIG_ROCKCHIP_CDN_DP=n
-
-CONFIG_SPI_ROCKCHIP=y
-CONFIG_PWM_ROCKCHIP=y
-CONFIG_PHY_ROCKCHIP_DP=y
-CONFIG_DWMAC_ROCKCHIP=y
-CONFIG_STMMAC_ETH=y
-CONFIG_TYPEC_FUSB302=y
-CONFIG_TYPEC=y
-CONFIG_TYPEC_TCPM=y
-
-CONFIG_ARCH_SUNXI=n
-CONFIG_ARCH_ALPINE=n
-CONFIG_ARCH_BCM2835=n
-CONFIG_ARCH_BCM_IPROC=n
-CONFIG_ARCH_BERLIN=n
-CONFIG_ARCH_BRCMSTB=n
-CONFIG_ARCH_EXYNOS=n
-CONFIG_ARCH_K3=n
-CONFIG_ARCH_LAYERSCAPE=n
-CONFIG_ARCH_LG1K=n
-CONFIG_ARCH_HISI=n
-CONFIG_ARCH_MEDIATEK=n
-CONFIG_ARCH_MESON=n
-CONFIG_ARCH_MVEBU=n
-CONFIG_ARCH_QCOM=n
-CONFIG_ARCH_SEATTLE=n
-CONFIG_ARCH_SYNQUACER=n
-CONFIG_ARCH_RENESAS=n
-CONFIG_ARCH_R8A774A1=n
-CONFIG_ARCH_R8A774C0=n
-CONFIG_ARCH_R8A7795=n
-CONFIG_ARCH_R8A7796=n
-CONFIG_ARCH_R8A77965=n
-CONFIG_ARCH_R8A77970=n
-CONFIG_ARCH_R8A77980=n
-CONFIG_ARCH_R8A77990=n
-CONFIG_ARCH_R8A77995=n
-CONFIG_ARCH_STRATIX10=n
-CONFIG_ARCH_TEGRA=n
-CONFIG_ARCH_SPRD=n
-CONFIG_ARCH_THUNDER=n
-CONFIG_ARCH_THUNDER2=n
-CONFIG_ARCH_UNIPHIER=n
-CONFIG_ARCH_VEXPRESS=n
-CONFIG_ARCH_XGENE=n
-CONFIG_ARCH_ZX=n
-CONFIG_ARCH_ZYNQMP=n
-
-CONFIG_ACPI=n
-
-CONFIG_REGULATOR_FAN53555=y
-CONFIG_REGULATOR=y
-
-CONFIG_REGULATOR_VCTRL=y
-
-CONFIG_KASAN=n
-CONFIG_KASAN_INLINE=n
-CONFIG_STACKTRACE=n
-
-CONFIG_TMPFS=y
-
-CONFIG_PROVE_LOCKING=n
-CONFIG_DEBUG_LOCKDEP=n
-CONFIG_SOFTLOCKUP_DETECTOR=n
-CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=n \ No newline at end of file
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/create-rootfs.sh b/lib/mesa/src/gallium/drivers/panfrost/ci/create-rootfs.sh
deleted file mode 100644
index 84ce8cdc8..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/create-rootfs.sh
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-apt-get -y install --no-install-recommends initramfs-tools libpng16-16 weston strace libsensors5
-passwd root -d
-chsh -s /bin/sh
-ln -s /bin/sh /init
-
-#######################################################################
-# Strip the image to a small minimal system without removing the debian
-# toolchain.
-
-# Copy timezone file and remove tzdata package
-rm -rf /etc/localtime
-cp /usr/share/zoneinfo/Etc/UTC /etc/localtime
-
-
-UNNEEDED_PACKAGES=" libfdisk1"\
-" tzdata"\
-
-export DEBIAN_FRONTEND=noninteractive
-
-# Removing unused packages
-for PACKAGE in ${UNNEEDED_PACKAGES}
-do
- echo ${PACKAGE}
- if ! apt-get remove --purge --yes "${PACKAGE}"
- then
- echo "WARNING: ${PACKAGE} isn't installed"
- fi
-done
-
-apt-get autoremove --yes || true
-
-# Dropping logs
-rm -rf /var/log/*
-
-# Dropping documentation, localization, i18n files, etc
-rm -rf /usr/share/doc/*
-rm -rf /usr/share/locale/*
-rm -rf /usr/share/man
-rm -rf /usr/share/i18n/*
-rm -rf /usr/share/info/*
-rm -rf /usr/share/lintian/*
-rm -rf /usr/share/common-licenses/*
-rm -rf /usr/share/mime/*
-
-# Dropping reportbug scripts
-rm -rf /usr/share/bug
-
-# Drop udev hwdb not required on a stripped system
-rm -rf /lib/udev/hwdb.bin /lib/udev/hwdb.d/*
-
-# Drop all gconv conversions && binaries
-rm -rf usr/bin/iconv
-rm -rf usr/sbin/iconvconfig
-rm -rf usr/lib/*/gconv/
-
-# Remove libusb database
-rm -rf usr/sbin/update-usbids
-rm -rf var/lib/usbutils/usb.ids
-rm -rf usr/share/misc/usb.ids
-
-#######################################################################
-# Crush into a minimal production image to be deployed via some type of image
-# updating system.
-# IMPORTANT: The Debian system is not longer functional at this point,
-# for example, apt and dpkg will stop working
-
-UNNEEDED_PACKAGES="apt libapt-pkg5.0 "\
-"ncurses-bin ncurses-base libncursesw5 libncurses5 "\
-"perl-base "\
-"debconf libdebconfclient0 "\
-"e2fsprogs e2fslibs libfdisk1 "\
-"insserv "\
-"udev "\
-"init-system-helpers "\
-"bash "\
-"cpio "\
-"passwd "\
-"libsemanage1 libsemanage-common "\
-"libsepol1 "\
-"gzip "\
-"gnupg "\
-"gpgv "\
-"hostname "\
-"adduser "\
-"debian-archive-keyring "\
-"libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libegl-mesa0 libgles2 "\
-"libllvm7 "\
-"libx11-data libthai-data "\
-"systemd dbus "\
-
-# Removing unneeded packages
-for PACKAGE in ${UNNEEDED_PACKAGES}
-do
- echo "Forcing removal of ${PACKAGE}"
- if ! dpkg --purge --force-remove-essential --force-depends "${PACKAGE}"
- then
- echo "WARNING: ${PACKAGE} isn't installed"
- fi
-done
-
-# Show what's left package-wise before dropping dpkg itself
-COLUMNS=300 dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n
-
-# Drop dpkg
-dpkg --purge --force-remove-essential --force-depends dpkg
-
-# No apt or dpkg, no need for its configuration archives
-rm -rf etc/apt
-rm -rf etc/dpkg
-
-# Drop directories not part of ostree
-# Note that /var needs to exist as ostree bind mounts the deployment /var over
-# it
-rm -rf var/* opt srv share
-
-# ca-certificates are in /etc drop the source
-rm -rf usr/share/ca-certificates
-
-# No bash, no need for completions
-rm -rf usr/share/bash-completion
-
-# No zsh, no need for comletions
-rm -rf usr/share/zsh/vendor-completions
-
-# drop gcc-6 python helpers
-rm -rf usr/share/gcc-6
-
-# Drop sysvinit leftovers
-rm -rf etc/init.d
-rm -rf etc/rc[0-6S].d
-
-# Drop upstart helpers
-rm -rf etc/init
-
-# Various xtables helpers
-rm -rf usr/lib/xtables
-
-# Drop all locales
-# TODO: only remaining locale is actually "C". Should we really remove it?
-rm -rf usr/lib/locale/*
-
-# partition helpers
-rm usr/sbin/*fdisk
-
-# local compiler
-rm usr/bin/localedef
-
-# Systemd dns resolver
-find usr etc -name '*systemd-resolve*' -prune -exec rm -r {} \;
-
-# Systemd network configuration
-find usr etc -name '*networkd*' -prune -exec rm -r {} \;
-
-# systemd ntp client
-find usr etc -name '*timesyncd*' -prune -exec rm -r {} \;
-
-# systemd hw database manager
-find usr etc -name '*systemd-hwdb*' -prune -exec rm -r {} \;
-
-# No need for fuse
-find usr etc -name '*fuse*' -prune -exec rm -r {} \;
-
-# lsb init function leftovers
-rm -rf usr/lib/lsb
-
-# Only needed when adding libraries
-rm usr/sbin/ldconfig*
-
-# Games, unused
-rmdir usr/games
-
-# Remove pam module to authenticate against a DB
-# plus libdb-5.3.so that is only used by this pam module
-rm usr/lib/*/security/pam_userdb.so
-rm usr/lib/*/libdb-5.3.so
-
-# remove NSS support for nis, nisplus and hesiod
-rm usr/lib/*/libnss_hesiod*
-rm usr/lib/*/libnss_nis*
-
-rm usr/bin/tar \ No newline at end of file
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/debian-install.sh b/lib/mesa/src/gallium/drivers/panfrost/ci/debian-install.sh
deleted file mode 100644
index c42c43877..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/bin/bash
-
-set -e
-set -o xtrace
-
-PANFROST_CI_DIR=/tmp/clone/src/gallium/drivers/panfrost/ci
-
-############### Install packages for building
-dpkg --add-architecture ${DEBIAN_ARCH}
-echo 'deb-src https://deb.debian.org/debian testing main' > /etc/apt/sources.list.d/deb-src.list
-apt-get update
-apt-get -y install ca-certificates
-apt-get -y install --no-install-recommends \
- crossbuild-essential-${DEBIAN_ARCH} \
- meson \
- g++ \
- git \
- ccache \
- pkg-config \
- python3-mako \
- python-numpy \
- python-six \
- python-mako \
- python3-pip \
- python3-setuptools \
- python3-six \
- python3-wheel \
- python3-jinja2 \
- bison \
- flex \
- libwayland-dev \
- gettext \
- cmake \
- bc \
- libssl-dev \
- lavacli \
- csvkit \
- curl \
- unzip \
- wget \
- debootstrap \
- procps \
- qemu-user-static \
- cpio \
- \
- libdrm-dev:${DEBIAN_ARCH} \
- libx11-dev:${DEBIAN_ARCH} \
- libxxf86vm-dev:${DEBIAN_ARCH} \
- libexpat1-dev:${DEBIAN_ARCH} \
- libsensors-dev:${DEBIAN_ARCH} \
- libxfixes-dev:${DEBIAN_ARCH} \
- libxdamage-dev:${DEBIAN_ARCH} \
- libxext-dev:${DEBIAN_ARCH} \
- x11proto-dev:${DEBIAN_ARCH} \
- libx11-xcb-dev:${DEBIAN_ARCH} \
- libxcb-dri2-0-dev:${DEBIAN_ARCH} \
- libxcb-glx0-dev:${DEBIAN_ARCH} \
- libxcb-xfixes0-dev:${DEBIAN_ARCH} \
- libxcb-dri3-dev:${DEBIAN_ARCH} \
- libxcb-present-dev:${DEBIAN_ARCH} \
- libxcb-randr0-dev:${DEBIAN_ARCH} \
- libxcb-sync-dev:${DEBIAN_ARCH} \
- libxrandr-dev:${DEBIAN_ARCH} \
- libxshmfence-dev:${DEBIAN_ARCH} \
- libelf-dev:${DEBIAN_ARCH} \
- libwayland-dev:${DEBIAN_ARCH} \
- libwayland-egl-backend-dev:${DEBIAN_ARCH} \
- libclang-7-dev:${DEBIAN_ARCH} \
- zlib1g-dev:${DEBIAN_ARCH} \
- libglvnd-core-dev:${DEBIAN_ARCH} \
- wayland-protocols:${DEBIAN_ARCH} \
- libpng-dev:${DEBIAN_ARCH}
-
-############### Cross-build dEQP
-mkdir -p /artifacts/rootfs/deqp
-
-wget https://github.com/KhronosGroup/VK-GL-CTS/archive/opengl-es-cts-3.2.5.0.zip
-unzip -q opengl-es-cts-3.2.5.0.zip -d /
-rm opengl-es-cts-3.2.5.0.zip
-
-cd /VK-GL-CTS-opengl-es-cts-3.2.5.0
-python3 external/fetch_sources.py
-
-cd /artifacts/rootfs/deqp
-cmake -DDEQP_TARGET=wayland \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_C_COMPILER=${GCC_ARCH}-gcc \
- -DCMAKE_CXX_COMPILER=${GCC_ARCH}-g++ \
- /VK-GL-CTS-opengl-es-cts-3.2.5.0
-make -j$(nproc)
-rm -rf /artifacts/rootfs/deqp/external
-rm -rf /artifacts/rootfs/deqp/modules/gles3
-rm -rf /artifacts/rootfs/deqp/modules/gles31
-rm -rf /artifacts/rootfs/deqp/modules/internal
-rm -rf /artifacts/rootfs/deqp/executor
-rm -rf /artifacts/rootfs/deqp/execserver
-rm -rf /artifacts/rootfs/deqp/modules/egl
-rm -rf /artifacts/rootfs/deqp/framework
-find . -name CMakeFiles | xargs rm -rf
-find . -name lib\*.a | xargs rm -rf
-du -sh *
-rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
-
-
-############### Cross-build kernel
-KERNEL_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.2.tar.gz"
-export ARCH=${KERNEL_ARCH}
-export CROSS_COMPILE="${GCC_ARCH}-"
-
-mkdir -p /kernel
-wget -qO- ${KERNEL_URL} | tar -xz --strip-components=1 -C /kernel
-cd /kernel
-./scripts/kconfig/merge_config.sh ${DEFCONFIG} ${PANFROST_CI_DIR}/${KERNEL_ARCH}.config
-make -j12 ${KERNEL_IMAGE_NAME} dtbs
-cp arch/${KERNEL_ARCH}/boot/${KERNEL_IMAGE_NAME} /artifacts/.
-cp ${DEVICE_TREES} /artifacts/.
-rm -rf /kernel
-
-
-############### Create rootfs
-cp ${PANFROST_CI_DIR}/create-rootfs.sh /artifacts/rootfs/.
-debootstrap --variant=minbase --arch=${DEBIAN_ARCH} testing /artifacts/rootfs/ http://deb.debian.org/debian
-chroot /artifacts/rootfs sh /create-rootfs.sh
-rm /artifacts/rootfs/create-rootfs.sh
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/deqp-runner.sh b/lib/mesa/src/gallium/drivers/panfrost/ci/deqp-runner.sh
deleted file mode 100644
index c468d95d2..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-set -x
-
-DEQP_OPTIONS="--deqp-surface-width=256 --deqp-surface-height=256"
-DEQP_OPTIONS="$DEQP_OPTIONS --deqp-visibility=hidden"
-DEQP_OPTIONS="$DEQP_OPTIONS --deqp-log-images=disable"
-DEQP_OPTIONS="$DEQP_OPTIONS --deqp-watchdog=enable"
-DEQP_OPTIONS="$DEQP_OPTIONS --deqp-crashhandler=enable"
-
-export XDG_RUNTIME_DIR=/tmp
-export LIBGL_DRIVERS_PATH=/mesa/lib/dri/
-export LD_LIBRARY_PATH=/mesa/lib/
-export XDG_CONFIG_HOME=$(pwd)
-export MESA_GLES_VERSION_OVERRIDE=3.0
-
-echo "[core]\nidle-time=0\nrequire-input=false\n[shell]\nlocking=false" > weston.ini
-
-cd /deqp/modules/gles2
-
-# Generate test case list file
-weston --tty=7 &
-sleep 1 # Give some time for Weston to start up
-./deqp-gles2 $DEQP_OPTIONS --deqp-runmode=stdout-caselist | grep "TEST: dEQP-GLES2" | cut -d ' ' -f 2 > /tmp/case-list.txt
-
-# Disable for now tests that are very slow, either by just using lots of CPU or by crashing
-sed -i '/dEQP-GLES2.performance/d' /tmp/case-list.txt
-sed -i '/dEQP-GLES2.stress/d' /tmp/case-list.txt
-sed -i '/dEQP-GLES2.functional.fbo.render.depth./d' /tmp/case-list.txt
-sed -i '/dEQP-GLES2.functional.flush_finish./d' /tmp/case-list.txt
-
-# Cannot use tee because dash doesn't have pipefail
-touch /tmp/result.txt
-tail -f /tmp/result.txt &
-
-while [ -s /tmp/case-list.txt ]; do
- ./deqp-gles2 $DEQP_OPTIONS --deqp-log-filename=/dev/null --deqp-caselist-file=/tmp/case-list.txt >> /tmp/result.txt
- if [ $? -ne 0 ]; then
- # Continue from the subtest after the failing one
- crashed_test=$(grep "Test case" /tmp/result.txt | tail -1 | sed "s/Test case '\(.*\)'\.\./\1/")
- sed -i "0,/^$crashed_test$/d" /tmp/case-list.txt
-
- # So LAVA knows what happened
- echo "Test case '$crashed_test'..
- Crash"
- else
- break
- fi
-done
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/expected-failures.txt b/lib/mesa/src/gallium/drivers/panfrost/ci/expected-failures.txt
deleted file mode 100644
index 0ecfb02c7..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/expected-failures.txt
+++ /dev/null
@@ -1,237 +0,0 @@
-dEQP-GLES2.functional.buffer.write.use.index_array.array
-dEQP-GLES2.functional.buffer.write.use.index_array.element_array
-dEQP-GLES2.functional.color_clear.masked_rgb
-dEQP-GLES2.functional.color_clear.masked_rgba
-dEQP-GLES2.functional.color_clear.masked_scissored_rgb
-dEQP-GLES2.functional.color_clear.masked_scissored_rgba
-dEQP-GLES2.functional.color_clear.scissored_rgb
-dEQP-GLES2.functional.color_clear.scissored_rgba
-dEQP-GLES2.functional.color_clear.short_scissored_rgb
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgb565_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgb565_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgb5_a1_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgb5_a1_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgba4_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgba4_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_tex2d_rgb_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_tex2d_rgb_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_tex2d_rgba_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_tex2d_rgba_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_rbo_rgb565_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_rbo_rgb565_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_rbo_rgb5_a1_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_rbo_rgb5_a1_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_rbo_rgba4_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_rbo_rgba4_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgb_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgb_stencil_index8
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgba_depth_component16
-dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgba_stencil_index8
-dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgb565_depth_component16
-dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb_depth_component16
-dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgba_depth_component16
-dEQP-GLES2.functional.fbo.render.shared_depthbuffer.rbo_rgb565_depth_component16
-dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgb_depth_component16
-dEQP-GLES2.functional.fbo.render.shared_depthbuffer.tex2d_rgba_depth_component16
-dEQP-GLES2.functional.fbo.render.texsubimage.after_render_tex2d_rgb
-dEQP-GLES2.functional.fbo.render.texsubimage.after_render_tex2d_rgba
-dEQP-GLES2.functional.fbo.render.texsubimage.between_render_tex2d_rgb
-dEQP-GLES2.functional.fbo.render.texsubimage.between_render_tex2d_rgba
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.0
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.1
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.10
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.11
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.12
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.13
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.15
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.16
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.18
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.19
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.20
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.21
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.22
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.23
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.24
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.25
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.26
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.29
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.3
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.30
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.31
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.32
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.33
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.34
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.35
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.36
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.37
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.38
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.39
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.40
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.41
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.42
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.43
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.44
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.46
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.47
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.48
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.49
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.5
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.50
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.51
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.52
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.53
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.54
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.55
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.56
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.57
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.58
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.59
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.6
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.60
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.61
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.62
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.63
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.64
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.65
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.66
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.67
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.68
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.69
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.7
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.70
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.71
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.72
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.73
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.74
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.75
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.76
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.77
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.78
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.79
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.8
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.80
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.81
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.82
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.83
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.84
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.85
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.86
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.87
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.88
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.89
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.9
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.90
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.91
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.92
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.93
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.94
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.95
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.96
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.97
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.98
-dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.99
-dEQP-GLES2.functional.fragment_ops.random.0
-dEQP-GLES2.functional.fragment_ops.random.1
-dEQP-GLES2.functional.fragment_ops.random.10
-dEQP-GLES2.functional.fragment_ops.random.11
-dEQP-GLES2.functional.fragment_ops.random.12
-dEQP-GLES2.functional.fragment_ops.random.13
-dEQP-GLES2.functional.fragment_ops.random.14
-dEQP-GLES2.functional.fragment_ops.random.15
-dEQP-GLES2.functional.fragment_ops.random.16
-dEQP-GLES2.functional.fragment_ops.random.17
-dEQP-GLES2.functional.fragment_ops.random.18
-dEQP-GLES2.functional.fragment_ops.random.19
-dEQP-GLES2.functional.fragment_ops.random.2
-dEQP-GLES2.functional.fragment_ops.random.20
-dEQP-GLES2.functional.fragment_ops.random.21
-dEQP-GLES2.functional.fragment_ops.random.22
-dEQP-GLES2.functional.fragment_ops.random.23
-dEQP-GLES2.functional.fragment_ops.random.24
-dEQP-GLES2.functional.fragment_ops.random.25
-dEQP-GLES2.functional.fragment_ops.random.26
-dEQP-GLES2.functional.fragment_ops.random.27
-dEQP-GLES2.functional.fragment_ops.random.28
-dEQP-GLES2.functional.fragment_ops.random.29
-dEQP-GLES2.functional.fragment_ops.random.3
-dEQP-GLES2.functional.fragment_ops.random.30
-dEQP-GLES2.functional.fragment_ops.random.31
-dEQP-GLES2.functional.fragment_ops.random.32
-dEQP-GLES2.functional.fragment_ops.random.33
-dEQP-GLES2.functional.fragment_ops.random.34
-dEQP-GLES2.functional.fragment_ops.random.35
-dEQP-GLES2.functional.fragment_ops.random.36
-dEQP-GLES2.functional.fragment_ops.random.37
-dEQP-GLES2.functional.fragment_ops.random.38
-dEQP-GLES2.functional.fragment_ops.random.39
-dEQP-GLES2.functional.fragment_ops.random.4
-dEQP-GLES2.functional.fragment_ops.random.40
-dEQP-GLES2.functional.fragment_ops.random.41
-dEQP-GLES2.functional.fragment_ops.random.42
-dEQP-GLES2.functional.fragment_ops.random.43
-dEQP-GLES2.functional.fragment_ops.random.44
-dEQP-GLES2.functional.fragment_ops.random.45
-dEQP-GLES2.functional.fragment_ops.random.46
-dEQP-GLES2.functional.fragment_ops.random.47
-dEQP-GLES2.functional.fragment_ops.random.48
-dEQP-GLES2.functional.fragment_ops.random.49
-dEQP-GLES2.functional.fragment_ops.random.5
-dEQP-GLES2.functional.fragment_ops.random.50
-dEQP-GLES2.functional.fragment_ops.random.51
-dEQP-GLES2.functional.fragment_ops.random.52
-dEQP-GLES2.functional.fragment_ops.random.53
-dEQP-GLES2.functional.fragment_ops.random.54
-dEQP-GLES2.functional.fragment_ops.random.55
-dEQP-GLES2.functional.fragment_ops.random.56
-dEQP-GLES2.functional.fragment_ops.random.57
-dEQP-GLES2.functional.fragment_ops.random.58
-dEQP-GLES2.functional.fragment_ops.random.59
-dEQP-GLES2.functional.fragment_ops.random.6
-dEQP-GLES2.functional.fragment_ops.random.60
-dEQP-GLES2.functional.fragment_ops.random.61
-dEQP-GLES2.functional.fragment_ops.random.62
-dEQP-GLES2.functional.fragment_ops.random.63
-dEQP-GLES2.functional.fragment_ops.random.64
-dEQP-GLES2.functional.fragment_ops.random.65
-dEQP-GLES2.functional.fragment_ops.random.66
-dEQP-GLES2.functional.fragment_ops.random.67
-dEQP-GLES2.functional.fragment_ops.random.68
-dEQP-GLES2.functional.fragment_ops.random.69
-dEQP-GLES2.functional.fragment_ops.random.7
-dEQP-GLES2.functional.fragment_ops.random.70
-dEQP-GLES2.functional.fragment_ops.random.71
-dEQP-GLES2.functional.fragment_ops.random.72
-dEQP-GLES2.functional.fragment_ops.random.73
-dEQP-GLES2.functional.fragment_ops.random.74
-dEQP-GLES2.functional.fragment_ops.random.75
-dEQP-GLES2.functional.fragment_ops.random.76
-dEQP-GLES2.functional.fragment_ops.random.77
-dEQP-GLES2.functional.fragment_ops.random.78
-dEQP-GLES2.functional.fragment_ops.random.79
-dEQP-GLES2.functional.fragment_ops.random.8
-dEQP-GLES2.functional.fragment_ops.random.80
-dEQP-GLES2.functional.fragment_ops.random.81
-dEQP-GLES2.functional.fragment_ops.random.82
-dEQP-GLES2.functional.fragment_ops.random.83
-dEQP-GLES2.functional.fragment_ops.random.84
-dEQP-GLES2.functional.fragment_ops.random.85
-dEQP-GLES2.functional.fragment_ops.random.86
-dEQP-GLES2.functional.fragment_ops.random.87
-dEQP-GLES2.functional.fragment_ops.random.88
-dEQP-GLES2.functional.fragment_ops.random.89
-dEQP-GLES2.functional.fragment_ops.random.9
-dEQP-GLES2.functional.fragment_ops.random.90
-dEQP-GLES2.functional.fragment_ops.random.91
-dEQP-GLES2.functional.fragment_ops.random.92
-dEQP-GLES2.functional.fragment_ops.random.93
-dEQP-GLES2.functional.fragment_ops.random.94
-dEQP-GLES2.functional.fragment_ops.random.95
-dEQP-GLES2.functional.fragment_ops.random.96
-dEQP-GLES2.functional.fragment_ops.random.97
-dEQP-GLES2.functional.fragment_ops.random.98
-dEQP-GLES2.functional.fragment_ops.random.99
-dEQP-GLES2.functional.polygon_offset.fixed16_render_with_units
-dEQP-GLES2.functional.polygon_offset.fixed16_factor_1_slope
-dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_w
-dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_fragment
-dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_vertex
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/generate_lava.py b/lib/mesa/src/gallium/drivers/panfrost/ci/generate_lava.py
deleted file mode 100755
index ec9b1e7ef..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/generate_lava.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python3
-
-from jinja2 import Environment, FileSystemLoader
-import argparse
-
-parser = argparse.ArgumentParser()
-parser.add_argument("--template")
-parser.add_argument("--base-artifacts-url")
-parser.add_argument("--arch")
-parser.add_argument("--device-type")
-parser.add_argument("--kernel-image-name")
-args = parser.parse_args()
-
-env = Environment(loader = FileSystemLoader('.'), trim_blocks=True, lstrip_blocks=True)
-template = env.get_template(args.template)
-
-values = {}
-values['base_artifacts_url'] = args.base_artifacts_url
-values['arch'] = args.arch
-values['device_type'] = args.device_type
-values['kernel_image_name'] = args.kernel_image_name
-
-print(template.render(values))
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/gitlab-ci.yml b/lib/mesa/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
deleted file mode 100644
index a135c5dd5..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ /dev/null
@@ -1,264 +0,0 @@
-# IMAGE_TAG is the tag of the docker image used for the build jobs. If the
-# image doesn't exist yet, the docker-image stage generates it.
-#
-# In order to generate a new image, one should generally change the tag.
-# While removing the image from the registry would also work, that's not
-# recommended except for ephemeral images during development: Replacing an
-# image after a significant amount of time might pull in newer versions of
-# gcc/clang or other packages, which might break the build with older commits
-# using the same tag.
-#
-# After merging a change resulting in generating a new image to the main
-# repository, it's recommended to remove the image from the source repository's
-# container registry, so that the image from the main repository's registry
-# will be used there as well. You can manage your images on your fork of:
-# https://gitlab.freedesktop.org/xorg/xserver/container_registry
-variables:
- UPSTREAM_REPO: mesa/mesa
- DEBIAN_VERSION: testing-slim
- IMAGE_TAG: "2019-07-25-1"
-
-include:
- - project: 'wayland/ci-templates'
- ref: c73dae8b84697ef18e2dbbf4fed7386d9652b0cd
- file: '/templates/debian.yml'
-
-stages:
- - containers
- - build
- - test
-
-# Retry jobs after runner system failures
-.retry: &retry
- retry:
- max: 2
- when:
- - runner_system_failure
-
-# Build Docker image with deqp, the rootfs and the build deps for Mesa
-.container:
- extends: .debian@container-ifnot-exists
- stage: containers
- <<: *retry
- variables:
- GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
- DEBIAN_TAG: '${DEBIAN_ARCH}-${IMAGE_TAG}'
- DEBIAN_EXEC: 'DEBIAN_ARCH=${DEBIAN_ARCH}
- GCC_ARCH=${GCC_ARCH}
- KERNEL_ARCH=${KERNEL_ARCH}
- DEFCONFIG=${DEFCONFIG}
- DEVICE_TREES=${DEVICE_TREES}
- KERNEL_IMAGE_NAME=${KERNEL_IMAGE_NAME}
- bash src/gallium/drivers/panfrost/ci/debian-install.sh'
-
-container:armhf:
- extends: .container
- variables:
- DEBIAN_ARCH: "armhf"
- GCC_ARCH: "arm-linux-gnueabihf"
- KERNEL_ARCH: "arm"
- DEFCONFIG: "arch/arm/configs/multi_v7_defconfig"
- DEVICE_TREES: "arch/arm/boot/dts/rk3288-veyron-jaq.dtb"
- KERNEL_IMAGE_NAME: "zImage"
-
-container:arm64:
- extends: .container
- variables:
- DEBIAN_ARCH: "arm64"
- GCC_ARCH: "aarch64-linux-gnu"
- KERNEL_ARCH: "arm64"
- DEFCONFIG: "arch/arm64/configs/defconfig"
- DEVICE_TREES: "arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb"
- KERNEL_IMAGE_NAME: "Image"
-
-.build:
- stage: build
- image: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:${DEBIAN_ARCH}-${IMAGE_TAG}
- cache:
- paths:
- - ccache
- before_script:
- - mkdir -p results mesa-build
- - mkdir -p ccache
- script:
- - export CCACHE_BASEDIR=$CI_PROJECT_DIR
- - export CCACHE_DIR=$CI_PROJECT_DIR/ccache
- - export PATH="/usr/lib/ccache:$PATH"
- - ccache -s
-
- # Build Mesa
- - /usr/share/meson/debcrossgen --arch ${DEBIAN_ARCH} -o /tmp/cross_file.txt
- - meson . mesa-build
- --cross-file /tmp/cross_file.txt
- --libdir /artifacts/rootfs/mesa/lib/
- --buildtype release
- -Dgallium-drivers=kmsro,panfrost
- -Ddri-drivers=
- -Dprefix=/artifacts/rootfs/mesa
- - ninja -C mesa-build install
- - du -sh /artifacts/rootfs/mesa/*
- - rm -rf /artifacts/rootfs/mesa/include
-
- # Pack rootfs
- - cp src/gallium/drivers/panfrost/ci/deqp-runner.sh /artifacts/rootfs/deqp/.
- - du -sh /artifacts/rootfs/deqp/*
- - find /artifacts/rootfs/ -type f -printf "%s\t%p\n" | sort -n
- - cd /artifacts/rootfs/ ; find -H | cpio -H newc -v -o | gzip -c - > $CI_PROJECT_DIR/results/panfrost-rootfs-${DEBIAN_ARCH}.cpio.gz
-
- # Copy kernel and DT
- - cp /artifacts/${KERNEL_IMAGE_NAME} /artifacts/*.dtb $CI_PROJECT_DIR/results/.
-
- # Generate LAVA job
- - cd $CI_PROJECT_DIR
- - src/gallium/drivers/panfrost/ci/generate_lava.py
- --template src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
- --arch ${DEBIAN_ARCH}
- --base-artifacts-url $CI_PROJECT_URL/-/jobs/$CI_JOB_ID/artifacts/raw/results
- --device-type ${DEVICE_TYPE}
- --kernel-image-name ${KERNEL_IMAGE_NAME}
- > results/lava-deqp.yml
- - cp src/gallium/drivers/panfrost/ci/expected-failures.txt results/.
- artifacts:
- when: always
- paths:
- - results/
-
-build:armhf:
- extends: .build
- variables:
- DEBIAN_ARCH: "armhf"
- GCC_ARCH: "arm-linux-gnueabihf"
- DEVICE_TYPE: "rk3288-veyron-jaq"
- KERNEL_IMAGE_NAME: "zImage"
-
-build:arm64:
- extends: .build
- variables:
- DEBIAN_ARCH: "arm64"
- GCC_ARCH: "aarch64-linux-gnu"
- DEVICE_TYPE: "rk3399-gru-kevin"
- KERNEL_IMAGE_NAME: "Image"
-
-.test:
- stage: test
- tags:
- - idle-jobs
- image: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:arm64-${IMAGE_TAG} # Any of the images will be fine
- variables:
- GIT_STRATEGY: none # no need to pull the whole tree for submitting the job
- script:
- - mkdir -p ~/.config/
- - |
- echo "default:
- uri: https://lava.collabora.co.uk/RPC2
- timeout: 120
- username: jenkins-fdo
- token: $LAVA_TOKEN
- " > ~/.config/lavacli.yaml
- - lava_job_id=`lavacli jobs submit $CI_PROJECT_DIR/results/lava-deqp.yml` || echo $lava_job_id
- - lavacli jobs logs $lava_job_id | grep -a -v "{'case':" | tee results/lava-deqp-$lava_job_id.log
- - lavacli jobs show $lava_job_id
- - curl "https://lava.collabora.co.uk/results/$lava_job_id/csv?user=jenkins-fdo&token=$LAVA_TOKEN" > raw_results.csv
- - cat raw_results.csv | csvcut -c 12,3 | grep dEQP-GLES2 | sort > results/results-$lava_job_id.csv
-
- # FIXME: Remove flip-flops from comparison files
- - |
- FLIP_FLOPS="
- dEQP-GLES2.functional.clipping.triangle_vertex.clip_three.clip_neg_x_neg_z_and_pos_x_pos_z_and_neg_x_neg_y_pos_z
- dEQP-GLES2.functional.clipping.triangle_vertex.clip_three.clip_pos_y_pos_z_and_neg_x_neg_y_pos_z_and_pos_x_pos_y_neg_z
- dEQP-GLES2.functional.fbo.render.color.blend_rbo_rgb5_a1
- dEQP-GLES2.functional.fbo.render.color.blend_rbo_rgb5_a1_depth_component16
- dEQP-GLES2.functional.fbo.render.color.blend_rbo_rgba4
- dEQP-GLES2.functional.fbo.render.color.blend_rbo_rgba4_depth_component16
- dEQP-GLES2.functional.fbo.render.color.blend_npot_rbo_rgb5_a1
- dEQP-GLES2.functional.fbo.render.color.blend_npot_rbo_rgb5_a1_depth_component16
- dEQP-GLES2.functional.fbo.render.color.blend_npot_rbo_rgba4
- dEQP-GLES2.functional.fbo.render.color.blend_npot_rbo_rgba4_depth_component16
- dEQP-GLES2.functional.fbo.render.color_clear.rbo_rgb5_a1
- dEQP-GLES2.functional.fbo.render.color_clear.rbo_rgb5_a1_depth_component16
- dEQP-GLES2.functional.fbo.render.color_clear.rbo_rgb5_a1_stencil_index8
- dEQP-GLES2.functional.fbo.render.color_clear.rbo_rgba4_depth_component16
- dEQP-GLES2.functional.fbo.render.color_clear.rbo_rgba4_stencil_index8
- dEQP-GLES2.functional.fbo.render.recreate_depthbuffer.
- dEQP-GLES2.functional.fbo.render.recreate_stencilbuffer.
- dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear.rbo_rgb5_a1
- dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear.rbo_rgba4
- dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear.tex2d_rgb
- dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear.tex2d_rgba
- dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgb5_a1
- dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgba4
- dEQP-GLES2.functional.fbo.render.shared_depthbuffer.rbo_rgb5_a1_depth_component16
- dEQP-GLES2.functional.fbo.render.shared_depthbuffer.rbo_rgba4_depth_component16
- dEQP-GLES2.functional.fbo.render.stencil_clear.rbo_rgb5_a1_stencil_index8
- dEQP-GLES2.functional.fbo.render.stencil.npot_rbo_rgb5_a1_stencil_index8
- dEQP-GLES2.functional.fbo.render.stencil.npot_rbo_rgba4_stencil_index8
- dEQP-GLES2.functional.fbo.render.stencil.rbo_rgb5_a1_stencil_index8
- dEQP-GLES2.functional.fbo.render.stencil.rbo_rgba4_stencil_index8
- dEQP-GLES2.functional.lifetime.attach.deleted_input.renderbuffer_framebuffer
- dEQP-GLES2.functional.lifetime.attach.deleted_output.renderbuffer_framebuffer
- dEQP-GLES2.functional.polygon_offset.fixed16_factor_0_slope
- dEQP-GLES2.functional.polygon_offset.fixed16_factor_1_slope
- dEQP-GLES2.functional.shaders.invariance.highp.loop_4
- dEQP-GLES2.functional.shaders.matrix.mul.dynamic_highp_mat4_vec4_vertex
- dEQP-GLES2.functional.shaders.matrix.mul.dynamic_highp_vec4_mat4_fragment
- dEQP-GLES2.functional.shaders.operator.common_functions.smoothstep.mediump_vec3_vertex
- dEQP-GLES2.functional.shaders.random.all_features.fragment.12
- dEQP-GLES2.functional.shaders.random.all_features.fragment.37
- dEQP-GLES2.functional.texture.units.2_units.mixed.1
- dEQP-GLES2.functional.texture.units.2_units.mixed.3
- dEQP-GLES2.functional.texture.units.2_units.only_2d.2
- dEQP-GLES2.functional.texture.units.4_units.mixed.5
- dEQP-GLES2.functional.texture.units.4_units.only_2d.0
- dEQP-GLES2.functional.texture.units.8_units.only_cube.2
- dEQP-GLES2.functional.texture.units.all_units.mixed.6
- dEQP-GLES2.functional.texture.units.all_units.only_cube.4
- dEQP-GLES2.functional.texture.units.all_units.only_cube.7
- dEQP-GLES2.functional.texture.units.all_units.only_cube.8
- "
-
- # FIXME: These tests fail in RK3288 but pass on RK3399
- - |
- FLIP_FLOPS="$FLIP_FLOPS
- dEQP-GLES2.functional.fragment_ops.blend.*
- dEQP-GLES2.functional.shaders.builtin_variable.max_draw_buffers_vertex
- dEQP-GLES2.functional.shaders.matrix.div.const_lowp_mat2_mat2_vertex
- dEQP-GLES2.functional.shaders.operator.unary_operator.pre_increment_effect.highp_ivec4_vertex
- dEQP-GLES2.functional.shaders.texture_functions.vertex.texture2dprojlod_vec3
- dEQP-GLES2.functional.shaders.swizzles.vector_swizzles.mediump_ivec3_stts_fragment
- dEQP-GLES2.functional.texture.filtering.2d.nearest_mipmap_nearest_linear_repeat_rgba8888
- dEQP-GLES2.functional.shaders.swizzles.vector_swizzles.mediump_ivec3_stts_fragment
- dEQP-GLES2.functional.shaders.loops.do_while_constant_iterations.only_continue_vertex
- dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb_depth_component16
- dEQP-GLES2.functional.fbo.render.resize.tex2d_rgba_depth_component16
- dEQP-GLES2.functional.texture.filtering.2d.linear_mipmap_nearest_nearest_clamp_rgba8888
- "
-
- - for test in $FLIP_FLOPS; do sed -i "/$test/d" results/expected-failures.txt results/results-$lava_job_id.csv; done
-
- - PASSED=$(grep pass$ results/results-$lava_job_id.csv | wc -l)
- - FAILED=$(grep fail$ results/results-$lava_job_id.csv | wc -l)
- - TOTAL=$(wc -l < results/results-$lava_job_id.csv)
- - 'echo "Passed: $PASSED ($(expr $PASSED \* 100 / $TOTAL)%)"'
- - 'echo "Failed: $FAILED ($(expr $FAILED \* 100 / $TOTAL)%)"'
- - 'echo "Total: $TOTAL"'
- - 'if [ $TOTAL != 16374 ]; then echo "WARNING: Unexpected count of results. Incomplete run?"; fi'
-
- - sed '/,pass/d' results/results-$lava_job_id.csv | sed 's/,fail//' > results/failures-$lava_job_id.txt
-
- # Don't error out on RK3288
- - diff -u results/expected-failures.txt results/failures-$lava_job_id.txt || [ -f results/rk3288-veyron-jaq.dtb ]
- artifacts:
- when: always
- paths:
- - results/
-
-test:armhf:
- extends: .test
- dependencies:
- - build:armhf
-
-test:arm64:
- extends: .test
- dependencies:
- - build:arm64
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 b/lib/mesa/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
deleted file mode 100644
index f610f9c82..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
+++ /dev/null
@@ -1,70 +0,0 @@
-job_name: panfrost-deqp
-device_type: {{ device_type }}
-timeouts:
- job:
- minutes: 40
- action:
- minutes: 10
- actions:
- power-off:
- seconds: 30
-priority: medium
-visibility: public
-actions:
-- deploy:
- timeout:
- minutes: 2
- to: tftp
- kernel:
- url: {{ base_artifacts_url }}/{{ kernel_image_name }}
- ramdisk:
- url: {{ base_artifacts_url }}/panfrost-rootfs-{{ arch }}.cpio.gz
- compression: gz
- dtb:
- url: {{ base_artifacts_url }}/{{ device_type }}.dtb
- os: oe
-- boot:
- timeout:
- minutes: 5
- method: depthcharge
- commands: ramdisk
- prompts:
- - '#'
-- test:
- timeout:
- minutes: 40
- definitions:
- - repository:
- metadata:
- format: Lava-Test Test Definition 1.0
- name: igt
- description: "IGT test plan"
- os:
- - oe
- scope:
- - functional
- run:
- steps:
- - mount -t proc none /proc
- - mount -t sysfs none /sys
- - mount -t devtmpfs none /dev
- - mkdir -p /dev/pts
- - mount -t devpts devpts /dev/pts
- - echo 1 > /proc/sys/kernel/printk
-# - echo performance > /sys/devices/platform/ff9a0000.gpu/devfreq/devfreq0/governor
- - sh /deqp/deqp-runner.sh
- parse:
- pattern: 'Test case ''(?P<test_case_id>\S*)''..\s+(?P<result>(Pass|NotSupported|QualityWarning|CompatibilityWarning|Fail|ResourceError|Crash|Timeout|InternalError))'
- fixupdict:
- Pass: pass
- NotSupported: pass
- QualityWarning: pass
- CompatibilityWarning: pass
- Fail: fail
- ResourceError: fail
- Crash: fail
- Timeout: fail
- InternalError: fail
- from: inline
- name: deqp
- path: inline/lava-deqp.yaml
diff --git a/lib/mesa/src/gallium/drivers/panfrost/nir/nir_clamp_psiz.c b/lib/mesa/src/gallium/drivers/panfrost/nir/nir_clamp_psiz.c
deleted file mode 100644
index 249a400a1..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/nir/nir_clamp_psiz.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-/**
- * @file
- *
- * Clamps writes to VARYING_SLOT_PSIZ to a given limit.
- */
-
-#include "compiler/nir/nir.h"
-#include "compiler/nir/nir_builder.h"
-
-void
-nir_clamp_psiz(nir_shader *shader, float min_size, float max_size);
-
-void
-nir_clamp_psiz(nir_shader *shader, float min_size, float max_size)
-{
- nir_foreach_function(func, shader) {
- nir_foreach_block(block, func->impl) {
- nir_foreach_instr_safe(instr, block) {
- if (instr->type != nir_instr_type_intrinsic)
- continue;
-
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
- if (intr->intrinsic != nir_intrinsic_store_deref)
- continue;
-
- nir_variable *var = nir_intrinsic_get_var(intr, 0);
- if (var->data.location != VARYING_SLOT_PSIZ)
- continue;
-
- nir_builder b;
- nir_builder_init(&b, func->impl);
- b.cursor = nir_before_instr(instr);
-
- nir_ssa_def *in_size = nir_ssa_for_src(&b, intr->src[1],
- intr->num_components);
-
- nir_ssa_def *clamped =
- nir_fmin(&b,
- nir_fmax(&b, in_size, nir_imm_float(&b, min_size)),
- nir_imm_float(&b, max_size));
-
- nir_instr_rewrite_src(instr, &intr->src[1],
- nir_src_for_ssa(clamped));
-
- }
- }
-
- nir_metadata_preserve(func->impl, nir_metadata_block_index |
- nir_metadata_dominance);
- }
-}
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/nir/nir_undef_to_zero.c b/lib/mesa/src/gallium/drivers/panfrost/nir/nir_undef_to_zero.c
deleted file mode 100644
index ed0bb5402..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/nir/nir_undef_to_zero.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors (Collabora):
- * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
- */
-
-/**
- * @file
- *
- * Flushes undefined SSA values to a zero vector fo the appropriate component
- * count, to avoid undefined behaviour in the resulting shader. Not required
- * for conformance as use of uninitialized variables is explicitly left
- * undefined by the spec. Works around buggy apps, however.
- *
- * Call immediately after nir_opt_undef. If called before, larger optimization
- * opportunities from the former pass will be missed. If called outside of an
- * optimization loop, constant propagation and algebraic optimizations won't be
- * able to kick in to reduce stuff consuming the zero.
- */
-
-#include "compiler/nir/nir.h"
-#include "compiler/nir/nir_builder.h"
-
-bool nir_undef_to_zero(nir_shader *shader);
-
-bool
-nir_undef_to_zero(nir_shader *shader)
-{
- bool progress = false;
-
- nir_foreach_function(function, shader) {
- if (!function->impl) continue;
-
- nir_builder b;
- nir_builder_init(&b, function->impl);
-
- nir_foreach_block(block, function->impl) {
- nir_foreach_instr_safe(instr, block) {
- if (instr->type != nir_instr_type_ssa_undef) continue;
-
- nir_ssa_undef_instr *und = nir_instr_as_ssa_undef(instr);
-
- /* Get the required size */
- unsigned c = und->def.num_components;
- unsigned s = und->def.bit_size;
-
- nir_const_value v[NIR_MAX_VEC_COMPONENTS];
- memset(v, 0, sizeof(v));
-
- b.cursor = nir_before_instr(instr);
- nir_ssa_def *zero = nir_build_imm(&b, c, s, v);
- nir_src zerosrc = nir_src_for_ssa(zero);
-
- nir_ssa_def_rewrite_uses(&und->def, zerosrc);
-
- progress |= true;
- }
- }
-
- nir_metadata_preserve(function->impl, nir_metadata_block_index | nir_metadata_dominance);
-
- }
-
- return progress;
-}
-
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_afbc.c b/lib/mesa/src/gallium/drivers/panfrost/pan_afbc.c
deleted file mode 100644
index 23e1ec921..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_afbc.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Authors:
- * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
- */
-
-#include "pan_resource.h"
-#include "util/u_format.h"
-
-/* Arm FrameBuffer Compression (AFBC) is a lossless compression scheme natively
- * implemented in Mali GPUs (as well as many display controllers paired with
- * Mali GPUs, etc). Where possible, Panfrost prefers to use AFBC for both
- * rendering and texturing. In most cases, this is a performance-win due to a
- * dramatic reduction in memory bandwidth and cache locality compared to a
- * linear resources.
- *
- * AFBC divides the framebuffer into 16x16 tiles (other sizes possible, TODO:
- * do we need to support this?). So, the width and height each must be aligned
- * up to 16 pixels. This is inherently good for performance; note that for a 4
- * byte-per-pixel format like RGBA8888, that means that rows are 16*4=64 byte
- * aligned, which is the cache-line size.
- *
- * For each AFBC-compressed resource, there is a single contiguous
- * (CPU/GPU-shared) buffer. This buffer itself is divided into two parts:
- * header and body, placed immediately after each other.
- *
- * The AFBC header contains 16 bytes of metadata per tile.
- *
- * The AFBC body is the same size as the original linear resource (padded to
- * the nearest tile). Although the body comes immediately after the header, it
- * must also be cache-line aligned, so there can sometimes be a bit of padding
- * between the header and body.
- *
- * As an example, a 64x64 RGBA framebuffer contains 64/16 = 4 tiles horizontally and
- * 4 tiles vertically. There are 4*4=16 tiles in total, each containing 16
- * bytes of metadata, so there is a 16*16=256 byte header. 64x64 is already
- * tile aligned, so the body is 64*64 * 4 bytes per pixel = 16384 bytes of
- * body.
- *
- * From userspace, Panfrost needs to be able to calculate these sizes. It
- * explicitly does not and can not know the format of the data contained within
- * this header and body. The GPU has native support for AFBC encode/decode. For
- * an internal FBO or a framebuffer used for scanout with an AFBC-compatible
- * winsys/display-controller, the buffer is maintained AFBC throughout flight,
- * and the driver never needs to know the internal data. For edge cases where
- * the driver really does need to read/write from the AFBC resource, we
- * generate a linear staging buffer and use the GPU to blit AFBC<--->linear.
- * TODO: Implement me. */
-
-#define AFBC_TILE_WIDTH 16
-#define AFBC_TILE_HEIGHT 16
-#define AFBC_HEADER_BYTES_PER_TILE 16
-#define AFBC_CACHE_ALIGN 64
-
-/* Is it possible to AFBC compress a particular format? Common formats (and
- * YUV) are compressible. Some obscure formats are not and fallback on linear,
- * at a performance hit. Also, if you need to disable AFBC entirely in the
- * driver for debug/profiling, just always return false here. */
-
-bool
-panfrost_format_supports_afbc(enum pipe_format format)
-{
- const struct util_format_description *desc =
- util_format_description(format);
-
- /* sRGB cannot be AFBC, but it can be tiled. TODO: Verify. The blob
- * does not do AFBC for SRGB8_ALPHA8, but it's not clear why it
- * shouldn't be able to. */
-
- if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
- return false;
-
- if (util_format_is_rgba8_variant(desc))
- return true;
-
- /* Z32/Z16/S8 are all compressible as well, but they are implemented as
- * Z24S8 with wasted bits. So Z24S8 is the only format we actually need
- * to handle compressed, and we can make the state tracker deal with
- * the rest. */
-
- if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT)
- return true;
-
- /* TODO: AFBC of other formats */
-
- return false;
-}
-
-unsigned
-panfrost_afbc_header_size(unsigned width, unsigned height)
-{
- /* Align to tile */
- unsigned aligned_width = ALIGN_POT(width, AFBC_TILE_WIDTH);
- unsigned aligned_height = ALIGN_POT(height, AFBC_TILE_HEIGHT);
-
- /* Compute size in tiles, rather than pixels */
- unsigned tile_count_x = aligned_width / AFBC_TILE_WIDTH;
- unsigned tile_count_y = aligned_height / AFBC_TILE_HEIGHT;
- unsigned tile_count = tile_count_x * tile_count_y;
-
- /* Multiply to find the header size */
- unsigned header_bytes = tile_count * AFBC_HEADER_BYTES_PER_TILE;
-
- /* Align and go */
- return ALIGN_POT(header_bytes, AFBC_CACHE_ALIGN);
-
-}
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_bo_cache.c b/lib/mesa/src/gallium/drivers/panfrost/pan_bo_cache.c
deleted file mode 100644
index 9dd6b694b..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_bo_cache.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Authors (Collabora):
- * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
- */
-#include <xf86drm.h>
-#include "drm-uapi/panfrost_drm.h"
-
-#include "pan_screen.h"
-#include "util/u_math.h"
-
-/* This file implements a userspace BO cache. Allocating and freeing
- * GPU-visible buffers is very expensive, and even the extra kernel roundtrips
- * adds more work than we would like at this point. So caching BOs in userspace
- * solves both of these problems and does not require kernel updates.
- *
- * Cached BOs are sorted into a bucket based on rounding their size down to the
- * nearest power-of-two. Each bucket contains a linked list of free panfrost_bo
- * objects. Putting a BO into the cache is accomplished by adding it to the
- * corresponding bucket. Getting a BO from the cache consists of finding the
- * appropriate bucket and sorting. A cache eviction is a kernel-level free of a
- * BO and removing it from the bucket. We special case evicting all BOs from
- * the cache, since that's what helpful in practice and avoids extra logic
- * around the linked list.
- */
-
-/* Helper to calculate the bucket index of a BO */
-
-static unsigned
-pan_bucket_index(unsigned size)
-{
- /* Round down to POT to compute a bucket index */
-
- unsigned bucket_index = util_logbase2(size);
-
- /* Clamp the bucket index; all huge allocations will be
- * sorted into the largest bucket */
-
- bucket_index = MIN2(bucket_index, MAX_BO_CACHE_BUCKET);
-
- /* The minimum bucket size must equal the minimum allocation
- * size; the maximum we clamped */
-
- assert(bucket_index >= MIN_BO_CACHE_BUCKET);
- assert(bucket_index <= MAX_BO_CACHE_BUCKET);
-
- /* Reindex from 0 */
- return (bucket_index - MIN_BO_CACHE_BUCKET);
-}
-
-static struct list_head *
-pan_bucket(struct panfrost_screen *screen, unsigned size)
-{
- return &screen->bo_cache[pan_bucket_index(size)];
-}
-
-/* Tries to fetch a BO of sufficient size with the appropriate flags from the
- * BO cache. If it succeeds, it returns that BO and removes the BO from the
- * cache. If it fails, it returns NULL signaling the caller to allocate a new
- * BO. */
-
-struct panfrost_bo *
-panfrost_bo_cache_fetch(
- struct panfrost_screen *screen,
- size_t size, uint32_t flags)
-{
- struct list_head *bucket = pan_bucket(screen, size);
-
- /* Iterate the bucket looking for something suitable */
- list_for_each_entry_safe(struct panfrost_bo, entry, bucket, link) {
- if (entry->size >= size &&
- entry->flags == flags) {
- int ret;
- struct drm_panfrost_madvise madv;
-
- /* This one works, splice it out of the cache */
- list_del(&entry->link);
-
- madv.handle = entry->gem_handle;
- madv.madv = PANFROST_MADV_WILLNEED;
- madv.retained = 0;
-
- ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MADVISE, &madv);
- if (!ret && !madv.retained) {
- panfrost_drm_release_bo(screen, entry, false);
- continue;
- }
- /* Let's go! */
- return entry;
- }
- }
-
- /* We didn't find anything */
- return NULL;
-}
-
-/* Tries to add a BO to the cache. Returns if it was
- * successful */
-
-bool
-panfrost_bo_cache_put(
- struct panfrost_screen *screen,
- struct panfrost_bo *bo)
-{
- struct list_head *bucket = pan_bucket(screen, bo->size);
- struct drm_panfrost_madvise madv;
-
- madv.handle = bo->gem_handle;
- madv.madv = PANFROST_MADV_DONTNEED;
- madv.retained = 0;
-
- drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MADVISE, &madv);
-
- /* Add us to the bucket */
- list_addtail(&bo->link, bucket);
-
- return true;
-}
-
-/* Evicts all BOs from the cache. Called during context
- * destroy or during low-memory situations (to free up
- * memory that may be unused by us just sitting in our
- * cache, but still reserved from the perspective of the
- * OS) */
-
-void
-panfrost_bo_cache_evict_all(
- struct panfrost_screen *screen)
-{
- for (unsigned i = 0; i < ARRAY_SIZE(screen->bo_cache); ++i) {
- struct list_head *bucket = &screen->bo_cache[i];
-
- list_for_each_entry_safe(struct panfrost_bo, entry, bucket, link) {
- list_del(&entry->link);
- panfrost_drm_release_bo(screen, entry, false);
- }
- }
-
- return;
-}
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_drm.c b/lib/mesa/src/gallium/drivers/panfrost/pan_drm.c
deleted file mode 100644
index 28a428720..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_drm.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * © Copyright 2019 Collabora, Ltd.
- * Copyright 2019 Alyssa Rosenzweig
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#include <fcntl.h>
-#include <xf86drm.h>
-
-#include "drm-uapi/panfrost_drm.h"
-
-#include "util/u_memory.h"
-#include "util/os_time.h"
-#include "os/os_mman.h"
-
-#include "pan_screen.h"
-#include "pan_resource.h"
-#include "pan_context.h"
-#include "pan_util.h"
-#include "pandecode/decode.h"
-
-void
-panfrost_drm_mmap_bo(struct panfrost_screen *screen, struct panfrost_bo *bo)
-{
- struct drm_panfrost_mmap_bo mmap_bo = { .handle = bo->gem_handle };
- int ret;
-
- if (bo->cpu)
- return;
-
- ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MMAP_BO, &mmap_bo);
- if (ret) {
- fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %m\n");
- assert(0);
- }
-
- bo->cpu = os_mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
- screen->fd, mmap_bo.offset);
- if (bo->cpu == MAP_FAILED) {
- fprintf(stderr, "mmap failed: %p %m\n", bo->cpu);
- assert(0);
- }
-
- /* Record the mmap if we're tracing */
- if (pan_debug & PAN_DBG_TRACE)
- pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
-}
-
-static void
-panfrost_drm_munmap_bo(struct panfrost_screen *screen, struct panfrost_bo *bo)
-{
- if (!bo->cpu)
- return;
-
- if (os_munmap((void *) (uintptr_t)bo->cpu, bo->size)) {
- perror("munmap");
- abort();
- }
-
- bo->cpu = NULL;
-}
-
-struct panfrost_bo *
-panfrost_drm_create_bo(struct panfrost_screen *screen, size_t size,
- uint32_t flags)
-{
- struct panfrost_bo *bo;
-
- /* Kernel will fail (confusingly) with EPERM otherwise */
- assert(size > 0);
-
- /* To maximize BO cache usage, don't allocate tiny BOs */
- size = MAX2(size, 4096);
-
- /* GROWABLE BOs cannot be mmapped */
- if (flags & PAN_ALLOCATE_GROWABLE)
- assert(flags & PAN_ALLOCATE_INVISIBLE);
-
- unsigned translated_flags = 0;
-
- if (screen->kernel_version->version_major > 1 ||
- screen->kernel_version->version_minor >= 1) {
- if (flags & PAN_ALLOCATE_GROWABLE)
- translated_flags |= PANFROST_BO_HEAP;
- if (!(flags & PAN_ALLOCATE_EXECUTE))
- translated_flags |= PANFROST_BO_NOEXEC;
- }
-
- struct drm_panfrost_create_bo create_bo = {
- .size = size,
- .flags = translated_flags,
- };
-
- /* Before creating a BO, we first want to check the cache */
-
- bo = panfrost_bo_cache_fetch(screen, size, flags);
-
- if (bo == NULL) {
- /* Otherwise, the cache misses and we need to allocate a BO fresh from
- * the kernel */
-
- int ret;
-
- ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_CREATE_BO, &create_bo);
- if (ret) {
- fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: %m\n");
- assert(0);
- }
-
- /* We have a BO allocated from the kernel; fill in the userspace
- * version */
-
- bo = rzalloc(screen, struct panfrost_bo);
- bo->size = create_bo.size;
- bo->gpu = create_bo.offset;
- bo->gem_handle = create_bo.handle;
- bo->flags = flags;
- }
-
- /* Only mmap now if we know we need to. For CPU-invisible buffers, we
- * never map since we don't care about their contents; they're purely
- * for GPU-internal use. But we do trace them anyway. */
-
- if (!(flags & (PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_DELAY_MMAP)))
- panfrost_drm_mmap_bo(screen, bo);
- else if (flags & PAN_ALLOCATE_INVISIBLE) {
- if (pan_debug & PAN_DBG_TRACE)
- pandecode_inject_mmap(bo->gpu, NULL, bo->size, NULL);
- }
-
- pipe_reference_init(&bo->reference, 1);
- return bo;
-}
-
-void
-panfrost_drm_release_bo(struct panfrost_screen *screen, struct panfrost_bo *bo, bool cacheable)
-{
- struct drm_gem_close gem_close = { .handle = bo->gem_handle };
- int ret;
-
- if (!bo)
- return;
-
- /* Rather than freeing the BO now, we'll cache the BO for later
- * allocations if we're allowed to */
-
- panfrost_drm_munmap_bo(screen, bo);
-
- if (cacheable) {
- bool cached = panfrost_bo_cache_put(screen, bo);
-
- if (cached)
- return;
- }
-
- /* Otherwise, if the BO wasn't cached, we'll legitimately free the BO */
-
- ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, &gem_close);
- if (ret) {
- fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
- assert(0);
- }
-
- ralloc_free(bo);
-}
-
-void
-panfrost_drm_allocate_slab(struct panfrost_screen *screen,
- struct panfrost_memory *mem,
- size_t pages,
- bool same_va,
- int extra_flags,
- int commit_count,
- int extent)
-{
- // TODO cache allocations
- // TODO properly handle errors
- // TODO take into account extra_flags
- mem->bo = panfrost_drm_create_bo(screen, pages * 4096, extra_flags);
- mem->stack_bottom = 0;
-}
-
-void
-panfrost_drm_free_slab(struct panfrost_screen *screen, struct panfrost_memory *mem)
-{
- panfrost_bo_unreference(&screen->base, mem->bo);
- mem->bo = NULL;
-}
-
-struct panfrost_bo *
-panfrost_drm_import_bo(struct panfrost_screen *screen, int fd)
-{
- struct panfrost_bo *bo = rzalloc(screen, struct panfrost_bo);
- struct drm_panfrost_get_bo_offset get_bo_offset = {0,};
- ASSERTED int ret;
- unsigned gem_handle;
-
- ret = drmPrimeFDToHandle(screen->fd, fd, &gem_handle);
- assert(!ret);
-
- get_bo_offset.handle = gem_handle;
- ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_BO_OFFSET, &get_bo_offset);
- assert(!ret);
-
- bo->gem_handle = gem_handle;
- bo->gpu = (mali_ptr) get_bo_offset.offset;
- bo->size = lseek(fd, 0, SEEK_END);
- assert(bo->size > 0);
- pipe_reference_init(&bo->reference, 1);
-
- // TODO map and unmap on demand?
- panfrost_drm_mmap_bo(screen, bo);
- return bo;
-}
-
-int
-panfrost_drm_export_bo(struct panfrost_screen *screen, const struct panfrost_bo *bo)
-{
- struct drm_prime_handle args = {
- .handle = bo->gem_handle,
- .flags = DRM_CLOEXEC,
- };
-
- int ret = drmIoctl(screen->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
- if (ret == -1)
- return -1;
-
- return args.fd;
-}
-
-static int
-panfrost_drm_submit_job(struct panfrost_context *ctx, u64 job_desc, int reqs)
-{
- struct pipe_context *gallium = (struct pipe_context *) ctx;
- struct panfrost_screen *screen = pan_screen(gallium->screen);
- struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
- struct drm_panfrost_submit submit = {0,};
- int *bo_handles, ret;
-
- submit.in_syncs = (u64) (uintptr_t) &ctx->out_sync;
- submit.in_sync_count = 1;
-
- submit.out_sync = ctx->out_sync;
-
- submit.jc = job_desc;
- submit.requirements = reqs;
-
- bo_handles = calloc(job->bos->entries, sizeof(*bo_handles));
- assert(bo_handles);
-
- set_foreach(job->bos, entry) {
- struct panfrost_bo *bo = (struct panfrost_bo *)entry->key;
- assert(bo->gem_handle > 0);
- bo_handles[submit.bo_handle_count++] = bo->gem_handle;
- }
-
- submit.bo_handles = (u64) (uintptr_t) bo_handles;
- ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit);
- free(bo_handles);
- if (ret) {
- fprintf(stderr, "Error submitting: %m\n");
- return errno;
- }
-
- /* Trace the job if we're doing that */
- if (pan_debug & PAN_DBG_TRACE) {
- /* Wait so we can get errors reported back */
- drmSyncobjWait(screen->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
- pandecode_jc(submit.jc, FALSE);
- }
-
- return 0;
-}
-
-int
-panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool is_scanout)
-{
- int ret = 0;
-
- struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
-
- /* TODO: Add here the transient pools */
- panfrost_job_add_bo(job, ctx->scratchpad.bo);
- panfrost_job_add_bo(job, ctx->tiler_heap.bo);
- panfrost_job_add_bo(job, job->polygon_list);
-
- if (job->first_job.gpu) {
- ret = panfrost_drm_submit_job(ctx, job->first_job.gpu, 0);
- assert(!ret);
- }
-
- if (job->first_tiler.gpu || job->clear) {
- ret = panfrost_drm_submit_job(ctx, panfrost_fragment_job(ctx, has_draws), PANFROST_JD_REQ_FS);
- assert(!ret);
- }
-
- return ret;
-}
-
-static struct panfrost_fence *
-panfrost_fence_create(struct panfrost_context *ctx)
-{
- struct pipe_context *gallium = (struct pipe_context *) ctx;
- struct panfrost_screen *screen = pan_screen(gallium->screen);
- struct panfrost_fence *f = calloc(1, sizeof(*f));
- if (!f)
- return NULL;
-
- /* Snapshot the last Panfrost's rendering's out fence. We'd rather have
- * another syncobj instead of a sync file, but this is all we get.
- * (HandleToFD/FDToHandle just gives you another syncobj ID for the
- * same syncobj).
- */
- drmSyncobjExportSyncFile(screen->fd, ctx->out_sync, &f->fd);
- if (f->fd == -1) {
- fprintf(stderr, "export failed: %m\n");
- free(f);
- return NULL;
- }
-
- pipe_reference_init(&f->reference, 1);
-
- return f;
-}
-
-void
-panfrost_drm_force_flush_fragment(struct panfrost_context *ctx,
- struct pipe_fence_handle **fence)
-{
- struct pipe_context *gallium = (struct pipe_context *) ctx;
- struct panfrost_screen *screen = pan_screen(gallium->screen);
-
- if (!screen->last_fragment_flushed) {
- drmSyncobjWait(screen->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
- screen->last_fragment_flushed = true;
-
- /* The job finished up, so we're safe to clean it up now */
- panfrost_free_job(ctx, screen->last_job);
- }
-
- if (fence) {
- struct panfrost_fence *f = panfrost_fence_create(ctx);
- gallium->screen->fence_reference(gallium->screen, fence, NULL);
- *fence = (struct pipe_fence_handle *)f;
- }
-}
-
-unsigned
-panfrost_drm_query_gpu_version(struct panfrost_screen *screen)
-{
- struct drm_panfrost_get_param get_param = {0,};
- ASSERTED int ret;
-
- get_param.param = DRM_PANFROST_PARAM_GPU_PROD_ID;
- ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_PARAM, &get_param);
- assert(!ret);
-
- return get_param.value;
-}
-
-int
-panfrost_drm_init_context(struct panfrost_context *ctx)
-{
- struct pipe_context *gallium = (struct pipe_context *) ctx;
- struct panfrost_screen *screen = pan_screen(gallium->screen);
-
- return drmSyncobjCreate(screen->fd, DRM_SYNCOBJ_CREATE_SIGNALED,
- &ctx->out_sync);
-}
-
-void
-panfrost_drm_fence_reference(struct pipe_screen *screen,
- struct pipe_fence_handle **ptr,
- struct pipe_fence_handle *fence)
-{
- struct panfrost_fence **p = (struct panfrost_fence **)ptr;
- struct panfrost_fence *f = (struct panfrost_fence *)fence;
- struct panfrost_fence *old = *p;
-
- if (pipe_reference(&(*p)->reference, &f->reference)) {
- close(old->fd);
- free(old);
- }
- *p = f;
-}
-
-boolean
-panfrost_drm_fence_finish(struct pipe_screen *pscreen,
- struct pipe_context *ctx,
- struct pipe_fence_handle *fence,
- uint64_t timeout)
-{
- struct panfrost_screen *screen = pan_screen(pscreen);
- struct panfrost_fence *f = (struct panfrost_fence *)fence;
- int ret;
-
- unsigned syncobj;
- ret = drmSyncobjCreate(screen->fd, 0, &syncobj);
- if (ret) {
- fprintf(stderr, "Failed to create syncobj to wait on: %m\n");
- return false;
- }
-
- drmSyncobjImportSyncFile(screen->fd, syncobj, f->fd);
- if (ret) {
- fprintf(stderr, "Failed to import fence to syncobj: %m\n");
- return false;
- }
-
- uint64_t abs_timeout = os_time_get_absolute_timeout(timeout);
- if (abs_timeout == OS_TIMEOUT_INFINITE)
- abs_timeout = INT64_MAX;
-
- ret = drmSyncobjWait(screen->fd, &syncobj, 1, abs_timeout, 0, NULL);
-
- drmSyncobjDestroy(screen->fd, syncobj);
-
- return ret >= 0;
-}
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_format.c b/lib/mesa/src/gallium/drivers/panfrost/pan_format.c
deleted file mode 100644
index f272e3a37..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_format.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * © Copyright 2018 Alyssa Rosenzweig
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#include "pan_format.h"
-
-/* From panwrap/panwrap-decoder, but we don't want to bring in all those headers */
-char *panwrap_format_name(enum mali_format format);
-
-/* Construct a default swizzle based on the number of components */
-
-static unsigned
-panfrost_translate_swizzle(enum pipe_swizzle s)
-{
- switch (s) {
- case PIPE_SWIZZLE_X:
- return MALI_CHANNEL_RED;
-
- case PIPE_SWIZZLE_Y:
- return MALI_CHANNEL_GREEN;
-
- case PIPE_SWIZZLE_Z:
- return MALI_CHANNEL_BLUE;
-
- case PIPE_SWIZZLE_W:
- return MALI_CHANNEL_ALPHA;
-
- case PIPE_SWIZZLE_0:
- case PIPE_SWIZZLE_NONE:
- return MALI_CHANNEL_ZERO;
-
- case PIPE_SWIZZLE_1:
- return MALI_CHANNEL_ONE;
-
- default:
- unreachable("INvalid swizzle");
- }
-}
-
-/* Translate a Gallium swizzle quad to a 12-bit Mali swizzle code */
-
-unsigned
-panfrost_translate_swizzle_4(const unsigned char swizzle[4])
-{
- unsigned out = 0;
-
- for (unsigned i = 0; i < 4; ++i) {
- unsigned translated = panfrost_translate_swizzle(swizzle[i]);
- out |= (translated << (3*i));
- }
-
- return out;
-}
-
-unsigned
-panfrost_get_default_swizzle(unsigned components)
-{
- unsigned char default_swizzles[4][4] = {
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_0, PIPE_SWIZZLE_0, PIPE_SWIZZLE_1},
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_0, PIPE_SWIZZLE_1},
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_1},
- {PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W},
- };
-
- assert(components >= 1 && components <= 4);
- return panfrost_translate_swizzle_4(default_swizzles[components - 1]);
-}
-
-static unsigned
-panfrost_translate_channel_width(unsigned size)
-{
- switch (size) {
- case 4:
- return MALI_CHANNEL_4;
- case 8:
- return MALI_CHANNEL_8;
- case 16:
- return MALI_CHANNEL_16;
- case 32:
- return MALI_CHANNEL_32;
- default:
- unreachable("Invalid width");
- }
-}
-
-static unsigned
-panfrost_translate_channel_type(unsigned type, unsigned size, bool norm)
-{
- switch (type) {
- case UTIL_FORMAT_TYPE_UNSIGNED:
- return norm ? MALI_FORMAT_UNORM : MALI_FORMAT_UINT;
-
- case UTIL_FORMAT_TYPE_SIGNED:
- return norm ? MALI_FORMAT_SNORM : MALI_FORMAT_SINT;
-
- case UTIL_FORMAT_TYPE_FLOAT:
- if (size == 16) {
- /* With FLOAT, fp16 */
- return MALI_FORMAT_SINT;
- } else if (size == 32) {
- /* With FLOAT< fp32 */
- return MALI_FORMAT_UNORM;
- } else {
- assert(0);
- return 0;
- }
-
- default:
- unreachable("Invalid type");
- }
-}
-
-/* Constructs a mali_format satisfying the specified Gallium format
- * description */
-
-enum mali_format
-panfrost_find_format(const struct util_format_description *desc) {
- /* Find first non-VOID channel */
- struct util_format_channel_description chan = desc->channel[0];
-
- for (unsigned c = 0; c < 4; ++c)
- {
- if (desc->channel[c].type == UTIL_FORMAT_TYPE_VOID)
- continue;
-
- chan = desc->channel[c];
- break;
- }
-
- /* Check for special formats */
- switch (desc->format)
- {
- case PIPE_FORMAT_YV12:
- case PIPE_FORMAT_YV16:
- case PIPE_FORMAT_IYUV:
- case PIPE_FORMAT_NV21:
- fprintf(stderr, "YUV format type %s (%d) is not yet supported, but it's probably close to NV12!\n", desc->name, desc->format);
- assert(0);
- break;
-
- case PIPE_FORMAT_NV12:
- return MALI_NV12;
-
- case PIPE_FORMAT_R10G10B10X2_UNORM:
- case PIPE_FORMAT_B10G10R10X2_UNORM:
- case PIPE_FORMAT_R10G10B10A2_UNORM:
- case PIPE_FORMAT_B10G10R10A2_UNORM:
- return MALI_RGB10_A2_UNORM;
-
- case PIPE_FORMAT_R10G10B10X2_SNORM:
- case PIPE_FORMAT_R10G10B10A2_SNORM:
- case PIPE_FORMAT_B10G10R10A2_SNORM:
- return MALI_RGB10_A2_SNORM;
-
- case PIPE_FORMAT_R10G10B10A2_UINT:
- case PIPE_FORMAT_B10G10R10A2_UINT:
- return MALI_RGB10_A2UI;
-
- case PIPE_FORMAT_R10G10B10A2_SSCALED:
- case PIPE_FORMAT_B10G10R10A2_SSCALED:
- return MALI_RGB10_A2I;
-
- case PIPE_FORMAT_Z32_UNORM:
- case PIPE_FORMAT_Z24X8_UNORM:
- return MALI_Z32_UNORM;
-
- case PIPE_FORMAT_B5G6R5_UNORM:
- return MALI_RGB565;
-
- case PIPE_FORMAT_B5G5R5A1_UNORM:
- return MALI_RGB5_A1_UNORM;
-
- case PIPE_FORMAT_A1B5G5R5_UNORM:
- case PIPE_FORMAT_X1B5G5R5_UNORM:
- /* Not supported - this is backwards from OpenGL! */
- assert(0);
- break;
-
- case PIPE_FORMAT_R32_FIXED:
- return MALI_R32_FIXED;
- case PIPE_FORMAT_R32G32_FIXED:
- return MALI_RG32_FIXED;
- case PIPE_FORMAT_R32G32B32_FIXED:
- return MALI_RGB32_FIXED;
- case PIPE_FORMAT_R32G32B32A32_FIXED:
- return MALI_RGBA32_FIXED;
-
- case PIPE_FORMAT_R11G11B10_FLOAT:
- return MALI_R11F_G11F_B10F;
- case PIPE_FORMAT_R9G9B9E5_FLOAT:
- return MALI_R9F_G9F_B9F_E5F;
-
- default:
- /* Fallthrough to default */
- break;
- }
-
- /* Formats must match in channel count */
- assert(desc->nr_channels >= 1 && desc->nr_channels <= 4);
- unsigned format = MALI_NR_CHANNELS(desc->nr_channels);
-
- switch (chan.type)
- {
- case UTIL_FORMAT_TYPE_UNSIGNED:
- case UTIL_FORMAT_TYPE_SIGNED:
- case UTIL_FORMAT_TYPE_FIXED:
- /* Channel width */
- format |= panfrost_translate_channel_width(chan.size);
-
- /* Channel type */
- format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
- break;
-
- case UTIL_FORMAT_TYPE_FLOAT:
- /* Float formats use a special width and encode width
- * with type mixed */
-
- format |= MALI_CHANNEL_FLOAT;
- format |= panfrost_translate_channel_type(chan.type, chan.size, chan.normalized);
- break;
-
- default:
- printf("%s\n", util_format_name(desc->format));
- unreachable("Invalid format type");
- }
-
- return (enum mali_format) format;
-}
-
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_format.h b/lib/mesa/src/gallium/drivers/panfrost/pan_format.h
deleted file mode 100644
index a44d1d809..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_format.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * © Copyright 2018 Alyssa Rosenzweig
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#ifndef __PAN_FORMAT_H__
-#define __PAN_FORMAT_H__
-
-#include "pan_context.h"
-#include "util/u_format.h"
-
-unsigned
-panfrost_translate_swizzle_4(const unsigned char swizzle[4]);
-
-unsigned
-panfrost_get_default_swizzle(unsigned components);
-
-enum mali_format
-panfrost_find_format(const struct util_format_description *desc);
-
-#endif
-
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_instancing.c b/lib/mesa/src/gallium/drivers/panfrost/pan_instancing.c
deleted file mode 100644
index cd93fa7be..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_instancing.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Copyright (C) 2018-2019 Alyssa Rosenzweig
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#include "pan_context.h"
-
-/* See mali_job for notes on how this works. But basically, for small vertex
- * counts, we have a lookup table, and for large vertex counts, we look at the
- * high bits as a heuristic. This has to match exactly how the hardware
- * calculates this (which is why the algorithm is so weird) or else instancing
- * will break. */
-
-/* Given an odd number (of the form 2k + 1), compute k */
-#define ODD(odd) ((odd - 1) >> 1)
-
-/* Given the shift/odd pair, recover the original padded integer */
-
-unsigned
-pan_expand_shift_odd(struct pan_shift_odd o)
-{
- unsigned odd = 2*o.odd + 1;
- unsigned shift = 1 << o.shift;
- return odd * shift;
-}
-
-static inline struct pan_shift_odd
-pan_factored(unsigned pot, unsigned odd)
-{
- struct pan_shift_odd out;
-
- assert(util_is_power_of_two_or_zero(pot));
- assert(odd & 1);
-
- /* Odd is of the form (2k + 1) = (k << 1) + 1 = (k << 1) | 1.
- *
- * So (odd >> 1) = ((k << 1) | 1) >> 1 = ((k << 1) >> 1) | (1 >> 1)
- * = k | 0 = k */
-
- out.odd = (odd >> 1);
-
- /* POT is the form (1 << shift) */
- out.shift = __builtin_ctz(pot);
-
- return out;
-}
-
-
-/* For small vertices. Second argument is whether the primitive takes a
- * power-of-two argument, which determines how rounding works. True for POINTS
- * and LINES, false for TRIANGLES. Presumably true for QUADS but you'd be crazy
- * to try instanced quads on ES class hardware <3 */
-
-static struct {
- unsigned pot;
- unsigned odd;
-} small_lut[] = {
- { 0, 1 },
- { 1, 1 },
- { 2, 1 },
- { 1, 3 },
- { 4, 1 },
- { 1, 5 },
- { 2, 3 },
- { 1, 7 },
- { 8, 1 },
- { 1, 9 },
- { 2, 5 },
- { 4, 3 }, /* 11 */
- { 4, 3 },
- { 2, 7 }, /* 13 */
- { 2, 7 },
- { 16, 1 }, /* 15 */
- { 16, 1 },
- { 2, 9 },
- { 4, 5 }, /* 20 */
- { 4, 5 }
-};
-
-static struct pan_shift_odd
-panfrost_small_padded_vertex_count(unsigned idx)
-{
- return pan_factored(
- small_lut[idx].pot,
- small_lut[idx].odd);
-}
-
-static struct pan_shift_odd
-panfrost_large_padded_vertex_count(uint32_t vertex_count)
-{
- struct pan_shift_odd out = { 0 };
-
- /* First, we have to find the highest set one */
- unsigned highest = 32 - __builtin_clz(vertex_count);
-
- /* Using that, we mask out the highest 4-bits */
- unsigned n = highest - 4;
- unsigned nibble = (vertex_count >> n) & 0xF;
-
- /* Great, we have the nibble. Now we can just try possibilities. Note
- * that we don't care about the bottom most bit in most cases, and we
- * know the top bit must be 1 */
-
- unsigned middle_two = (nibble >> 1) & 0x3;
-
- switch (middle_two) {
- case 0b00:
- if (nibble & 1)
- return pan_factored(1 << n, 9);
- else
- return pan_factored(1 << (n + 1), 5);
- case 0b01:
- return pan_factored(1 << (n + 2), 3);
- case 0b10:
- return pan_factored(1 << (n + 1), 7);
- case 0b11:
- return pan_factored(1 << (n + 4), 1);
- default:
- unreachable("Invalid two bits");
- }
-
- return out;
-}
-
-struct pan_shift_odd
-panfrost_padded_vertex_count(
- unsigned vertex_count,
- bool pot)
-{
- assert(vertex_count > 0);
-
- if (vertex_count < 20) {
- /* Add an off-by-one if it won't align naturally (quirk of the hardware) */
- //if (!pot)
- // vertex_count++;
-
- return panfrost_small_padded_vertex_count(vertex_count);
- } else
- return panfrost_large_padded_vertex_count(vertex_count);
-}
-
-/* The much, much more irritating case -- instancing is enabled. See
- * panfrost_job.h for notes on how this works */
-
-static unsigned
-panfrost_vertex_instanced(
- struct panfrost_job *batch,
- struct panfrost_resource *rsrc,
- unsigned divisor,
- union mali_attr *attrs,
- mali_ptr addr,
- unsigned vertex_count,
- unsigned instance_count)
-{
- /* First, grab the padded vertex count */
-
- struct pan_shift_odd o = {
- .shift = batch->ctx->payloads[PIPE_SHADER_FRAGMENT].instance_shift,
- .odd = batch->ctx->payloads[PIPE_SHADER_FRAGMENT].instance_odd,
- };
-
- unsigned padded_count = batch->ctx->padded_count;
-
- /* Depending if there is an instance divisor or not, packing varies.
- * When there is a divisor, the hardware-level divisor is actually the
- * product of the instance divisor and the padded count */
-
- unsigned hw_divisor = padded_count * divisor;
-
- if (divisor == 0) {
- /* Per-vertex attributes use the MODULO mode. First, compute
- * the modulus */
-
- attrs->elements |= MALI_ATTR_MODULO;
- attrs->shift = o.shift;
- attrs->extra_flags = o.odd;
-
- return 1;
- } else if (util_is_power_of_two_or_zero(hw_divisor)) {
- /* If there is a divisor but the hardware divisor works out to
- * a power of two (not terribly exceptional), we can use an
- * easy path (just shifting) */
-
- attrs->elements |= MALI_ATTR_POT_DIVIDE;
- attrs->shift = __builtin_ctz(hw_divisor);
-
- return 1;
- } else {
- /* We have a NPOT divisor. Here's the fun one (multipling by
- * the inverse and shifting) */
-
- /* floor(log2(d)) */
- unsigned shift = util_logbase2(hw_divisor);
-
- /* m = ceil(2^(32 + shift) / d) */
- uint64_t shift_hi = 32 + shift;
- uint64_t t = 1ll << shift_hi;
- double t_f = t;
- double hw_divisor_d = hw_divisor;
- double m_f = ceil(t_f / hw_divisor_d);
- unsigned m = m_f;
-
- /* Default case */
- unsigned magic_divisor = m, extra_flags = 0;
-
- /* e = 2^(shift + 32) % d */
- uint64_t e = t % hw_divisor;
-
- /* Apply round-down algorithm? e <= 2^shift?. XXX: The blob
- * seems to use a different condition */
- if (e <= (1 << shift)) {
- magic_divisor = m - 1;
- extra_flags = 1;
- }
-
- /* Top flag implicitly set */
- assert(magic_divisor & (1 << 31));
- magic_divisor &= ~(1 << 31);
-
- /* Upload to two different slots */
-
- attrs[0].elements |= MALI_ATTR_NPOT_DIVIDE;
- attrs[0].shift = shift;
- attrs[0].extra_flags = extra_flags;
-
- attrs[1].unk = 0x20;
- attrs[1].magic_divisor = magic_divisor;
- attrs[1].zero = 0;
- attrs[1].divisor = divisor;
-
- return 2;
- }
-}
-
-void
-panfrost_emit_vertex_data(struct panfrost_job *batch)
-{
- struct panfrost_context *ctx = batch->ctx;
- struct panfrost_vertex_state *so = ctx->vertex;
-
- /* Staged mali_attr, and index into them. i =/= k, depending on the
- * vertex buffer mask and instancing. Twice as much room is allocated,
- * for a worst case of NPOT_DIVIDEs which take up extra slot */
- union mali_attr attrs[PIPE_MAX_ATTRIBS * 2];
- unsigned k = 0;
-
- unsigned vertex_count = ctx->vertex_count;
- unsigned instanced_count = ctx->instance_count;
-
- for (unsigned i = 0; i < so->num_elements; ++i) {
- /* We map a mali_attr to be 1:1 with the mali_attr_meta, which
- * means duplicating some vertex buffers (who cares? aside from
- * maybe some caching implications but I somehow doubt that
- * matters) */
-
- struct pipe_vertex_element *elem = &so->pipe[i];
- unsigned vbi = elem->vertex_buffer_index;
-
- /* The exception to 1:1 mapping is that we can have multiple
- * entries (NPOT divisors), so we fixup anyways */
-
- so->hw[i].index = k;
-
- if (!(ctx->vb_mask & (1 << vbi))) continue;
-
- struct pipe_vertex_buffer *buf = &ctx->vertex_buffers[vbi];
- struct panfrost_resource *rsrc = (struct panfrost_resource *) (buf->buffer.resource);
-
- if (!rsrc) continue;
-
- /* Align to 64 bytes by masking off the lower bits. This
- * will be adjusted back when we fixup the src_offset in
- * mali_attr_meta */
-
- mali_ptr raw_addr = panfrost_vertex_buffer_address(ctx, vbi);
- mali_ptr addr = raw_addr & ~63;
- unsigned chopped_addr = raw_addr - addr;
-
- /* Add a dependency of the batch on the vertex buffer */
- panfrost_job_add_bo(batch, rsrc->bo);
-
- /* Set common fields */
- attrs[k].elements = addr;
- attrs[k].stride = buf->stride;
- attrs[k].size = rsrc->base.width0;
-
- /* We need to add the extra size we masked off (for
- * correctness) so the data doesn't get clamped away */
- attrs[k].size += chopped_addr;
-
- /* For non-instancing make sure we initialize */
- attrs[k].shift = attrs[k].extra_flags = 0;
-
- /* Instancing uses a dramatically different code path than
- * linear, so dispatch for the actual emission now that the
- * common code is finished */
-
- unsigned divisor = elem->instance_divisor;
-
- if (divisor && instanced_count == 1) {
- /* Silly corner case where there's a divisor(=1) but
- * there's no legitimate instancing. So we want *every*
- * attribute to be the same. So set stride to zero so
- * we don't go anywhere. */
-
- attrs[k].size = attrs[k].stride + chopped_addr;
- attrs[k].stride = 0;
- attrs[k++].elements |= MALI_ATTR_LINEAR;
- } else if (instanced_count <= 1) {
- /* Normal, non-instanced attributes */
- attrs[k++].elements |= MALI_ATTR_LINEAR;
- } else {
- k += panfrost_vertex_instanced(
- batch, rsrc, divisor, &attrs[k], addr, vertex_count, instanced_count);
- }
- }
-
- /* Upload whatever we emitted and go */
-
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.attributes =
- panfrost_upload_transient(ctx, attrs, k * sizeof(union mali_attr));
-}
-
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_invocation.c b/lib/mesa/src/gallium/drivers/panfrost/pan_invocation.c
deleted file mode 100644
index 44ee6eb18..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_invocation.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Authors (Collabora):
- * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
- *
- */
-
-#include "pan_context.h"
-
-/* Compute shaders are invoked with a gl_NumWorkGroups X/Y/Z triplet. Vertex
- * shaders, it turns out, are invoked with the same mechanism, with the triplet
- * (1, vertex_count, instance_count).
- *
- * Alongside this triplet is the gl_WorkGroupSize X/Y/Z triplet.
- *
- * Unfortunately, the packing for these triplet into the
- * mali_vertex_tiler_prefix is a little funky, using a dynamic bitfield. The
- * routines here exist to pack this */
-
-void
-panfrost_pack_work_groups_compute(
- struct mali_vertex_tiler_prefix *out,
- unsigned num_x,
- unsigned num_y,
- unsigned num_z,
- unsigned size_x,
- unsigned size_y,
- unsigned size_z)
-{
- /* First of all, all 6 values are off-by-one (strictly positive).
- * Account for that, first by ensuring all values are strictly positive
- * and then by offsetting */
-
- assert(num_x > 0);
- assert(num_y > 0);
- assert(num_z > 0);
-
- assert(size_x > 0);
- assert(size_y > 0);
- assert(size_z > 0);
-
- num_x = MALI_POSITIVE(num_x);
- num_y = MALI_POSITIVE(num_y);
- num_z = MALI_POSITIVE(num_z);
-
- size_x = MALI_POSITIVE(size_x);
- size_y = MALI_POSITIVE(size_y);
- size_z = MALI_POSITIVE(size_z);
-
- /* Next up is to pack in order */
-
- uint32_t packed = 0;
-
- /* The values needing packing, in order, and the corresponding shifts.
- * Indicies into shift are off-by-one to make the logic easier */
-
- unsigned shifts[7] = { 0 };
- unsigned values[6] = { size_x, size_y, size_z, num_x, num_y, num_z };
-
- for (unsigned i = 0; i < 6; ++i) {
- /* OR it in, shifting as required */
- packed |= (values[i] << shifts[i]);
-
- /* How many bits did we use? */
- unsigned bit_count = util_logbase2_ceil(values[i] + 1);
-
- /* Set the next shift accordingly */
- shifts[i + 1] = shifts[i] + bit_count;
- }
-
- /* We're packed, so upload everything */
- out->invocation_count = packed;
- out->size_y_shift = shifts[1];
- out->size_z_shift = shifts[2];
- out->workgroups_x_shift = shifts[3];
- out->workgroups_y_shift = shifts[4];
- out->workgroups_z_shift = shifts[5];
-
- /* Special fields */
- out->workgroups_x_shift_2 = MAX2(out->workgroups_x_shift, 2);
- out->workgroups_x_shift_3 = out->workgroups_x_shift_2;
-}
-
-/* Packs vertex/tiler descriptors simultaneously */
-void
-panfrost_pack_work_groups_fused(
- struct mali_vertex_tiler_prefix *vertex,
- struct mali_vertex_tiler_prefix *tiler,
- unsigned num_x,
- unsigned num_y,
- unsigned num_z,
- unsigned size_x,
- unsigned size_y,
- unsigned size_z)
-{
- panfrost_pack_work_groups_compute(vertex, num_x, num_y, num_z, size_x, size_y, size_z);
-
- /* Copy results over */
- tiler->invocation_count = vertex->invocation_count;
- tiler->size_y_shift = vertex->size_y_shift;
- tiler->size_z_shift = vertex->size_z_shift;
- tiler->workgroups_x_shift = vertex->workgroups_x_shift;
- tiler->workgroups_x_shift_2 = vertex->workgroups_x_shift_2;
- tiler->workgroups_y_shift = vertex->workgroups_y_shift;
- tiler->workgroups_z_shift = vertex->workgroups_z_shift;
-
- /* Set special fields for each */
- vertex->workgroups_x_shift_3 = 5;
- tiler->workgroups_x_shift_3 = 6;
-}
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_tiler.c b/lib/mesa/src/gallium/drivers/panfrost/pan_tiler.c
deleted file mode 100644
index 25f8490cb..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_tiler.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Authors:
- * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
- */
-
-#include "util/u_math.h"
-#include "util/macros.h"
-#include "pan_tiler.h"
-
-/* Mali GPUs are tiled-mode renderers, rather than immediate-mode.
- * Conceptually, the screen is divided into 16x16 tiles. Vertex shaders run.
- * Then, a fixed-function hardware block (the tiler) consumes the gl_Position
- * results. For each triangle specified, it marks each containing tile as
- * containing that triangle. This set of "triangles per tile" form the "polygon
- * list". Finally, the rasterization unit consumes the polygon list to invoke
- * the fragment shader.
- *
- * In practice, it's a bit more complicated than this. 16x16 is the logical
- * tile size, but Midgard features "hierarchical tiling", where power-of-two
- * multiples of the base tile size can be used: hierarchy level 0 (16x16),
- * level 1 (32x32), level 2 (64x64), per public information about Midgard's
- * tiling. In fact, tiling goes up to 2048x2048 (!), although in practice
- * 128x128 is the largest usually used (though higher modes are enabled). The
- * idea behind hierarchical tiling is to use low tiling levels for small
- * triangles and high levels for large triangles, to minimize memory bandwidth
- * and repeated fragment shader invocations (the former issue inherent to
- * immediate-mode rendering and the latter common in traditional tilers).
- *
- * The tiler itself works by reading varyings in and writing a polygon list
- * out. Unfortunately (for us), both of these buffers are managed in main
- * memory; although they ideally will be cached, it is the drivers'
- * responsibility to allocate these buffers. Varying buffer allocation is
- * handled elsewhere, as it is not tiler specific; the real issue is allocating
- * the polygon list.
- *
- * This is hard, because from the driver's perspective, we have no information
- * about what geometry will actually look like on screen; that information is
- * only gained from running the vertex shader. (Theoretically, we could run the
- * vertex shaders in software as a prepass, or in hardware with transform
- * feedback as a prepass, but either idea is ludicrous on so many levels).
- *
- * Instead, Mali uses a bit of a hybrid approach, splitting the polygon list
- * into three distinct pieces. First, the driver statically determines which
- * tile hierarchy levels to use (more on that later). At this point, we know the
- * framebuffer dimensions and all the possible tilings of the framebuffer, so
- * we know exactly how many tiles exist across all hierarchy levels. The first
- * piece of the polygon list is the header, which is exactly 8 bytes per tile,
- * plus padding and a small 64-byte prologue. (If that doesn't remind you of
- * AFBC, it should. See pan_afbc.c for some fun parallels). The next part is
- * the polygon list body, which seems to contain 512 bytes per tile, again
- * across every level of the hierarchy. These two parts form the polygon list
- * buffer. This buffer has a statically determinable size, approximately equal
- * to the # of tiles across all hierarchy levels * (8 bytes + 512 bytes), plus
- * alignment / minimum restrictions / etc.
- *
- * The third piece is the easy one (for us): the tiler heap. In essence, the
- * tiler heap is a gigantic slab that's as big as could possibly be necessary
- * in the worst case imaginable. Just... a gigantic allocation that we give a
- * start and end pointer to. What's the catch? The tiler heap is lazily
- * allocated; that is, a huge amount of memory is _reserved_, but only a tiny
- * bit is actually allocated upfront. The GPU just keeps using the
- * unallocated-but-reserved portions as it goes along, generating page faults
- * if it goes beyond the allocation, and then the kernel is instructed to
- * expand the allocation on page fault (known in the vendor kernel as growable
- * memory). This is quite a bit of bookkeeping of its own, but that task is
- * pushed to kernel space and we can mostly ignore it here, just remembering to
- * set the GROWABLE flag so the kernel actually uses this path rather than
- * allocating a gigantic amount up front and burning a hole in RAM.
- *
- * As far as determining which hierarchy levels to use, the simple answer is
- * that right now, we don't. In the tiler configuration fields (consistent from
- * the earliest Midgard's SFBD through the latest Bifrost traces we have),
- * there is a hierarchy_mask field, controlling which levels (tile sizes) are
- * enabled. Ideally, the hierarchical tiling dream -- mapping big polygons to
- * big tiles and small polygons to small tiles -- would be realized here as
- * well. As long as there are polygons at all needing tiling, we always have to
- * have big tiles available, in case there are big polygons. But we don't
- * necessarily need small tiles available. Ideally, when there are small
- * polygons, small tiles are enabled (to avoid waste from putting small
- * triangles in the big tiles); when there are not, small tiles are disabled to
- * avoid enabling more levels than necessary, which potentially costs in memory
- * bandwidth / power / tiler performance.
- *
- * Of course, the driver has to figure this out statically. When tile
- * hiearchies are actually established, this occurs by the tiler in
- * fixed-function hardware, after the vertex shaders have run and there is
- * sufficient information to figure out the size of triangles. The driver has
- * no such luxury, again barring insane hacks like additionally running the
- * vertex shaders in software or in hardware via transform feedback. Thus, for
- * the driver, we need a heuristic approach.
- *
- * There are lots of heuristics to guess triangle size statically you could
- * imagine, but one approach shines as particularly simple-stupid: assume all
- * on-screen triangles are equal size and spread equidistantly throughout the
- * screen. Let's be clear, this is NOT A VALID ASSUMPTION. But if we roll with
- * it, then we see:
- *
- * Triangle Area = (Screen Area / # of triangles)
- * = (Width * Height) / (# of triangles)
- *
- * Or if you prefer, we can also make a third CRAZY assumption that we only draw
- * right triangles with edges parallel/perpendicular to the sides of the screen
- * with no overdraw, forming a triangle grid across the screen:
- *
- * |--w--|
- * _____ |
- * | /| /| |
- * |/_|/_| h
- * | /| /| |
- * |/_|/_| |
- *
- * Then you can use some middle school geometry and algebra to work out the
- * triangle dimensions. I started working on this, but realised I didn't need
- * to to make my point, but couldn't bare to erase that ASCII art. Anyway.
- *
- * POINT IS, by considering the ratio of screen area and triangle count, we can
- * estimate the triangle size. For a small size, use small bins; for a large
- * size, use large bins. Intuitively, this metric makes sense: when there are
- * few triangles on a large screen, you're probably compositing a UI and
- * therefore the triangles are large; when there are a lot of triangles on a
- * small screen, you're probably rendering a 3D mesh and therefore the
- * triangles are tiny. (Or better said -- there will be tiny triangles, even if
- * there are also large triangles. There have to be unless you expect crazy
- * overdraw. Generally, it's better to allow more small bin sizes than
- * necessary than not allow enough.)
- *
- * From this heuristic (or whatever), we determine the minimum allowable tile
- * size, and we use that to decide the hierarchy masking, selecting from the
- * minimum "ideal" tile size to the maximum tile size (2048x2048).
- *
- * Once we have that mask and the framebuffer dimensions, we can compute the
- * size of the statically-sized polygon list structures, allocate them, and go!
- *
- */
-
-/* Hierarchical tiling spans from 16x16 to 2048x2048 tiles */
-
-#define MIN_TILE_SIZE 16
-#define MAX_TILE_SIZE 2048
-
-/* Constants as shifts for easier power-of-two iteration */
-
-#define MIN_TILE_SHIFT util_logbase2(MIN_TILE_SIZE)
-#define MAX_TILE_SHIFT util_logbase2(MAX_TILE_SIZE)
-
-/* The hierarchy has a 64-byte prologue */
-#define PROLOGUE_SIZE 0x40
-
-/* For each tile (across all hierarchy levels), there is 8 bytes of header */
-#define HEADER_BYTES_PER_TILE 0x8
-
-/* Absent any geometry, the minimum size of the header */
-#define MINIMUM_HEADER_SIZE 0x200
-
-/* If the width-x-height framebuffer is divided into tile_size-x-tile_size
- * tiles, how many tiles are there? Rounding up in each direction. For the
- * special case of tile_size=16, this aligns with the usual Midgard count.
- * tile_size must be a power-of-two. Not really repeat code from AFBC/checksum,
- * because those care about the stride (not just the overall count) and only at
- * a a fixed-tile size (not any of a number of power-of-twos) */
-
-static unsigned
-pan_tile_count(unsigned width, unsigned height, unsigned tile_size)
-{
- unsigned aligned_width = ALIGN_POT(width, tile_size);
- unsigned aligned_height = ALIGN_POT(height, tile_size);
-
- unsigned tile_count_x = aligned_width / tile_size;
- unsigned tile_count_y = aligned_height / tile_size;
-
- return tile_count_x * tile_count_y;
-}
-
-/* For `masked_count` of the smallest tile sizes masked out, computes how the
- * size of the polygon list header. We iterate the tile sizes (16x16 through
- * 2048x2048, if nothing is masked; (16*2^masked_count)x(16*2^masked_count)
- * through 2048x2048 more generally. For each tile size, we figure out how many
- * tiles there are at this hierarchy level and therefore many bytes this level
- * is, leaving us with a byte count for each level. We then just sum up the
- * byte counts across the levels to find a byte count for all levels. */
-
-static unsigned
-panfrost_raw_header_size(unsigned width, unsigned height, unsigned masked_count)
-{
- unsigned size = PROLOGUE_SIZE;
-
- /* Normally we start at 16x16 tiles (MIN_TILE_SHIFT), but we add more
- * if anything is masked off */
-
- unsigned start_level = MIN_TILE_SHIFT + masked_count;
-
- /* Iterate hierarchy levels / tile sizes */
-
- for (unsigned i = start_level; i < MAX_TILE_SHIFT; ++i) {
- /* Shift from a level to a tile size */
- unsigned tile_size = (1 << i);
-
- unsigned tile_count = pan_tile_count(width, height, tile_size);
- unsigned header_bytes = HEADER_BYTES_PER_TILE * tile_count;
-
- size += header_bytes;
- }
-
- /* This size will be used as an offset, so ensure it's aligned */
- return ALIGN_POT(size, 512);
-}
-
-/* Given a hierarchy mask and a framebuffer size, compute the header size */
-
-unsigned
-panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask)
-{
- /* If no hierarchy levels are enabled, that means there is no geometry
- * for the tiler to process, so use a minimum size. Used for clears */
-
- if (mask == 0x00)
- return MINIMUM_HEADER_SIZE;
-
- /* Some levels are enabled. Ensure that only smaller levels are
- * disabled and there are no gaps. Theoretically the hardware is more
- * flexible, but there's no known reason to use other configurations
- * and this keeps the code simple. Since we know the 0x80 bit is set,
- * ctz(mask) will return the number of masked off levels. */
-
- unsigned masked_count = __builtin_ctz(mask);
-
- assert(mask & 0x80);
- assert(((mask >> masked_count) & ((mask >> masked_count) + 1)) == 0);
-
- /* Everything looks good. Use the number of trailing zeroes we found to
- * figure out how many smaller levels are disabled to compute the
- * actual header size */
-
- return panfrost_raw_header_size(width, height, masked_count);
-}
-
-/* The body seems to be about 512 bytes per tile. Noting that the header is
- * about 8 bytes per tile, we can be a little sloppy and estimate the body size
- * to be equal to the header size * (512/8). Given the header size is a
- * considerable overestimate, this is fine. Eventually, we should maybe figure
- * out how to actually implement this. */
-
-unsigned
-panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask)
-{
- /* No levels means no body */
- if (!mask)
- return 0x00;
-
- unsigned header_size = panfrost_tiler_header_size(width, height, mask);
- return ALIGN_POT(header_size * 512 / 8, 512);
-}
-
-
-/* In the future, a heuristic to choose a tiler hierarchy mask would go here.
- * At the moment, we just default to 0xFF, which enables all possible hierarchy
- * levels. Overall this yields good performance but presumably incurs a cost in
- * memory bandwidth / power consumption / etc, at least on smaller scenes that
- * don't really need all the smaller levels enabled */
-
-unsigned
-panfrost_choose_hierarchy_mask(
- unsigned width, unsigned height,
- unsigned vertex_count)
-{
- /* If there is no geometry, we don't bother enabling anything */
-
- if (!vertex_count)
- return 0x00;
-
- /* Otherwise, default everything on. TODO: Proper tests */
-
- return 0xFF;
-}
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_tiler.h b/lib/mesa/src/gallium/drivers/panfrost/pan_tiler.h
deleted file mode 100644
index 8d7f6f29d..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_tiler.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Authors:
- * Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
- *
- */
-
-#ifndef __PAN_TILER_H__
-#define __PAN_TILER_H__
-
-unsigned
-panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask);
-
-unsigned
-panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask);
-
-unsigned
-panfrost_choose_hierarchy_mask(
- unsigned width, unsigned height,
- unsigned vertex_count);
-
-#endif
-
-
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_util.h b/lib/mesa/src/gallium/drivers/panfrost/pan_util.h
deleted file mode 100644
index 24c71d59b..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_util.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2019 Collabora, Ltd.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef PAN_UTIL_H
-#define PAN_UTIL_H
-
-#define PAN_DBG_MSGS 0x0001
-#define PAN_DBG_TRACE 0x0002
-#define PAN_DBG_DEQP 0x0004
-#define PAN_DBG_AFBC 0x0008
-
-extern int pan_debug;
-
-#define DBG(fmt, ...) \
- do { if (pan_debug & PAN_DBG_MSGS) \
- fprintf(stderr, "%s:%d: "fmt, \
- __FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
-
-#endif /* PAN_UTIL_H */
diff --git a/lib/mesa/src/gallium/drivers/panfrost/pan_varyings.c b/lib/mesa/src/gallium/drivers/panfrost/pan_varyings.c
deleted file mode 100644
index 69e9e6d03..000000000
--- a/lib/mesa/src/gallium/drivers/panfrost/pan_varyings.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Copyright (C) 2018-2019 Alyssa Rosenzweig
- * Copyright (C) 2019 Collabora, Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- */
-
-#include "pan_context.h"
-#include "util/u_prim.h"
-
-static mali_ptr
-panfrost_emit_varyings(
- struct panfrost_context *ctx,
- union mali_attr *slot,
- unsigned stride,
- unsigned count)
-{
- /* Fill out the descriptor */
- slot->stride = stride;
- slot->size = stride * count;
- slot->shift = slot->extra_flags = 0;
-
- struct panfrost_transfer transfer =
- panfrost_allocate_transient(ctx, slot->size);
-
- slot->elements = transfer.gpu | MALI_ATTR_LINEAR;
-
- return transfer.gpu;
-}
-
-static void
-panfrost_emit_streamout(
- struct panfrost_context *ctx,
- union mali_attr *slot,
- unsigned stride,
- unsigned offset,
- unsigned count,
- struct pipe_stream_output_target *target)
-{
- /* Fill out the descriptor */
- slot->stride = stride * 4;
- slot->shift = slot->extra_flags = 0;
-
- unsigned max_size = target->buffer_size;
- unsigned expected_size = slot->stride * count;
-
- slot->size = MIN2(max_size, expected_size);
-
- /* Grab the BO and bind it to the batch */
- struct panfrost_job *batch = panfrost_get_job_for_fbo(ctx);
- struct panfrost_bo *bo = pan_resource(target->buffer)->bo;
- panfrost_job_add_bo(batch, bo);
-
- mali_ptr addr = bo->gpu + target->buffer_offset + (offset * slot->stride);
- slot->elements = addr;
-}
-
-static void
-panfrost_emit_point_coord(union mali_attr *slot)
-{
- slot->elements = MALI_VARYING_POINT_COORD | MALI_ATTR_LINEAR;
- slot->stride = slot->size = slot->shift = slot->extra_flags = 0;
-}
-
-static void
-panfrost_emit_front_face(union mali_attr *slot)
-{
- slot->elements = MALI_VARYING_FRONT_FACING | MALI_ATTR_INTERNAL;
-}
-
-/* Given a shader and buffer indices, link varying metadata together */
-
-static bool
-is_special_varying(gl_varying_slot loc)
-{
- switch (loc) {
- case VARYING_SLOT_POS:
- case VARYING_SLOT_PSIZ:
- case VARYING_SLOT_PNTC:
- case VARYING_SLOT_FACE:
- return true;
- default:
- return false;
- }
-}
-
-static void
-panfrost_emit_varying_meta(
- void *outptr, struct panfrost_shader_state *ss,
- signed general, signed gl_Position,
- signed gl_PointSize, signed gl_PointCoord,
- signed gl_FrontFacing)
-{
- struct mali_attr_meta *out = (struct mali_attr_meta *) outptr;
-
- for (unsigned i = 0; i < ss->tripipe->varying_count; ++i) {
- gl_varying_slot location = ss->varyings_loc[i];
- int index = -1;
-
- switch (location) {
- case VARYING_SLOT_POS:
- index = gl_Position;
- break;
- case VARYING_SLOT_PSIZ:
- index = gl_PointSize;
- break;
- case VARYING_SLOT_PNTC:
- index = gl_PointCoord;
- break;
- case VARYING_SLOT_FACE:
- index = gl_FrontFacing;
- break;
- default:
- index = general;
- break;
- }
-
- assert(index >= 0);
- out[i].index = index;
- }
-}
-
-static bool
-has_point_coord(unsigned mask, gl_varying_slot loc)
-{
- if ((loc >= VARYING_SLOT_TEX0) && (loc <= VARYING_SLOT_TEX7))
- return (mask & (1 << (loc - VARYING_SLOT_TEX0)));
- else if (loc == VARYING_SLOT_PNTC)
- return (mask & (1 << 8));
- else
- return false;
-}
-
-/* Helpers for manipulating stream out information so we can pack varyings
- * accordingly. Compute the src_offset for a given captured varying */
-
-static struct pipe_stream_output
-pan_get_so(struct pipe_stream_output_info info, gl_varying_slot loc)
-{
- for (unsigned i = 0; i < info.num_outputs; ++i) {
- if (info.output[i].register_index == loc)
- return info.output[i];
- }
-
- unreachable("Varying not captured");
-}
-
-/* TODO: Integers */
-static enum mali_format
-pan_xfb_format(unsigned nr_components)
-{
- switch (nr_components) {
- case 1: return MALI_R32F;
- case 2: return MALI_RG32F;
- case 3: return MALI_RGB32F;
- case 4: return MALI_RGBA32F;
- default: unreachable("Invalid format");
- }
-}
-
-void
-panfrost_emit_varying_descriptor(
- struct panfrost_context *ctx,
- unsigned vertex_count)
-{
- /* Load the shaders */
-
- struct panfrost_shader_state *vs = &ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant];
- struct panfrost_shader_state *fs = &ctx->shader[PIPE_SHADER_FRAGMENT]->variants[ctx->shader[PIPE_SHADER_FRAGMENT]->active_variant];
- unsigned int num_gen_varyings = 0;
-
- /* Allocate the varying descriptor */
-
- size_t vs_size = sizeof(struct mali_attr_meta) * vs->tripipe->varying_count;
- size_t fs_size = sizeof(struct mali_attr_meta) * fs->tripipe->varying_count;
-
- struct panfrost_transfer trans = panfrost_allocate_transient(ctx,
- vs_size + fs_size);
-
- struct pipe_stream_output_info so = vs->stream_output;
-
- /* Check if this varying is linked by us. This is the case for
- * general-purpose, non-captured varyings. If it is, link it. If it's
- * not, use the provided stream out information to determine the
- * offset, since it was already linked for us. */
-
- for (unsigned i = 0; i < vs->tripipe->varying_count; i++) {
- gl_varying_slot loc = vs->varyings_loc[i];
-
- bool special = is_special_varying(loc);
- bool captured = ((vs->so_mask & (1ll << loc)) ? true : false);
-
- if (captured) {
- struct pipe_stream_output o = pan_get_so(so, loc);
-
- unsigned dst_offset = o.dst_offset * 4; /* dwords */
- vs->varyings[i].src_offset = dst_offset;
- } else if (!special) {
- vs->varyings[i].src_offset = 16 * (num_gen_varyings++);
- }
- }
-
- /* Conversely, we need to set src_offset for the captured varyings.
- * Here, the layout is defined by the stream out info, not us */
-
- /* Link up with fragment varyings */
- bool reads_point_coord = fs->reads_point_coord;
-
- for (unsigned i = 0; i < fs->tripipe->varying_count; i++) {
- gl_varying_slot loc = fs->varyings_loc[i];
- signed vs_idx = -1;
-
- /* Link up */
- for (unsigned j = 0; j < vs->tripipe->varying_count; ++j) {
- if (vs->varyings_loc[j] == loc) {
- vs_idx = j;
- break;
- }
- }
-
- /* Either assign or reuse */
- if (vs_idx >= 0)
- fs->varyings[i].src_offset = vs->varyings[vs_idx].src_offset;
- else
- fs->varyings[i].src_offset = 16 * (num_gen_varyings++);
-
- if (has_point_coord(fs->point_sprite_mask, loc))
- reads_point_coord |= true;
- }
-
- memcpy(trans.cpu, vs->varyings, vs_size);
- memcpy(trans.cpu + vs_size, fs->varyings, fs_size);
-
- union mali_attr varyings[PIPE_MAX_ATTRIBS];
-
- /* Figure out how many streamout buffers could be bound */
- unsigned so_count = ctx->streamout.num_targets;
- for (unsigned i = 0; i < vs->tripipe->varying_count; i++) {
- gl_varying_slot loc = vs->varyings_loc[i];
-
- bool captured = ((vs->so_mask & (1ll << loc)) ? true : false);
- if (!captured) continue;
-
- struct pipe_stream_output o = pan_get_so(so, loc);
- so_count = MAX2(so_count, o.output_buffer + 1);
- }
-
- signed idx = so_count;
- signed general = idx++;
- signed gl_Position = idx++;
- signed gl_PointSize = vs->writes_point_size ? (idx++) : -1;
- signed gl_PointCoord = reads_point_coord ? (idx++) : -1;
- signed gl_FrontFacing = fs->reads_face ? (idx++) : -1;
-
- /* Emit the stream out buffers */
-
- unsigned output_count = u_stream_outputs_for_vertices(
- ctx->active_prim, ctx->vertex_count);
-
- for (unsigned i = 0; i < so_count; ++i) {
- struct pipe_stream_output_target *target =
- (i < ctx->streamout.num_targets) ? ctx->streamout.targets[i] : NULL;
-
- if (target) {
- panfrost_emit_streamout(ctx, &varyings[i], so.stride[i], ctx->streamout.offsets[i], output_count, target);
- } else {
- /* Emit a dummy buffer */
- panfrost_emit_varyings(ctx, &varyings[i], so.stride[i] * 4, output_count);
-
- /* Clear the attribute type */
- varyings[i].elements &= ~0xF;
- }
- }
-
- panfrost_emit_varyings(ctx, &varyings[general], num_gen_varyings * 16,
- vertex_count);
-
- /* fp32 vec4 gl_Position */
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.position_varying =
- panfrost_emit_varyings(ctx, &varyings[gl_Position],
- sizeof(float) * 4, vertex_count);
-
-
- if (vs->writes_point_size)
- ctx->payloads[PIPE_SHADER_FRAGMENT].primitive_size.pointer =
- panfrost_emit_varyings(ctx, &varyings[gl_PointSize],
- 2, vertex_count);
-
- if (reads_point_coord)
- panfrost_emit_point_coord(&varyings[gl_PointCoord]);
-
- if (fs->reads_face)
- panfrost_emit_front_face(&varyings[gl_FrontFacing]);
-
- /* Let's go ahead and link varying meta to the buffer in question, now
- * that that information is available */
-
- panfrost_emit_varying_meta(trans.cpu, vs,
- general, gl_Position, gl_PointSize,
- gl_PointCoord, gl_FrontFacing);
-
- panfrost_emit_varying_meta(trans.cpu + vs_size, fs,
- general, gl_Position, gl_PointSize,
- gl_PointCoord, gl_FrontFacing);
-
- /* Replace streamout */
-
- struct mali_attr_meta *ovs = (struct mali_attr_meta *) (trans.cpu);
- struct mali_attr_meta *ofs = (struct mali_attr_meta *) (trans.cpu + vs_size);
-
- for (unsigned i = 0; i < vs->tripipe->varying_count; i++) {
- gl_varying_slot loc = vs->varyings_loc[i];
-
- bool captured = ((vs->so_mask & (1ll << loc)) ? true : false);
- if (!captured) continue;
-
- struct pipe_stream_output o = pan_get_so(so, loc);
- ovs[i].index = o.output_buffer;
-
- /* Set the type appropriately. TODO: Integer varyings XXX */
- assert(o.stream == 0);
- ovs[i].format = pan_xfb_format(o.num_components);
- ovs[i].swizzle = panfrost_get_default_swizzle(o.num_components);
-
- /* Link to the fragment */
- signed fs_idx = -1;
-
- /* Link up */
- for (unsigned j = 0; j < fs->tripipe->varying_count; ++j) {
- if (fs->varyings_loc[j] == loc) {
- fs_idx = j;
- break;
- }
- }
-
- if (fs_idx >= 0) {
- ofs[fs_idx].index = ovs[i].index;
- ofs[fs_idx].format = ovs[i].format;
- ofs[fs_idx].swizzle = ovs[i].swizzle;
- }
- }
-
- /* Replace point sprite */
- for (unsigned i = 0; i < fs->tripipe->varying_count; i++) {
- /* If we have a point sprite replacement, handle that here. We
- * have to translate location first. TODO: Flip y in shader.
- * We're already keying ... just time crunch .. */
-
- if (has_point_coord(fs->point_sprite_mask, fs->varyings_loc[i])) {
- ofs[i].index = gl_PointCoord;
-
- /* Swizzle out the z/w to 0/1 */
- ofs[i].format = MALI_RG16F;
- ofs[i].swizzle =
- panfrost_get_default_swizzle(2);
- }
- }
-
- /* Fix up unaligned addresses */
- for (unsigned i = 0; i < so_count; ++i) {
- unsigned align = (varyings[i].elements & 63);
-
- /* While we're at it, the SO buffers are linear */
-
- if (!align) {
- varyings[i].elements |= MALI_ATTR_LINEAR;
- continue;
- }
-
- /* We need to adjust alignment */
- varyings[i].elements &= ~63;
- varyings[i].elements |= MALI_ATTR_LINEAR;
- varyings[i].size += align;
-
- for (unsigned v = 0; v < vs->tripipe->varying_count; ++v) {
- if (ovs[v].index == i)
- ovs[v].src_offset = vs->varyings[v].src_offset + align;
- }
-
- for (unsigned f = 0; f < fs->tripipe->varying_count; ++f) {
- if (ofs[f].index == i)
- ofs[f].src_offset = fs->varyings[f].src_offset + align;
- }
- }
-
- mali_ptr varyings_p = panfrost_upload_transient(ctx, &varyings, idx * sizeof(union mali_attr));
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.varyings = varyings_p;
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.varyings = varyings_p;
-
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.varying_meta = trans.gpu;
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.varying_meta = trans.gpu + vs_size;
-}