freedreno: Introduce gitlab-based CI.

Since freedreno's kernel and GPU reset seem to be totally solid, we
don't need to have the complexity of the LAVA setup that panfrost has.
Instead, we can register some boards as shared gitlab runners and have
the jobs run out of a docker container just like we do for llvmpipe.
Just make sure that the DRI device node is passed through to the
containers in the gitlab config ('devices = ["/dev/dri"]' under
runners.docker).

If a runner fails (networking dies, kernel panic, etc.) it'll take out
one build but the rest can keep going since gitlab-runner is what
pulls jobs.  Since the runner pulls jobs, it also means that they can
live behind firewalls instead of needing some public address to be
accessed by gitlab.fd.o.

For now, enable it just on db410c (A307) and cheza (A630) as those are
the hardware that I have plenty of.  A307 is only testing GLES2 since
running all of GLES3 takes too long for the number of boards I've
brought up.

Acked-by: Rob Clark <robdclark@chromium.org>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7d8e988..d5dc203 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,12 +15,15 @@
 variables:
   UPSTREAM_REPO: mesa/mesa
   DEBIAN_TAG: "2019-09-11"
+  DEBIAN_ARM64_TAG: "arm64v8-2019-08-09"
   DEBIAN_VERSION: stretch-slim
+  DEBIAN_ARM64_VERSION: buster-slim
   DEBIAN_IMAGE: "$CI_REGISTRY_IMAGE/debian/$DEBIAN_VERSION:$DEBIAN_TAG"
+  DEBIAN_ARM64_IMAGE: "$CI_REGISTRY_IMAGE/debian/$DEBIAN_ARM64_VERSION:$DEBIAN_ARM64_TAG"
 
 include:
   - project: 'wayland/ci-templates'
-    ref: c73dae8b84697ef18e2dbbf4fed7386d9652b0cd
+    ref: 1f7f57c6
     file: '/templates/debian.yml'
 
 stages:
@@ -49,8 +52,7 @@
       # https://gitlab.com/gitlab-org/gitlab-ce/commit/8788fb925706cad594adf6917a6c5f6587dd1521
       - artifacts
 
-# CONTAINERS
-
+# Builds the normal CI native and cross-build docker image.
 debian:
   extends: .debian@container-ifnot-exists
   stage: containers-build
@@ -59,6 +61,16 @@
     GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
     DEBIAN_EXEC: 'bash .gitlab-ci/debian-install.sh'
 
+# Builds a Docker image with the native environment and VK-GL-CTS for testing.
+test-container:arm64:
+  extends: .debian@container-ifnot-exists@arm64v8
+  <<: *ci-run-policy
+  stage: containers-build
+  variables:
+    DEBIAN_TAG: "$DEBIAN_ARM64_TAG"
+    DEBIAN_VERSION: "$DEBIAN_ARM64_VERSION"
+    GIT_STRATEGY: none # no need to pull the whole tree for rebuilding the image
+    DEBIAN_EXEC: 'bash .gitlab-ci/debian-test-install.sh'
 
 # BUILD
 
@@ -252,7 +264,7 @@
     DRI_LOADERS: >
       -D glx=disabled
       -D gbm=false
-      -D egl=false
+      -D egl=true
       -D platforms=surfaceless
       -D osmesa=none
     GALLIUM_ST: >
@@ -291,6 +303,7 @@
       -D build-tests=false
       -D I-love-half-baked-turnips=true
       -D vulkan-overlay-layer=true
+    BUILDTYPE: "debugoptimized"
 
 # While the main point of this build is testing the i386 cross build,
 # we also use this one to test some other options that are exclusive
@@ -382,3 +395,48 @@
   dependencies:
     - meson-main
   needs: [meson-main]
+
+arm64_a306_gles2:
+  extends: .deqp-test
+  parallel: 4
+  image: $DEBIAN_ARM64_IMAGE
+  variables:
+    DEQP_VER: gles2
+    DEQP_EXPECTED_FAILS: deqp-freedreno-a307-fails.txt
+    NIR_VALIDATE: 0
+    DEQP_RENDERER_MATCH: "FD307"
+  tags:
+    - db410c
+  dependencies:
+    - meson-arm64
+
+.cheza-test:
+  image: $DEBIAN_ARM64_IMAGE
+  extends: .deqp-test
+  variables:
+    DEQP_RENDERER_MATCH: "FD630"
+    DEQP_EXPECTED_FAILS: deqp-freedreno-a630-fails.txt
+    DEQP_SKIPS: deqp-freedreno-a630-skips.txt
+    NIR_VALIDATE: 0
+  tags:
+    - mesa-cheza
+  dependencies:
+    - meson-arm64
+  needs: [ meson-arm64 ]
+
+arm64_a630_gles2:
+  extends: .cheza-test
+  variables:
+    DEQP_VER: gles2
+
+arm64_a630_gles3:
+  parallel: 6
+  extends: .cheza-test
+  variables:
+    DEQP_VER: gles3
+
+arm64_a630_gles31:
+  parallel: 4
+  extends: .cheza-test
+  variables:
+    DEQP_VER: gles31