[Mesa-dev] [PATCH 2/3] panfrost/ci: Update kernel to 5.3-rc8

2019-09-10 Thread Tomeu Vizoso
We haven't updated in a long time, so better do it now and again when
5.3 is released.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/debian-install.sh | 2 +-
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index 4205ae56e35d..dead65fe74dd 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -146,7 +146,7 @@ apt-get -y remove \*llvm\*
 
 
 ### Cross-build kernel
-KERNEL_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.2.tar.gz;
+KERNEL_URL="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.3-rc8.tar.gz;
 export ARCH=${KERNEL_ARCH}
 export CROSS_COMPILE="${GCC_ARCH}-"
 
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index a77b42f23b83..10fbb7ea6fc0 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-09-10-1"
+  IMAGE_TAG: "2019-09-10-2"
 
 include:
   - project: 'wayland/ci-templates'
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/3] panfrost/ci: Run dEQP with the surfaceless platform

2019-09-10 Thread Tomeu Vizoso
Instead of running it with the Wayland platform, which introduces
unwanted dependencies and complexity.

Makes tests run 30% faster, as well.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/create-rootfs.sh  |  2 +-
 .../drivers/panfrost/ci/debian-install.sh | 35 ---
 .../drivers/panfrost/ci/deqp-runner.sh| 10 ++
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 21 ---
 4 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/create-rootfs.sh 
b/src/gallium/drivers/panfrost/ci/create-rootfs.sh
index e01ccb34cb4a..e84f2271f422 100644
--- a/src/gallium/drivers/panfrost/ci/create-rootfs.sh
+++ b/src/gallium/drivers/panfrost/ci/create-rootfs.sh
@@ -2,7 +2,7 @@
 
 set -ex
 
-apt-get -y install --no-install-recommends initramfs-tools libpng16-16 weston 
strace libsensors5
+apt-get -y install --no-install-recommends initramfs-tools libpng16-16 strace 
libsensors5 libexpat1 libdrm2
 passwd root -d
 chsh -s /bin/sh
 ln -s /bin/sh /init
diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index ec2aa6723a88..4205ae56e35d 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -28,7 +28,6 @@ apt-get -y install --no-install-recommends \
python3-jinja2 \
bison \
flex \
-   libwayland-dev \
gettext \
cmake \
bc \
@@ -49,6 +48,7 @@ apt-get -y install --no-install-recommends \
gdc-9 \
lld-8 \
nasm \
+   libegl1-mesa-dev \
\
libdrm-dev:${DEBIAN_ARCH} \
libx11-dev:${DEBIAN_ARCH} \
@@ -70,31 +70,42 @@ apt-get -y install --no-install-recommends \
libxrandr-dev:${DEBIAN_ARCH} \
libxshmfence-dev:${DEBIAN_ARCH} \
libelf-dev:${DEBIAN_ARCH} \
-   libwayland-dev:${DEBIAN_ARCH} \
-   libwayland-egl-backend-dev:${DEBIAN_ARCH} \
zlib1g-dev:${DEBIAN_ARCH} \
libglvnd-core-dev:${DEBIAN_ARCH} \
-   wayland-protocols:${DEBIAN_ARCH} \
+   libgles2-mesa-dev:${DEBIAN_ARCH} \
+   libegl1-mesa-dev:${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
+git config --global user.email "m...@example.com"
+git config --global user.name "Mesa CI"
+# XXX: Use --depth 1 once we can drop the cherry-picks.
+git clone \
+https://github.com/KhronosGroup/VK-GL-CTS.git \
+-b opengl-es-cts-3.2.5.1 \
+/VK-GL-CTS
+cd /VK-GL-CTS
+# Fix surfaceless build
+git cherry-pick -x 22f41e5e321c6dcd8569c4dad91bce89f06b3670
+git cherry-pick -x 1daa8dff73161ea60ead965bd6c9f2a0a2165648
+
+# surfaceless links against libkms and such despite not using it.
+sed -i '/gbm/d' targets/surfaceless/surfaceless.cmake
+sed -i '/libkms/d' targets/surfaceless/surfaceless.cmake
+sed -i '/libgbm/d' targets/surfaceless/surfaceless.cmake
 
-cd /VK-GL-CTS-opengl-es-cts-3.2.5.0
 python3 external/fetch_sources.py
 
 cd /artifacts/rootfs/deqp
-cmake -DDEQP_TARGET=wayland   \
+cmake -G Ninja\
+  -DDEQP_TARGET=surfaceless   \
   -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)
+  /VK-GL-CTS
+ninja
 rm -rf /artifacts/rootfs/deqp/external
 rm -rf /artifacts/rootfs/deqp/modules/gles31
 rm -rf /artifacts/rootfs/deqp/modules/internal
diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index bf37d75aeabb..11faf2350569 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -5,23 +5,18 @@ 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"
+DEQP_OPTIONS="$DEQP_OPTIONS --deqp-surface-type=pbuffer"
 
-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
 
 DEVFREQ_GOVERNOR=`echo /sys/devices/platform/*.gpu/devfreq/devfreq0/governor`
 echo performance > $DEVFREQ_GOVERNOR
 
-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 ' 

[Mesa-dev] [PATCH 3/3] panfrost/ci: Use releases for Volt dEQP

2019-09-10 Thread Tomeu Vizoso
So we can better correlate different results to versions of the runner.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/debian-install.sh | 8 +---
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index dead65fe74dd..91bc58cbc46d 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -130,13 +130,15 @@ rm -rf /battery
 
 mkdir -p /volt
 cd /volt
-git clone --depth=1 https://github.com/VoltLang/Watt.git
-git clone --depth=1 https://github.com/VoltLang/Volta.git --branch 
go-go-gadget-armhf
-git clone --depth=1 https://github.com/Wallbraker/dEQP.git
+mkdir -p Watt Volta dEQP
+wget -qO- https://github.com/VoltLang/Watt/archive/v0.1.3.tar.gz | tar -xz 
--strip-components=1 -C ./Watt
+wget -qO- https://github.com/VoltLang/Volta/archive/v0.1.3.tar.gz | tar -xz 
--strip-components=1 -C ./Volta
+wget -qO- https://github.com/Wallbraker/dEQP/archive/v0.1.4.tar.gz | tar -xz 
--strip-components=1 -C ./dEQP
 battery config --release --lto Volta Watt
 battery build
 battery config --arch ${VOLT_ARCH} --cmd-volta Volta/volta Volta/rt Watt dEQP
 battery build
+rm /usr/local/bin/battery
 cp dEQP/deqp /artifacts/rootfs/deqp/deqp-volt
 rm -rf /volt
 
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 10fbb7ea6fc0..95e8db980173 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-09-10-2"
+  IMAGE_TAG: "2019-09-10-3"
 
 include:
   - project: 'wayland/ci-templates'
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost/ci: Increase timeouts

2019-09-06 Thread Tomeu Vizoso
Sometimes LAVA jobs will timeout due to transient issues, and the Gitlab
job will fail in that case. Increase the timeouts to reduce the
likeliness of that happening and reduce false positives.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 
b/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
index a6edb4e7a524..a975c1b4632e 100644
--- a/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
+++ b/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
@@ -13,7 +13,7 @@ visibility: public
 actions:
 - deploy:
 timeout:
-  minutes: 2
+  minutes: 10
 to: tftp
 kernel:
   url: {{ base_artifacts_url }}/{{ kernel_image_name }}
@@ -32,7 +32,7 @@ actions:
   - '#' 
 - test:
 timeout:
-  minutes: 40
+  minutes: 60
 definitions:
 - repository:
 metadata:
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/2] panfrost/ci: Re-add support for armhf

2019-09-06 Thread Tomeu Vizoso
Now that Volt supports armhf, build again images and submit to LAVA for
RK3288.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/debian-install.sh | 10 ++--
 .../drivers/panfrost/ci/deqp-runner.sh|  3 ++
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 53 +++
 .../drivers/panfrost/ci/lava-deqp.yml.jinja2  |  1 -
 4 files changed, 39 insertions(+), 28 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index fbb95887d345..ec2aa6723a88 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -111,20 +111,20 @@ rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
 ### Cross-build Volt dEQP runner
 mkdir -p /battery
 cd /battery
-wget 
https://github.com/VoltLang/Battery/releases/download/v0.1.22/battery-0.1.22-x86_64-linux.tar.gz
-tar xzvf battery-0.1.22-x86_64-linux.tar.gz
-rm battery-0.1.22-x86_64-linux.tar.gz
+wget 
https://github.com/VoltLang/Battery/releases/download/v0.1.23/battery-0.1.23-x86_64-linux.tar.gz
+tar xzvf battery-0.1.23-x86_64-linux.tar.gz
+rm battery-0.1.23-x86_64-linux.tar.gz
 mv battery /usr/local/bin
 rm -rf /battery
 
 mkdir -p /volt
 cd /volt
 git clone --depth=1 https://github.com/VoltLang/Watt.git
-git clone --depth=1 https://github.com/VoltLang/Volta.git
+git clone --depth=1 https://github.com/VoltLang/Volta.git --branch 
go-go-gadget-armhf
 git clone --depth=1 https://github.com/Wallbraker/dEQP.git
 battery config --release --lto Volta Watt
 battery build
-battery config --arch aarch64 --cmd-volta Volta/volta Volta/rt Watt dEQP
+battery config --arch ${VOLT_ARCH} --cmd-volta Volta/volta Volta/rt Watt dEQP
 battery build
 cp dEQP/deqp /artifacts/rootfs/deqp/deqp-volt
 rm -rf /volt
diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index b226c3d3e6f6..bf37d75aeabb 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -12,6 +12,9 @@ export LD_LIBRARY_PATH=/mesa/lib/
 export XDG_CONFIG_HOME=$(pwd)
 export MESA_GLES_VERSION_OVERRIDE=3.0
 
+DEVFREQ_GOVERNOR=`echo /sys/devices/platform/*.gpu/devfreq/devfreq0/governor`
+echo performance > $DEVFREQ_GOVERNOR
+
 echo "[core]\nidle-time=0\nrequire-input=false\n[shell]\nlocking=false" > 
weston.ini
 
 cd /deqp/modules/gles2
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index ed0123b00a91..6cbdd134b1c3 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-08-29-1"
+  IMAGE_TAG: "2019-09-02-2"
 
 include:
   - project: 'wayland/ci-templates'
@@ -46,20 +46,22 @@ stages:
 DEBIAN_EXEC: 'DEBIAN_ARCH=${DEBIAN_ARCH}
   GCC_ARCH=${GCC_ARCH}
   KERNEL_ARCH=${KERNEL_ARCH}
+  VOLT_ARCH=${VOLT_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:armhf:
+  extends: .container
+  variables:
+DEBIAN_ARCH: "armhf"
+GCC_ARCH: "arm-linux-gnueabihf"
+KERNEL_ARCH: "arm"
+VOLT_ARCH: "armhf"
+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
@@ -67,6 +69,7 @@ container:arm64:
 DEBIAN_ARCH: "arm64"
 GCC_ARCH: "aarch64-linux-gnu"
 KERNEL_ARCH: "arm64"
+VOLT_ARCH: "aarch64"
 DEFCONFIG: "arch/arm64/configs/defconfig"
 DEVICE_TREES: "arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb"
 KERNEL_IMAGE_NAME: "Image"
@@ -124,16 +127,18 @@ container:arm64:
 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:armhf:
+  extends: .build
+  needs: ["container:armhf"]
+  variables:
+DEBIAN_ARCH: "armhf"
+GCC_ARCH: "arm-linux-gnueabihf"
+DEVICE_TYPE: "rk3288-ve

[Mesa-dev] [PATCH 2/2] panfrost/ci: Use special runner for LAVA jobs

2019-09-06 Thread Tomeu Vizoso
So repositories don't need to be specially configured with a token to
access LAVA, store this token in a bind volume for a special runner.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 6cbdd134b1c3..9be47935e77e 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -148,19 +148,11 @@ build:arm64:
 .test:
   stage: test
   tags:
-- idle-jobs
+- idle-lava
   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
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] Enabling freedreno CI in Mesa MRs

2019-09-06 Thread Tomeu Vizoso
On Fri, 6 Sep 2019 at 03:23, Rob Clark  wrote:
>
> On Wed, Sep 4, 2019 at 1:42 PM Eric Anholt  wrote:
> >
> > If you haven't seen this MR:
> >
> > https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1632
> >
> > I feel ready to enable CI of freedreno on Mesa MRs.  There are some docs
> > here:
> >
> > https://gitlab.freedesktop.org/mesa/mesa/blob/e81a2d3b40240651f506a2a5afeb989792b3dc0e/.gitlab-ci/README.md
> >
> > Once we merge this, this will greatly increase Mesa's pre-merge CI
> > coverage on MRs by getting us up to GLES3.1 going through the CTS.  Once
> > krh is ready to put up an in-progress MR of tess, we can override the
> > GLES3.1 run to force-enable 3.2 with the remaining tess issues as
> > expected fails, and get a whole lot more API coverage.
> >
> > As far as stability of this CI, I've been through I think an order of
> > magnitude more runs of the CI than are visible from that MR, and I'm
> > pretty sure we've got a stable set of tests now -- I'm currently working
> > on fixing the flappy tests so we can drop the a630-specific skip list.
> > The lab has also been up for long enough that I'm convinced the HW is
> > stable enough to subject you all to it.
>
> I won't claim to be an unbiased observer, but I'm pretty excited about
> this.  This has been in the works for a while, and I think it is to
> the point where we aren't going to get much more useful testing of our
> gitlab runners with it living off on a branch, so at some point you
> just have to throw the switch.
>
> I'd propose, that unless there are any objections, we land this Monday
> morning (PST) on master, to ensure a relatively short turn-around just
> in case something went badly.
>
> (I can be online(ish) over the weekend if we want to throw the switch
> sooner.. but I might be AFK here and there to get groceries and things
> like that.  So response time might be a bit longer than on a week
> day.)
>
> Objections anyone?  Or counter-proposals?

I like the MR a lot and I think it will be a great base for CI for
panfrost and other gallium SoC drivers.

I'm concerned about the reliability of the current setup though, the
latest CI run I see in anholt/mesa seemed to fail due to problems in
the runners?

https://gitlab.freedesktop.org/anholt/mesa/pipelines/61502

Cheers,

Tomeu

> BR,
> -R
>
> > Once this is merged, please @anholt me on your MRs if you find spurious
> > failures in freedreno so I can go either disable those tests or fix
> > them.
> >
> > For some info on how I set up my DUTs, see
> > https://gitlab.freedesktop.org/anholt/mesa/wikis/db410c-setup for
> > starting from a pretty normal debian buster rootfs.  I'd love to work
> > with anyone on replicating this style of CI for your own hardware lab if
> > you're interested, or hooking pre-merge gitlab CI up to your existing CI
> > lab if you can make it public-access (panfrost?  Intel's CI?)
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost/ci: Re-add support for armhf

2019-09-02 Thread Tomeu Vizoso
Now that Volt supports armhf, build again images and submit to LAVA for
RK3288.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/debian-install.sh | 10 ++--
 .../drivers/panfrost/ci/deqp-runner.sh|  3 ++
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 53 +++
 .../drivers/panfrost/ci/lava-deqp.yml.jinja2  |  1 -
 4 files changed, 39 insertions(+), 28 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index fbb95887d345..ec2aa6723a88 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -111,20 +111,20 @@ rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
 ### Cross-build Volt dEQP runner
 mkdir -p /battery
 cd /battery
-wget 
https://github.com/VoltLang/Battery/releases/download/v0.1.22/battery-0.1.22-x86_64-linux.tar.gz
-tar xzvf battery-0.1.22-x86_64-linux.tar.gz
-rm battery-0.1.22-x86_64-linux.tar.gz
+wget 
https://github.com/VoltLang/Battery/releases/download/v0.1.23/battery-0.1.23-x86_64-linux.tar.gz
+tar xzvf battery-0.1.23-x86_64-linux.tar.gz
+rm battery-0.1.23-x86_64-linux.tar.gz
 mv battery /usr/local/bin
 rm -rf /battery
 
 mkdir -p /volt
 cd /volt
 git clone --depth=1 https://github.com/VoltLang/Watt.git
-git clone --depth=1 https://github.com/VoltLang/Volta.git
+git clone --depth=1 https://github.com/VoltLang/Volta.git --branch 
go-go-gadget-armhf
 git clone --depth=1 https://github.com/Wallbraker/dEQP.git
 battery config --release --lto Volta Watt
 battery build
-battery config --arch aarch64 --cmd-volta Volta/volta Volta/rt Watt dEQP
+battery config --arch ${VOLT_ARCH} --cmd-volta Volta/volta Volta/rt Watt dEQP
 battery build
 cp dEQP/deqp /artifacts/rootfs/deqp/deqp-volt
 rm -rf /volt
diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index b226c3d3e6f6..bf37d75aeabb 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -12,6 +12,9 @@ export LD_LIBRARY_PATH=/mesa/lib/
 export XDG_CONFIG_HOME=$(pwd)
 export MESA_GLES_VERSION_OVERRIDE=3.0
 
+DEVFREQ_GOVERNOR=`echo /sys/devices/platform/*.gpu/devfreq/devfreq0/governor`
+echo performance > $DEVFREQ_GOVERNOR
+
 echo "[core]\nidle-time=0\nrequire-input=false\n[shell]\nlocking=false" > 
weston.ini
 
 cd /deqp/modules/gles2
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index ed0123b00a91..6cbdd134b1c3 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-08-29-1"
+  IMAGE_TAG: "2019-09-02-2"
 
 include:
   - project: 'wayland/ci-templates'
@@ -46,20 +46,22 @@ stages:
 DEBIAN_EXEC: 'DEBIAN_ARCH=${DEBIAN_ARCH}
   GCC_ARCH=${GCC_ARCH}
   KERNEL_ARCH=${KERNEL_ARCH}
+  VOLT_ARCH=${VOLT_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:armhf:
+  extends: .container
+  variables:
+DEBIAN_ARCH: "armhf"
+GCC_ARCH: "arm-linux-gnueabihf"
+KERNEL_ARCH: "arm"
+VOLT_ARCH: "armhf"
+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
@@ -67,6 +69,7 @@ container:arm64:
 DEBIAN_ARCH: "arm64"
 GCC_ARCH: "aarch64-linux-gnu"
 KERNEL_ARCH: "arm64"
+VOLT_ARCH: "aarch64"
 DEFCONFIG: "arch/arm64/configs/defconfig"
 DEVICE_TREES: "arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb"
 KERNEL_IMAGE_NAME: "Image"
@@ -124,16 +127,18 @@ container:arm64:
 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:armhf:
+  extends: .build
+  needs: ["container:armhf"]
+  variables:
+DEBIAN_ARCH: "armhf"
+GCC_ARCH: "arm-linux-gnueabihf"
+DEVICE_TYPE: "rk3288-ve

[Mesa-dev] [PATCH] panfrost/ci: Print only regressions

2019-08-29 Thread Tomeu Vizoso
Some functionality has been added to deqp-volt to only print
regressions, so update our version of it and use the new options.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/deqp-runner.sh | 9 ++---
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml  | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index c6b2cce88829..b226c3d3e6f6 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -95,11 +95,14 @@ for test in $FLIP_FLOPS; do sed -i "/$test/d" 
/tmp/case-list.txt; done
 --results-file=/tmp/results.txt \
 --no-passed-results \
 --regression-file=/deqp/expected-failures.txt \
---no-rerun-tests
+--no-rerun-tests \
+--print-regression \
+--no-print-fail \
+--no-print-quality \
+--no-colour-term
 
 if [ $? -ne 0 ]; then
-echo "Regressions detected, printing results:"
-cat /tmp/results.txt
+echo "Regressions detected"
 echo "deqp: fail"
 else
 echo "No regressions detected"
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 8bbb48ab76f1..ed0123b00a91 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-08-21-1"
+  IMAGE_TAG: "2019-08-29-1"
 
 include:
   - project: 'wayland/ci-templates'
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost/ci: Diff results when printing

2019-08-22 Thread Tomeu Vizoso

On 8/21/19 7:48 PM, Alyssa Rosenzweig wrote:

Otherwise, there is too much noise to see what's going on.


I'm afraid this doesn't improve things much, as you can see below:

https://gitlab.freedesktop.org/tomeu/mesa/-/jobs/524402

Jakob has kindly offered to add this weekend a mode that prints only 
regressions and improvements. That should match what we had before.


Regards,

Tomeu


Signed-off-by: Alyssa Rosenzweig 
---
  src/gallium/drivers/panfrost/ci/deqp-runner.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index c6b2cce8882..54fa6834ad8 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -99,7 +99,7 @@ for test in $FLIP_FLOPS; do sed -i "/$test/d" 
/tmp/case-list.txt; done
  
  if [ $? -ne 0 ]; then

  echo "Regressions detected, printing results:"
-cat /tmp/results.txt
+diff /tmp/results.txt /deqp/expected-failures.txt
  echo "deqp: fail"
  else
  echo "No regressions detected"


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/5] panfrost/ci: Use Volt-based runner for dEQP tests

2019-08-21 Thread Tomeu Vizoso
It's able to run tests in parallel, fully utilizing the HW and
shortening considerable the time it takes.

Needed to disable tests in RK3288 for now because Volt doesn't support
armhf yet, though this should be fixed soon.

Tests are now run with --deqp-gl-config-name=rgbad24s8ms0, so we are
hitting a few more failures in tests that previously were being skipped.

The time to run the tests decreases from around 8 minutes to 1:45
minutes, allowing for extending coverage without increasing CI times too
much.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/create-rootfs.sh  |8 +-
 .../drivers/panfrost/ci/debian-install.sh |   36 +-
 .../drivers/panfrost/ci/deqp-runner.sh|  124 +-
 .../drivers/panfrost/ci/expected-failures.txt | 1118 +
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml |  138 +-
 .../drivers/panfrost/ci/lava-deqp.yml.jinja2  |   16 +-
 6 files changed, 1048 insertions(+), 392 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/create-rootfs.sh 
b/src/gallium/drivers/panfrost/ci/create-rootfs.sh
index 84ce8cdc882a..e01ccb34cb4a 100644
--- a/src/gallium/drivers/panfrost/ci/create-rootfs.sh
+++ b/src/gallium/drivers/panfrost/ci/create-rootfs.sh
@@ -15,9 +15,9 @@ ln -s /bin/sh /init
 rm -rf /etc/localtime
 cp /usr/share/zoneinfo/Etc/UTC /etc/localtime
 
-
-UNNEEDED_PACKAGES=" libfdisk1"\
-" tzdata"\
+UNNEEDED_PACKAGES="libfdisk1
+   tzdata
+   diffutils"
 
 export DEBIAN_FRONTEND=noninteractive
 
@@ -182,4 +182,4 @@ rm usr/lib/*/libdb-5.3.so
 rm usr/lib/*/libnss_hesiod*
 rm usr/lib/*/libnss_nis*
 
-rm usr/bin/tar
\ No newline at end of file
+rm bin/tar
diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index c42c4387729a..816b616b491a 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -42,6 +42,13 @@ apt-get -y install --no-install-recommends \
procps \
qemu-user-static \
cpio \
+   clang-8 \
+   llvm-8 \
+   libclang-8-dev \
+   llvm-8-dev \
+   gdc-9 \
+   lld-8 \
+   nasm \
\
libdrm-dev:${DEBIAN_ARCH} \
libx11-dev:${DEBIAN_ARCH} \
@@ -65,12 +72,12 @@ apt-get -y install --no-install-recommends \
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
 
@@ -89,7 +96,6 @@ cmake -DDEQP_TARGET=wayland   \
   /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
@@ -102,6 +108,32 @@ du -sh *
 rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
 
 
+### Cross-build Volt dEQP runner
+mkdir -p /battery
+cd /battery
+wget 
https://github.com/VoltLang/Battery/releases/download/v0.1.22/battery-0.1.22-x86_64-linux.tar.gz
+tar xzvf battery-0.1.22-x86_64-linux.tar.gz
+rm battery-0.1.22-x86_64-linux.tar.gz
+mv battery /usr/local/bin
+rm -rf /battery
+
+mkdir -p /volt
+cd /volt
+git clone --depth=1 https://github.com/VoltLang/Watt.git
+git clone --depth=1 https://github.com/VoltLang/Volta.git
+git clone --depth=1 https://github.com/Wallbraker/dEQP.git
+battery config --release --lto Volta Watt
+battery build
+battery config --arch aarch64 --cmd-volta Volta/volta Volta/rt Watt dEQP
+battery build
+cp dEQP/deqp /artifacts/rootfs/deqp/deqp-volt
+rm -rf /volt
+
+
+### Remove LLVM now, so the container image is smaller
+apt-get -y remove \*llvm\*
+
+
 ### 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}
diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index c468d95d2b42..e2a1eedda3e8 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -1,7 +1,5 @@
 #!/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"
@@ -24,26 +22,102 @@ 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 crashi

[Mesa-dev] [PATCH 5/5] panfrost/ci: Print load stats

2019-08-21 Thread Tomeu Vizoso
To help make sure we are running tests in the ideal number of threads,
print load stats to make obvious when there's a problem with
utilization.

This will be specially useful when we run tests on a wider variety of
devices.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 
b/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
index 56cbdf913f46..a04da3e182ec 100644
--- a/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
+++ b/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
@@ -53,6 +53,7 @@ actions:
   - echo 3 > /proc/sys/kernel/printk
   - echo performance > 
/sys/devices/platform/ff9a.gpu/devfreq/devfreq0/governor
   - sh /deqp/deqp-runner.sh
+  - cat /proc/loadavg
 parse:
   pattern: '(?P\S*):\s+(?P(pass|fail))'
   from: inline
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 3/5] panfrost/ci: Build kernel with CONFIG_DETECT_HUNG_TASK

2019-08-21 Thread Tomeu Vizoso
There's lots of locking changes going into the Panfrost kernel driver,
so better be prepared.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/arm64.config | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/arm64.config 
b/src/gallium/drivers/panfrost/ci/arm64.config
index 80662541feb8..44dfe860b8dd 100644
--- a/src/gallium/drivers/panfrost/ci/arm64.config
+++ b/src/gallium/drivers/panfrost/ci/arm64.config
@@ -78,5 +78,7 @@ 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
+CONFIG_SOFTLOCKUP_DETECTOR=y
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=y
+
+CONFIG_DETECT_HUNG_TASK=y
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 4/5] panfrost/ci: Install qemu-arm-static into chroot

2019-08-21 Thread Tomeu Vizoso
Some runners may be configured such that the qemu binary might not be
available by the time we need to start running commands within the
chroot.

So make sure that it's there to avoid suprising problems in that case.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/debian-install.sh | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index 09f3319628c3..fbb95887d345 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -151,10 +151,17 @@ rm -rf /kernel
 
 ### Create rootfs
 cp ${PANFROST_CI_DIR}/create-rootfs.sh /artifacts/rootfs/.
+mkdir -p /artifacts/rootfs/bin
+cp /usr/bin/qemu-aarch64-static /artifacts/rootfs/bin
+cp /usr/bin/qemu-arm-static /artifacts/rootfs/bin
+
 set +e
 debootstrap --variant=minbase --arch=${DEBIAN_ARCH} testing /artifacts/rootfs/ 
http://deb.debian.org/debian
 cat /artifacts/rootfs/debootstrap/debootstrap.log
 set -e
 chroot /artifacts/rootfs sh /create-rootfs.sh
+
+rm /artifacts/rootfs/bin/qemu-arm-static
+rm /artifacts/rootfs/bin/qemu-aarch64-static
 rm /artifacts/rootfs/create-rootfs.sh
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/5] panfrost/ci: Print bootstrap log

2019-08-21 Thread Tomeu Vizoso
A number of things can go wrong when building the rootfs from within a
non-native chroot, so make sure to print the bootstrap.log so we can
tell what's going on.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/debian-install.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index 816b616b491a..09f3319628c3 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -151,7 +151,10 @@ rm -rf /kernel
 
 ### Create rootfs
 cp ${PANFROST_CI_DIR}/create-rootfs.sh /artifacts/rootfs/.
+set +e
 debootstrap --variant=minbase --arch=${DEBIAN_ARCH} testing /artifacts/rootfs/ 
http://deb.debian.org/debian
+cat /artifacts/rootfs/debootstrap/debootstrap.log
+set -e
 chroot /artifacts/rootfs sh /create-rootfs.sh
 rm /artifacts/rootfs/create-rootfs.sh
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 2/2] panfrost: Add madvise support to BO cache

2019-08-16 Thread Tomeu Vizoso
Both patches look good to me.

Reviewed-by: Tomeu Vizoso 

Thanks!

Tomeu

On Fri, 9 Aug 2019 at 21:53, Rob Herring  wrote:
>
> The kernel now supports madvise ioctl to indicate which BOs can be freed
> when there is memory pressure. Mark BOs purgeable when they are in the
> BO cache. The BOs must also be munmapped when they are in the cache or
> they cannot be purged.
>
> We could optimize avoiding the madvise ioctl on older kernels once the
> driver version bump lands, but probably not worth it given the other
> driver features also being added.
>
> Signed-off-by: Rob Herring 
> ---
>  src/gallium/drivers/panfrost/pan_bo_cache.c | 21 +
>  src/gallium/drivers/panfrost/pan_drm.c  |  4 ++--
>  2 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_bo_cache.c 
> b/src/gallium/drivers/panfrost/pan_bo_cache.c
> index 7378d0a8abea..239ea0b46cb2 100644
> --- a/src/gallium/drivers/panfrost/pan_bo_cache.c
> +++ b/src/gallium/drivers/panfrost/pan_bo_cache.c
> @@ -23,6 +23,8 @@
>   * Authors (Collabora):
>   *   Alyssa Rosenzweig 
>   */
> +#include 
> +#include "drm-uapi/panfrost_drm.h"
>
>  #include "pan_screen.h"
>  #include "util/u_math.h"
> @@ -88,9 +90,21 @@ panfrost_bo_cache_fetch(
>  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(>link);
>
> +madv.handle = entry->gem_handle;
> +madv.madv = PANFROST_MADV_WILLNEED;
> +   madv.retained = 0;
> +
> +ret = drmIoctl(screen->fd, 
> DRM_IOCTL_PANFROST_MADVISE, );
> +   if (!ret && !madv.retained) {
> +   panfrost_drm_release_bo(screen, entry, false);
> +   continue;
> +   }
>  /* Let's go! */
>  return entry;
>  }
> @@ -109,6 +123,13 @@ panfrost_bo_cache_put(
>  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, );
>
>  /* Add us to the bucket */
>  list_addtail(>link, bucket);
> diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
> b/src/gallium/drivers/panfrost/pan_drm.c
> index 36a6b975680a..28a4287202bd 100644
> --- a/src/gallium/drivers/panfrost/pan_drm.c
> +++ b/src/gallium/drivers/panfrost/pan_drm.c
> @@ -163,6 +163,8 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
> struct panfrost_bo *bo,
>  /* 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);
>
> @@ -172,8 +174,6 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
> struct panfrost_bo *bo,
>
>  /* Otherwise, if the BO wasn't cached, we'll legitimately free the 
> BO */
>
> -panfrost_drm_munmap_bo(screen, bo);
> -
>  ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, _close);
>  if (ret) {
>  fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
> --
> 2.20.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH v2 2/5] panfrost: Allocate shaders in their own BOs

