gitlab-ci: rules:changes to test on tested drivers changes

For now tests only use these drivers:
  * llvmpipe
  * softpipe
  * freedreno
  * lima
  * etnaviv
  * panfrost

So using rules:changes gitlab feature to run the tests when the changes
made are potentially affecting these drivers.

A few notes:
  * the following code:
      .piglit-test:
        extends:
          - .test-gl
          - .llvmpipe-rules
    makes gitlab replace .test-gl "rules:changes" values by the one from
    ".llvmpipe-rules".
  * rules:changes always matches for non-MR new branches so jobs will always be
    created (and they'll be run if their dependencies are run). For pushes to
    existing branches the files changed by the push are used to match the
    rules:changes path.
  * the same gitlab feature could be used for some build jobs

Acked-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2569>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2569>
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 56b9a76..5cc46fb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,6 +6,7 @@
     ref: b7030c2cd0d6ccc5f6d4f8299bafa4daa9240d71
     file: '/templates/debian.yml'
   - local: '.gitlab-ci/lava-gitlab-ci.yml'
+  - local: '.gitlab-ci/test-source-dep.yml'
 
 stages:
   - container
@@ -567,8 +568,9 @@
     - x86_test-vk
 
 .piglit-test:
-  extends: .test-gl
-  stage: llvmpipe
+  extends:
+    - .test-gl
+    - .llvmpipe-rules
   artifacts:
     when: on_failure
     name: "mesa_${CI_JOB_NAME}"
@@ -644,12 +646,14 @@
     LP_NUM_THREADS: 0
     DEQP_EXPECTED_FAILS: deqp-llvmpipe-fails.txt
     LIBGL_ALWAYS_SOFTWARE: "true"
-  extends: .deqp-test-gl
-  stage: llvmpipe
+  extends:
+    - .deqp-test-gl
+    - .llvmpipe-rules
 
 softpipe-gles2:
-  extends: llvmpipe-gles2
-  stage: softpipe
+  extends:
+    - llvmpipe-gles2
+    - .softpipe-rules
   variables:
     DEQP_EXPECTED_FAILS: deqp-softpipe-fails.txt
     DEQP_SKIPS: deqp-softpipe-skips.txt
@@ -671,7 +675,7 @@
   extends:
     - .deqp-test-gl
     - .use-arm_test
-  stage: freedreno
+    - .freedreno-rules
   variables:
     DEQP_VER: gles2
     DEQP_EXPECTED_FAILS: deqp-freedreno-a630-fails.txt
@@ -766,7 +770,9 @@
     - ./artifacts/tracie-runner-vk.sh
 
 llvmpipe-traces:
-  extends: .traces-test-gl
+  extends:
+    - .traces-test-gl
+    - .llvmpipe-rules
   variables:
     LIBGL_ALWAYS_SOFTWARE: "true"
     GALLIUM_DRIVER: "llvmpipe"