2019-08-09 Thread Tomeu Vizoso
On Thu, 8 Aug 2019 at 16:50, Rob Herring  wrote:
>
> On Wed, Aug 7, 2019 at 5:47 PM Alyssa Rosenzweig
>  wrote:
> >
> > > This is using the
> > > untranslated flags, but I think it should be the 'translated_flags' as
> > > those are the ones changing the allocation.
> >
> > It's a little more complex than that. There some hypothetical
> > untranslated flags that I would want to match on. For instance, future
> > CPU read-only/write-only modifiers -- those affect the mmap (and need to
> > be accounted for in the BO cache) but aren't specified as
> > translated_flags to the kernel.
>
> I'll still argue that we shouldn't leave cached BOs mmap'ed so that
> example would be mute.
>
> The more bits we have to match on, the less effective the BO cache
> will be. Either we should use translated_flags or we should filter the
> untranslated flags to the ones we care about. The latter would be more
> flexible I guess.

Yeah, there's lots to optimize still, fortunately :)

Cheers,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH v2 2/5] panfrost: Allocate shaders in their own BOs

2019-08-09 Thread Tomeu Vizoso
On Thu, 8 Aug 2019 at 16:19, Rob Herring  wrote:
>
> On Wed, Aug 7, 2019 at 11:23 PM Tomeu Vizoso  
> wrote:
> >
> > On Thu, 8 Aug 2019 at 00:47, Rob Herring  wrote:
> > >
> > > On Wed, Aug 7, 2019 at 2:37 AM Tomeu Vizoso  
> > > wrote:
> > > >
> > > > Instead of all shaders being stored in a single BO, have each shader in
> > > > its own.
> > > >
> > > > This removes the need for a 16MB allocation per context, and allows us
> > > > to place transient blend shaders in BOs marked as executable (before
> > > > they were allocated in the transient pool, which shouldn't be
> > > > executable).
> > > >
> > > > v2: - Store compiled blend shaders in a malloc'ed buffer, to avoid
> > > >   reading from GPU-accessible memory when patching (Alyssa).
> > > > - Free struct panfrost_blend_shader (Alyssa).
> > > > - Give the job a reference to regular shaders when emitting
> > > >   (Alyssa).
> > > >
> > > > Signed-off-by: Tomeu Vizoso 
> > >
> > >
> > > > diff --git a/src/gallium/drivers/panfrost/pan_bo_cache.c 
> > > > b/src/gallium/drivers/panfrost/pan_bo_cache.c
> > > > index fba495c1dd69..7378d0a8abea 100644
> > > > --- a/src/gallium/drivers/panfrost/pan_bo_cache.c
> > > > +++ b/src/gallium/drivers/panfrost/pan_bo_cache.c
> > > > @@ -84,11 +84,10 @@ panfrost_bo_cache_fetch(
> > > >  {
> > > >  struct list_head *bucket = pan_bucket(screen, size);
> > > >
> > > > -/* TODO: Honour flags? */
> > > > -
> > > >  /* Iterate the bucket looking for something suitable */
> > > >  list_for_each_entry_safe(struct panfrost_bo, entry, bucket, 
> > > > link) {
> > > > -if (entry->size >= size) {
> > > > +if (entry->size >= size &&
> > > > +entry->flags == flags) {
> > >
> > > This change probably warrants its own patch IMO.
> >
> > Agreed.
> >
> > > This is using the
> > > untranslated flags, but I think it should be the 'translated_flags' as
> > > those are the ones changing the allocation. For example, I don't think
> > > there's any reason for DELAYED_MMAP to be used as a match criteria
> > > (BTW, I'm also not sure if we can reclaim BOs if they remain mmap'ed).
> > >
> > > Another problem I see, if we have a 100MB buffer in the cache, would
> > > we really want to hit on a 4KB allocation? Perhaps a 'entry->size * 2
> > > < size' check.
> >
> > Yeah, as mentioned in the v1 discussion, we have plenty of room for
> > improvements here, but the goal now is just to stop doing memory
> > allocation so greedily that we reach OOM after launching a few GL
> > clients.
>
> Sure. IMO, committing the BO cache without madvise was a mistake.
> Without madvise, 2 instances of glmark will OOM.

How can I test that? I just checked here and I'm running 10 instances
of it within gnome-shell with 1GB still free (from a total of 2GB).
This is with HEAP support, without it we'd be still allocating one
16MB buffer per context, but it's still not that bad.

It used to be pretty bad when we were allocating gigantic buffers on
context creation, just to be safe. But Mesa master now is much more
careful with that and I think .

> I should be able to
> send out the patch for it today. I think it's going to need to disable
> caching when madvise is not supported.

Can you check if that would be still needed, please?

Thanks,

Tomeu

> Rob
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH v2 5/5] panfrost: Print errors from kernel

2019-08-07 Thread Tomeu Vizoso
On Thu, 8 Aug 2019 at 00:52, Rob Herring  wrote:
>
> On Wed, Aug 7, 2019 at 2:37 AM Tomeu Vizoso  
> wrote:
> >
> > Signed-off-by: Tomeu Vizoso 
> > Reviewed-by: Alyssa Rosenzweig 
> > ---
> >  src/gallium/drivers/panfrost/pan_drm.c | 10 +-
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
> > b/src/gallium/drivers/panfrost/pan_drm.c
> > index 71eda2d1e328..36a6b975680a 100644
> > --- a/src/gallium/drivers/panfrost/pan_drm.c
> > +++ b/src/gallium/drivers/panfrost/pan_drm.c
> > @@ -49,14 +49,14 @@ panfrost_drm_mmap_bo(struct panfrost_screen *screen, 
> > struct panfrost_bo *bo)
> >
> >  ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MMAP_BO, _bo);
> >  if (ret) {
> > -fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %d\n", 
> > ret);
> > +fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %m\n");
>
> Is this going to work on Android and bionic?

Yep: 
https://android.googlesource.com/platform/bionic/+/refs/heads/master/libc/stdio/vfprintf.cpp#455

Musl and uClibc also support it.

Cheers,

Tomeu

> stderr goes to /dev/null
> anyways on Android, so probably not a big deal.
>
> Rob
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH v2 2/5] panfrost: Allocate shaders in their own BOs

2019-08-07 Thread Tomeu Vizoso
On Thu, 8 Aug 2019 at 00:47, Rob Herring  wrote:
>
> On Wed, Aug 7, 2019 at 2:37 AM Tomeu Vizoso  
> wrote:
> >
> > Instead of all shaders being stored in a single BO, have each shader in
> > its own.
> >
> > This removes the need for a 16MB allocation per context, and allows us
> > to place transient blend shaders in BOs marked as executable (before
> > they were allocated in the transient pool, which shouldn't be
> > executable).
> >
> > v2: - Store compiled blend shaders in a malloc'ed buffer, to avoid
> >   reading from GPU-accessible memory when patching (Alyssa).
> > - Free struct panfrost_blend_shader (Alyssa).
> > - Give the job a reference to regular shaders when emitting
> >   (Alyssa).
> >
> > Signed-off-by: Tomeu Vizoso 
>
>
> > diff --git a/src/gallium/drivers/panfrost/pan_bo_cache.c 
> > b/src/gallium/drivers/panfrost/pan_bo_cache.c
> > index fba495c1dd69..7378d0a8abea 100644
> > --- a/src/gallium/drivers/panfrost/pan_bo_cache.c
> > +++ b/src/gallium/drivers/panfrost/pan_bo_cache.c
> > @@ -84,11 +84,10 @@ panfrost_bo_cache_fetch(
> >  {
> >  struct list_head *bucket = pan_bucket(screen, size);
> >
> > -/* TODO: Honour flags? */
> > -
> >  /* Iterate the bucket looking for something suitable */
> >  list_for_each_entry_safe(struct panfrost_bo, entry, bucket, link) {
> > -if (entry->size >= size) {
> > +if (entry->size >= size &&
> > +entry->flags == flags) {
>
> This change probably warrants its own patch IMO.

Agreed.

> This is using the
> untranslated flags, but I think it should be the 'translated_flags' as
> those are the ones changing the allocation. For example, I don't think
> there's any reason for DELAYED_MMAP to be used as a match criteria
> (BTW, I'm also not sure if we can reclaim BOs if they remain mmap'ed).
>
> Another problem I see, if we have a 100MB buffer in the cache, would
> we really want to hit on a 4KB allocation? Perhaps a 'entry->size * 2
> < size' check.

Yeah, as mentioned in the v1 discussion, we have plenty of room for
improvements here, but the goal now is just to stop doing memory
allocation so greedily that we reach OOM after launching a few GL
clients.

For 19.3 we could start tracking performance and other metrics such as
peak memory usage, etc.

Cheers,

Tomeu

>
> >  /* This one works, splice it out of the cache */
> >  list_del(>link);
> >
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2 5/5] panfrost: Print errors from kernel

2019-08-07 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
Reviewed-by: Alyssa Rosenzweig 
---
 src/gallium/drivers/panfrost/pan_drm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 71eda2d1e328..36a6b975680a 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -49,14 +49,14 @@ panfrost_drm_mmap_bo(struct panfrost_screen *screen, struct 
panfrost_bo *bo)
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MMAP_BO, _bo);
 if (ret) {
-fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %d\n", 
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\n", bo->cpu);
+fprintf(stderr, "mmap failed: %p %m\n", bo->cpu);
 assert(0);
 }
 
@@ -122,7 +122,7 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_CREATE_BO, 
_bo);
 if (ret) {
-fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: 
%d\n", ret);
+fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: 
%m\n");
 assert(0);
 }
 
@@ -176,7 +176,7 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
struct panfrost_bo *bo,
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, _close);
 if (ret) {
-fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %d\n", ret);
+fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
 assert(0);
 }
 
@@ -332,7 +332,7 @@ panfrost_fence_create(struct panfrost_context *ctx)
  */
 drmSyncobjExportSyncFile(screen->fd, ctx->out_sync, >fd);
 if (f->fd == -1) {
-fprintf(stderr, "export failed\n");
+fprintf(stderr, "export failed: %m\n");
 free(f);
 return NULL;
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2 2/5] panfrost: Allocate shaders in their own BOs

2019-08-07 Thread Tomeu Vizoso
Instead of all shaders being stored in a single BO, have each shader in
its own.

This removes the need for a 16MB allocation per context, and allows us
to place transient blend shaders in BOs marked as executable (before
they were allocated in the transient pool, which shouldn't be
executable).

v2: - Store compiled blend shaders in a malloc'ed buffer, to avoid
  reading from GPU-accessible memory when patching (Alyssa).
- Free struct panfrost_blend_shader (Alyssa).
- Give the job a reference to regular shaders when emitting
  (Alyssa).

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_allocate.h   |  2 +
 src/gallium/drivers/panfrost/pan_assemble.c   |  5 ++-
 src/gallium/drivers/panfrost/pan_blend.h  | 13 --
 src/gallium/drivers/panfrost/pan_blend_cso.c  | 41 +--
 .../drivers/panfrost/pan_blend_shaders.c  | 13 ++
 src/gallium/drivers/panfrost/pan_bo_cache.c   |  5 +--
 src/gallium/drivers/panfrost/pan_context.c| 14 +--
 src/gallium/drivers/panfrost/pan_context.h|  3 +-
 src/gallium/drivers/panfrost/pan_drm.c|  5 ++-
 9 files changed, 66 insertions(+), 35 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_allocate.h 
b/src/gallium/drivers/panfrost/pan_allocate.h
index 8d925ee38a4c..0e06567d2069 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.h
+++ b/src/gallium/drivers/panfrost/pan_allocate.h
@@ -59,6 +59,8 @@ struct panfrost_bo {
 size_t size;
 
 int gem_handle;
+
+uint32_t flags;
 };
 
 struct panfrost_memory {
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c 
b/src/gallium/drivers/panfrost/pan_assemble.c
index 15f77585a25c..dd877056d3b5 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -43,6 +43,7 @@ panfrost_shader_compile(
 gl_shader_stage stage,
 struct panfrost_shader_state *state)
 {
+struct panfrost_screen *screen = pan_screen(ctx->base.screen);
 uint8_t *dst;
 
 nir_shader *s;
@@ -80,7 +81,9 @@ panfrost_shader_compile(
  * I bet someone just thought that would be a cute pun. At least,
  * that's how I'd do it. */
 
-meta->shader = panfrost_upload(>shaders, dst, size) | 
program.first_tag;
+state->bo = panfrost_drm_create_bo(screen, size, PAN_ALLOCATE_EXECUTE);
+memcpy(state->bo->cpu, dst, size);
+meta->shader = state->bo->gpu | program.first_tag;
 
 util_dynarray_fini();
 
diff --git a/src/gallium/drivers/panfrost/pan_blend.h 
b/src/gallium/drivers/panfrost/pan_blend.h
index a881e0945f48..a29353ff0014 100644
--- a/src/gallium/drivers/panfrost/pan_blend.h
+++ b/src/gallium/drivers/panfrost/pan_blend.h
@@ -33,8 +33,10 @@
 /* An internal blend shader descriptor, from the compiler */
 
 struct panfrost_blend_shader {
-/* The compiled shader in GPU memory */
-struct panfrost_transfer shader;
+struct panfrost_context *ctx;
+
+/* The compiled shader */
+void *buffer;
 
 /* Byte count of the shader */
 unsigned size;
@@ -53,8 +55,11 @@ struct panfrost_blend_shader {
 /* A blend shader descriptor ready for actual use */
 
 struct panfrost_blend_shader_final {
-/* The upload, possibly to transient memory */
-mali_ptr gpu;
+/* The compiled shader in GPU memory, possibly patched */
+struct panfrost_bo *bo;
+
+/* First instruction tag (for tagging the pointer) */
+unsigned first_tag;
 
 /* Same meaning as panfrost_blend_shader */
 unsigned work_count;
diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c 
b/src/gallium/drivers/panfrost/pan_blend_cso.c
index f685b25b41b3..08a86980ca88 100644
--- a/src/gallium/drivers/panfrost/pan_blend_cso.c
+++ b/src/gallium/drivers/panfrost/pan_blend_cso.c
@@ -151,11 +151,24 @@ panfrost_bind_blend_state(struct pipe_context *pipe,
 ctx->dirty |= PAN_DIRTY_FS;
 }
 
+static void
+panfrost_delete_blend_shader(struct hash_entry *entry)
+{
+struct panfrost_blend_shader *shader = (struct panfrost_blend_shader 
*)entry->data;
+free(shader->buffer);
+free(shader);
+}
+
 static void
 panfrost_delete_blend_state(struct pipe_context *pipe,
-void *blend)
+void *cso)
 {
-/* TODO: Free shader binary? */
+struct panfrost_blend_state *blend = (struct panfrost_blend_state *) 
cso;
+
+for (unsigned c = 0; c < 4; ++c) {
+struct panfrost_blend_rt *rt = >rt[c];
+_mesa_hash_table_u64_clear(rt->shaders, 
panfrost_delete_blend_shader);
+}
 ralloc_free(blend);
 }
 
@@ -208,6 +221,9 @@ panfrost_blend_constant(float *out, float *in, unsigned 
mask)
 struct panfrost_blend_final
 panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti)
 {
+st

[Mesa-dev] [PATCH v2 4/5] panfrost: Mark buffers as PANFROST_BO_HEAP

2019-08-07 Thread Tomeu Vizoso
What we call GROWABLE in Mesa corresponds to the HEAP BO flag in the
kernel. These buffers cannot be memory mapped in the CPU side at the
moment, so make sure they are also marked INVISIBLE.

This allows us to allocate a big heap upfront (16MB) without actually
reserving space unless it's needed.

Signed-off-by: Tomeu Vizoso 
Reviewed-by: Alyssa Rosenzweig 
---
 src/gallium/drivers/panfrost/pan_drm.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 6d1e0c08d33d..71eda2d1e328 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -91,10 +91,16 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 /* 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;
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2 1/5] util/hash_table: Fix hashing in clears on 32-bit

2019-08-07 Thread Tomeu Vizoso
Some hash functions (eg. key_u64_hash) will attempt to dereference the
key, causing an invalid access when passed DELETED_KEY_VALUE (0x1) or
FREED_KEY_VALUE (0x0).

To avoid this problem, stuff the fake keys into a hash_key_u64 struct
and pass the pointer to it instead.

Signed-off-by: Tomeu Vizoso 
Suggested-by: Caio Marcelo de Oliveira Filho 
Cc: Samuel Pitoiset 
Cc: Nicolai Hähnle 
---
 src/util/hash_table.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index f58575de558f..58e6fc2d9169 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -667,7 +667,12 @@ _mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
  struct hash_entry entry;
 
  /* Create a fake entry for the delete function. */
- entry.hash = table->key_hash_function(table->deleted_key);
+ if (sizeof(void *) == 8) {
+entry.hash = table->key_hash_function(table->deleted_key);
+ } else {
+struct hash_key_u64 _key = { .value = 
(uintptr_t)table->deleted_key };
+entry.hash = table->key_hash_function(&_key);
+ }
  entry.key = table->deleted_key;
  entry.data = ht->deleted_key_data;
 
@@ -682,7 +687,12 @@ _mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
  struct hash_entry entry;
 
  /* Create a fake entry for the delete function. */
- entry.hash = table->key_hash_function(uint_key(FREED_KEY_VALUE));
+ if (sizeof(void *) == 8) {
+entry.hash = table->key_hash_function(uint_key(FREED_KEY_VALUE));
+ } else {
+struct hash_key_u64 _key = { .value = (uintptr_t)FREED_KEY_VALUE };
+entry.hash = table->key_hash_function(&_key);
+ }
  entry.key = uint_key(FREED_KEY_VALUE);
  entry.data = ht->freed_key_data;
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2 3/5] panfrost: Mark BOs as NOEXEC

2019-08-07 Thread Tomeu Vizoso
Unless a BO has the EXECUTABLE flag, mark it as NOEXEC.

v2: - Rework version detection (Alyssa).

Signed-off-by: Tomeu Vizoso 
---
 include/drm-uapi/panfrost_drm.h   | 27 +++
 src/gallium/drivers/panfrost/pan_drm.c|  6 -
 src/gallium/drivers/panfrost/pan_screen.c |  3 ++-
 src/gallium/drivers/panfrost/pan_screen.h |  3 +++
 4 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/include/drm-uapi/panfrost_drm.h b/include/drm-uapi/panfrost_drm.h
index a52e0283b90d..9150dd75aad8 100644
--- a/include/drm-uapi/panfrost_drm.h
+++ b/include/drm-uapi/panfrost_drm.h
@@ -18,6 +18,8 @@ extern "C" {
 #define DRM_PANFROST_MMAP_BO   0x03
 #define DRM_PANFROST_GET_PARAM 0x04
 #define DRM_PANFROST_GET_BO_OFFSET 0x05
+#define DRM_PANFROST_PERFCNT_ENABLE0x06
+#define DRM_PANFROST_PERFCNT_DUMP  0x07
 
 #define DRM_IOCTL_PANFROST_SUBMIT  DRM_IOW(DRM_COMMAND_BASE + 
DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
 #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + 
DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
@@ -26,6 +28,15 @@ extern "C" {
 #define DRM_IOCTL_PANFROST_GET_PARAM   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param)
 #define DRM_IOCTL_PANFROST_GET_BO_OFFSET   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
 
+/*
+ * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module
+ * param is set to true.
+ * All these ioctl(s) are subject to deprecation, so please don't rely on
+ * them for anything but debugging purpose.
+ */
+#define DRM_IOCTL_PANFROST_PERFCNT_ENABLE  DRM_IOW(DRM_COMMAND_BASE + 
DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable)
+#define DRM_IOCTL_PANFROST_PERFCNT_DUMP
DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct 
drm_panfrost_perfcnt_dump)
+
 #define PANFROST_JD_REQ_FS (1 << 0)
 /**
  * struct drm_panfrost_submit - ioctl argument for submitting commands to the 
3D
@@ -71,6 +82,9 @@ struct drm_panfrost_wait_bo {
__s64 timeout_ns;   /* absolute */
 };
 
+#define PANFROST_BO_NOEXEC 1
+#define PANFROST_BO_HEAP   2
+
 /**
  * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
  *
@@ -135,6 +149,19 @@ struct drm_panfrost_get_bo_offset {
__u64 offset;
 };
 
+struct drm_panfrost_perfcnt_enable {
+   __u32 enable;
+   /*
+* On bifrost we have 2 sets of counters, this parameter defines the
+* one to track.
+*/
+   __u32 counterset;
+};
+
+struct drm_panfrost_perfcnt_dump {
+   __u64 buf_ptr;
+};
+
 #if defined(__cplusplus)
 }
 #endif
diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 8ae541ae11b6..6d1e0c08d33d 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -93,7 +93,11 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 
 unsigned translated_flags = 0;
 
-/* TODO: translate flags to kernel flags, if the kernel supports */
+if (screen->kernel_version->version_major > 1 ||
+screen->kernel_version->version_minor >= 1) {
+if (!(flags & PAN_ALLOCATE_EXECUTE))
+translated_flags |= PANFROST_BO_NOEXEC;
+}
 
 struct drm_panfrost_create_bo create_bo = {
 .size = size,
diff --git a/src/gallium/drivers/panfrost/pan_screen.c 
b/src/gallium/drivers/panfrost/pan_screen.c
index b2fac88e956e..5f527d0d3b3d 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -37,7 +37,6 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
 #include "draw/draw_context.h"
-#include 
 
 #include 
 
@@ -537,6 +536,7 @@ panfrost_destroy_screen(struct pipe_screen *pscreen)
 {
 struct panfrost_screen *screen = pan_screen(pscreen);
 panfrost_bo_cache_evict_all(screen);
+drmFreeVersion(screen->kernel_version);
 ralloc_free(screen);
 }
 
@@ -617,6 +617,7 @@ panfrost_create_screen(int fd, struct renderonly *ro)
 
 screen->gpu_id = panfrost_drm_query_gpu_version(screen);
 screen->require_sfbd = screen->gpu_id < 0x0750; /* T760 is the first 
to support MFBD */
+screen->kernel_version = drmGetVersion(fd);
 
 /* Check if we're loading against a supported GPU model. */
 
diff --git a/src/gallium/drivers/panfrost/pan_screen.h 
b/src/gallium/drivers/panfrost/pan_screen.h
index 22cd7dcc9fea..35fb8de26282 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -29,6 +29,7 @@
 #ifndef PAN_SCREEN_H
 #define PAN_SCREEN_H
 
+#include 
 #include "pipe/p_screen.h"

Re: [Mesa-dev] [PATCH 5/5] panfrost: Print errors from kernel

2019-08-06 Thread Tomeu Vizoso
On Tue, 6 Aug 2019 at 16:58, Alyssa Rosenzweig  wrote:
>
> > Android should be fine, as they use it in their own code.
>
> Hmm, still uncomfortable, but tentative R-b I guess :/
>
> I just.. don't like relying on glibc specific behaviour. Even if bionic
> implements it too, I mean... what happens for the postmarketOS guys?
> They've been interested in Panfrost for a while, but they use musl. Will
> this break their build..?

Musl seems to support it as well :)

https://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c#n57

Cheers,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost/ci: Remove two tests from list of failures

2019-08-06 Thread Tomeu Vizoso
These tests have been fixed by:

b514f411837b ("glcpp: use pre-expansion line number for __LINE__")

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/expected-failures.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt 
b/src/gallium/drivers/panfrost/ci/expected-failures.txt
index 440231bfb54b..0ecfb02c7cd6 100644
--- a/src/gallium/drivers/panfrost/ci/expected-failures.txt
+++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt
@@ -233,7 +233,5 @@ 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.preprocessor.predefined_macros.line_2_fragment
-dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_vertex
 
dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_fragment
 
dEQP-GLES2.functional.shaders.scoping.valid.local_variable_hides_function_parameter_vertex
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 5/5] panfrost: Print errors from kernel

2019-08-06 Thread Tomeu Vizoso
On Mon, 5 Aug 2019 at 19:06, Alyssa Rosenzweig  wrote:
>
> I didn't know about %m, nifty.
>
> I don't think this is portable, though... which might be a problem
> if/when someone tries to port Android, etc.

Android should be fine, as they use it in their own code.

Cheers,

Tomeu

>
> On Mon, Aug 05, 2019 at 05:18:36PM +0200, Tomeu Vizoso wrote:
> > Signed-off-by: Tomeu Vizoso 
> > ---
> >  src/gallium/drivers/panfrost/pan_drm.c | 10 +-
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
> > b/src/gallium/drivers/panfrost/pan_drm.c
> > index 122bc5f3db36..46cceb808919 100644
> > --- a/src/gallium/drivers/panfrost/pan_drm.c
> > +++ b/src/gallium/drivers/panfrost/pan_drm.c
> > @@ -49,14 +49,14 @@ panfrost_drm_mmap_bo(struct panfrost_screen *screen, 
> > struct panfrost_bo *bo)
> >
> >  ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MMAP_BO, _bo);
> >  if (ret) {
> > -fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %d\n", 
> > 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\n", bo->cpu);
> > +fprintf(stderr, "mmap failed: %p %m\n", bo->cpu);
> >  assert(0);
> >  }
> >
> > @@ -121,7 +121,7 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
> > size_t size,
> >
> >  ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_CREATE_BO, 
> > _bo);
> >  if (ret) {
> > -fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO 
> > failed: %d\n", ret);
> > +fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO 
> > failed: %m\n");
> >  assert(0);
> >  }
> >
> > @@ -175,7 +175,7 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
> > struct panfrost_bo *bo,
> >
> >  ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, _close);
> >  if (ret) {
> > -fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %d\n", ret);
> > +fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
> >  assert(0);
> >  }
> >
> > @@ -331,7 +331,7 @@ panfrost_fence_create(struct panfrost_context *ctx)
> >   */
> >  drmSyncobjExportSyncFile(screen->fd, ctx->out_sync, >fd);
> >  if (f->fd == -1) {
> > -fprintf(stderr, "export failed\n");
> > +fprintf(stderr, "export failed: %m\n");
> >  free(f);
> >  return NULL;
> >  }
> > --
> > 2.20.1
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 3/5] panfrost: Mark BOs as NOEXEC

2019-08-06 Thread Tomeu Vizoso
On Mon, 5 Aug 2019 at 19:06, Alyssa Rosenzweig  wrote:
>
> > +if (screen->kernel_version >= 1) {
>
> Maybe have some #defines for kernel versions instead of magic numbers?
> Also, maybe make it clear that this is a minor version -- what does
> happen if we bump the major version at some point...?

In that case we would need to change Mesa to also take into account
the major field. I cannot see why we would do it, though.

> >  panfrost_create_screen(int fd, struct renderonly *ro)
> >  {
> >  struct panfrost_screen *screen = rzalloc(NULL, struct 
> > panfrost_screen);
> > + drmVersionPtr version;
> >
> >  pan_debug = debug_get_option_pan_debug();
> >
> > @@ -618,6 +619,17 @@ panfrost_create_screen(int fd, struct renderonly *ro)
> >  return NULL;
> >  }
> >
> > + version = drmGetVersion(fd);
> > + if (version->version_major != 1) {
> > +debug_printf("panfrost: Unsupported version: %u.%u.%u",
> > + version->version_major, 
> > version->version_minor,
> > + version->version_patchlevel);
> > + drmFreeVersion(version);
> > +return NULL;
> > +}
> > +screen->kernel_version = version->version_minor;
> > + drmFreeVersion(version);
> > +
> >  util_dynarray_init(>transient_bo, screen);
> >
>
> I don't really care *too* much but spacing is all over the place.

Will check before v2.

Thanks,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 2/5] panfrost: Allocate shaders in their own BOs

2019-08-06 Thread Tomeu Vizoso
On Mon, 5 Aug 2019 at 19:01, Alyssa Rosenzweig  wrote:
>
> > +for (unsigned c = 0; c < 4; ++c) {
> > +struct panfrost_blend_rt *rt = >rt[c];
> > +_mesa_hash_table_u64_clear(rt->shaders, 
> > panfrost_delete_blend_shader);
> > +}
>
> What's the implication  of the clear call? Does that recursively free
> the blend CSOs due to ralloc infrastructure?

struct panfrost_blend_shader is allocated here with memdup, so I was
indeed missing a free(). Thanks!

> > +memcpy(final.shader.bo->cpu, shader->bo->cpu, 
> > shader->size);
>
> I'm not totally comfortable with reading off CPU-writeable GPU-mapped
> memory. We do it for scoreboarding too (which is probably a bug). But as
> discussed, this may have performance and/or security implications that
> we don't really understand. Maybe we might be better off having a purely
> CPU copy of shaders we'll need to patch?

Hmm, guess would be better to play safe in this case.

> > +entry->flags == flags) {
>
> This is definitely necessary, +1
>
> I'm wondering if we should be optimizing this somehow but we can sail
> that boat when we get there, I guess.

Yep.

> > @@ -2035,6 +2041,7 @@ panfrost_bind_shader_state(
> >  enum pipe_shader_type type)
> >  {
> >  struct panfrost_context *ctx = pan_context(pctx);
> > +struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
> >
> >  ctx->shader[type] = hwcso;
> >
> > @@ -2098,6 +2105,8 @@ panfrost_bind_shader_state(
> >
> >  shader_state->compiled = true;
> >  }
> > +
> > +panfrost_job_add_bo(job, shader_state->bo);
>
> This doesn't strike me as quite right. Conceptually, a shader state
> could be bound on one frame and then just reused for 2000 frames in a
> row, no? I guess that's not something you'll hit in CTS / normal apps,
> but it still strikes me as something we need to pay attention to.
>
> I think we want the add_bo() call to be part of emit_for_draw().

Makes sense.

> > +/* To maximize BO cache usage, don't allocate tiny BOs */
> > +size = MAX2(size, 4096);
>
> FWIW I think we round up to 4k anyway elsewhere?

I think that happens only when going though panfrost_drm_allocate_slab.

> Also, how does this
> interact with shaders -- if you have a bunch of tiny shaders of 128
> bytes each, you'll be wasting 3968 bytes per shader, no? At least the
> old strategy  (with the 16MB slab) allowed subdivision with byte
> granularity.

Yeah, there's the wastage you describe, but we are currently wasting
several megs so it's a vast improvement in this regard.

For more fine-grained performance and memory usage improvements, I
think we should track these kind of regressions in CI, or we'll
struggle to consistently improve.

Thanks,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/5] util/hash_table: Don't hash the deleted and freed keys

2019-08-06 Thread Tomeu Vizoso
On Mon, 5 Aug 2019 at 19:01, Alyssa Rosenzweig  wrote:
>
> What's the implication of this for Panfrost? (I.e. which patch/es in the
> series are pending on this change)

Patch 2 needs this, otherwise we SIGSEGV on context destruction if
blend shaders are used. And patch 3 depends on patch 5, otherwise the
GPU would try to execute a shader in a memory region marked as not
executable.

Will be sending a v2 with Caio's suggestion.

Cheers,

Tomeu




> On Mon, Aug 05, 2019 at 05:18:32PM +0200, Tomeu Vizoso wrote:
> > Some hash functions (eg. key_u64_hash) will attempt to dereference the
> > key, causing an invalid access when passed DELETED_KEY_VALUE (0x1) or
> > FREED_KEY_VALUE (0x0).
> >
> > The entry.hash field isn't needed by the delete_function, so just stop
> > populating it.
> >
> > Signed-off-by: Tomeu Vizoso 
> > Cc: Samuel Pitoiset 
> > Cc: Nicolai Hähnle 
> > ---
> >  src/util/hash_table.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/src/util/hash_table.c b/src/util/hash_table.c
> > index f58575de558f..e691f8baa9c1 100644
> > --- a/src/util/hash_table.c
> > +++ b/src/util/hash_table.c
> > @@ -667,7 +667,6 @@ _mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
> >   struct hash_entry entry;
> >
> >   /* Create a fake entry for the delete function. */
> > - entry.hash = table->key_hash_function(table->deleted_key);
> >   entry.key = table->deleted_key;
> >   entry.data = ht->deleted_key_data;
> >
> > @@ -682,7 +681,6 @@ _mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
> >   struct hash_entry entry;
> >
> >   /* Create a fake entry for the delete function. */
> > - entry.hash = table->key_hash_function(uint_key(FREED_KEY_VALUE));
> >   entry.key = uint_key(FREED_KEY_VALUE);
> >   entry.data = ht->freed_key_data;
> >
> > --
> > 2.20.1
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 5/5] panfrost: Print errors from kernel

2019-08-05 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_drm.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 122bc5f3db36..46cceb808919 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -49,14 +49,14 @@ panfrost_drm_mmap_bo(struct panfrost_screen *screen, struct 
panfrost_bo *bo)
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_MMAP_BO, _bo);
 if (ret) {
-fprintf(stderr, "DRM_IOCTL_PANFROST_MMAP_BO failed: %d\n", 
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\n", bo->cpu);
+fprintf(stderr, "mmap failed: %p %m\n", bo->cpu);
 assert(0);
 }
 
@@ -121,7 +121,7 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_CREATE_BO, 
_bo);
 if (ret) {
-fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: 
%d\n", ret);
+fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: 
%m\n");
 assert(0);
 }
 
@@ -175,7 +175,7 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
struct panfrost_bo *bo,
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, _close);
 if (ret) {
-fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %d\n", ret);
+fprintf(stderr, "DRM_IOCTL_GEM_CLOSE failed: %m\n");
 assert(0);
 }
 
@@ -331,7 +331,7 @@ panfrost_fence_create(struct panfrost_context *ctx)
  */
 drmSyncobjExportSyncFile(screen->fd, ctx->out_sync, >fd);
 if (f->fd == -1) {
-fprintf(stderr, "export failed\n");
+fprintf(stderr, "export failed: %m\n");
 free(f);
 return NULL;
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/5] panfrost: Allocate shaders in their own BOs

2019-08-05 Thread Tomeu Vizoso
Instead of all shaders being stored in a single BO, have each shader in
its own.

This removes the need for a 16MB allocation per context, and allows us
to place transient blend shaders in BOs marked as executable (before
they were allocated in the transient pool, which shouldn't be
executable).

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_allocate.h   |  2 +
 src/gallium/drivers/panfrost/pan_assemble.c   |  5 ++-
 src/gallium/drivers/panfrost/pan_blend.h  | 11 --
 src/gallium/drivers/panfrost/pan_blend_cso.c  | 39 ++-
 .../drivers/panfrost/pan_blend_shaders.c  |  7 +++-
 src/gallium/drivers/panfrost/pan_bo_cache.c   |  5 +--
 src/gallium/drivers/panfrost/pan_context.c| 15 +--
 src/gallium/drivers/panfrost/pan_context.h|  3 +-
 src/gallium/drivers/panfrost/pan_drm.c|  5 ++-
 9 files changed, 68 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_allocate.h 
b/src/gallium/drivers/panfrost/pan_allocate.h
index 8d925ee38a4c..0e06567d2069 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.h
+++ b/src/gallium/drivers/panfrost/pan_allocate.h
@@ -59,6 +59,8 @@ struct panfrost_bo {
 size_t size;
 
 int gem_handle;
+
+uint32_t flags;
 };
 
 struct panfrost_memory {
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c 
b/src/gallium/drivers/panfrost/pan_assemble.c
index 15f77585a25c..dd877056d3b5 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -43,6 +43,7 @@ panfrost_shader_compile(
 gl_shader_stage stage,
 struct panfrost_shader_state *state)
 {
+struct panfrost_screen *screen = pan_screen(ctx->base.screen);
 uint8_t *dst;
 
 nir_shader *s;
@@ -80,7 +81,9 @@ panfrost_shader_compile(
  * I bet someone just thought that would be a cute pun. At least,
  * that's how I'd do it. */
 
-meta->shader = panfrost_upload(>shaders, dst, size) | 
program.first_tag;
+state->bo = panfrost_drm_create_bo(screen, size, PAN_ALLOCATE_EXECUTE);
+memcpy(state->bo->cpu, dst, size);
+meta->shader = state->bo->gpu | program.first_tag;
 
 util_dynarray_fini();
 
diff --git a/src/gallium/drivers/panfrost/pan_blend.h 
b/src/gallium/drivers/panfrost/pan_blend.h
index a881e0945f48..1269a9b0aa08 100644
--- a/src/gallium/drivers/panfrost/pan_blend.h
+++ b/src/gallium/drivers/panfrost/pan_blend.h
@@ -33,8 +33,10 @@
 /* An internal blend shader descriptor, from the compiler */
 
 struct panfrost_blend_shader {
+struct panfrost_context *ctx;
+
 /* The compiled shader in GPU memory */
-struct panfrost_transfer shader;
+struct panfrost_bo *bo;
 
 /* Byte count of the shader */
 unsigned size;
@@ -53,8 +55,11 @@ struct panfrost_blend_shader {
 /* A blend shader descriptor ready for actual use */
 
 struct panfrost_blend_shader_final {
-/* The upload, possibly to transient memory */
-mali_ptr gpu;
+/* The compiled shader in GPU memory, possibly patched */
+struct panfrost_bo *bo;
+
+/* First instruction tag (for tagging the pointer) */
+unsigned first_tag;
 
 /* Same meaning as panfrost_blend_shader */
 unsigned work_count;
diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c 
b/src/gallium/drivers/panfrost/pan_blend_cso.c
index f685b25b41b3..92b94326b346 100644
--- a/src/gallium/drivers/panfrost/pan_blend_cso.c
+++ b/src/gallium/drivers/panfrost/pan_blend_cso.c
@@ -151,11 +151,23 @@ panfrost_bind_blend_state(struct pipe_context *pipe,
 ctx->dirty |= PAN_DIRTY_FS;
 }
 
+static void
+panfrost_delete_blend_shader(struct hash_entry *entry)
+{
+struct panfrost_blend_shader *shader = (struct panfrost_blend_shader 
*)entry->data;
+panfrost_bo_unreference(shader->ctx->base.screen, shader->bo);
+}
+
 static void
 panfrost_delete_blend_state(struct pipe_context *pipe,
-void *blend)
+void *cso)
 {
-/* TODO: Free shader binary? */
+struct panfrost_blend_state *blend = (struct panfrost_blend_state *) 
cso;
+
+for (unsigned c = 0; c < 4; ++c) {
+struct panfrost_blend_rt *rt = >rt[c];
+_mesa_hash_table_u64_clear(rt->shaders, 
panfrost_delete_blend_shader);
+}
 ralloc_free(blend);
 }
 
@@ -208,6 +220,9 @@ panfrost_blend_constant(float *out, float *in, unsigned 
mask)
 struct panfrost_blend_final
 panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti)
 {
+struct panfrost_screen *screen = pan_screen(ctx->base.screen);
+struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
+
 /* Grab the format, falling back gracefully if called invalidly (which
  * has to happen for no-color-attachment FBOs, for in

[Mesa-dev] [PATCH 3/5] panfrost: Mark BOs as NOEXEC

2019-08-05 Thread Tomeu Vizoso
Unless a BO has the EXECUTABLE flag, mark it as NOEXEC.

Signed-off-by: Tomeu Vizoso 
---
 include/drm-uapi/panfrost_drm.h   | 27 +++
 src/gallium/drivers/panfrost/pan_drm.c|  7 +-
 src/gallium/drivers/panfrost/pan_screen.c | 12 ++
 src/gallium/drivers/panfrost/pan_screen.h |  4 
 4 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/include/drm-uapi/panfrost_drm.h b/include/drm-uapi/panfrost_drm.h
index a52e0283b90d..9150dd75aad8 100644
--- a/include/drm-uapi/panfrost_drm.h
+++ b/include/drm-uapi/panfrost_drm.h
@@ -18,6 +18,8 @@ extern "C" {
 #define DRM_PANFROST_MMAP_BO   0x03
 #define DRM_PANFROST_GET_PARAM 0x04
 #define DRM_PANFROST_GET_BO_OFFSET 0x05
+#define DRM_PANFROST_PERFCNT_ENABLE0x06
+#define DRM_PANFROST_PERFCNT_DUMP  0x07
 
 #define DRM_IOCTL_PANFROST_SUBMIT  DRM_IOW(DRM_COMMAND_BASE + 
DRM_PANFROST_SUBMIT, struct drm_panfrost_submit)
 #define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOW(DRM_COMMAND_BASE + 
DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo)
@@ -26,6 +28,15 @@ extern "C" {
 #define DRM_IOCTL_PANFROST_GET_PARAM   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param)
 #define DRM_IOCTL_PANFROST_GET_BO_OFFSET   DRM_IOWR(DRM_COMMAND_BASE + 
DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
 
+/*
+ * Unstable ioctl(s): only exposed when the unsafe unstable_ioctls module
+ * param is set to true.
+ * All these ioctl(s) are subject to deprecation, so please don't rely on
+ * them for anything but debugging purpose.
+ */
+#define DRM_IOCTL_PANFROST_PERFCNT_ENABLE  DRM_IOW(DRM_COMMAND_BASE + 
DRM_PANFROST_PERFCNT_ENABLE, struct drm_panfrost_perfcnt_enable)
+#define DRM_IOCTL_PANFROST_PERFCNT_DUMP
DRM_IOW(DRM_COMMAND_BASE + DRM_PANFROST_PERFCNT_DUMP, struct 
drm_panfrost_perfcnt_dump)
+
 #define PANFROST_JD_REQ_FS (1 << 0)
 /**
  * struct drm_panfrost_submit - ioctl argument for submitting commands to the 
3D
@@ -71,6 +82,9 @@ struct drm_panfrost_wait_bo {
__s64 timeout_ns;   /* absolute */
 };
 
+#define PANFROST_BO_NOEXEC 1
+#define PANFROST_BO_HEAP   2
+
 /**
  * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs.
  *
@@ -135,6 +149,19 @@ struct drm_panfrost_get_bo_offset {
__u64 offset;
 };
 
+struct drm_panfrost_perfcnt_enable {
+   __u32 enable;
+   /*
+* On bifrost we have 2 sets of counters, this parameter defines the
+* one to track.
+*/
+   __u32 counterset;
+};
+
+struct drm_panfrost_perfcnt_dump {
+   __u64 buf_ptr;
+};
+
 #if defined(__cplusplus)
 }
 #endif
diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 8ae541ae11b6..a3f35aed4d0f 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -93,7 +93,12 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 
 unsigned translated_flags = 0;
 
-/* TODO: translate flags to kernel flags, if the kernel supports */
+if (screen->kernel_version >= 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,
diff --git a/src/gallium/drivers/panfrost/pan_screen.c 
b/src/gallium/drivers/panfrost/pan_screen.c
index 5b51faa7f566..e5fc321a8802 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -584,6 +584,7 @@ struct pipe_screen *
 panfrost_create_screen(int fd, struct renderonly *ro)
 {
 struct panfrost_screen *screen = rzalloc(NULL, struct panfrost_screen);
+   drmVersionPtr version;
 
 pan_debug = debug_get_option_pan_debug();
 
@@ -618,6 +619,17 @@ panfrost_create_screen(int fd, struct renderonly *ro)
 return NULL;
 }
 
+   version = drmGetVersion(fd);
+   if (version->version_major != 1) {
+debug_printf("panfrost: Unsupported version: %u.%u.%u",
+ version->version_major, version->version_minor,
+ version->version_patchlevel);
+   drmFreeVersion(version);
+return NULL;
+}
+screen->kernel_version = version->version_minor;
+   drmFreeVersion(version);
+
 util_dynarray_init(>transient_bo, screen);
 
 for (unsigned i = 0; i < ARRAY_SIZE(screen->bo_cache); ++i)
diff --git a/src/gallium/drivers/panfrost/pan_screen.h 
b/src/gallium/drivers/panfrost/pan_screen.h
index 22cd7dcc9fea..0b355ed8fc53 100644
--- a/src/gallium/

[Mesa-dev] [PATCH 4/5] panfrost: Mark buffers as PANFROST_BO_HEAP

2019-08-05 Thread Tomeu Vizoso
What we call GROWABLE in Mesa corresponds to the HEAP BO flag in the
kernel. These buffers cannot be memory mapped in the CPU side at the
moment, so make sure they are also marked INVISIBLE.

This allows us to allocate a big heap upfront (16MB) without actually
reserving space unless it's needed.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_drm.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index a3f35aed4d0f..122bc5f3db36 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -91,11 +91,15 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 /* 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 >= 1) {
-//if (flags & PAN_ALLOCATE_GROWABLE)
-//translated_flags |= PANFROST_BO_HEAP;
+if (flags & PAN_ALLOCATE_GROWABLE)
+translated_flags |= PANFROST_BO_HEAP;
 if (!(flags & PAN_ALLOCATE_EXECUTE))
 translated_flags |= PANFROST_BO_NOEXEC;
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/5] util/hash_table: Don't hash the deleted and freed keys

2019-08-05 Thread Tomeu Vizoso
Some hash functions (eg. key_u64_hash) will attempt to dereference the
key, causing an invalid access when passed DELETED_KEY_VALUE (0x1) or
FREED_KEY_VALUE (0x0).

The entry.hash field isn't needed by the delete_function, so just stop
populating it.

Signed-off-by: Tomeu Vizoso 
Cc: Samuel Pitoiset 
Cc: Nicolai Hähnle 
---
 src/util/hash_table.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index f58575de558f..e691f8baa9c1 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -667,7 +667,6 @@ _mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
  struct hash_entry entry;
 
  /* Create a fake entry for the delete function. */
- entry.hash = table->key_hash_function(table->deleted_key);
  entry.key = table->deleted_key;
  entry.data = ht->deleted_key_data;
 
@@ -682,7 +681,6 @@ _mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
  struct hash_entry entry;
 
  /* Create a fake entry for the delete function. */
- entry.hash = table->key_hash_function(uint_key(FREED_KEY_VALUE));
  entry.key = uint_key(FREED_KEY_VALUE);
  entry.data = ht->freed_key_data;
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost/ci: Update kernel to 5.2

2019-07-25 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/debian-install.sh | 4 ++--
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index beff1027fd92..c42c4387729a 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -103,12 +103,12 @@ rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
 
 
 ### Cross-build kernel
-KERNEL_URL="https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+archive/refs/tags/v5.2-rc2.tar.gz;
+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 -C /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
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 3c015678a755..a135c5dd57c2 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-06-26-3"
+  IMAGE_TAG: "2019-07-25-1"
 
 include:
   - project: 'wayland/ci-templates'
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost/midgard: Use _safe iterator

2019-07-11 Thread Tomeu Vizoso
Fixes this assertion:

../mesa/src/panfrost/midgard/midgard_schedule.c:507:schedule_block: Assertion 
`ins == __next && "use _safe iterator"' failed.
Trace/breakpoint trap

Signed-off-by: Tomeu Vizoso 
---
 src/panfrost/midgard/midgard_schedule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_schedule.c 
b/src/panfrost/midgard/midgard_schedule.c
index 7a3841e4d44d..3e78020f6d68 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -504,7 +504,7 @@ schedule_block(compiler_context *ctx, midgard_block *block)
 
 block->quadword_count = 0;
 
-mir_foreach_instr_in_block(block, ins) {
+mir_foreach_instr_in_block_safe(block, ins) {
 int skip;
 midgard_bundle bundle = schedule_bundle(ctx, block, ins, 
);
 util_dynarray_append(>bundles, midgard_bundle, bundle);
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH v2] panfrost: Place the height value in the height field

2019-07-11 Thread Tomeu Vizoso
In the mali_single_framebuffer descriptor.

Signed-off-by: Tomeu Vizoso 

v2: Remove unwanted chunks
---
 src/gallium/drivers/panfrost/pan_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index cb55dc66e799..b3545e1748a7 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -141,7 +141,7 @@ panfrost_emit_sfbd(struct panfrost_context *ctx, unsigned 
vertex_count)
 
 struct mali_single_framebuffer framebuffer = {
 .width = MALI_POSITIVE(width),
-.height = MALI_POSITIVE(width),
+.height = MALI_POSITIVE(height),
 .unknown2 = 0x1f,
 .format = 0x3000,
 .clear_flags = 0x1000,
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: Place the height value in the height field

2019-07-11 Thread Tomeu Vizoso
In the mali_single_framebuffer descriptor.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.c | 12 
 src/gallium/drivers/panfrost/pan_tiler.c   | 12 
 src/gallium/drivers/panfrost/pan_tiler.h   |  6 --
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index cb55dc66e799..9a378ccbfc03 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -102,7 +102,7 @@ panfrost_emit_midg_tiler(
 
 unsigned total_size = header_size + body_size;
 
-if (t.hierarchy_mask) {
+if (t.hierarchy_mask != PAN_TILER_HIERARCHY_MASK_DISABLED) {
 assert(ctx->tiler_polygon_list.bo->size >= total_size);
 
 /* Specify allocated tiler structures */
@@ -113,6 +113,8 @@ panfrost_emit_midg_tiler(
 t.heap_end =
 ctx->tiler_heap.bo->gpu + ctx->tiler_heap.bo->size;
 } else {
+assert(ctx->tiler_dummy.bo->size >= total_size);
+
 /* The tiler is disabled, so don't allow the tiler heap */
 t.heap_start = ctx->tiler_heap.bo->gpu;
 t.heap_end = t.heap_start;
@@ -120,8 +122,10 @@ panfrost_emit_midg_tiler(
 /* Use a dummy polygon list */
 t.polygon_list = ctx->tiler_dummy.bo->gpu;
 
-/* Also, set a "tiler disabled?" flag? */
-t.hierarchy_mask |= 0x1000;
+/* We don't have a SET_VALUE job, so write the polygon list 
manually */
+uint32_t *polygon_list_body = (uint32_t *)
+(ctx->tiler_dummy.bo->cpu + header_size);
+polygon_list_body[0] = 0xa000; /* TODO: Just that? */
 }
 
 t.polygon_list_body =
@@ -141,7 +145,7 @@ panfrost_emit_sfbd(struct panfrost_context *ctx, unsigned 
vertex_count)
 
 struct mali_single_framebuffer framebuffer = {
 .width = MALI_POSITIVE(width),
-.height = MALI_POSITIVE(width),
+.height = MALI_POSITIVE(height),
 .unknown2 = 0x1f,
 .format = 0x3000,
 .clear_flags = 0x1000,
diff --git a/src/gallium/drivers/panfrost/pan_tiler.c 
b/src/gallium/drivers/panfrost/pan_tiler.c
index fc0de7d8842d..a1a1f8475ad7 100644
--- a/src/gallium/drivers/panfrost/pan_tiler.c
+++ b/src/gallium/drivers/panfrost/pan_tiler.c
@@ -229,12 +229,12 @@ panfrost_raw_header_size(unsigned width, unsigned height, 
unsigned masked_count)
 /* Given a hierarchy mask and a framebuffer size, compute the header size */
 
 unsigned
-panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask)
+panfrost_tiler_header_size(unsigned width, unsigned height, unsigned 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)
+if (mask == PAN_TILER_HIERARCHY_MASK_DISABLED)
 return MINIMUM_HEADER_SIZE;
 
 /* Some levels are enabled. Ensure that only smaller levels are
@@ -262,9 +262,13 @@ panfrost_tiler_header_size(unsigned width, unsigned 
height, uint8_t mask)
  * out how to actually implement this. */
 
 unsigned
-panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask)
+panfrost_tiler_body_size(unsigned width, unsigned height, unsigned mask)
 {
 unsigned header_size = panfrost_tiler_header_size(width, height, mask);
+
+if (mask == PAN_TILER_HIERARCHY_MASK_DISABLED)
+return 0;
+
 return ALIGN_POT(header_size * 512 / 8, 512);
 }
 
@@ -283,7 +287,7 @@ panfrost_choose_hierarchy_mask(
 /* If there is no geometry, we don't bother enabling anything */
 
 if (!vertex_count)
-return 0x00;
+return PAN_TILER_HIERARCHY_MASK_DISABLED;
 
 /* Otherwise, default everything on. TODO: Proper tests */
 
diff --git a/src/gallium/drivers/panfrost/pan_tiler.h 
b/src/gallium/drivers/panfrost/pan_tiler.h
index 8d7f6f29de0b..153829dd299a 100644
--- a/src/gallium/drivers/panfrost/pan_tiler.h
+++ b/src/gallium/drivers/panfrost/pan_tiler.h
@@ -28,11 +28,13 @@
 #ifndef __PAN_TILER_H__
 #define __PAN_TILER_H__
 
+#define PAN_TILER_HIERARCHY_MASK_DISABLED 0xFFF
+
 unsigned
-panfrost_tiler_header_size(unsigned width, unsigned height, uint8_t mask);
+panfrost_tiler_header_size(unsigned width, unsigned height, unsigned mask);
 
 unsigned
-panfrost_tiler_body_size(unsigned width, unsigned height, uint8_t mask);
+panfrost_tiler_body_size(unsigned width, unsigned height, unsigned mask);
 
 unsigned
 panfrost_choose_hierarchy_mask(
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedeskt

Re: [Mesa-dev] [PATCH 08/11] panfrost: Be more honest about PIPE_CAPs

2019-07-10 Thread Tomeu Vizoso

Patches 8 to 11 look good to me:

Reviewed-by: Tomeu Vizoso 

Thanks,

Tomeu

On 7/10/19 3:24 PM, Alyssa Rosenzweig wrote:

A lot of the pan_screen.c code was cargoculted from other drivers. The
upshot is that we return true for a lot of PIPE_CAPs that we don't
actually support, resulting in us exposing way too many extensions that
we don't actually support. Be more careful.

Some CAPs we do need to fake to access higher dEQP versions (i.e. in
order to debug the features we're hiding behind the CAP). For these, we
hide the CAP behind a special PAN_MESA_DEBUG=deqp option to avoid
apps randomly using these in-development features.

Signed-off-by: Alyssa Rosenzweig 
---
  src/gallium/drivers/panfrost/pan_screen.c | 139 ++
  src/gallium/drivers/panfrost/pan_util.h   |   1 +
  2 files changed, 39 insertions(+), 101 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_screen.c 
b/src/gallium/drivers/panfrost/pan_screen.c
index b044ae99399..6590359a53f 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -57,6 +57,8 @@
  static const struct debug_named_value debug_options[] = {
{"msgs",  PAN_DBG_MSGS,   "Print debug messages"},
{"trace", PAN_DBG_TRACE,"Trace the command stream"},
+{"deqp",  PAN_DBG_DEQP, "Hacks for dEQP"},
+/* ^^ If Rob can do it, so can I */
DEBUG_NAMED_VALUE_END
  };
  
@@ -85,36 +87,56 @@ panfrost_get_device_vendor(struct pipe_screen *screen)

  static int
  panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
  {
+/* We expose in-dev stuff for dEQP that we don't want apps to use yet 
*/
+bool is_deqp = pan_debug & PAN_DBG_DEQP;
+
  switch (param) {
  case PIPE_CAP_NPOT_TEXTURES:
  case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
  case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
-return 1;
-
  case PIPE_CAP_SM3:
  case PIPE_CAP_POINT_SPRITE:
  return 1;
  
  case PIPE_CAP_MAX_RENDER_TARGETS:

-case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
  return 1;
  
  case PIPE_CAP_OCCLUSION_QUERY:

+return 1;
  case PIPE_CAP_QUERY_TIME_ELAPSED:
  case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
-return 1; /* TODO: Queries */
+case PIPE_CAP_QUERY_TIMESTAMP:
+case PIPE_CAP_QUERY_SO_OVERFLOW:
+return 0;
  
  case PIPE_CAP_TEXTURE_MIRROR_CLAMP:

  case PIPE_CAP_TEXTURE_SWIZZLE:
  return 1;
  
-/* TODO: ES3. We expose these caps so we can access higher dEQP

- * tests; in actuality they are nonfunctional */
-case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
-return 4;
  case PIPE_CAP_TGSI_INSTANCEID:
  case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
-return 1;
+return is_deqp ? 1 : 0;
+
+case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
+return is_deqp ? 4 : 0;
+case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
+case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
+return is_deqp ? 64 : 0;
+
+case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
+return is_deqp ? 256 : 0; /* for GL3 */
+
+case PIPE_CAP_GLSL_FEATURE_LEVEL:
+case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
+return is_deqp ? 140 : 120;
+case PIPE_CAP_ESSL_FEATURE_LEVEL:
+return is_deqp ? 300 : 120;
+
+case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
+return is_deqp ? 16 : 0;
+
+case PIPE_CAP_CUBE_MAP_ARRAY:
+return is_deqp;
  
  /* TODO: Where does this req come from in practice? */

  case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
@@ -127,11 +149,7 @@ panfrost_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
  return 13;
  
  case PIPE_CAP_BLEND_EQUATION_SEPARATE:

-return 1;
-
  case PIPE_CAP_INDEP_BLEND_ENABLE:
-return 1;
-
  case PIPE_CAP_INDEP_BLEND_FUNC:
  return 1;
  
@@ -140,116 +158,49 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)

  return 0;
  
  case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:

-return 1;
  case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
  case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
-return 1;
-
  case PIPE_CAP_GENERATE_MIPMAP:
  return 1;
  
-case PIPE_CAP_DEPTH_CLIP_DISABLE:

-return 1;
-
-case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
-case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
-return 16 * 4;
-
- 

[Mesa-dev] [PATCH v2] panfrost: Remove panfrost_context.depth_stencil_buffer

2019-07-10 Thread Tomeu Vizoso
This was stale code that was causing a SIGSEGV when using SFBD, as we
stopped creating the corresponding BO.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.h | 1 -
 src/gallium/drivers/panfrost/pan_sfbd.c| 8 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.h 
b/src/gallium/drivers/panfrost/pan_context.h
index a913c8581ef5..b26abea369d3 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -134,7 +134,6 @@ struct panfrost_context {
 struct panfrost_memory varying_mem;
 struct panfrost_memory tiler_polygon_list;
 struct panfrost_memory tiler_dummy;
-struct panfrost_memory depth_stencil_buffer;
 
 struct panfrost_query *occlusion_query;
 
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c 
b/src/gallium/drivers/panfrost/pan_sfbd.c
index 76267b746ac0..b8c314d222f0 100644
--- a/src/gallium/drivers/panfrost/pan_sfbd.c
+++ b/src/gallium/drivers/panfrost/pan_sfbd.c
@@ -55,14 +55,18 @@ panfrost_sfbd_clear(
 sfbd->clear_depth_3 = job->clear_depth;
 sfbd->clear_depth_4 = job->clear_depth;
 
-sfbd->depth_buffer = ctx->depth_stencil_buffer.bo->gpu;
+struct pipe_surface *surf = ctx->pipe_framebuffer.zsbuf;
+struct panfrost_resource *rsrc = pan_resource(surf->texture);
+sfbd->depth_buffer = rsrc->bo->gpu;
 sfbd->depth_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
 }
 
 if (job->clear & PIPE_CLEAR_STENCIL) {
 sfbd->clear_stencil = job->clear_stencil;
 
-sfbd->stencil_buffer = ctx->depth_stencil_buffer.bo->gpu;
+struct pipe_surface *surf = ctx->pipe_framebuffer.zsbuf;
+struct panfrost_resource *rsrc = pan_resource(surf->texture);
+sfbd->stencil_buffer = rsrc->bo->gpu;
 sfbd->stencil_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
 }
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: Remove panfrost_context.depth_stencil_buffer

2019-07-10 Thread Tomeu Vizoso
This was stale code that was causing a SIGSEGV when using SFBD, as we
stopped creating the corresponding BO.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.h | 1 -
 src/gallium/drivers/panfrost/pan_sfbd.c| 6 --
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.h 
b/src/gallium/drivers/panfrost/pan_context.h
index a913c8581ef5..b26abea369d3 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -134,7 +134,6 @@ struct panfrost_context {
 struct panfrost_memory varying_mem;
 struct panfrost_memory tiler_polygon_list;
 struct panfrost_memory tiler_dummy;
-struct panfrost_memory depth_stencil_buffer;
 
 struct panfrost_query *occlusion_query;
 
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c 
b/src/gallium/drivers/panfrost/pan_sfbd.c
index 76267b746ac0..2cb3817d4bb3 100644
--- a/src/gallium/drivers/panfrost/pan_sfbd.c
+++ b/src/gallium/drivers/panfrost/pan_sfbd.c
@@ -41,6 +41,8 @@ panfrost_sfbd_clear(
 struct mali_single_framebuffer *sfbd)
 {
 struct panfrost_context *ctx = job->ctx;
+struct pipe_surface *zs_surf = ctx->pipe_framebuffer.zsbuf;
+struct panfrost_resource *zs_rsrc = pan_resource(zs_surf->texture);
 
 if (job->clear & PIPE_CLEAR_COLOR) {
 sfbd->clear_color_1 = job->clear_color;
@@ -55,14 +57,14 @@ panfrost_sfbd_clear(
 sfbd->clear_depth_3 = job->clear_depth;
 sfbd->clear_depth_4 = job->clear_depth;
 
-sfbd->depth_buffer = ctx->depth_stencil_buffer.bo->gpu;
+sfbd->depth_buffer = zs_rsrc->bo->gpu;
 sfbd->depth_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
 }
 
 if (job->clear & PIPE_CLEAR_STENCIL) {
 sfbd->clear_stencil = job->clear_stencil;
 
-sfbd->stencil_buffer = ctx->depth_stencil_buffer.bo->gpu;
+sfbd->stencil_buffer = zs_rsrc->bo->gpu;
 sfbd->stencil_buffer_enable = MALI_DEPTH_STENCIL_ENABLE;
 }
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 3/3] panfrost: Add support for modifiers

2019-07-04 Thread Tomeu Vizoso
On Thu, 4 Jul 2019 at 10:05, Tomeu Vizoso  wrote:
>
> Implement query_dmabuf_modifiers and resource_create_with_modifiers so
> Wayland clients can share AFBC buffers with the compositor.
>
> For now this is guarded behind the PAN_MESA_DEBUG=modifiers env var
> because implementing those callbacks causes Weston to try to pass
> modifiers to the Rockchip KMS driver, which currently doesn't support
> modifiers, thus failing the modeset.
>
> This has been fixed in Weston 6.0, so we can enable unconditionally once
> we are confident that most people testing panfrost have upgraded.
>
> This lays the ground for scanning out AFBC buffers, if the KMS driver
> supports it.
>
> Signed-off-by: Tomeu Vizoso 
> ---
>  src/gallium/drivers/panfrost/pan_drm.c  |  1 +
>  src/gallium/drivers/panfrost/pan_resource.c | 74 ++---
>  src/gallium/drivers/panfrost/pan_screen.c   | 37 +++
>  src/gallium/drivers/panfrost/pan_util.h |  7 ++
>  4 files changed, 108 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
> b/src/gallium/drivers/panfrost/pan_drm.c
> index 9648ac1d452d..623793a84411 100644
> --- a/src/gallium/drivers/panfrost/pan_drm.c
> +++ b/src/gallium/drivers/panfrost/pan_drm.c
> @@ -26,6 +26,7 @@
>  #include 
>  #include 
>
> +#include "drm-uapi/drm_fourcc.h"
>  #include "drm-uapi/panfrost_drm.h"
>
>  #include "util/u_memory.h"
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
> b/src/gallium/drivers/panfrost/pan_resource.c
> index 54497d3de2bb..d901d43168fb 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -34,6 +34,7 @@
>  #include "drm-uapi/drm_fourcc.h"
>
>  #include "state_tracker/winsys_handle.h"
> +#include "util/u_drm.h"
>  #include "util/u_format.h"
>  #include "util/u_memory.h"
>  #include "util/u_surface.h"
> @@ -91,6 +92,18 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
>
> rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
>
> +   switch(whandle->modifier) {
> +   case DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_ROCKCHIP):
> +   rsc->layout = PAN_AFBC;
> +   break;
> +   case DRM_FORMAT_MOD_LINEAR:
> +   rsc->layout = PAN_LINEAR;
> +   break;
> +   default:
> +fprintf(stderr, "unknown modifier: 0x%"PRIx64"\n", 
> whandle->modifier);
> +   assert(0);
> +   }
> +
>  size_t bo_size;
>  panfrost_setup_slices(rsc, _size);
>  assert(bo_size == rsc->bo->size);
> @@ -106,6 +119,21 @@ panfrost_resource_from_handle(struct pipe_screen 
> *pscreen,
>  return prsc;
>  }
>
> +static uint64_t
> +panfrost_resource_modifier(struct panfrost_resource *rsrc)
> +{
> +switch (rsrc->layout) {
> +case PAN_AFBC:
> +return DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_ROCKCHIP);
> +case PAN_TILED:
> +return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
> +case PAN_LINEAR:
> +return DRM_FORMAT_MOD_LINEAR;
> +default:
> +return DRM_FORMAT_MOD_INVALID;
> +}
> +}
> +
>  static boolean
>  panfrost_resource_get_handle(struct pipe_screen *pscreen,
>   struct pipe_context *ctx,
> @@ -117,7 +145,7 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
>  struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
>  struct renderonly_scanout *scanout = rsrc->scanout;
>
> -handle->modifier = DRM_FORMAT_MOD_INVALID;
> +handle->modifier = panfrost_resource_modifier(rsrc);
>
> if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
> return FALSE;
> @@ -341,7 +369,9 @@ panfrost_setup_slices(struct panfrost_resource *pres, 
> size_t *bo_size)
>  }
>
>  static void
> -panfrost_resource_create_bo(struct panfrost_screen *screen, struct 
> panfrost_resource *pres)
> +panfrost_resource_create_bo(struct panfrost_screen *screen,
> +struct panfrost_resource *pres,
> +const uint64_t *modifiers, int count)
>  {
> struct pipe_resource *res = >base;
>
> @@ -362,14 +392,19 @@ panfrost_resource_create_bo(struct panfrost_screen 
> *screen, struct panfrost_reso
>
>  /* Tiling textures is almost always faster, unless we only use it 
> once */
>
> +bool can_afbc = panfrost_format_supports_

[Mesa-dev] [PATCH 3/3] panfrost: Add support for modifiers

2019-07-04 Thread Tomeu Vizoso
Implement query_dmabuf_modifiers and resource_create_with_modifiers so
Wayland clients can share AFBC buffers with the compositor.

For now this is guarded behind the PAN_MESA_DEBUG=modifiers env var
because implementing those callbacks causes Weston to try to pass
modifiers to the Rockchip KMS driver, which currently doesn't support
modifiers, thus failing the modeset.

This has been fixed in Weston 6.0, so we can enable unconditionally once
we are confident that most people testing panfrost have upgraded.

This lays the ground for scanning out AFBC buffers, if the KMS driver
supports it.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_drm.c  |  1 +
 src/gallium/drivers/panfrost/pan_resource.c | 74 ++---
 src/gallium/drivers/panfrost/pan_screen.c   | 37 +++
 src/gallium/drivers/panfrost/pan_util.h |  7 ++
 4 files changed, 108 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 9648ac1d452d..623793a84411 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 
+#include "drm-uapi/drm_fourcc.h"
 #include "drm-uapi/panfrost_drm.h"
 
 #include "util/u_memory.h"
diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
b/src/gallium/drivers/panfrost/pan_resource.c
index 54497d3de2bb..d901d43168fb 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -34,6 +34,7 @@
 #include "drm-uapi/drm_fourcc.h"
 
 #include "state_tracker/winsys_handle.h"
+#include "util/u_drm.h"
 #include "util/u_format.h"
 #include "util/u_memory.h"
 #include "util/u_surface.h"
@@ -91,6 +92,18 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
 
rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
 
+   switch(whandle->modifier) {
+   case DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_ROCKCHIP):
+   rsc->layout = PAN_AFBC;
+   break;
+   case DRM_FORMAT_MOD_LINEAR:
+   rsc->layout = PAN_LINEAR;
+   break;
+   default:
+fprintf(stderr, "unknown modifier: 0x%"PRIx64"\n", 
whandle->modifier);
+   assert(0);
+   }
+
 size_t bo_size;
 panfrost_setup_slices(rsc, _size);
 assert(bo_size == rsc->bo->size);
@@ -106,6 +119,21 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
 return prsc;
 }
 
+static uint64_t
+panfrost_resource_modifier(struct panfrost_resource *rsrc)
+{
+switch (rsrc->layout) {
+case PAN_AFBC:
+return DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_ROCKCHIP);
+case PAN_TILED:
+return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
+case PAN_LINEAR:
+return DRM_FORMAT_MOD_LINEAR;
+default:
+return DRM_FORMAT_MOD_INVALID;
+}
+}
+
 static boolean
 panfrost_resource_get_handle(struct pipe_screen *pscreen,
  struct pipe_context *ctx,
@@ -117,7 +145,7 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen,
 struct panfrost_resource *rsrc = (struct panfrost_resource *) pt;
 struct renderonly_scanout *scanout = rsrc->scanout;
 
-handle->modifier = DRM_FORMAT_MOD_INVALID;
+handle->modifier = panfrost_resource_modifier(rsrc);
 
if (handle->type == WINSYS_HANDLE_TYPE_SHARED) {
return FALSE;
@@ -341,7 +369,9 @@ panfrost_setup_slices(struct panfrost_resource *pres, 
size_t *bo_size)
 }
 
 static void
-panfrost_resource_create_bo(struct panfrost_screen *screen, struct 
panfrost_resource *pres)
+panfrost_resource_create_bo(struct panfrost_screen *screen,
+struct panfrost_resource *pres,
+const uint64_t *modifiers, int count)
 {
struct pipe_resource *res = >base;
 
@@ -362,14 +392,19 @@ panfrost_resource_create_bo(struct panfrost_screen 
*screen, struct panfrost_reso
 
 /* Tiling textures is almost always faster, unless we only use it once 
*/
 
+bool can_afbc = panfrost_format_supports_afbc(res->format);
+bool want_afbc = 
drm_find_modifier(DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_ROCKCHIP), modifiers, 
count);
+bool want_linear = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, 
count);
+
 #define SCANOUT (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED | 
PIPE_BIND_DISPLAY_TARGET)
 
 bool is_scanout = (res->bind & SCANOUT);
 bool is_texture = (res->bind & PIPE_BIND_SAMPLER_VIEW);
+bool is_renderable = (res->bind & PIPE_BIND_RENDER_TARGET);
 bool is_2d = res->depth0 == 1 && res->array_size == 1;
 bool is_stre

[Mesa-dev] [PATCH 1/3] panfrost: Cache BO imports

2019-07-04 Thread Tomeu Vizoso
If two jobs use the same GEM object at the same time, the job that
finishes first will (previous to this commit) close the GEM object, even
if there's a job still referencing it.

To prevent this, have all jobs use the same panfrost_bo for a given GEM
object, so it's only closed once the last job is done with it.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_allocate.h |  2 +-
 src/gallium/drivers/panfrost/pan_drm.c  | 46 +++--
 src/gallium/drivers/panfrost/pan_resource.c | 20 -
 src/gallium/drivers/panfrost/pan_screen.h   |  6 +++
 4 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_allocate.h 
b/src/gallium/drivers/panfrost/pan_allocate.h
index 20ba204dee86..2dfa913b8c4d 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.h
+++ b/src/gallium/drivers/panfrost/pan_allocate.h
@@ -59,7 +59,7 @@ struct panfrost_transfer {
 };
 
 struct panfrost_bo {
-struct pipe_reference reference;
+int refcnt;
 
 /* Mapping for the entire object (all levels) */
 uint8_t *cpu;
diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index b89f8e66a877..9648ac1d452d 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -103,7 +103,12 @@ panfrost_drm_create_bo(struct panfrost_screen *screen, 
size_t size,
 // TODO map and unmap on demand?
 panfrost_drm_mmap_bo(screen, bo);
 
-pipe_reference_init(>reference, 1);
+p_atomic_set(>refcnt, 1);
+
+pthread_mutex_lock(>handle_table_lock);
+_mesa_hash_table_insert(screen->handle_table, >gem_handle, bo);
+pthread_mutex_unlock(>handle_table_lock);
+
 return bo;
 }
 
@@ -116,6 +121,9 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
struct panfrost_bo *bo)
 if (!bo)
 return;
 
+pthread_mutex_lock(>handle_table_lock);
+_mesa_hash_table_remove_key(screen->handle_table, >gem_handle);
+
 panfrost_drm_munmap_bo(screen, bo);
 
 ret = drmIoctl(screen->fd, DRM_IOCTL_GEM_CLOSE, _close);
@@ -125,6 +133,8 @@ panfrost_drm_release_bo(struct panfrost_screen *screen, 
struct panfrost_bo *bo)
 }
 
 ralloc_free(bo);
+
+pthread_mutex_unlock(>handle_table_lock);
 }
 
 void
@@ -150,17 +160,41 @@ panfrost_drm_free_slab(struct panfrost_screen *screen, 
struct panfrost_memory *m
 mem->bo = NULL;
 }
 
+/* lookup a buffer, call w/ table_lock held: */
+static struct panfrost_bo *lookup_bo(struct hash_table *tbl, uint32_t key)
+{
+   struct panfrost_bo *bo = NULL;
+   struct hash_entry *entry = _mesa_hash_table_search(tbl, );
+   if (entry) {
+   /* found, incr refcnt and return: */
+   bo = entry->data;
+   panfrost_bo_reference(bo);
+   }
+   return bo;
+}
+
 struct panfrost_bo *
 panfrost_drm_import_bo(struct panfrost_screen *screen, int fd)
 {
-   struct panfrost_bo *bo = rzalloc(screen, struct panfrost_bo);
+   struct panfrost_bo *bo = NULL;
 struct drm_panfrost_get_bo_offset get_bo_offset = {0,};
 int ret;
 unsigned gem_handle;
 
+pthread_mutex_lock(>handle_table_lock);
+
ret = drmPrimeFDToHandle(screen->fd, fd, _handle);
assert(!ret);
 
+if (ret)
+goto out_unlock;
+
+bo = lookup_bo(screen->handle_table, gem_handle);
+if (bo)
+goto out_unlock;
+
+bo = rzalloc(screen, struct panfrost_bo);
+
get_bo_offset.handle = gem_handle;
 ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_GET_BO_OFFSET, 
_bo_offset);
 assert(!ret);
@@ -169,10 +203,16 @@ panfrost_drm_import_bo(struct panfrost_screen *screen, 
int fd)
 bo->gpu = (mali_ptr) get_bo_offset.offset;
 bo->size = lseek(fd, 0, SEEK_END);
 assert(bo->size > 0);
-pipe_reference_init(>reference, 1);
+p_atomic_set(>refcnt, 1);
 
 // TODO map and unmap on demand?
 panfrost_drm_mmap_bo(screen, bo);
+
+_mesa_hash_table_insert(screen->handle_table, >gem_handle, bo);
+
+out_unlock:
+pthread_mutex_unlock(>handle_table_lock);
+
 return bo;
 }
 
diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
b/src/gallium/drivers/panfrost/pan_resource.c
index b651fcffb111..beef26a5ded0 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -47,6 +47,18 @@
 #include "pan_util.h"
 #include "pan_tiling.h"
 
+static uint32_t
+u32_hash(const void *key)
+{
+return _mesa_hash_data(key, sizeof(uint32_t));
+}
+
+static bool
+u32_equals(const void *key1, const void *key2)
+{
+return *(const uint32_t *)key1 == *(const uint32_t *)key2;
+}
+
 static struct pipe_resource *
 panfrost_resource_

[Mesa-dev] [PATCH 2/3] panfrost: Allocate scanout BOs in panfrost device

2019-07-04 Thread Tomeu Vizoso
In preparation for using AFBC for BOs that could be scanned out (though
they are likely to be only shared with the compositor for now), use the
buffer allocation UABI of the GPU driver, as dumb buffers cannot be
allocated for AFBC.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_resource.c   | 71 +--
 .../winsys/kmsro/drm/kmsro_drm_winsys.c   |  2 +-
 2 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
b/src/gallium/drivers/panfrost/pan_resource.c
index beef26a5ded0..54497d3de2bb 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -47,6 +47,13 @@
 #include "pan_util.h"
 #include "pan_tiling.h"
 
+static void
+panfrost_setup_slices(struct panfrost_resource *pres, size_t *bo_size);
+
+static void
+panfrost_resource_destroy(struct pipe_screen *screen,
+  struct pipe_resource *pt);
+
 static uint32_t
 u32_hash(const void *key)
 {
@@ -83,8 +90,12 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
 prsc->screen = pscreen;
 
rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
-   rsc->slices[0].stride = whandle->stride;
-   rsc->slices[0].initialized = true;
+
+size_t bo_size;
+panfrost_setup_slices(rsc, _size);
+assert(bo_size == rsc->bo->size);
+for (unsigned l = 0; l <= rsc->base.last_level; ++l)
+rsc->slices[l].initialized = true;
 
if (screen->ro) {
rsc->scanout =
@@ -198,37 +209,6 @@ panfrost_surface_destroy(struct pipe_context *pipe,
 ralloc_free(surf);
 }
 
-static struct pipe_resource *
-panfrost_create_scanout_res(struct pipe_screen *screen,
-const struct pipe_resource *template)
-{
-struct panfrost_screen *pscreen = pan_screen(screen);
-struct pipe_resource scanout_templat = *template;
-struct renderonly_scanout *scanout;
-struct winsys_handle handle;
-struct pipe_resource *res;
-
-scanout = renderonly_scanout_for_resource(_templat,
-  pscreen->ro, );
-if (!scanout)
-return NULL;
-
-assert(handle.type == WINSYS_HANDLE_TYPE_FD);
-/* TODO: handle modifiers? */
-res = screen->resource_from_handle(screen, template, ,
-   
PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
-close(handle.handle);
-if (!res)
-return NULL;
-
-struct panfrost_resource *pres = pan_resource(res);
-
-pres->scanout = scanout;
-pscreen->display_target = pres;
-
-return res;
-}
-
 /* Computes sizes for checksumming, which is 8 bytes per 16x16 tile */
 
 #define CHECKSUM_TILE_WIDTH 16
@@ -382,11 +362,14 @@ panfrost_resource_create_bo(struct panfrost_screen 
*screen, struct panfrost_reso
 
 /* Tiling textures is almost always faster, unless we only use it once 
*/
 
+#define SCANOUT (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED | 
PIPE_BIND_DISPLAY_TARGET)
+
+bool is_scanout = (res->bind & SCANOUT);
 bool is_texture = (res->bind & PIPE_BIND_SAMPLER_VIEW);
 bool is_2d = res->depth0 == 1 && res->array_size == 1;
-bool is_streaming = (res->usage != PIPE_USAGE_STREAM);
+bool is_streaming = (res->usage == PIPE_USAGE_STREAM);
 
-bool should_tile = is_streaming && is_texture && is_2d;
+bool should_tile = !is_streaming && is_texture && is_2d && !is_scanout;
 
 /* Depth/stencil can't be tiled, only linear or AFBC */
 should_tile &= !(res->bind & PIPE_BIND_DEPTH_STENCIL);
@@ -425,10 +408,6 @@ panfrost_resource_create(struct pipe_screen *screen,
 assert(0);
 }
 
-if (template->bind &
-(PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED))
-return panfrost_create_scanout_res(screen, template);
-
 struct panfrost_resource *so = rzalloc(screen, struct 
panfrost_resource);
 struct panfrost_screen *pscreen = (struct panfrost_screen *) screen;
 
@@ -440,6 +419,20 @@ panfrost_resource_create(struct pipe_screen *screen,
 util_range_init(>valid_buffer_range);
 
 panfrost_resource_create_bo(pscreen, so);
+
+/* Set up the "scanout resource" (the dmabuf export of our buffer to
+ * the KMS handle) if the buffer might ever have
+ * resource_get_handle(WINSYS_HANDLE_TYPE_KMS) called on it.
+ */
+if (template->bind & PIPE_BIND_SCANOUT) {
+so->scanout =
+renderonly_scanout_for_resource(>base, 
pscreen->ro, NULL);
+if (!so->scanout) {
+  

[Mesa-dev] [PATCH] panfrost: Take into account off-screen FBOs

2019-07-04 Thread Tomeu Vizoso
In that case, ctx->pipe_framebuffer.cbufs[0] can be NULL.

Signed-off-by: Tomeu Vizoso 
Cc: Boris Brezillon 
Fixes: 5375d009be18 ("panfrost: Pass referenced BOs to the SUBMIT ioctls")
---
 src/gallium/drivers/panfrost/pan_drm.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 8de4f483435c..b89f8e66a877 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -238,7 +238,6 @@ panfrost_drm_submit_job(struct panfrost_context *ctx, u64 
job_desc, int reqs)
 int
 panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, 
bool is_scanout)
 {
-struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
int ret;
 
 struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
@@ -256,9 +255,12 @@ panfrost_drm_submit_vs_fs_job(struct panfrost_context 
*ctx, bool has_draws, bool
 }
 
 if (job->first_tiler.gpu || job->clear) {
-struct panfrost_resource *res = pan_resource(surf->texture);
-assert(res->bo);
-panfrost_job_add_bo(job, res->bo);
+struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
+if (surf) {
+struct panfrost_resource *res = 
pan_resource(surf->texture);
+assert(res->bo);
+panfrost_job_add_bo(job, res->bo);
+}
 ret = panfrost_drm_submit_job(ctx, panfrost_fragment_job(ctx, 
has_draws), PANFROST_JD_REQ_FS);
 assert(!ret);
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 09/10] panfrost: Make SLAB pool creation rely on BO helpers

2019-07-02 Thread Tomeu Vizoso
On Tue, 2 Jul 2019 at 17:02, Boris Brezillon
 wrote:
>
> On Tue, 2 Jul 2019 16:54:22 +0200
> Tomeu Vizoso  wrote:
>
> > On Tue, 2 Jul 2019 at 15:24, Boris Brezillon
> >  wrote:
> > >
> > > There's no point duplicating the code, and it will help us simplify
> > > the bo_handles[] filling logic in panfrost_drm_submit_job().
> >
> > Looks good but, could we drop panfrost_memory completely? Other
> > drivers seem to do fine wthout such a thing.
>
> We need a wrapper that contains a BO plus a pb_slab object for
> SLAB-based allocations (allocation of sub-page-size objects), that's
> exactly what panfrost_memory is right now. We can rename it if you
> like, but I don't think we can get rid of it.

Sounds good, thanks!

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 09/10] panfrost: Make SLAB pool creation rely on BO helpers

2019-07-02 Thread Tomeu Vizoso
On Tue, 2 Jul 2019 at 15:24, Boris Brezillon
 wrote:
>
> There's no point duplicating the code, and it will help us simplify
> the bo_handles[] filling logic in panfrost_drm_submit_job().

Looks good but, could we drop panfrost_memory completely? Other
drivers seem to do fine wthout such a thing.

Thanks,

Tomeu

> Signed-off-by: Boris Brezillon 
> ---
>  src/gallium/drivers/panfrost/pan_allocate.c   | 21 +++---
>  src/gallium/drivers/panfrost/pan_allocate.h   | 22 --
>  src/gallium/drivers/panfrost/pan_context.c| 28 +++
>  src/gallium/drivers/panfrost/pan_drm.c| 74 +++
>  src/gallium/drivers/panfrost/pan_resource.h   | 15 
>  src/gallium/drivers/panfrost/pan_scoreboard.c |  2 +-
>  src/gallium/drivers/panfrost/pan_sfbd.c   |  4 +-
>  7 files changed, 56 insertions(+), 110 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_allocate.c 
> b/src/gallium/drivers/panfrost/pan_allocate.c
> index 91ace74d0e43..37a6785e7dff 100644
> --- a/src/gallium/drivers/panfrost/pan_allocate.c
> +++ b/src/gallium/drivers/panfrost/pan_allocate.c
> @@ -48,8 +48,8 @@ panfrost_allocate_chunk(struct panfrost_context *ctx, 
> size_t size, unsigned heap
>  struct panfrost_memory *backing = (struct panfrost_memory *) 
> entry->slab;
>
>  struct panfrost_transfer transfer = {
> -.cpu = backing->cpu + p_entry->offset,
> -.gpu = backing->gpu + p_entry->offset
> +.cpu = backing->bo->cpu + p_entry->offset,
> +.gpu = backing->bo->gpu + p_entry->offset
>  };
>
>  return transfer;
> @@ -97,8 +97,8 @@ panfrost_allocate_transient(struct panfrost_context *ctx, 
> size_t sz)
>  struct panfrost_memory *backing = (struct panfrost_memory *) 
> p_entry->base.slab;
>
>  struct panfrost_transfer ret = {
> -.cpu = backing->cpu + p_entry->offset + pool->entry_offset,
> -.gpu = backing->gpu + p_entry->offset + pool->entry_offset
> +.cpu = backing->bo->cpu + p_entry->offset + 
> pool->entry_offset,
> +.gpu = backing->bo->gpu + p_entry->offset + 
> pool->entry_offset
>  };
>
>  /* Advance the pointer */
> @@ -192,18 +192,19 @@ mali_ptr
>  panfrost_upload(struct panfrost_memory *mem, const void *data, size_t sz, 
> bool no_pad)
>  {
>  /* Bounds check */
> -if ((mem->stack_bottom + sz) >= mem->size) {
> -printf("Out of memory, tried to upload %zd but only %zd 
> available\n", sz, mem->size - mem->stack_bottom);
> +if ((mem->stack_bottom + sz) >= mem->bo->size) {
> +printf("Out of memory, tried to upload %zd but only %zd 
> available\n",
> +   sz, mem->bo->size - mem->stack_bottom);
>  assert(0);
>  }
>
> -return pandev_upload(-1, >stack_bottom, mem->gpu, mem->cpu, 
> data, sz, no_pad);
> +return pandev_upload(-1, >stack_bottom, mem->bo->gpu, 
> mem->bo->cpu, data, sz, no_pad);
>  }
>
>  mali_ptr
>  panfrost_upload_sequential(struct panfrost_memory *mem, const void *data, 
> size_t sz)
>  {
> -return pandev_upload(last_offset, >stack_bottom, mem->gpu, 
> mem->cpu, data, sz, true);
> +return pandev_upload(last_offset, >stack_bottom, mem->bo->gpu, 
> mem->bo->cpu, data, sz, true);
>  }
>
>  /* Simplified interface to allocate a chunk without any upload, to allow
> @@ -215,6 +216,6 @@ panfrost_allocate_transfer(struct panfrost_memory *mem, 
> size_t sz, mali_ptr *gpu
>  {
>  int offset = pandev_allocate_offset(>stack_bottom, sz);
>
> -*gpu = mem->gpu + offset;
> -return mem->cpu + offset;
> +*gpu = mem->bo->gpu + offset;
> +return mem->bo->cpu + offset;
>  }
> diff --git a/src/gallium/drivers/panfrost/pan_allocate.h 
> b/src/gallium/drivers/panfrost/pan_allocate.h
> index 5bbb1e4b078d..20ba204dee86 100644
> --- a/src/gallium/drivers/panfrost/pan_allocate.h
> +++ b/src/gallium/drivers/panfrost/pan_allocate.h
> @@ -58,16 +58,28 @@ struct panfrost_transfer {
>  mali_ptr gpu;
>  };
>
> +struct panfrost_bo {
> +struct pipe_reference reference;
> +
> +/* Mapping for the entire object (all levels) */
> +uint8_t *cpu;
> +
> +/* GPU address for the object */
> +mali_ptr gpu;
> +
> +/* Size of all entire trees */
> +size_t size;
> +
> +int gem_handle;
> +};
> +
>  struct panfrost_memory {
>  /* Subclassing slab object */
>  struct pb_slab slab;
>
>  /* Backing for the slab in memory */
> -uint8_t *cpu;
> -mali_ptr gpu;
> +struct panfrost_bo *bo;
>  int stack_bottom;
> -size_t size;
> -int gem_handle;
>  };
>
>  /* Slab entry sizes range from 2^min to 2^max. In this case, we range from 1k
> @@ -109,7 +121,7 @@ static inline mali_ptr
>  panfrost_reserve(struct panfrost_memory *mem, size_t sz)
>  {
>  

Re: [Mesa-dev] [PATCH 00/10] panfrost: Try to make BO handling more consistent

2019-07-02 Thread Tomeu Vizoso
On Tue, 2 Jul 2019 at 15:24, Boris Brezillon
 wrote:
>
> Hello,
>
> This patch series is an attempt at making memory allocation more
> consistent by implementing SLAB pool allocation around the BO allocation
> logic.
> Note that my initial goal was to pass referenced BOs to the kernel
> driver, but I've decided to clean things up along the way (just let me
> know if you think it was a mistake).
>
> The first 4 patches are simple cleanups and could have been sent
> separately, but it's easier for me to post everything as a single series
> to avoid dependency issues.
>
> Patch 5 might be a bit more controversial, as I move some of the
> fields that were in panfrost_bo to panfrost_resource. The rationale here
> being that other drivers (vc4, freedreno, ...) seem to keep _bo objects
> as simple memory backing objs that do not contain any meta data
> describing the buffer content. This approach allows us to re-use those
> objects to allocate anything, not only texture or FB resources. Again,
> if you think that's a wrong decision, let me know.
>
> Patch 6 is in the same vein, it makes BO import/export functions more
> generic so they can be used for !winsys bufs.
>
> Patches 7-9 are here to re-use the BO creation/destruction logic as much
> as possible instead of duplicating the code or having convoluted code
> doing panfrost_bo <-> panfrost_memory conversions.
>
> And finally, patch 10 is making use of all the changes described above
> to pass all referenced BOs to the kernel driver when a job is submitted,
> thus making sure the job will wait for all resources to be ready before
> being scheduled.
>
> I know there's a lot going on in the panfrost area right now, and some
> of what I'm proposing here might be irrelevant or might have to be
> ported on top of other changes (which is fine). Let me know if that's
> the case.

Looks great to me, will be a pleasure to rebase my modifiers work on
top of this.

Reviewed-by: Tomeu Vizoso 

Thanks,

Tomeu

> Regards,
>
> Boris
>
> Boris Brezillon (10):
>   panfrost: Move scanout res creation out of panfrost_resource_create()
>   panfrost: Get rid of the panfrost_driver abstraction leftovers
>   panfrost: Get rid of the "free imported BO" logic
>   panfrost: Stop exposing internal panfrost_drm_*() functions
>   panfrost: Move BO meta-data out of panfrost_bo
>   panfrost: Avoid passing winsys handles to import/export BO funcs
>   panfrost: Move the mmap BO logic out of panfrost_drm_import_bo()
>   panfrost: Add the panfrost_drm_{create,release}_bo() helpers
>   panfrost: Make SLAB pool creation rely on BO helpers
>   panfrost: Pass referenced BOs to the SUBMIT ioctls
>
>  src/gallium/drivers/panfrost/pan_allocate.c   |  21 +-
>  src/gallium/drivers/panfrost/pan_allocate.h   |  22 +-
>  src/gallium/drivers/panfrost/pan_context.c|  40 +--
>  src/gallium/drivers/panfrost/pan_drm.c| 263 +-
>  src/gallium/drivers/panfrost/pan_drm.h|  32 ---
>  src/gallium/drivers/panfrost/pan_fragment.c   |   2 +-
>  src/gallium/drivers/panfrost/pan_mfbd.c   |  24 +-
>  src/gallium/drivers/panfrost/pan_resource.c   | 242 
>  src/gallium/drivers/panfrost/pan_resource.h   |  42 +--
>  src/gallium/drivers/panfrost/pan_scoreboard.c |   2 +-
>  src/gallium/drivers/panfrost/pan_screen.c |   2 -
>  src/gallium/drivers/panfrost/pan_screen.h |  17 +-
>  src/gallium/drivers/panfrost/pan_sfbd.c   |   8 +-
>  13 files changed, 333 insertions(+), 384 deletions(-)
>  delete mode 100644 src/gallium/drivers/panfrost/pan_drm.h
>
> --
> 2.21.0
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 06/10] panfrost: Avoid passing winsys handles to import/export BO funcs

2019-07-02 Thread Tomeu Vizoso
On Tue, 2 Jul 2019 at 15:24, Boris Brezillon
 wrote:
>
> Let's keep a clear split between ioctl wrappers and the rest of the
> driver. All the import BO function need is a dmabuf FD and the screen
> object, and the export one should only take care of generating a dmabuf
> FD out of a BO object. Winsys handle manipulation should stay in the
> resource.c file.

We'll need to change most of it for modifiers, but I have no problem
with this landing now.

Thanks,

Tomeu

> Signed-off-by: Boris Brezillon 
> ---
>  src/gallium/drivers/panfrost/pan_drm.c  | 17 +++--
>  src/gallium/drivers/panfrost/pan_resource.c | 16 +++-
>  src/gallium/drivers/panfrost/pan_screen.h   |  6 ++
>  3 files changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
> b/src/gallium/drivers/panfrost/pan_drm.c
> index f17f56bc6307..b88ab0e5ce2b 100644
> --- a/src/gallium/drivers/panfrost/pan_drm.c
> +++ b/src/gallium/drivers/panfrost/pan_drm.c
> @@ -114,7 +114,7 @@ panfrost_drm_free_slab(struct panfrost_screen *screen, 
> struct panfrost_memory *m
>  }
>
>  struct panfrost_bo *
> -panfrost_drm_import_bo(struct panfrost_screen *screen, struct winsys_handle 
> *whandle)
> +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,};
> @@ -122,7 +122,7 @@ panfrost_drm_import_bo(struct panfrost_screen *screen, 
> struct winsys_handle *wha
>  int ret;
>  unsigned gem_handle;
>
> -   ret = drmPrimeFDToHandle(screen->fd, whandle->handle, _handle);
> +   ret = drmPrimeFDToHandle(screen->fd, fd, _handle);
> assert(!ret);
>
> get_bo_offset.handle = gem_handle;
> @@ -141,7 +141,7 @@ panfrost_drm_import_bo(struct panfrost_screen *screen, 
> struct winsys_handle *wha
> assert(0);
> }
>
> -bo->size = lseek(whandle->handle, 0, SEEK_END);
> +bo->size = lseek(fd, 0, SEEK_END);
>  assert(bo->size > 0);
>  bo->cpu = os_mmap(NULL, bo->size, PROT_READ | PROT_WRITE, MAP_SHARED,
> screen->fd, mmap_bo.offset);
> @@ -158,21 +158,18 @@ panfrost_drm_import_bo(struct panfrost_screen *screen, 
> struct winsys_handle *wha
>  }
>
>  int
> -panfrost_drm_export_bo(struct panfrost_screen *screen, int gem_handle, 
> unsigned int stride, struct winsys_handle *whandle)
> +panfrost_drm_export_bo(struct panfrost_screen *screen, const struct 
> panfrost_bo *bo)
>  {
>  struct drm_prime_handle args = {
> -.handle = gem_handle,
> +.handle = bo->gem_handle,
>  .flags = DRM_CLOEXEC,
>  };
>
>  int ret = drmIoctl(screen->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, );
>  if (ret == -1)
> -return FALSE;
> +return -1;
>
> -whandle->handle = args.fd;
> -whandle->stride = stride;
> -
> -return TRUE;
> +return args.fd;
>  }
>
>  static int
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
> b/src/gallium/drivers/panfrost/pan_resource.c
> index 8901aeee09b1..f86617f80c20 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -70,7 +70,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen,
>  pipe_reference_init(>reference, 1);
>  prsc->screen = pscreen;
>
> -   rsc->bo = panfrost_drm_import_bo(screen, whandle);
> +   rsc->bo = panfrost_drm_import_bo(screen, whandle->handle);
> rsc->slices[0].stride = whandle->stride;
> rsc->slices[0].initialized = true;
>
> @@ -120,10 +120,16 @@ panfrost_resource_get_handle(struct pipe_screen 
> *pscreen,
>  handle->handle = args.fd;
>
>  return TRUE;
> -} else
> -   return panfrost_drm_export_bo(screen, 
> rsrc->bo->gem_handle,
> -  rsrc->slices[0].stride,
> -  handle);
> +} else {
> +int fd = panfrost_drm_export_bo(screen, rsrc->bo);
> +
> +if (fd < 0)
> +return FALSE;
> +
> +handle->handle = fd;
> +handle->stride = rsrc->slices[0].stride;
> +return TRUE;
> +   }
> }
>
> return FALSE;
> diff --git a/src/gallium/drivers/panfrost/pan_screen.h 
> b/src/gallium/drivers/panfrost/pan_screen.h
> index 83186ebb2f7f..1a1eb2f8bf27 100644
> --- a/src/gallium/drivers/panfrost/pan_screen.h
> +++ b/src/gallium/drivers/panfrost/pan_screen.h
> @@ -83,11 +83,9 @@ void
>  panfrost_drm_free_slab(struct panfrost_screen *screen,
> struct panfrost_memory *mem);
>  struct panfrost_bo *
> 

Re: [Mesa-dev] [PATCH 01/10] panfrost: Move scanout res creation out of panfrost_resource_create()

2019-07-02 Thread Tomeu Vizoso
Besides the leak, I think I preferred the open-coded version, which is
incidentally what all other drivers I've seen do. The modifiers work
is going to massively change this code anyway.

But I'm not against it, so

Reviewed-by: Tomeu Vizoso 

Cheers,

Tomeu

On Tue, 2 Jul 2019 at 15:24, Boris Brezillon
 wrote:
>
> Which improves readability and help us avoid a memory leak.
>
> Signed-off-by: Boris Brezillon 
> ---
>  src/gallium/drivers/panfrost/pan_resource.c | 79 -
>  1 file changed, 44 insertions(+), 35 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
> b/src/gallium/drivers/panfrost/pan_resource.c
> index 8db7e45af1b6..fae535ed4e29 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -180,6 +180,37 @@ panfrost_surface_destroy(struct pipe_context *pipe,
>  ralloc_free(surf);
>  }
>
> +static struct pipe_resource *
> +panfrost_create_scanout_res(struct pipe_screen *screen,
> +const struct pipe_resource *template)
> +{
> +struct panfrost_screen *pscreen = pan_screen(screen);
> +struct pipe_resource scanout_templat = *template;
> +struct renderonly_scanout *scanout;
> +struct winsys_handle handle;
> +struct pipe_resource *res;
> +
> +scanout = renderonly_scanout_for_resource(_templat,
> +  pscreen->ro, );
> +if (!scanout)
> +return NULL;
> +
> +assert(handle.type == WINSYS_HANDLE_TYPE_FD);
> +/* TODO: handle modifiers? */
> +res = screen->resource_from_handle(screen, template, ,
> +   
> PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
> +close(handle.handle);
> +if (!res)
> +return NULL;
> +
> +struct panfrost_resource *pres = pan_resource(res);
> +
> +pres->scanout = scanout;
> +pscreen->display_target = pres;
> +
> +return res;
> +}
> +
>  /* Computes sizes for checksumming, which is 8 bytes per 16x16 tile */
>
>  #define CHECKSUM_TILE_WIDTH 16
> @@ -368,14 +399,6 @@ static struct pipe_resource *
>  panfrost_resource_create(struct pipe_screen *screen,
>   const struct pipe_resource *template)
>  {
> -struct panfrost_resource *so = rzalloc(screen, struct 
> panfrost_resource);
> -struct panfrost_screen *pscreen = (struct panfrost_screen *) screen;
> -
> -so->base = *template;
> -so->base.screen = screen;
> -
> -pipe_reference_init(>base.reference, 1);
> -
>  /* Make sure we're familiar */
>  switch (template->target) {
>  case PIPE_BUFFER:
> @@ -391,35 +414,21 @@ panfrost_resource_create(struct pipe_screen *screen,
>  assert(0);
>  }
>
> +if (template->bind &
> +(PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | 
> PIPE_BIND_SHARED))
> +return panfrost_create_scanout_res(screen, template);
> +
> +struct panfrost_resource *so = rzalloc(screen, struct 
> panfrost_resource);
> +struct panfrost_screen *pscreen = (struct panfrost_screen *) screen;
> +
> +so->base = *template;
> +so->base.screen = screen;
> +
> +pipe_reference_init(>base.reference, 1);
> +
>  util_range_init(>valid_buffer_range);
>
> -if (template->bind & PIPE_BIND_DISPLAY_TARGET ||
> -template->bind & PIPE_BIND_SCANOUT ||
> -template->bind & PIPE_BIND_SHARED) {
> -struct pipe_resource scanout_templat = *template;
> -struct renderonly_scanout *scanout;
> -struct winsys_handle handle;
> -
> -scanout = renderonly_scanout_for_resource(_templat,
> -  pscreen->ro, 
> );
> -if (!scanout)
> -return NULL;
> -
> -assert(handle.type == WINSYS_HANDLE_TYPE_FD);
> -/* TODO: handle modifiers? */
> -so = pan_resource(screen->resource_from_handle(screen, 
> template,
> - ,
> - 
> PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE));
> -close(handle.handle);
> -if (!so)
> -return NULL;
> -
> -so->scanout = scanout;
> -pscreen->display_target = so;
> -} else {
> -so->bo = panfrost_create_bo(pscreen, template);
> -}
> -
> +so->bo = panfrost_create_bo(pscreen, template);
>  return (struct pipe_resource *)so;
>  }
>
> --
> 2.21.0
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: Only tag AFBC addresses when sampling

2019-06-28 Thread Tomeu Vizoso
Rendering to AFBC was broken, as the HW will complaint loudly if we pass
a tagged pointer in bifrost_render_target.

Signed-off-by: Tomeu Vizoso 
Fixes: 3609b50a6443 ("panfrost: Merge AFBC slab with BO backing")
---
 src/gallium/drivers/panfrost/pan_context.c  | 8 +++-
 src/gallium/drivers/panfrost/pan_resource.c | 7 +--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index 967d7116c249..be800ca6ce1c 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -834,6 +834,11 @@ panfrost_upload_tex(
 unsigned first_layer = pview->u.tex.first_layer;
 unsigned last_layer = pview->u.tex.last_layer;
 
+/* Lower-bit is set when sampling from colour AFBC */
+bool is_afbc = rsrc->bo->layout == PAN_AFBC;
+bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
+unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
+
 /* Inject the addresses in, interleaving mip levels, cube faces, and
  * strides in that order */
 
@@ -841,8 +846,9 @@ panfrost_upload_tex(
 
 for (unsigned l = first_level; l <= last_level; ++l) {
 for (unsigned f = first_layer; f <= last_layer; ++f) {
+
 view->hw.payload[idx++] =
-panfrost_get_texture_address(rsrc, l, f);
+panfrost_get_texture_address(rsrc, l, f) + 
afbc_bit;
 
 if (has_manual_stride) {
 view->hw.payload[idx++] =
diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
b/src/gallium/drivers/panfrost/pan_resource.c
index c5bda8093206..8db7e45af1b6 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -756,12 +756,7 @@ panfrost_get_texture_address(
 unsigned level_offset = rsrc->bo->slices[level].offset;
 unsigned face_offset = face * rsrc->bo->cubemap_stride;
 
-/* Lower-bit is set when sampling from colour AFBC */
-bool is_afbc = rsrc->bo->layout == PAN_AFBC;
-bool is_zs = rsrc->base.bind & PIPE_BIND_DEPTH_STENCIL;
-unsigned afbc_bit = (is_afbc && !is_zs) ? 1 : 0;
-
-return rsrc->bo->gpu + level_offset + face_offset + afbc_bit;
+return rsrc->bo->gpu + level_offset + face_offset;
 }
 
 static void
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 3/3] panfrost/ci: Don't print every kernel file

2019-06-27 Thread Tomeu Vizoso
As there's lots of them and Gitlab struggles rendering logs with so many
lines.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/debian-install.sh | 2 +-
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
b/src/gallium/drivers/panfrost/ci/debian-install.sh
index 8a8b4ec9a47c..beff1027fd92 100644
--- a/src/gallium/drivers/panfrost/ci/debian-install.sh
+++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
@@ -108,7 +108,7 @@ export ARCH=${KERNEL_ARCH}
 export CROSS_COMPILE="${GCC_ARCH}-"
 
 mkdir -p /kernel
-wget -qO- ${KERNEL_URL} | tar -xvz -C /kernel
+wget -qO- ${KERNEL_URL} | tar -xz -C /kernel
 cd /kernel
 ./scripts/kconfig/merge_config.sh ${DEFCONFIG} 
${PANFROST_CI_DIR}/${KERNEL_ARCH}.config
 make -j12 ${KERNEL_IMAGE_NAME} dtbs
diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 158fb5675430..6ca2bff5b502 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  IMAGE_TAG: "2019-06-26-1"
+  IMAGE_TAG: "2019-06-26-3"
 
 include:
   - project: 'wayland/ci-templates'
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/3] panfrost/ci: Fix the image name

2019-06-27 Thread Tomeu Vizoso
These changes will make sure we get the right image from the container
registry.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 63765f4af149..158fb5675430 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -1,4 +1,4 @@
-# DEBIAN_TAG is the tag of the docker image used for the build jobs. If the
+# 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.
@@ -16,7 +16,7 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_VERSION: testing-slim
-  DEBIAN_TAG: "2019-06-07-1"
+  IMAGE_TAG: "2019-06-26-1"
 
 include:
   - project: 'wayland/ci-templates'
@@ -42,7 +42,7 @@ stages:
   <<: *retry
   variables:
 GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the 
image
-IMAGE_LOCAL: "$CI_REGISTRY/$CI_PROJECT_PATH/${DEBIAN_ARCH}:latest"
+DEBIAN_TAG: '${DEBIAN_ARCH}-${IMAGE_TAG}'
 DEBIAN_EXEC: 'DEBIAN_ARCH=${DEBIAN_ARCH}
   GCC_ARCH=${GCC_ARCH}
   KERNEL_ARCH=${KERNEL_ARCH}
@@ -73,7 +73,7 @@ container:arm64:
 
 .build:
   stage: build
-  image: $CI_REGISTRY/$CI_PROJECT_PATH/${DEBIAN_ARCH}:latest
+  image: $CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:${DEBIAN_ARCH}-${IMAGE_TAG}
   cache:
 paths:
   - ccache
@@ -143,7 +143,7 @@ build:arm64:
   stage: test
   tags:
 - idle-jobs
-  image: $CI_REGISTRY/$CI_PROJECT_PATH/arm64:latest  # Any of the images will 
be fine
+  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:
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/3] panfrost/ci: Remove batching

2019-06-27 Thread Tomeu Vizoso
Panfrost has grown and doesn't leak as much as before.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/deqp-runner.sh | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index 33f146d789f0..e389fc484e6e 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -2,9 +2,6 @@
 
 set -x
 
-# To prevent memory leaks from slowing throughput, restart everything between 
batches
-BATCH_SIZE=3000
-
 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"
@@ -36,8 +33,7 @@ touch /tmp/result.txt
 tail -f /tmp/result.txt &
 
 while [ -s /tmp/case-list.txt ]; do
-   head -$BATCH_SIZE /tmp/case-list.txt > /tmp/next-batch.txt
-   ./deqp-gles2 $DEQP_OPTIONS --deqp-log-filename=/dev/null 
--deqp-caselist-file=/tmp/next-batch.txt >> /tmp/result.txt
+   ./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/")
@@ -47,7 +43,6 @@ while [ -s /tmp/case-list.txt ]; do
echo "Test case '$crashed_test'..
  Crash"
else
-   # Consume a whole batch
-   sed -i '1,'$BATCH_SIZE'd' /tmp/case-list.txt
+   break
fi
 done
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Update copyright identifiers

2019-06-27 Thread Tomeu Vizoso
On Tue, 25 Jun 2019 at 22:31, Alyssa Rosenzweig
 wrote:
>
> "Collabora, Ltd." should be listed in lieu of simply "Collabora"
>
> Signed-off-by: Alyssa Rosenzweig 
> Suggested-by: Daniel Stone 
> ---
>  src/gallium/drivers/panfrost/include/panfrost-job.h| 2 +-
>  src/gallium/drivers/panfrost/midgard/midgard_ra.c  | 2 +-
>  src/gallium/drivers/panfrost/midgard/midgard_ra_pipeline.c | 2 +-
>  src/gallium/drivers/panfrost/pan_afbc.c| 2 +-
>  src/gallium/drivers/panfrost/pan_blit.c| 2 +-
>  src/gallium/drivers/panfrost/pan_resource.c| 2 +-
>  src/gallium/drivers/panfrost/pan_scoreboard.c  | 2 +-
>  src/gallium/drivers/panfrost/pan_screen.c  | 2 +-
>  src/gallium/drivers/panfrost/pan_screen.h  | 2 +-
>  src/gallium/drivers/panfrost/pan_tiler.c   | 2 +-
>  src/gallium/drivers/panfrost/pan_tiler.h   | 2 +-
>  src/gallium/drivers/panfrost/pan_util.h| 2 +-
>  src/gallium/drivers/panfrost/pandecode/common.c| 2 +-
>  src/gallium/drivers/panfrost/pandecode/decode.c| 2 +-
>  14 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h 
> b/src/gallium/drivers/panfrost/include/panfrost-job.h
> index fbef4efdc32..f647313ed8f 100644
> --- a/src/gallium/drivers/panfrost/include/panfrost-job.h
> +++ b/src/gallium/drivers/panfrost/include/panfrost-job.h
> @@ -2,7 +2,7 @@
>   * © Copyright 2017-2018 Alyssa Rosenzweig
>   * © Copyright 2017-2018 Connor Abbott
>   * © Copyright 2017-2018 Lyude Paul
> - * © Copyright2019 Collabora
> + * © Copyright2019 Collabora, Ltd.

Patch looks good to me, but please add the space missing above.

Reviewed-by: Tomeu Vizoso 

Thanks,

Tomeu

>   *
>   * Permission is hereby granted, free of charge, to any person obtaining a
>   * copy of this software and associated documentation files (the "Software"),
> diff --git a/src/gallium/drivers/panfrost/midgard/midgard_ra.c 
> b/src/gallium/drivers/panfrost/midgard/midgard_ra.c
> index 7fd5e5b49e3..77ec65b4eae 100644
> --- a/src/gallium/drivers/panfrost/midgard/midgard_ra.c
> +++ b/src/gallium/drivers/panfrost/midgard/midgard_ra.c
> @@ -1,6 +1,6 @@
>  /*
>   * Copyright (C) 2018-2019 Alyssa Rosenzweig 
> - * Copyright (C) 2019 Collabora
> + * 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"),
> diff --git a/src/gallium/drivers/panfrost/midgard/midgard_ra_pipeline.c 
> b/src/gallium/drivers/panfrost/midgard/midgard_ra_pipeline.c
> index d4187edc0c8..6622c2bc534 100644
> --- a/src/gallium/drivers/panfrost/midgard/midgard_ra_pipeline.c
> +++ b/src/gallium/drivers/panfrost/midgard/midgard_ra_pipeline.c
> @@ -1,6 +1,6 @@
>  /*
>   * Copyright (C) 2019 Alyssa Rosenzweig 
> - * Copyright (C) 2019 Collabora
> + * 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"),
> diff --git a/src/gallium/drivers/panfrost/pan_afbc.c 
> b/src/gallium/drivers/panfrost/pan_afbc.c
> index 5621d1f333a..077e0dcba66 100644
> --- a/src/gallium/drivers/panfrost/pan_afbc.c
> +++ b/src/gallium/drivers/panfrost/pan_afbc.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (C) 2019 Collabora
> + * 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"),
> diff --git a/src/gallium/drivers/panfrost/pan_blit.c 
> b/src/gallium/drivers/panfrost/pan_blit.c
> index 5859f92f9d1..17f6a5d5bed 100644
> --- a/src/gallium/drivers/panfrost/pan_blit.c
> +++ b/src/gallium/drivers/panfrost/pan_blit.c
> @@ -1,6 +1,6 @@
>  /*
>   * Copyright (C) 2014 Broadcom
> - * Copyright (C) 2019 Collabora
> + * 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"),
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c 
> b/src/gallium/drivers/panfrost/pan_resource.c
> index 1a691a5be34..fda0b1367a5 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -2,7 +2,7 @@
>   * Copyright (C) 2008 VMware, Inc.
>   * Copyright (C) 2014 Broadcom
>   * Copyright (C) 2018-2019 Alyssa Rosenzweig
&g

[Mesa-dev] [PATCH 4/4] panfrost/decode: Mention the address of a few descriptors

2019-06-25 Thread Tomeu Vizoso
When the fault_pointer field in the header is set, we can get some idea
of which descriptor the HW isn't happy with if we know their addresses.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/pandecode/decode.c   | 24 +--
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pandecode/decode.c 
b/src/gallium/drivers/panfrost/pandecode/decode.c
index 2a21f072639e..587c00dd2460 100644
--- a/src/gallium/drivers/panfrost/pandecode/decode.c
+++ b/src/gallium/drivers/panfrost/pandecode/decode.c
@@ -450,7 +450,7 @@ pandecode_replay_sfbd(uint64_t gpu_va, int job_no)
 struct pandecode_mapped_memory *mem = 
pandecode_find_mapped_gpu_mem_containing(gpu_va);
 const struct mali_single_framebuffer *PANDECODE_PTR_VAR(s, mem, 
(mali_ptr) gpu_va);
 
-pandecode_log("struct mali_single_framebuffer framebuffer_%d = {\n", 
job_no);
+pandecode_log("struct mali_single_framebuffer framebuffer_%"PRIx64"_%d 
= {\n", gpu_va, job_no);
 pandecode_indent++;
 
 pandecode_prop("unknown1 = 0x%" PRIx32, s->unknown1);
@@ -555,7 +555,7 @@ pandecode_compute_fbd(uint64_t gpu_va, int job_no)
 struct pandecode_mapped_memory *mem = 
pandecode_find_mapped_gpu_mem_containing(gpu_va);
 const struct mali_compute_fbd *PANDECODE_PTR_VAR(s, mem, (mali_ptr) 
gpu_va);
 
-pandecode_log("struct mali_compute_fbd framebuffer_%d = {\n", job_no);
+pandecode_log("struct mali_compute_fbd framebuffer_%"PRIx64"_%d = 
{\n", gpu_va, job_no);
 pandecode_indent++;
 
 SHORT_SLIDE(1);
@@ -605,7 +605,7 @@ pandecode_rt_format(struct mali_rt_format format)
 static void
 pandecode_render_target(uint64_t gpu_va, unsigned job_no, const struct 
bifrost_framebuffer *fb)
 {
-pandecode_log("struct bifrost_render_target rts_list_%d[] = {\n", 
job_no);
+pandecode_log("struct bifrost_render_target rts_list_%"PRIx64"_%d[] = 
{\n", gpu_va, job_no);
 pandecode_indent++;
 
 for (int i = 0; i < MALI_NEGATIVE(fb->rt_count_1); i++) {
@@ -704,7 +704,7 @@ pandecode_replay_mfbd_bfr(uint64_t gpu_va, int job_no, bool 
with_render_targets)
 pandecode_log("};\n");
 }
 
-pandecode_log("struct bifrost_framebuffer framebuffer_%d = {\n", 
job_no);
+pandecode_log("struct bifrost_framebuffer framebuffer_%"PRIx64"_%d = 
{\n", gpu_va, job_no);
 pandecode_indent++;
 
 pandecode_prop("unk0 = 0x%x", fb->unk0);
@@ -775,7 +775,7 @@ pandecode_replay_mfbd_bfr(uint64_t gpu_va, int job_no, bool 
with_render_targets)
 mem = pandecode_find_mapped_gpu_mem_containing(gpu_va);
 const struct bifrost_fb_extra *PANDECODE_PTR_VAR(fbx, mem, 
(mali_ptr) gpu_va);
 
-pandecode_log("struct bifrost_fb_extra fb_extra_%d = {\n", 
job_no);
+pandecode_log("struct bifrost_fb_extra fb_extra_%"PRIx64"_%d = 
{\n", gpu_va, job_no);
 pandecode_indent++;
 
 MEMORY_PROP(fbx, checksum);
@@ -1271,7 +1271,7 @@ pandecode_replay_scratchpad(uintptr_t pscratchpad, int 
job_no, char *suffix)
 if (scratchpad->zero)
 pandecode_msg("XXX scratchpad zero tripped");
 
-pandecode_log("struct bifrost_scratchpad scratchpad_%d%s = {\n", 
job_no, suffix);
+pandecode_log("struct bifrost_scratchpad scratchpad_%"PRIx64"_%d%s = 
{\n", pscratchpad, job_no, suffix);
 pandecode_indent++;
 
 pandecode_prop("flags = 0x%x", scratchpad->flags);
@@ -1336,7 +1336,7 @@ pandecode_replay_vertex_tiler_postfix_pre(const struct 
mali_vertex_tiler_postfix
 struct pandecode_mapped_memory *smem = 
pandecode_find_mapped_gpu_mem_containing(shader_meta_ptr);
 struct mali_shader_meta *PANDECODE_PTR_VAR(s, smem, 
shader_meta_ptr);
 
-pandecode_log("struct mali_shader_meta shader_meta_%d%s = 
{\n", job_no, suffix);
+pandecode_log("struct mali_shader_meta 
shader_meta_%"PRIx64"_%d%s = {\n", shader_meta_ptr, job_no, suffix);
 pandecode_indent++;
 
 /* Save for dumps */
@@ -1624,7 +1624,7 @@ pandecode_replay_vertex_tiler_postfix_pre(const struct 
mali_vertex_tiler_postfix
 if (tmem) {
 struct mali_texture_descriptor 
*PANDECODE_PTR_VAR(t, tmem, *u);
 
-pandecode_log("struct 
mali_texture_descriptor texture_descriptor_%d_%d = {\n", job_no, tex);
+pandecode_log("struct 
mali_texture_descriptor texture_descriptor_%"PRIx64"_%d_%d = {\n", *u, job_no, 

[Mesa-dev] [PATCH 3/4] panfrost/decode: Wait for a job to finish before dumping

2019-06-25 Thread Tomeu Vizoso
Then we can get some information back about any exception that might
have happened.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_drm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 2602acea2988..a69d2aa39551 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -245,9 +245,11 @@ panfrost_drm_submit_job(struct panfrost_context *ctx, u64 
job_desc, int reqs, st
}
 
 /* Trace the job if we're doing that */
-
-if (pan_debug & PAN_DBG_TRACE)
+if (pan_debug & PAN_DBG_TRACE) {
+/* Wait so we can get errors reported back */
+drmSyncobjWait(screen->fd, >out_sync, 1, INT64_MAX, 0, 
NULL);
 pandecode_replay_jc(submit.jc, FALSE);
+}
 
return 0;
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/4] panfrost/decode: Decode exception status

2019-06-25 Thread Tomeu Vizoso
Arm's kernel driver mentions how to decode this field, which makes a bit
clearer what had happened.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pandecode/decode.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pandecode/decode.c 
b/src/gallium/drivers/panfrost/pandecode/decode.c
index d468e10140b7..2a21f072639e 100644
--- a/src/gallium/drivers/panfrost/pandecode/decode.c
+++ b/src/gallium/drivers/panfrost/pandecode/decode.c
@@ -2171,8 +2171,12 @@ pandecode_replay_jc(mali_ptr jc_gpu_va, bool bifrost)
 if (h->job_descriptor_size)
 pandecode_prop("job_descriptor_size = %d", 
h->job_descriptor_size);
 
-if (h->exception_status)
-pandecode_prop("exception_status = %d", 
h->exception_status);
+if (h->exception_status != 0x1)
+pandecode_prop("exception_status = %x (source ID: 0x%x 
access: 0x%x exception: 0x%x)",
+   h->exception_status,
+   (h->exception_status >> 16) & 0x,
+   (h->exception_status >> 8) & 0x3,
+   h->exception_status  & 0xFF);
 
 if (h->first_incomplete_task)
 pandecode_prop("first_incomplete_task = %d", 
h->first_incomplete_task);
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/4] panfrost/decode: Print AFBC struct when appropriate

2019-06-25 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pandecode/decode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pandecode/decode.c 
b/src/gallium/drivers/panfrost/pandecode/decode.c
index 7f58ad033669..d468e10140b7 100644
--- a/src/gallium/drivers/panfrost/pandecode/decode.c
+++ b/src/gallium/drivers/panfrost/pandecode/decode.c
@@ -619,8 +619,7 @@ pandecode_render_target(uint64_t gpu_va, unsigned job_no, 
const struct bifrost_f
 
 pandecode_rt_format(rt->format);
 
-/* TODO: How the actual heck does AFBC enabling work here? */
-if (0) {
+if (rt->format.block == MALI_MFBD_BLOCK_AFBC) {
 pandecode_log(".afbc = {\n");
 pandecode_indent++;
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/3] panfrost: Print a backtrace if there is one

2019-06-24 Thread Tomeu Vizoso
On Mon, 24 Jun 2019 at 12:00, Rohan Garg  wrote:
>
> > I think assertions should be limited to the most basic of sanity checks,
> > and the other asserts replaced by proper error handling.
>
> So, should I leave it as is and let us hit assertions that we fix?

Sorry, can you rephrase?

Thanks,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Implement command stream scoreboarding

2019-06-21 Thread Tomeu Vizoso

On 6/21/19 3:05 PM, Alyssa Rosenzweig wrote:

Very nice, this will fix a few tests.


Ah, of course :)


Good riddance!


To be fair, a lot of that just got moved in with panfrost_job.. :)


Can we remove now the has_draws arg?


Maybe? The has_draws arg controls a lot of things beyond just, you
know, having draws. The whole API there needs to be overhauled quite a
bit. So yes, we can remove it, but -after- this is merged. Enough code
is being changed here as it is; we don't need more things to break.


What's the primary batch? Might warrant an explanation somewhere.


Meh, I was making up terminology as I went. The primary batch being
everything but the FRAGMENT job -- so, the SET_VALUE/VERTEX/TILER jobs
(and later COMPUTE/GEOMETRY/FUSED). I.e. everything that we actually
handle in panfrost_job and the scoreboarding module, rather than just
what we tag on in pan_fragment (which is sort of special cased? not that
you couldn't also scoreboard those but there's no reason to since
there's only ever one in the chain -- so no deps and manual index=1 --
as far as I know?).


This is excelent work, thanks!


:D Thank you for the review!

--

has_draws can be addressed later. Do you want me to add a v2 with a
comment explaining what I meant by "primary batch"? Or should we just
merge as-is (while CI is still green :) and add a followup patch later)?


Both sound good to me.

Thanks,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Implement command stream scoreboarding

2019-06-21 Thread Tomeu Vizoso
ruct mali_job_descriptor_header *node = 
DESCRIPTOR_FOR_NODE(i);
+
+unsigned dep_1 = node->job_dependency_index_1;
+unsigned dep_2 = node->job_dependency_index_2;
+
+if (!(dep_1 || dep_2))
+BITSET_SET(no_incoming, i);
+}
+
+/* No next_job fields are set at the beginning, so L is implciitly the
+ * empty set. As next_job fields are filled, L is implicitly set. Tail
+ * is the tail of L, however. */
+
+struct mali_job_descriptor_header *tail = NULL;
+
+/* We iterate, popping off elements of S. A simple foreach won't do,
+ * since we mutate S as we go (even adding elements) */
+
+unsigned arr_size = BITSET_WORDS(node_count);
+
+for (unsigned node_n_1 = __bitset_ffs(no_incoming, arr_size);
+(node_n_1 != 0);
+node_n_1 = __bitset_ffs(no_incoming, arr_size)) {
+
+unsigned node_n = node_n_1 - 1;
+
+/* We've got a node n, pop it off */
+BITSET_CLEAR(no_incoming, node_n);
+
+/* Add it to the list */
+struct mali_job_descriptor_header *n =
+DESCRIPTOR_FOR_NODE(node_n);
+
+mali_ptr addr = GPU_ADDRESS_FOR_NODE(node_n);
+
+if (tail) {
+/* Link us to the last node */
+panfrost_set_job_next(tail, addr);
+} else {
+/* We are the first/last node */
+batch->first_job.cpu = (uint8_t *) n;
+batch->first_job.gpu = addr;
+}
+
+tail = n;
+
+/* Scan dependencies */
+for (unsigned node_m = 0; node_m < node_count; ++node_m) {
+struct mali_job_descriptor_header *m =
+DESCRIPTOR_FOR_NODE(node_m);
+
+/* Get the deps, accounting for removal */
+unsigned dep_1 = m->job_dependency_index_1;
+unsigned dep_2 = m->job_dependency_index_2;
+
+if (BITSET_TEST(edge_removal_1, node_m))
+dep_1 = 0;
+
+if (BITSET_TEST(edge_removal_2, node_m))
+dep_2 = 0;
+
+/* Pretend to remove edges */
+if (dep_1 == node_n_1) {
+BITSET_SET(edge_removal_1, node_m);
+dep_1 = 0;
+} else if (dep_2 == node_n_1) {
+BITSET_SET(edge_removal_2, node_m);
+dep_2 = 0;
+} else {
+/* This node has no relevant dependencies */
+continue;
+}
+
+/* Are there edges left? If not, add us to S */
+bool has_edges = dep_1 || dep_2;
+
+if (!has_edges)
+BITSET_SET(no_incoming, node_m);
+}
+}
+
+}



This is excelent work, thanks!

Reviewed-by: Tomeu Vizoso 

Regards,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: ci: Fix parsing of crashed tests

2019-06-21 Thread Tomeu Vizoso
Without this fix, LAVA isn't parsing crashes as failed tests, because
the shell logging is interspersed within the fake deqp output.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/deqp-runner.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
index 8645f75080e6..0b11202c1086 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
+++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
@@ -46,8 +46,8 @@ while [ -s /tmp/case-list.txt ]; do
sed -i "0,/^$crashed_test$/d" /tmp/case-list.txt
 
# So LAVA knows what happened
-   echo "Test case '$crashed_test'.."
-   echo "  Crash"
+   echo "Test case '$crashed_test'..
+ Crash"
else
# Consume a whole batch
sed -i '1,'$BATCH_SIZE'd' /tmp/case-list.txt
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/3] panfrost: Print a backtrace if there is one

2019-06-21 Thread Tomeu Vizoso

On 6/21/19 12:23 PM, Rohan Garg wrote:

Hey

Good stuff, but isn't this change making us hit assertions?


Hm, I thought it only enabled debugging symbols. Do you have a recommendation
on how to enable debug symbols but not enabling assertions?


I think assertions should be limited to the most basic of sanity checks, 
and the other asserts replaced by proper error handling.


Cheers,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 2/3] panfrost: Make the gitlab-ci.yml file more robust

2019-06-20 Thread Tomeu Vizoso

On 6/20/19 6:33 PM, Rohan Garg wrote:

Not sure I understand how this works. Isn't this going to cause
unnecessary container builds?

And, why cannot developers just add whatever they want to DEBIAN_TAG
to that end?



This will spin a container for each branch, yes, though I think that is
how it should be.


Well, things are like this right now precisely because people wanted to 
avoid what you are proposing. I would be quite sad if every time I push a 
new branch I had to wait for the container to be rebuilt. Also note that 
this is how other projects based on wayland/ci-templates work, including 
the rest of mesa.



The patch allows for someone working in a branch to
( if the need be ) customize their containers for their branch.


As I said, you can easily do that atm by just updating DEBIAN_TAG.


To that extent, I've simply enabled the CI to auto generate a DEBIAN_TAG
which depends on the branch name so that a developer doesn't have to change
the DEBIAN_TAG themselves.


But, why is that such a problem?

Cheers,

Tomeu


Cheers
Rohan Garg

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: ci: Update expectations

2019-06-20 Thread Tomeu Vizoso
These tests have been fixed recently.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/expected-failures.txt | 54 ---
 1 file changed, 54 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt 
b/src/gallium/drivers/panfrost/ci/expected-failures.txt
index 350d4b529ff0..b5d3d430c30b 100644
--- a/src/gallium/drivers/panfrost/ci/expected-failures.txt
+++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt
@@ -546,60 +546,6 @@ 
dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba5551_2d
 
dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba5551_cube
 dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba_2d
 
dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba_cube
-dEQP-GLES2.functional.texture.units.2_units.mixed.5
-dEQP-GLES2.functional.texture.units.2_units.only_2d.1
-dEQP-GLES2.functional.texture.units.2_units.only_2d.5
-dEQP-GLES2.functional.texture.units.2_units.only_2d.6
-dEQP-GLES2.functional.texture.units.2_units.only_2d.8
-dEQP-GLES2.functional.texture.units.4_units.mixed.1
-dEQP-GLES2.functional.texture.units.4_units.mixed.3
-dEQP-GLES2.functional.texture.units.4_units.mixed.9
-dEQP-GLES2.functional.texture.units.4_units.only_2d.0
-dEQP-GLES2.functional.texture.units.4_units.only_2d.1
-dEQP-GLES2.functional.texture.units.4_units.only_2d.2
-dEQP-GLES2.functional.texture.units.4_units.only_2d.3
-dEQP-GLES2.functional.texture.units.4_units.only_2d.5
-dEQP-GLES2.functional.texture.units.4_units.only_2d.6
-dEQP-GLES2.functional.texture.units.4_units.only_2d.7
-dEQP-GLES2.functional.texture.units.4_units.only_2d.8
-dEQP-GLES2.functional.texture.units.8_units.mixed.0
-dEQP-GLES2.functional.texture.units.8_units.mixed.1
-dEQP-GLES2.functional.texture.units.8_units.mixed.2
-dEQP-GLES2.functional.texture.units.8_units.mixed.3
-dEQP-GLES2.functional.texture.units.8_units.mixed.5
-dEQP-GLES2.functional.texture.units.8_units.mixed.6
-dEQP-GLES2.functional.texture.units.8_units.mixed.7
-dEQP-GLES2.functional.texture.units.8_units.mixed.8
-dEQP-GLES2.functional.texture.units.8_units.mixed.9
-dEQP-GLES2.functional.texture.units.8_units.only_2d.0
-dEQP-GLES2.functional.texture.units.8_units.only_2d.1
-dEQP-GLES2.functional.texture.units.8_units.only_2d.2
-dEQP-GLES2.functional.texture.units.8_units.only_2d.3
-dEQP-GLES2.functional.texture.units.8_units.only_2d.5
-dEQP-GLES2.functional.texture.units.8_units.only_2d.6
-dEQP-GLES2.functional.texture.units.8_units.only_2d.7
-dEQP-GLES2.functional.texture.units.8_units.only_2d.8
-dEQP-GLES2.functional.texture.units.8_units.only_cube.2
-dEQP-GLES2.functional.texture.units.all_units.mixed.0
-dEQP-GLES2.functional.texture.units.all_units.mixed.1
-dEQP-GLES2.functional.texture.units.all_units.mixed.2
-dEQP-GLES2.functional.texture.units.all_units.mixed.3
-dEQP-GLES2.functional.texture.units.all_units.mixed.4
-dEQP-GLES2.functional.texture.units.all_units.mixed.5
-dEQP-GLES2.functional.texture.units.all_units.mixed.6
-dEQP-GLES2.functional.texture.units.all_units.mixed.7
-dEQP-GLES2.functional.texture.units.all_units.mixed.8
-dEQP-GLES2.functional.texture.units.all_units.mixed.9
-dEQP-GLES2.functional.texture.units.all_units.only_2d.0
-dEQP-GLES2.functional.texture.units.all_units.only_2d.1
-dEQP-GLES2.functional.texture.units.all_units.only_2d.2
-dEQP-GLES2.functional.texture.units.all_units.only_2d.3
-dEQP-GLES2.functional.texture.units.all_units.only_2d.4
-dEQP-GLES2.functional.texture.units.all_units.only_2d.5
-dEQP-GLES2.functional.texture.units.all_units.only_2d.6
-dEQP-GLES2.functional.texture.units.all_units.only_2d.7
-dEQP-GLES2.functional.texture.units.all_units.only_2d.8
-dEQP-GLES2.functional.texture.units.all_units.only_2d.9
 dEQP-GLES2.functional.texture.units.all_units.only_cube.8
 
dEQP-GLES2.functional.texture.vertex.2d.filtering.linear_mipmap_linear_linear_clamp
 
dEQP-GLES2.functional.texture.vertex.2d.filtering.linear_mipmap_linear_linear_mirror
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Skip shading unaffected tiles

2019-06-20 Thread Tomeu Vizoso
On Thu, 20 Jun 2019 at 16:56, Alyssa Rosenzweig
 wrote:
>
> > Isn't enough with ctx->blitter->running ?
>
> What if we're legitimately blitting something?

Forgot about that.

Reviewed-by: Tomeu Vizoso 

Thanks!

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Skip shading unaffected tiles

2019-06-20 Thread Tomeu Vizoso

On 6/20/19 4:18 PM, Alyssa Rosenzweig wrote:

Looking at the scissor, we can discard some tiles. We specifially don't
care about the scissor on the wallpaper, since that's a no-op if the
entire tile is culled.

Signed-off-by: Alyssa Rosenzweig 
---
  src/gallium/drivers/panfrost/pan_context.c  |  9 +
  src/gallium/drivers/panfrost/pan_context.h  |  1 +
  src/gallium/drivers/panfrost/pan_fragment.c |  6 --
  src/gallium/drivers/panfrost/pan_job.c  | 22 +
  src/gallium/drivers/panfrost/pan_job.h  | 11 +++
  5 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index e4a04dd821f..e543542d4fc 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1372,6 +1372,13 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, 
bool with_vertex_data)
  miny = MIN2(ctx->pipe_framebuffer.height, miny);
  maxy = MIN2(ctx->pipe_framebuffer.height, maxy);
  
+/* Update the job, unless we're doing wallpapering (whose lack of

+ * scissor we can ignore, since if we "miss" a tile of wallpaper, it'll
+ * just... be faster :) */
+
+if (!ctx->in_wallpaper)


Isn't enough with ctx->blitter->running ?

Cheers,

Tomeu


+panfrost_job_union_scissor(job, minx, miny, maxx, maxy);
+
  /* Upload */
  
  view.viewport0[0] = minx;

@@ -1466,7 +1473,9 @@ panfrost_draw_wallpaper(struct pipe_context *pipe)
return;
  
  /* Blit the wallpaper in */

+ctx->in_wallpaper = true;
  panfrost_blit_wallpaper(ctx);
+ctx->in_wallpaper = false;
  
  /* We are flushing all queued draws and we know that no more jobs will

   * be added until the next frame.
diff --git a/src/gallium/drivers/panfrost/pan_context.h 
b/src/gallium/drivers/panfrost/pan_context.h
index d0365310223..deba4668767 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -201,6 +201,7 @@ struct panfrost_context {
  
  struct primconvert_context *primconvert;

  struct blitter_context *blitter;
+bool in_wallpaper;
  
  struct panfrost_blend_state *blend;
  
diff --git a/src/gallium/drivers/panfrost/pan_fragment.c b/src/gallium/drivers/panfrost/pan_fragment.c

index ea0bd6cebdf..70358fec3f3 100644
--- a/src/gallium/drivers/panfrost/pan_fragment.c
+++ b/src/gallium/drivers/panfrost/pan_fragment.c
@@ -46,9 +46,11 @@ panfrost_fragment_job(struct panfrost_context *ctx, bool 
has_draws)
  #endif
  };
  
+struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);

+
  struct mali_payload_fragment payload = {
-.min_tile_coord = MALI_COORDINATE_TO_TILE_MIN(0, 0),
-.max_tile_coord = 
MALI_COORDINATE_TO_TILE_MAX(ctx->pipe_framebuffer.width, 
ctx->pipe_framebuffer.height),
+.min_tile_coord = MALI_COORDINATE_TO_TILE_MIN(job->minx, 
job->miny),
+.max_tile_coord = MALI_COORDINATE_TO_TILE_MAX(job->maxx, 
job->maxy),
  .framebuffer = framebuffer,
  };
  
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c

index 96f05c66354..cf64d2862c9 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -38,6 +38,9 @@ panfrost_create_job(struct panfrost_context *ctx)
  job->bos = _mesa_set_create(job,
  _mesa_hash_pointer,
  _mesa_key_pointer_equal);
+
+job->minx = job->miny = ~0;
+job->maxx = job->maxy = 0;
   
  return job;

  }
@@ -233,6 +236,11 @@ panfrost_job_clear(struct panfrost_context *ctx,
  }
  
  job->clear |= buffers;

+
+/* Clearing affects the entire framebuffer */
+panfrost_job_union_scissor(job, 0, 0,
+ctx->pipe_framebuffer.width,
+ctx->pipe_framebuffer.height);
  }
  
  void

@@ -266,6 +274,20 @@ panfrost_job_hash(const void *key)
  return _mesa_hash_data(key, sizeof(struct panfrost_job_key));
  }
  
+/* Given a new bounding rectangle (scissor), let the job cover the union of the

+ * new and old bounding rectangles */
+
+void
+panfrost_job_union_scissor(struct panfrost_job *job,
+unsigned minx, unsigned miny,
+unsigned maxx, unsigned maxy)
+{
+job->minx = MIN2(job->minx, minx);
+job->miny = MIN2(job->miny, miny);
+job->maxx = MAX2(job->maxx, maxx);
+job->maxy = MAX2(job->maxy, maxy);
+}
+
  void
  panfrost_job_init(struct panfrost_context *ctx)
  {
diff --git a/src/gallium/drivers/panfrost/pan_job.h 
b/src/gallium/drivers/panfrost/pan_job.h
index 2e7c0532341..ed8b084246a 100644
--- a/src/gallium/drivers/panfrost/pan_job.h
+++ 

Re: [Mesa-dev] [PATCH 2/3] panfrost: Make the gitlab-ci.yml file more robust

2019-06-20 Thread Tomeu Vizoso
On Thu, 20 Jun 2019 at 15:59, Rohan Garg  wrote:
>
> This enables developers to add packages to the container
> when working on their own branches by creating
> a container tag which features the branch name.

Not sure I understand how this works. Isn't this going to cause
unnecessary container builds?

And, why cannot developers just add whatever they want to DEBIAN_TAG
to that end?

> Dropped the IMAGE_LOCAL variable since I did not see it being
> used anywhere.

Cool.

Thanks,

Tomeu

> ---
>  src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
> b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
> index 887c93dbc8b..7be53d623d6 100644
> --- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
> +++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
> @@ -16,7 +16,8 @@
>  variables:
>UPSTREAM_REPO: mesa/mesa
>DEBIAN_VERSION: testing-slim
> -  DEBIAN_TAG: "2019-06-17-1"
> +  REV: 2019-06-17-1
> +  DEBIAN_TAG: "${CI_COMMIT_REF_SLUG}_${DEBIAN_ARCH}_${REV}"
>
>  include:
>- project: 'wayland/ci-templates'
> @@ -42,7 +43,6 @@ stages:
><<: *retry
>variables:
>  GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the 
> image
> -IMAGE_LOCAL: "$CI_REGISTRY/$CI_PROJECT_PATH/${DEBIAN_ARCH}:latest"
>  DEBIAN_EXEC: 'DEBIAN_ARCH=${DEBIAN_ARCH}
>GCC_ARCH=${GCC_ARCH}
>KERNEL_ARCH=${KERNEL_ARCH}
> @@ -73,7 +73,7 @@ container:arm64:
>
>  .build:
>stage: build
> -  image: $CI_REGISTRY/$CI_PROJECT_PATH/${DEBIAN_ARCH}:latest
> +  image: "$CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG"
>cache:
>  paths:
>- ccache
> --
> 2.17.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 3/3] panfrost: The working dir is deleted right before

2019-06-20 Thread Tomeu Vizoso
Good commit, but the "what" should be in the subject line and the
"why" in the body.

With that change:

Reviewed-by: Tomeu Vizoso 

Thanks,

Tomeu

On Thu, 20 Jun 2019 at 15:59, Rohan Garg  wrote:
>
> Change to /artifacts in order to potentially fix
> debootstrap failiures.
> ---
>  src/gallium/drivers/panfrost/ci/debian-install.sh | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/gallium/drivers/panfrost/ci/debian-install.sh 
> b/src/gallium/drivers/panfrost/ci/debian-install.sh
> index 8a8b4ec9a47..dca6d49197c 100644
> --- a/src/gallium/drivers/panfrost/ci/debian-install.sh
> +++ b/src/gallium/drivers/panfrost/ci/debian-install.sh
> @@ -118,6 +118,7 @@ rm -rf /kernel
>
>
>  ### Create rootfs
> +cd /artifacts
>  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
> --
> 2.17.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/3] panfrost: Print a backtrace if there is one

2019-06-20 Thread Tomeu Vizoso
On Thu, 20 Jun 2019 at 15:59, Rohan Garg  wrote:
>
> ---
>  src/gallium/drivers/panfrost/ci/create-rootfs.sh | 2 +-
>  src/gallium/drivers/panfrost/ci/deqp-runner.sh   | 6 ++
>  src/gallium/drivers/panfrost/ci/gitlab-ci.yml| 4 ++--
>  src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 | 3 +++
>  4 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/ci/create-rootfs.sh 
> b/src/gallium/drivers/panfrost/ci/create-rootfs.sh
> index 84ce8cdc882..ff0742238fe 100644
> --- a/src/gallium/drivers/panfrost/ci/create-rootfs.sh
> +++ b/src/gallium/drivers/panfrost/ci/create-rootfs.sh
> @@ -2,7 +2,7 @@
>
>  set -ex
>
> -apt-get -y install --no-install-recommends initramfs-tools libpng16-16 
> weston strace libsensors5
> +apt-get -y install --no-install-recommends initramfs-tools libpng16-16 
> weston strace libsensors5 gdb
>  passwd root -d
>  chsh -s /bin/sh
>  ln -s /bin/sh /init
> diff --git a/src/gallium/drivers/panfrost/ci/deqp-runner.sh 
> b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
> index 8645f75080e..47eef89a0d0 100644
> --- a/src/gallium/drivers/panfrost/ci/deqp-runner.sh
> +++ b/src/gallium/drivers/panfrost/ci/deqp-runner.sh
> @@ -53,3 +53,9 @@ while [ -s /tmp/case-list.txt ]; do
> sed -i '1,'$BATCH_SIZE'd' /tmp/case-list.txt
> fi
>  done
> +
> +if [ -e /tmp/core ]; then
> +   /usr/bin/gdb /usr/bin/weston /tmp/core \
> +   -batch \
> +   -ex "t a a bt"
> +fi
> diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
> b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
> index e1035e0fdff..887c93dbc8b 100644
> --- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
> +++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
> @@ -16,7 +16,7 @@
>  variables:
>UPSTREAM_REPO: mesa/mesa
>DEBIAN_VERSION: testing-slim
> -  DEBIAN_TAG: "2019-06-07-1"
> +  DEBIAN_TAG: "2019-06-17-1"
>
>  include:
>- project: 'wayland/ci-templates'
> @@ -91,7 +91,7 @@ container:arm64:
>  - meson . mesa-build
>  --cross-file /tmp/cross_file.txt
>  --libdir /artifacts/rootfs/mesa/lib/
> ---buildtype release
> +--buildtype debug

Good stuff, but isn't this change making us hit assertions?

Cheers,

Tomeu

>  -Dgallium-drivers=kmsro,panfrost
>  -Ddri-drivers=
>  -Dprefix=/artifacts/rootfs/mesa
> diff --git a/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2 
> b/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
> index f610f9c826a..8f3d516da76 100644
> --- a/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
> +++ b/src/gallium/drivers/panfrost/ci/lava-deqp.yml.jinja2
> @@ -52,6 +52,9 @@ actions:
>- mount -t devpts devpts /dev/pts
>- echo 1 > /proc/sys/kernel/printk
>  #  - echo performance > 
> /sys/devices/platform/ff9a.gpu/devfreq/devfreq0/governor
> +  - echo /tmp/core > /proc/sys/kernel/core_pattern
> +  - echo 0 > /proc/sys/kernel/core_uses_pid
> +  - ulimit -c unlimited
>- sh /deqp/deqp-runner.sh
>  parse:
>pattern: 'Test case 
> ''(?P\S*)''..\s+(?P(Pass|NotSupported|QualityWarning|CompatibilityWarning|Fail|ResourceError|Crash|Timeout|InternalError))'
> --
> 2.17.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: Set job requirements during draw

2019-06-20 Thread Tomeu Vizoso
Right now we are doing it at a moment when we don't have all the
information we need.

Signed-off-by: Tomeu Vizoso 
Suggested-by: Alyssa Rosenzweig 
Cc: Rohan Garg 
Fixes: bfca21b622df ("panfrost: Figure out job requirements in pan_job.c")
---
 src/gallium/drivers/panfrost/pan_context.c | 2 ++
 src/gallium/drivers/panfrost/pan_job.c | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index 470a259419b6..d33c9331e67d 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1056,6 +1056,8 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool 
with_vertex_data)
 SET_BIT(ctx->fragment_shader_core.unknown2_4, MALI_NO_MSAA, 
!msaa);
 }
 
+   panfrost_job_set_requirements(ctx, job);
+
 if (ctx->occlusion_query) {
 ctx->payload_tiler.gl_enables |= MALI_OCCLUSION_QUERY | 
MALI_OCCLUSION_PRECISE;
 ctx->payload_tiler.postfix.occlusion_counter = 
ctx->occlusion_query->transfer.gpu;
diff --git a/src/gallium/drivers/panfrost/pan_job.c 
b/src/gallium/drivers/panfrost/pan_job.c
index 717676021b44..9c5d385e2ef2 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -90,7 +90,6 @@ panfrost_get_job(struct panfrost_context *ctx,
 
 memcpy(>key, , sizeof(key));
 _mesa_hash_table_insert(ctx->jobs, >key, job);
-panfrost_job_set_requirements(ctx, job);
 
 return job;
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/3] Revert "panfrost/midgard: Enable autovectorization"

2019-06-20 Thread Tomeu Vizoso

On 6/20/19 3:28 PM, Alyssa Rosenzweig wrote:

NAK. There's a patch for this I pushed to your repo which should fix
these regressions (they were legitimate bugs that had nothing to do with
autovectorization and would have cropped up anyhow).


You mean this commit?

https://gitlab.freedesktop.org/tomeu/mesa/commit/87b18087168718678bc818ca6869e031ddd90ca4

That one seems to introduce quite a few other regressions.

Thanks,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 3/3] panfrost: Allocate panfrost_job in panfrost_context

2019-06-20 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_job.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_job.c 
b/src/gallium/drivers/panfrost/pan_job.c
index 14efa71fb055..ecc0ac7be8e1 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -31,7 +31,7 @@
 struct panfrost_job *
 panfrost_create_job(struct panfrost_context *ctx)
 {
-struct panfrost_job *job = rzalloc(NULL, struct panfrost_job);
+struct panfrost_job *job = rzalloc(ctx, struct panfrost_job);
 
 job->ctx = ctx;
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/3] panfrost: Move ra_regs to the screen context

2019-06-20 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/midgard/compiler.h   |   2 +
 .../panfrost/midgard/midgard_compile.c|  13 +-
 .../panfrost/midgard/midgard_compile.h|  17 ++-
 .../drivers/panfrost/midgard/midgard_ra.c | 116 ++
 .../panfrost/midgard/midgard_schedule.c   |   1 +
 src/gallium/drivers/panfrost/pan_assemble.c   |   6 +-
 .../drivers/panfrost/pan_blend_shaders.c  |   5 +-
 src/gallium/drivers/panfrost/pan_screen.c |   1 +
 src/gallium/drivers/panfrost/pan_screen.h |   2 +
 9 files changed, 104 insertions(+), 59 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/compiler.h 
b/src/gallium/drivers/panfrost/midgard/compiler.h
index 4c2202711b1a..7299bc5c1826 100644
--- a/src/gallium/drivers/panfrost/midgard/compiler.h
+++ b/src/gallium/drivers/panfrost/midgard/compiler.h
@@ -180,6 +180,7 @@ typedef struct midgard_bundle {
 } midgard_bundle;
 
 typedef struct compiler_context {
+struct midgard_compiler *compiler;
 nir_shader *nir;
 gl_shader_stage stage;
 
@@ -425,6 +426,7 @@ void schedule_program(compiler_context *ctx);
 
 struct ra_graph;
 
+void init_regsets(struct midgard_compiler *compiler);
 struct ra_graph* allocate_registers(compiler_context *ctx);
 void install_registers(compiler_context *ctx, struct ra_graph *g);
 bool mir_is_live_after(compiler_context *ctx, midgard_block *block, 
midgard_instruction *start, int src);
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c 
b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 0c8032cc80bf..ce290a11cb4c 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -2442,13 +2442,15 @@ midgard_get_first_tag_from_block(compiler_context *ctx, 
unsigned block_idx)
 }
 
 int
-midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool 
is_blend)
+midgard_compile_shader_nir(struct midgard_compiler *compiler, nir_shader *nir,
+   midgard_program *program, bool is_blend)
 {
 struct util_dynarray *compiled = >compiled;
 
midgard_debug = debug_get_option_midgard_debug();
 
 compiler_context ictx = {
+.compiler = compiler,
 .nir = nir,
 .stage = nir->info.stage,
 
@@ -2758,3 +2760,12 @@ midgard_compile_shader_nir(nir_shader *nir, 
midgard_program *program, bool is_bl
 
 return 0;
 }
+
+struct midgard_compiler *midgard_compiler_create(const void *ctx)
+{
+struct midgard_compiler *compiler = rzalloc(ctx, struct 
midgard_compiler);
+
+init_regsets(compiler);
+
+return compiler;
+}
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.h 
b/src/gallium/drivers/panfrost/midgard/midgard_compile.h
index 44c3533b6de3..f3b23381ad51 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.h
@@ -54,6 +54,16 @@ enum {
 #define PAN_SYSVAL_ID_TO_TXS_DIM(id)(((id) >> 7) & 0x3)
 #define PAN_SYSVAL_ID_TO_TXS_IS_ARRAY(id)   !!((id) & (1 << 9))
 
+#define REGS_VARIANTS_COUNT 8
+
+struct midgard_compiler {
+struct ra_regs *regs[REGS_VARIANTS_COUNT];
+int work_vec1;
+int work_vec2;
+int work_vec3;
+int work_vec4;
+};
+
 typedef struct {
 int work_register_count;
 int uniform_count;
@@ -87,8 +97,11 @@ typedef struct {
 float alpha_ref;
 } midgard_program;
 
-int
-midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool 
is_blend);
+struct midgard_compiler *midgard_compiler_create(const void *ctx);
+
+int midgard_compile_shader_nir(struct midgard_compiler *compiler,
+   nir_shader *nir, midgard_program *program,
+   bool is_blend);
 
 /* NIR options are shared between the standalone compiler and the online
  * compiler. Defining it here is the simplest, though maybe not the Right
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_ra.c 
b/src/gallium/drivers/panfrost/midgard/midgard_ra.c
index 7fd5e5b49e3f..60b17c832d3c 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_ra.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_ra.c
@@ -212,60 +212,6 @@ index_to_reg(compiler_context *ctx, struct ra_graph *g, 
int reg)
 struct ra_graph *
 allocate_registers(compiler_context *ctx)
 {
-/* The number of vec4 work registers available depends on when the
- * uniforms start, so compute that first */
-
-int work_count = 16 - MAX2((ctx->uniform_cutoff - 8), 0);
-
-int virtual_count = work_count * WORK_STRIDE;
-
-/* First, initialize the RA */
-struct ra_regs *regs = ra_alloc_reg_set(NULL, virtual_count, true);
-
-int work_vec4 = ra_alloc_reg_class(regs);
-int work_vec3 = ra_alloc_reg_class(regs);
-int work_v

[Mesa-dev] [PATCH 2/3] panfrost: Release transient pools

2019-06-20 Thread Tomeu Vizoso
Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index 7c0ba679dd91..78976facda3d 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -2530,6 +2530,13 @@ panfrost_destroy(struct pipe_context *pipe)
 screen->driver->free_slab(screen, >shaders);
 screen->driver->free_slab(screen, >tiler_heap);
 screen->driver->free_slab(screen, >tiler_polygon_list);
+screen->driver->free_slab(screen, >tiler_dummy);
+
+for (int i = 0; i < ARRAY_SIZE(panfrost->transient_pools); ++i) {
+struct panfrost_memory_entry *entry;
+entry = panfrost->transient_pools[i].entries[0];
+pb_slab_free(>slabs, (struct pb_slab_entry *)entry);
+}
 
 ralloc_free(pipe);
 }
@@ -2688,7 +2695,6 @@ panfrost_setup_hardware(struct panfrost_context *ctx)
 screen->driver->allocate_slab(screen, >tiler_heap, 32768, false, 
PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_GROWABLE, 1, 128);
 screen->driver->allocate_slab(screen, >tiler_polygon_list, 
128*128, false, PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_GROWABLE, 1, 128);
 screen->driver->allocate_slab(screen, >tiler_dummy, 1, false, 
PAN_ALLOCATE_INVISIBLE, 0, 0);
-
 }
 
 /* New context creation, which also does hardware initialisation since I don't
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 0/3] panfrost: Fix a few memory leaks

2019-06-20 Thread Tomeu Vizoso
Hi,

we often OOM when trying to run test suites as the leaks quickly
accumulate.

With these patches things get much better.

Thanks,

Tomeu

Tomeu Vizoso (3):
  panfrost: Move ra_regs to the screen context
  panfrost: Release transient pools
  panfrost: Allocate panfrost_job in panfrost_context

 .../drivers/panfrost/midgard/compiler.h   |   2 +
 .../panfrost/midgard/midgard_compile.c|  13 +-
 .../panfrost/midgard/midgard_compile.h|  17 ++-
 .../drivers/panfrost/midgard/midgard_ra.c | 116 ++
 .../panfrost/midgard/midgard_schedule.c   |   1 +
 src/gallium/drivers/panfrost/pan_assemble.c   |   6 +-
 .../drivers/panfrost/pan_blend_shaders.c  |   5 +-
 src/gallium/drivers/panfrost/pan_context.c|   8 +-
 src/gallium/drivers/panfrost/pan_job.c|   2 +-
 src/gallium/drivers/panfrost/pan_screen.c |   1 +
 src/gallium/drivers/panfrost/pan_screen.h |   2 +
 11 files changed, 112 insertions(+), 61 deletions(-)

-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 3/3] panfrost: ci: Exclude flip-flops from results

2019-06-20 Thread Tomeu Vizoso
These tests are failing at times, blacklist for now:

dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear.tex2d_rgba
dEQP-GLES2.functional.fbo.render.shared_colorbuffer_clear.tex2d_rgb
dEQP-GLES2.functional.shaders.matrix.mul.dynamic_highp_mat4_vec4_vertex

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 5bab95465ff8..e1035e0fdffc 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -183,6 +183,8 @@ build:arm64:
 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
@@ -197,6 +199,7 @@ build:arm64:
 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
@@ -228,7 +231,7 @@ build:arm64:
 - 'echo "Passed: $PASSED ($(expr $PASSED \* 100 / $TOTAL)%)"'
 - 'echo "Failed: $FAILED ($(expr $FAILED \* 100 / $TOTAL)%)"'
 - 'echo "Total: $TOTAL"'
-- 'if [ $TOTAL != 16375 ]; then echo "WARNING: Unexpected count of 
results. Incomplete run?"; fi'
+- 'if [ $TOTAL != 16372 ]; 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
 - diff -u results/expected-failures.txt results/failures-$lava_job_id.txt
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/3] Revert "panfrost: Figure out job requirements in pan_job.c"

2019-06-20 Thread Tomeu Vizoso
This reverts commit bfca21b622dfd2fcfe32494339aea9061070c7e5.
---
 src/gallium/drivers/panfrost/pan_context.c |  8 
 src/gallium/drivers/panfrost/pan_job.c | 12 
 src/gallium/drivers/panfrost/pan_job.h |  4 
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index e4a04dd821f5..7c0ba679dd91 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1056,6 +1056,14 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, 
bool with_vertex_data)
 SET_BIT(ctx->fragment_shader_core.unknown2_4, MALI_NO_MSAA, 
!msaa);
 }
 
+/* Enable job requirements at draw-time */
+
+if (msaa)
+job->requirements |= PAN_REQ_MSAA;
+
+if (ctx->depth_stencil->depth.writemask)
+job->requirements |= PAN_REQ_DEPTH_WRITE;
+
 if (ctx->occlusion_query) {
 ctx->payload_tiler.gl_enables |= MALI_OCCLUSION_QUERY | 
MALI_OCCLUSION_PRECISE;
 ctx->payload_tiler.postfix.occlusion_counter = 
ctx->occlusion_query->transfer.gpu;
diff --git a/src/gallium/drivers/panfrost/pan_job.c 
b/src/gallium/drivers/panfrost/pan_job.c
index 96f05c663540..14efa71fb055 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -90,7 +90,6 @@ panfrost_get_job(struct panfrost_context *ctx,
 
 memcpy(>key, , sizeof(key));
 _mesa_hash_table_insert(ctx->jobs, >key, job);
-panfrost_job_set_requirements(ctx, job);
 
 return job;
 }
@@ -166,17 +165,6 @@ panfrost_job_submit(struct panfrost_context *ctx, struct 
panfrost_job *job)
 ctx->tiler_job_count = 0;
 }
 
-void
-panfrost_job_set_requirements(struct panfrost_context *ctx,
- struct panfrost_job *job)
-{
-if (ctx->rasterizer && ctx->rasterizer->base.multisample)
-job->requirements |= PAN_REQ_MSAA;
-
-if (ctx->depth_stencil && ctx->depth_stencil->depth.writemask)
-job->requirements |= PAN_REQ_DEPTH_WRITE;
-}
-
 static uint32_t
 pan_pack_color(const union pipe_color_union *color, enum pipe_format format)
 {
diff --git a/src/gallium/drivers/panfrost/pan_job.h 
b/src/gallium/drivers/panfrost/pan_job.h
index 2e7c0532341b..ed63c9c404be 100644
--- a/src/gallium/drivers/panfrost/pan_job.h
+++ b/src/gallium/drivers/panfrost/pan_job.h
@@ -91,10 +91,6 @@ panfrost_flush_jobs_reading_resource(struct panfrost_context 
*panfrost,
 void
 panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_job *job);
 
-void
-panfrost_job_set_requirements(struct panfrost_context *ctx,
- struct panfrost_job *job);
-
 void
 panfrost_job_clear(struct panfrost_context *ctx,
 struct panfrost_job *job,
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/3] Revert "panfrost/midgard: Enable autovectorization"

2019-06-20 Thread Tomeu Vizoso
This reverts commit 9402970751ca04c4d6edb3a0441a4063a975295c.
---
 src/gallium/drivers/panfrost/midgard/midgard_compile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c 
b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 1cc551b603c7..0c8032cc80bf 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -476,7 +476,8 @@ optimise_nir(nir_shader *nir)
  nir_var_shader_out |
  nir_var_function_temp);
 
-NIR_PASS(progress, nir, nir_opt_vectorize);
+/* TODO: Enable vectorize when merged upstream */
+// NIR_PASS(progress, nir, nir_opt_vectorize);
 } while (progress);
 
 /* Must be run at the end to prevent creation of fsin/fcos ops */
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 0/3] Make CI green again

2019-06-20 Thread Tomeu Vizoso
Hi,

the two commits reverted introduced some regressions and don't have an
obvious fix, so I propose to revert them while we fix them properly.

I also add some tests to the ignore list because they pass and fail
randomly.

Thanks,

Tomeu

Tomeu Vizoso (3):
  Revert "panfrost/midgard: Enable autovectorization"
  Revert "panfrost: Figure out job requirements in pan_job.c"
  panfrost: ci: Exclude flip-flops from results

 src/gallium/drivers/panfrost/ci/gitlab-ci.yml|  5 -
 .../drivers/panfrost/midgard/midgard_compile.c   |  3 ++-
 src/gallium/drivers/panfrost/pan_context.c   |  8 
 src/gallium/drivers/panfrost/pan_job.c   | 12 
 src/gallium/drivers/panfrost/pan_job.h   |  4 
 5 files changed, 14 insertions(+), 18 deletions(-)

-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 9/9] panfrost: Enable sRGB

2019-06-19 Thread Tomeu Vizoso
On Wed, 19 Jun 2019 at 07:44, Tomeu Vizoso  wrote:
>
> On Tue, 18 Jun 2019 at 17:00, Alyssa Rosenzweig
>  wrote:
> >
> > Now that sRGB formats are supported for both rendering and sampling,
> > advertise support.
> >
> > Signed-off-by: Alyssa Rosenzweig 
>
> Hi there,
>
> this patch seems to have caused the following regressions:
>
> dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgb565
> dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb
>
> For more details, see 
> https://gitlab.freedesktop.org/tomeu/mesa/pipelines/43396
>
> Should we revert it for now?

Actually, I think this is the commit that introduced these regressions:

panfrost: Figure out job requirements in pan_job.c

Cheers,

Tomeu

> Cheers,
>
> Tomeu
>
> > ---
> >  src/gallium/drivers/panfrost/pan_screen.c | 4 
> >  1 file changed, 4 deletions(-)
> >
> > diff --git a/src/gallium/drivers/panfrost/pan_screen.c 
> > b/src/gallium/drivers/panfrost/pan_screen.c
> > index 9cd98cd9051..70bff565930 100644
> > --- a/src/gallium/drivers/panfrost/pan_screen.c
> > +++ b/src/gallium/drivers/panfrost/pan_screen.c
> > @@ -450,10 +450,6 @@ panfrost_is_format_supported( struct pipe_screen 
> > *screen,
> >  if (sample_count > 1)
> >  return FALSE;
> >
> > -   /* sRGB colorspace is not supported (yet?) */
> > -   if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
> > -   return FALSE;
> > -
> >  /* Format wishlist */
> >  if (format == PIPE_FORMAT_Z24X8_UNORM || format == 
> > PIPE_FORMAT_X8Z24_UNORM)
> >  return FALSE;
> > --
> > 2.20.1
> >
> > ___
> > mesa-dev mailing list
> > mesa-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 9/9] panfrost: Enable sRGB

2019-06-18 Thread Tomeu Vizoso
On Tue, 18 Jun 2019 at 17:00, Alyssa Rosenzweig
 wrote:
>
> Now that sRGB formats are supported for both rendering and sampling,
> advertise support.
>
> Signed-off-by: Alyssa Rosenzweig 

Hi there,

this patch seems to have caused the following regressions:

dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.no_rebind_rbo_rgb565
dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb

For more details, see https://gitlab.freedesktop.org/tomeu/mesa/pipelines/43396

Should we revert it for now?

Cheers,

Tomeu

> ---
>  src/gallium/drivers/panfrost/pan_screen.c | 4 
>  1 file changed, 4 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_screen.c 
> b/src/gallium/drivers/panfrost/pan_screen.c
> index 9cd98cd9051..70bff565930 100644
> --- a/src/gallium/drivers/panfrost/pan_screen.c
> +++ b/src/gallium/drivers/panfrost/pan_screen.c
> @@ -450,10 +450,6 @@ panfrost_is_format_supported( struct pipe_screen *screen,
>  if (sample_count > 1)
>  return FALSE;
>
> -   /* sRGB colorspace is not supported (yet?) */
> -   if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
> -   return FALSE;
> -
>  /* Format wishlist */
>  if (format == PIPE_FORMAT_Z24X8_UNORM || format == 
> PIPE_FORMAT_X8Z24_UNORM)
>  return FALSE;
> --
> 2.20.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 2/2] panfrost/midgard: Enable autovectorization

2019-06-18 Thread Tomeu Vizoso
Hi there,

this patch seems to have caused the following regressions:

+dEQP-GLES2.functional.shaders.conversions.vector_combine.bvec2_float_to_bvec3_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.float_bool_to_bvec2_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.float_float_float_to_bvec3_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.float_float_float_to_ivec3_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.float_float_to_bvec2_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.float_float_to_ivec2_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.int_int_int_to_bvec3_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.int_int_int_to_ivec3_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.int_int_to_bvec2_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.int_int_to_ivec2_fragment
+dEQP-GLES2.functional.shaders.conversions.vector_combine.vec2_bool_to_bvec3_fragment

For more details, see https://gitlab.freedesktop.org/tomeu/mesa/pipelines/43340

Should we revert it for now?

Cheers,

Tomeu

On Mon, 17 Jun 2019 at 20:37, Alyssa Rosenzweig
 wrote:
>
> Enable nir_opt_vectorize.
>
> Signed-off-by: Alyssa Rosenzweig 
> ---
>  src/gallium/drivers/panfrost/midgard/midgard_compile.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c 
> b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
> index cfb17572b35..69585ec421a 100644
> --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
> +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
> @@ -428,8 +428,7 @@ optimise_nir(nir_shader *nir)
>   nir_var_shader_out |
>   nir_var_function_temp);
>
> -/* TODO: Enable vectorize when merged upstream */
> -// NIR_PASS(progress, nir, nir_opt_vectorize);
> +NIR_PASS(progress, nir, nir_opt_vectorize);
>  } while (progress);
>
>  /* Must be run at the end to prevent creation of fsin/fcos ops */
> --
> 2.20.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: Move to use ralloc for some allocations

2019-06-18 Thread Tomeu Vizoso
We have some serious leaks, so plug some and also move to ralloc to
limit the lifetime of some objects to that of their parent.

Lots more such work to do.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.c  | 24 +++--
 src/gallium/drivers/panfrost/pan_drm.c  |  2 +-
 src/gallium/drivers/panfrost/pan_job.c  |  6 ++--
 src/gallium/drivers/panfrost/pan_resource.c | 39 -
 src/gallium/drivers/panfrost/pan_resource.h |  1 +
 src/gallium/drivers/panfrost/pan_screen.c   |  8 +++--
 6 files changed, 44 insertions(+), 36 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index 7f5741da48e8..5dcd41c459b8 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -2006,7 +2006,7 @@ panfrost_set_constant_buffer(
 pbuf->size = sz;
 
 if (pbuf->buffer) {
-free(pbuf->buffer);
+ralloc_free(pbuf->buffer);
 pbuf->buffer = NULL;
 }
 
@@ -2033,7 +2033,7 @@ panfrost_set_constant_buffer(
 
 /* Copy the constant buffer into the driver context for later upload */
 
-pbuf->buffer = malloc(sz);
+pbuf->buffer = rzalloc_size(ctx, sz);
 memcpy(pbuf->buffer, cpu + buf->buffer_offset, sz);
 }
 
@@ -2055,7 +2055,7 @@ panfrost_create_sampler_view(
 struct pipe_resource *texture,
 const struct pipe_sampler_view *template)
 {
-struct panfrost_sampler_view *so = 
CALLOC_STRUCT(panfrost_sampler_view);
+struct panfrost_sampler_view *so = rzalloc(pctx, struct 
panfrost_sampler_view);
 int bytes_per_pixel = util_format_get_blocksize(texture->format);
 
 pipe_reference(NULL, >reference);
@@ -2193,7 +2193,7 @@ panfrost_sampler_view_destroy(
 struct pipe_sampler_view *view)
 {
 pipe_resource_reference(>texture, NULL);
-free(view);
+ralloc_free(view);
 }
 
 static void
@@ -2286,7 +2286,7 @@ panfrost_create_blend_state(struct pipe_context *pipe,
 const struct pipe_blend_state *blend)
 {
 struct panfrost_context *ctx = pan_context(pipe);
-struct panfrost_blend_state *so = CALLOC_STRUCT(panfrost_blend_state);
+struct panfrost_blend_state *so = rzalloc(ctx, struct 
panfrost_blend_state);
 so->base = *blend;
 
 /* TODO: The following features are not yet implemented */
@@ -2336,7 +2336,7 @@ panfrost_delete_blend_state(struct pipe_context *pipe,
 DBG("Deleting blend state leak blend shaders bytecode\n");
 }
 
-free(blend);
+ralloc_free(blend);
 }
 
 static void
@@ -2482,6 +2482,8 @@ panfrost_destroy(struct pipe_context *pipe)
 screen->driver->free_slab(screen, >shaders);
 screen->driver->free_slab(screen, >tiler_heap);
 screen->driver->free_slab(screen, >tiler_polygon_list);
+
+ralloc_free(pipe);
 }
 
 static struct pipe_query *
@@ -2489,7 +2491,7 @@ panfrost_create_query(struct pipe_context *pipe,
  unsigned type,
  unsigned index)
 {
-struct panfrost_query *q = CALLOC_STRUCT(panfrost_query);
+struct panfrost_query *q = rzalloc(pipe, struct panfrost_query);
 
 q->type = type;
 q->index = index;
@@ -2500,7 +2502,7 @@ panfrost_create_query(struct pipe_context *pipe,
 static void
 panfrost_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
 {
-FREE(q);
+ralloc_free(q);
 }
 
 static boolean
@@ -2584,7 +2586,7 @@ panfrost_create_stream_output_target(struct pipe_context 
*pctx,
 {
 struct pipe_stream_output_target *target;
 
-target = CALLOC_STRUCT(pipe_stream_output_target);
+target = rzalloc(pctx, struct pipe_stream_output_target);
 
 if (!target)
 return NULL;
@@ -2604,7 +2606,7 @@ panfrost_stream_output_target_destroy(struct pipe_context 
*pctx,
  struct pipe_stream_output_target *target)
 {
 pipe_resource_reference(>buffer, NULL);
-free(target);
+ralloc_free(target);
 }
 
 static void
@@ -2647,7 +2649,7 @@ panfrost_setup_hardware(struct panfrost_context *ctx)
 struct pipe_context *
 panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
 {
-struct panfrost_context *ctx = CALLOC_STRUCT(panfrost_context);
+struct panfrost_context *ctx = rzalloc(screen, struct 
panfrost_context);
 struct panfrost_screen *pscreen = pan_screen(screen);
 memset(ctx, 0, sizeof(*ctx));
 struct pipe_context *gallium = (struct pipe_context *) ctx;
diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index e2f4f2437d30..3b2733a562e4 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src

Re: [Mesa-dev] [PATCH] panfrost: ci: Update results

2019-06-18 Thread Tomeu Vizoso
On Tue, 18 Jun 2019 at 15:19, Alyssa Rosenzweig
 wrote:
>
> Not sure what would have fixed any of these but sure, A-b, I won't say
> no to fixed tests ^_^
>
> What about the fragment_ops.scissor.* tests?

Don't know, what about them? They seem to pass.

Cheers,

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: ci: Update results

2019-06-18 Thread Tomeu Vizoso
Alyssa fixed some failing tests last night.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/expected-failures.txt | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt 
b/src/gallium/drivers/panfrost/ci/expected-failures.txt
index ded1cc18ab05..cd86b1c66381 100644
--- a/src/gallium/drivers/panfrost/ci/expected-failures.txt
+++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt
@@ -59,11 +59,7 @@ 
dEQP-GLES2.functional.fbo.render.resize.rbo_rgb5_a1_stencil_index8
 dEQP-GLES2.functional.fbo.render.resize.rbo_rgba4
 dEQP-GLES2.functional.fbo.render.resize.rbo_rgba4_depth_component16
 dEQP-GLES2.functional.fbo.render.resize.rbo_rgba4_stencil_index8
-dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb
-dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb_depth_component16
 dEQP-GLES2.functional.fbo.render.resize.tex2d_rgb_stencil_index8
-dEQP-GLES2.functional.fbo.render.resize.tex2d_rgba
-dEQP-GLES2.functional.fbo.render.resize.tex2d_rgba_depth_component16
 dEQP-GLES2.functional.fbo.render.resize.tex2d_rgba_stencil_index8
 
dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgb565_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgb565_stencil_index8
@@ -75,7 +71,6 @@ 
dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgba_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgba_stencil_index8
 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_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
@@ -553,16 +548,12 @@ 
dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba5551_cub
 dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba_2d
 
dEQP-GLES2.functional.texture.specification.texsubimage2d_empty_tex.rgba_cube
 dEQP-GLES2.functional.texture.units.2_units.mixed.5
-dEQP-GLES2.functional.texture.units.2_units.mixed.8
 dEQP-GLES2.functional.texture.units.2_units.only_2d.1
 dEQP-GLES2.functional.texture.units.2_units.only_2d.5
 dEQP-GLES2.functional.texture.units.2_units.only_2d.6
 dEQP-GLES2.functional.texture.units.2_units.only_2d.8
-dEQP-GLES2.functional.texture.units.2_units.only_cube.2
 dEQP-GLES2.functional.texture.units.4_units.mixed.1
 dEQP-GLES2.functional.texture.units.4_units.mixed.3
-dEQP-GLES2.functional.texture.units.4_units.mixed.4
-dEQP-GLES2.functional.texture.units.4_units.mixed.8
 dEQP-GLES2.functional.texture.units.4_units.mixed.9
 dEQP-GLES2.functional.texture.units.4_units.only_2d.0
 dEQP-GLES2.functional.texture.units.4_units.only_2d.1
@@ -572,10 +563,6 @@ dEQP-GLES2.functional.texture.units.4_units.only_2d.5
 dEQP-GLES2.functional.texture.units.4_units.only_2d.6
 dEQP-GLES2.functional.texture.units.4_units.only_2d.7
 dEQP-GLES2.functional.texture.units.4_units.only_2d.8
-dEQP-GLES2.functional.texture.units.4_units.only_cube.1
-dEQP-GLES2.functional.texture.units.4_units.only_cube.3
-dEQP-GLES2.functional.texture.units.4_units.only_cube.6
-dEQP-GLES2.functional.texture.units.4_units.only_cube.8
 dEQP-GLES2.functional.texture.units.8_units.mixed.0
 dEQP-GLES2.functional.texture.units.8_units.mixed.1
 dEQP-GLES2.functional.texture.units.8_units.mixed.2
@@ -594,8 +581,6 @@ dEQP-GLES2.functional.texture.units.8_units.only_2d.6
 dEQP-GLES2.functional.texture.units.8_units.only_2d.7
 dEQP-GLES2.functional.texture.units.8_units.only_2d.8
 dEQP-GLES2.functional.texture.units.8_units.only_cube.2
-dEQP-GLES2.functional.texture.units.8_units.only_cube.3
-dEQP-GLES2.functional.texture.units.8_units.only_cube.7
 dEQP-GLES2.functional.texture.units.all_units.mixed.0
 dEQP-GLES2.functional.texture.units.all_units.mixed.1
 dEQP-GLES2.functional.texture.units.all_units.mixed.2
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: Adapt to constant name change in UABI

2019-06-18 Thread Tomeu Vizoso
We hadn't updated the kernel header after the driver got into mainline.

Signed-off-by: Tomeu Vizoso 
---
 include/drm-uapi/panfrost_drm.h| 6 --
 src/gallium/drivers/panfrost/pan_drm.c | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/drm-uapi/panfrost_drm.h b/include/drm-uapi/panfrost_drm.h
index 508b9621d9db..a52e0283b90d 100644
--- a/include/drm-uapi/panfrost_drm.h
+++ b/include/drm-uapi/panfrost_drm.h
@@ -59,7 +59,7 @@ struct drm_panfrost_submit {
 
 /**
  * struct drm_panfrost_wait_bo - ioctl argument for waiting for
- * completion of the last DRM_PANFROST_SUBMIT_CL on a BO.
+ * completion of the last DRM_PANFROST_SUBMIT on a BO.
  *
  * This is useful for cases where multiple processes might be
  * rendering to a BO and you want to wait for all rendering to be
@@ -82,6 +82,8 @@ struct drm_panfrost_create_bo {
__u32 flags;
/** Returned GEM handle for the BO. */
__u32 handle;
+   /* Pad, must be zero-filled. */
+   __u32 pad;
/**
 * Returned offset for the BO in the GPU address space.  This offset
 * is private to the DRM fd and is valid for the lifetime of the GEM
@@ -113,7 +115,7 @@ struct drm_panfrost_mmap_bo {
 };
 
 enum drm_panfrost_param {
-   DRM_PANFROST_PARAM_GPU_ID,
+   DRM_PANFROST_PARAM_GPU_PROD_ID,
 };
 
 struct drm_panfrost_get_param {
diff --git a/src/gallium/drivers/panfrost/pan_drm.c 
b/src/gallium/drivers/panfrost/pan_drm.c
index 98e40b57c3ee..cacc6a7f715d 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -337,7 +337,7 @@ panfrost_drm_query_gpu_version(struct panfrost_screen 
*screen)
 struct drm_panfrost_get_param get_param = {0,};
 int ret;
 
-   get_param.param = DRM_PANFROST_PARAM_GPU_ID;
+   get_param.param = DRM_PANFROST_PARAM_GPU_PROD_ID;
 ret = drmIoctl(drm->fd, DRM_IOCTL_PANFROST_GET_PARAM, _param);
 assert(!ret);
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 1/2] panfrost: ci: Update test expectations

2019-06-13 Thread Tomeu Vizoso
Some tests got fixed since the last update, but also some regressions
crept in.

To keep the CI green, add the regressions to the expected failures.

Signed-off-by: Tomeu Vizoso 
---
 .../drivers/panfrost/ci/expected-failures.txt | 98 +--
 1 file changed, 5 insertions(+), 93 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt 
b/src/gallium/drivers/panfrost/ci/expected-failures.txt
index 9cbea0c6bfd8..c53869665545 100644
--- a/src/gallium/drivers/panfrost/ci/expected-failures.txt
+++ b/src/gallium/drivers/panfrost/ci/expected-failures.txt
@@ -8,8 +8,6 @@ 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.completeness.size.distinct
-dEQP-GLES2.functional.fbo.render.color.blend_npot_rbo_rgb565
-dEQP-GLES2.functional.fbo.render.color.blend_npot_rbo_rgb565_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
@@ -54,6 +52,7 @@ 
dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgba_depth_co
 
dEQP-GLES2.functional.fbo.render.recreate_colorbuffer.rebind_tex2d_rgba_stencil_index8
 dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgb
 dEQP-GLES2.functional.fbo.render.repeated_clear.tex2d_rgba
+dEQP-GLES2.functional.fbo.render.resize.rbo_rgb565_stencil_index8
 dEQP-GLES2.functional.fbo.render.resize.rbo_rgb5_a1
 dEQP-GLES2.functional.fbo.render.resize.rbo_rgb5_a1_depth_component16
 dEQP-GLES2.functional.fbo.render.resize.rbo_rgb5_a1_stencil_index8
@@ -70,28 +69,25 @@ 
dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgb565_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgb565_stencil_index8
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgba4_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.rbo_rgba4_stencil_index8
-dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgb_stencil_index8
-dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgba
 
dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgba_depth_component16
 dEQP-GLES2.functional.fbo.render.shared_colorbuffer.tex2d_rgba_stencil_index8
 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_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.stencil.npot_rbo_rgb565_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.npot_tex2d_rgb_stencil_index8
-dEQP-GLES2.functional.fbo.render.stencil.npot_tex2d_rgba_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.fbo.render.stencil_clear.rbo_rgb5_a1_stencil_index8
+dEQP-GLES2.functional.fbo.render.stencil_clear.rbo_rgb565_stencil_index8
 dEQP-GLES2.functional.fbo.render.stencil_clear.rbo_rgba4_stencil_index8
+dEQP-GLES2.functional.fbo.render.stencil_clear.tex2d_rgb_stencil_index8
+dEQP-GLES2.functional.fbo.render.stencil_clear.tex2d_rgba_stencil_index8
 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
@@ -307,95 +303,39 @@ dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_w
 dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_fragment
 dEQP-GLES2.functional.shaders.preprocessor.predefined_macros.line_2_vertex
 dEQP-GLES2.functional.shaders.random.all_features.fragment.0
-dEQP-GLES2.functional.shaders.random.all_features.fragment.10
 dEQP-GLES2.functional.shaders.random.all_features.fragment.16
-dEQP-GLES2.functional.shaders.random.all_features.fragment.17
 dEQP-GLES2.functional.shaders.random.all_features.fragment.45
-dEQP-GLES2.functional.shaders.random.all_features.fragment.48
 dEQP-GLES2.functional.shaders.random.all_features.fragment.5
-dEQP-GLES2.functional.shaders.random.all_features.fragment.54
 dEQP-GLES2.functional.shaders.random.all_features.fragment.6
-dEQP-GLES2.functional.shaders.random.all_features.fragment.60
 dEQP-GLES2

[Mesa-dev] [PATCH 2/2] panfrost: ci: Exclude some tests from results

2019-06-13 Thread Tomeu Vizoso
These are tests that regressed in RK3288 but still pass on RK3399.

So we still have a CI we can rely on, add them to the flip-flop list for
now.

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 51 ++-
 1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index d67c1ff6c946..276d4649dad8 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -194,6 +194,7 @@ build:arm64:
 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_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
@@ -202,10 +203,58 @@ build:arm64:
 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.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.equation_src_func_dst_func.add_dst_color_one_minus_src_color
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.add_dst_color_src_color
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.add_one_minus_dst_color_src_color
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_constant_alpha_one_minus_dst_color
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_dst_alpha_one_minus_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_dst_color_constant_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_dst_color
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.reverse_subtract_zero_one
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.subtract_one_one
+
dEQP-GLES2.functional.fragment_ops.blend.equation_src_func_dst_func.subtract_src_alpha_saturate_constant_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_equation_alpha_equation.reverse_subtract_reverse_subtract
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.constant_color_one
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_constant_alpha_one_minus_constant_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_constant_alpha_src_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_constant_color_src_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_dst_color_one_minus_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_src_color_one_minus_src_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_minus_src_color_one_minus_src_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.one_one_minus_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.src_color_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.src_color_src_alpha
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.zero_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.dst.zero_one_minus_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.src.constant_color_one_minus_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.src.dst_color_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.src.one_minus_constant_color_one_minus_constant_color
+
dEQP-GLES2.functional.fragment_ops.blend.rgb_func_alpha_func.src.one_minus_dst_color_constant_color
+

[Mesa-dev] [RFC] panfrost/midgard: Hack some bits to get things working on T720

2019-06-12 Thread Tomeu Vizoso
Any ideas on why these two changes get kmscube working on T720?

Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/pan_context.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index e20e8e8d5923..a1423c22e1fb 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -95,11 +95,14 @@ panfrost_emit_sfbd(struct panfrost_context *ctx)
 .unknown_address_0 = ctx->scratchpad.gpu,
 .unknown_address_1 = ctx->misc_0.gpu,
 .unknown_address_2 = ctx->misc_0.gpu + 40960,
-.tiler_flags = 0xf0,
+.tiler_flags = 0xfff,
 .tiler_heap_free = ctx->tiler_heap.gpu,
 .tiler_heap_end = ctx->tiler_heap.gpu + ctx->tiler_heap.size,
 };
 
+uint32_t *known_unknown = ((void*)ctx->misc_0.cpu + 40960);
+*known_unknown = 0xa000;
+
 panfrost_set_framebuffer_resolution(, 
ctx->pipe_framebuffer.width, ctx->pipe_framebuffer.height);
 
 return framebuffer;
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Fix stride check when mipmapping

2019-06-10 Thread Tomeu Vizoso
On Sat, 8 Jun 2019 at 02:15, Alyssa Rosenzweig
 wrote:
>
> Now that we support custom strides on mipmapped lines textures
> (theoretically, at least), extend the stride check to support mipmaps.
> Fixes incorrect strides of linear windows in Weston.
>
> Signed-off-by: Alyssa Rosenzweig 

Looks good too me!

Reviewed-by: Tomeu Vizoso 

Thanks,

Tomeu

> ---
>  src/gallium/drivers/panfrost/pan_context.c | 22 +++---
>  1 file changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_context.c 
> b/src/gallium/drivers/panfrost/pan_context.c
> index 90f60f35581..c5e49805872 100644
> --- a/src/gallium/drivers/panfrost/pan_context.c
> +++ b/src/gallium/drivers/panfrost/pan_context.c
> @@ -2002,15 +2002,23 @@ panfrost_create_sampler_view(
>
>  /* Check if we need to set a custom stride by computing the 
> "expected"
>   * stride and comparing it to what the BO actually wants. Only 
> applies
> - * to linear textures TODO: Mipmap? */
> + * to linear textures, since tiled/compressed textures have strict
> + * alignment requirements for their strides as it is */
>
> -unsigned actual_stride = prsrc->bo->slices[0].stride;
> +unsigned first_level = template->u.tex.first_level;
> +unsigned last_level = template->u.tex.last_level;
>
> -if (prsrc->bo->layout == PAN_LINEAR &&
> -template->u.tex.last_level == 0 &&
> -template->u.tex.first_level == 0 &&
> -(texture->width0 * bytes_per_pixel) != actual_stride) {
> -usage2_layout |= MALI_TEX_MANUAL_STRIDE;
> +if (prsrc->bo->layout == PAN_LINEAR) {
> +for (unsigned l = first_level; l <= last_level; ++l) {
> +unsigned actual_stride = prsrc->bo->slices[l].stride;
> +unsigned width = u_minify(texture->width0, l);
> +unsigned comp_stride = width * bytes_per_pixel;
> +
> +if (comp_stride != actual_stride) {
> +usage2_layout |= MALI_TEX_MANUAL_STRIDE;
> +break;
> +}
> +}
>  }
>
>  struct mali_texture_descriptor texture_descriptor = {
> --
> 2.20.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH 1/2] panfrost: ci: Switch to kernel 5.2-rc1

2019-06-07 Thread Tomeu Vizoso
On Fri, 7 Jun 2019 at 09:51, Eduardo Lima Mitev  wrote:
>
> On 5/20/19 11:33 AM, Tomeu Vizoso wrote:
> > Signed-off-by: Tomeu Vizoso 
> > ---
> >  src/gallium/drivers/panfrost/ci/Dockerfile | 7 +++
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/gallium/drivers/panfrost/ci/Dockerfile 
> > b/src/gallium/drivers/panfrost/ci/Dockerfile
> > index 268edf224a20..8c4a4e0444ec 100644
> > --- a/src/gallium/drivers/panfrost/ci/Dockerfile
> > +++ b/src/gallium/drivers/panfrost/ci/Dockerfile
> > @@ -112,12 +112,11 @@ ARG KERNEL_ARCH
> >  ARG DEFCONFIG
> >  ARG DEVICE_TREES
> >  ARG KERNEL_IMAGE_NAME
> > -# TODO: Switch to 5.2-rc* when the time comes
> > +ENV 
> > KERNEL_URL="https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux/+archive/refs/tags/v5.2-rc1.tar.gz;
>
> What's wrong with
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-5.2-rc1.tar.gz
> ?

Nothing that I know, I just went with what I found first.

Cheers,

Tomeu

> Eduardo
>
> > +
> >  COPY ${KERNEL_ARCH}.config /panfrost-ci/
> >  RUN mkdir -p /kernel   
> > && \
> > -  wget 
> > https://github.com/freedesktop/drm-misc/archive/drm-misc-next-2019-04-18.tar.gz
> >  && \
> > -  tar xfz drm-misc-next-2019-04-18.tar.gz -C /kernel --strip-components=1  
> > && \
> > -  rm drm-misc-next-2019-04-18.tar.gz   
> > && \
> > +  wget -qO- ${KERNEL_URL} | tar -xvz -C /kernel
> > && \
> >cd /kernel   
> > && \
> >ARCH=${KERNEL_ARCH} CROSS_COMPILE="${GCC_ARCH}-" 
> > ./scripts/kconfig/merge_config.sh ${DEFCONFIG} 
> > /panfrost-ci/${KERNEL_ARCH}.config && \
> >ARCH=${KERNEL_ARCH} CROSS_COMPILE="${GCC_ARCH}-" make -j12 
> > ${KERNEL_IMAGE_NAME} dtbs && \
> >
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: ci: Switch from direct Docker use to buildah

2019-06-07 Thread Tomeu Vizoso
Use the infrastructure in wayland/ci-templates to build the container
images.

This prevents from getting into some situations in which the images
wouldn't be rebuilt, and allows us to share some infrastructure with
other projects in freedesktop.org.

Signed-off-by: Tomeu Vizoso 
Suggested-by: Michel Dänzer 
---
 src/gallium/drivers/panfrost/ci/Dockerfile| 135 --
 .../drivers/panfrost/ci/debian-install.sh | 125 
 src/gallium/drivers/panfrost/ci/gitlab-ci.yml |  66 +
 3 files changed, 166 insertions(+), 160 deletions(-)
 delete mode 100644 src/gallium/drivers/panfrost/ci/Dockerfile
 create mode 100644 src/gallium/drivers/panfrost/ci/debian-install.sh

diff --git a/src/gallium/drivers/panfrost/ci/Dockerfile 
b/src/gallium/drivers/panfrost/ci/Dockerfile
deleted file mode 100644
index fe0e67c27bd1..
--- a/src/gallium/drivers/panfrost/ci/Dockerfile
+++ /dev/null
@@ -1,135 +0,0 @@
-FROM debian:testing
-
-ENV DEBIAN_FRONTEND=noninteractive
-
-RUN echo 'path-exclude=/usr/share/doc/*' > 
/etc/dpkg/dpkg.cfg.d/99-exclude-cruft
-RUN echo 'path-exclude=/usr/share/man/*' >> 
/etc/dpkg/dpkg.cfg.d/99-exclude-cruft
-RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d
-RUN echo 'exit 101' >> /usr/sbin/policy-rc.d
-RUN chmod +x /usr/sbin/policy-rc.d
-
-### Install packages for building
-
-ARG DEBIAN_ARCH
-RUN dpkg --add-architecture ${DEBIAN_ARCH}
-RUN echo deb-src http://deb.debian.org/debian testing main >> 
/etc/apt/sources.list
-RUN 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} && \
-rm -rf /var/lib/apt/lists
-
-### Cross-build dEQP
-ARG GCC_ARCH
-RUN 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

Re: [Mesa-dev] [PATCH 2/2] panfrost: ci: Avoid pulling Docker image on every run

2019-06-07 Thread Tomeu Vizoso

On 6/6/19 6:10 PM, Michel Dänzer wrote:

On 2019-05-20 11:33 a.m., Tomeu Vizoso wrote:

Jump over the container stage if we haven't changed any of the files
that involved in building the container images.

This saves 1-2 minutes in each run and helps conserve resources.

Signed-off-by: Tomeu Vizoso 
---
  src/gallium/drivers/panfrost/ci/gitlab-ci.yml | 52 +++
  1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml 
b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
index 635d7b04bcde..3491b9f98752 100644
--- a/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+++ b/src/gallium/drivers/panfrost/ci/gitlab-ci.yml
@@ -2,23 +2,29 @@ variables:
DOCKER_DRIVER: overlay2
  
  stages:

-  - build-container
+  - containers
- build
- test
  
  # Build Docker image with deqp, the rootfs and the build deps for Mesa

-.build-container:
-  stage: build-container
-  when: always
+.container:
+  stage: containers
+  image: docker:stable
+  only:
+changes:
+  - src/gallium/drivers/panfrost/ci/gitlab-ci.yml
+  - src/gallium/drivers/panfrost/ci/Dockerfile
+  - src/gallium/drivers/panfrost/ci/create-rootfs.sh
+  - src/gallium/drivers/panfrost/ci/${KERNEL_ARCH}.config


FYI, this might break under some circumstances; see
https://gitlab.freedesktop.org/xorg/xserver/commit/0ec9a13c2a207e98e2dd6b352552c0e069af0727
.


See the top-level .gitlab-ci.yml file for a well-tested way to only
generate a docker image when needed, based on a fixed image tag.


It also looks much cleaner, will see what else I can steal.

Thanks!

Tomeu
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] panfrost: bifrost: Fix format string in disassembler

2019-06-05 Thread Tomeu Vizoso
The compiler configuration was hardened to fail on format warnings and
things stopped building.

Fixes: c9c1e2610647 ("mesa: prevent common string formatting security issues")
Signed-off-by: Tomeu Vizoso 
---
 src/gallium/drivers/panfrost/bifrost/disassemble.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/bifrost/disassemble.c 
b/src/gallium/drivers/panfrost/bifrost/disassemble.c
index daadf2578965..03ade19a689d 100644
--- a/src/gallium/drivers/panfrost/bifrost/disassemble.c
+++ b/src/gallium/drivers/panfrost/bifrost/disassemble.c
@@ -2195,7 +2195,7 @@ bool dump_clause(uint32_t *words, unsigned *size, 
unsigned offset, bool verbose)
 
 if (verbose) {
 for (unsigned i = 0; i < num_consts; i++) {
-printf("# const%d: %08lx\n", 2 * i, consts[i] & 
0x);
+printf("# const%d: %08" PRIx64 "\n", 2 * i, consts[i] 
& 0x);
 printf("# const%d: %08" PRIx64 "\n", 2 * i + 1, 
consts[i] >> 32);
 }
 }
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] panfrost: Don't flip scanout

2019-05-31 Thread Tomeu Vizoso
On Tue, 28 May 2019 at 08:17, Tomeu Vizoso  wrote:
>
> On 5/26/19 1:51 AM, Alyssa Rosenzweig wrote:
> > The mesa/st flips the viewport, so we respect that rather than
> > trying to flip the framebuffer itself and ignoring the viewport and
> > using a messy heuristic.
> >
> > However, this brings an underlying disagreement about the interpretation
> > of winding order to light. The blob uses a different strategy than Mesa
> > for handling viewport Y flipping, so the meanings of the winding order
> > bit are flipped for it. To keep things clean on our end, we rename to
> > explicitly use Gallium (rather than flipped OpenGL) conventions.
> >
> > Fixes upside-down Xwayland/egl windows.
> >
> > Suggested-by: Rob Clark 
> > Signed-off-by: Alyssa Rosenzweig 
> > Cc: Tomeu Vizoso 
>
> This is a great cleanup, thanks!
>
> Reviewed-by: Tomeu Vizoso 

Actually, the CI has found these regressions:

dEQP-GLES2.functional.fbo.render.resize.rbo_rgb565_stencil_index8
dEQP-GLES2.functional.fbo.render.stencil_clear.rbo_rgb565_stencil_index8
dEQP-GLES2.functional.fbo.render.stencil_clear.tex2d_rgb_stencil_index8
dEQP-GLES2.functional.fbo.render.stencil_clear.tex2d_rgba_stencil_index8

dEQP-GLES2.functional.shaders.builtin_variable.fragcoord_xyz
dEQP-GLES2.functional.shaders.builtin_variable.pointcoord

Guess there's some flipping in stencil and *coord that needs to be unflipped?

Thanks,

Tomeu

> Cheers,
>
> Tomeu
>
>
> > ---
> >   .../drivers/panfrost/include/panfrost-job.h   |  8 +--
> >   src/gallium/drivers/panfrost/pan_context.c| 54 +++
> >   src/gallium/drivers/panfrost/pan_context.h|  7 +--
> >   src/gallium/drivers/panfrost/pan_fragment.c   |  7 +--
> >   src/gallium/drivers/panfrost/pan_mfbd.c   | 16 ++
> >   src/gallium/drivers/panfrost/pan_sfbd.c   | 17 ++
> >   .../drivers/panfrost/pandecode/decode.c   | 12 ++---
> >   7 files changed, 40 insertions(+), 81 deletions(-)
> >
> > diff --git a/src/gallium/drivers/panfrost/include/panfrost-job.h 
> > b/src/gallium/drivers/panfrost/include/panfrost-job.h
> > index f4f145890de..8a4a7644070 100644
> > --- a/src/gallium/drivers/panfrost/include/panfrost-job.h
> > +++ b/src/gallium/drivers/panfrost/include/panfrost-job.h
> > @@ -73,9 +73,11 @@ enum mali_draw_mode {
> >   #define MALI_OCCLUSION_QUERY(1 << 3)
> >   #define MALI_OCCLUSION_PRECISE  (1 << 4)
> >
> > -#define MALI_FRONT_FACE(v)  (v << 5)
> > -#define MALI_CCW (0)
> > -#define MALI_CW  (1)
> > +/* Set for a glFrontFace(GL_CCW) in a Y=0=TOP coordinate system (like 
> > Gallium).
> > + * In OpenGL, this would corresponds to glFrontFace(GL_CW). Mesa and the 
> > blob
> > + * disagree about how to do viewport flipping, so the blob actually sets 
> > this
> > + * for GL_CW but then has a negative viewport stride */
> > +#define MALI_FRONT_CCW_TOP  (1 << 5)
> >
> >   #define MALI_CULL_FACE_FRONT(1 << 6)
> >   #define MALI_CULL_FACE_BACK (1 << 7)
> > diff --git a/src/gallium/drivers/panfrost/pan_context.c 
> > b/src/gallium/drivers/panfrost/pan_context.c
> > index 5cae386f070..d0170a63def 100644
> > --- a/src/gallium/drivers/panfrost/pan_context.c
> > +++ b/src/gallium/drivers/panfrost/pan_context.c
> > @@ -1143,15 +1143,6 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, 
> > bool with_vertex_data)
> >
> >   const struct pipe_viewport_state *vp = >pipe_viewport;
> >
> > -/* For flipped-Y buffers (signaled by negative scale), the 
> > translate is
> > - * flipped as well */
> > -
> > -bool invert_y = vp->scale[1] < 0.0;
> > -float translate_y = vp->translate[1];
> > -
> > -if (invert_y)
> > -translate_y = ctx->pipe_framebuffer.height - translate_y;
> > -
> >   for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) {
> >   struct panfrost_constant_buffer *buf = 
> > >constant_buffer[i];
> >
> > @@ -1171,11 +1162,11 @@ panfrost_emit_for_draw(struct panfrost_context 
> > *ctx, bool with_vertex_data)
> >
> >   if (sysval == PAN_SYSVAL_VIEWPORT_SCALE) {
> >   uniforms[4*i + 0] = vp->scale[0];
> > -uniforms[4*i + 1] = fabsf(vp->scale[1]);
> > +uniforms[4*i + 1] = vp->scale[1];
> >   uniforms[4*i + 2] = vp->scale[2];
> >   

  1   2   3   >