.virgl-rules:
  stage: layered-backends
  rules:
    - !reference [.test, rules]
    - if: $FORCE_KERNEL_TAG != null
      when: never
    - !reference [.gl-rules, rules]
    - !reference [.llvmpipe-rules, rules]
    - changes: &virgl_file_list
      - src/gallium/drivers/virgl/**/*
      - src/gallium/winsys/virgl/**/*
      when: on_success

.virgl-iris-manual-rules:
  stage: layered-backends
  extends: .no-auto-retry
  rules:
    - !reference [.test, rules]
    - !reference [.collabora-farm-manual-rules, rules]
    - !reference [.gl-manual-rules, rules]
    - changes:
        *virgl_file_list
      when: manual
    - !reference [.iris-manual-rules, rules]

.virgl-iris-rules-performance:
  stage: performance
  extends: .no-auto-retry
  rules:
    - !reference [.test, rules]
    - !reference [.collabora-farm-manual-rules, rules]
    - !reference [.performance-rules, rules]
    - !reference [.gl-manual-rules, rules]
    - !reference [.llvmpipe-manual-rules, rules]
    - changes:
        *virgl_file_list
      when: manual
  allow_failure: true # see comment in .performance-rules, which we don't inherit this line from.
  variables:
    JOB_PRIORITY: 40
    S3_ARTIFACT_NAME: "mesa-x86_64-default-release"
  needs:
    - kernel+rootfs_x86_64
    - debian-release

.virpipe-test:
  extends:
    - .test-gl
    - .virgl-rules
  variables:
    GALLIVM_PERF: nopt
    FLAKES_CHANNEL: "#virgl-ci"
  script:
    - xvfb-run --server-args='-noreset' bash -c ". $SCRIPTS_DIR/setup-test-env.sh && GALLIUM_DRIVER=virpipe install/deqp-runner.sh"

.virgl-test:
  extends:
    - .test-gl
    - .virgl-rules
  variables:
    FLAKES_CHANNEL: "#virgl-ci"
    GALLIUM_DRIVER: "virgl"
    CROSVM_GALLIUM_DRIVER: "llvmpipe"
    CROSVM_GPU_ARGS: "gles=false,backend=virglrenderer,egl=true,surfaceless=true,width=1024,height=768"
    GALLIVM_PERF: "nopt,no_quad_lod"

.virgl-iris-test:
  extends:
    - .lava-piglit-traces:x86_64
    - .lava-acer-cp514-2h-1160g7-volteer:x86_64
  variables:
    HWCI_KERNEL_MODULES: vhost_vsock
    HWCI_KVM: "true"
    HWCI_TEST_SCRIPT: "/install/crosvm-runner.sh"
    HWCI_TEST_ARGS: "/install/piglit/piglit-traces.sh"
    PARALLELISE_VIA_LP_THREADS: 1
    GPU_VERSION: virgl
    DRIVER_NAME: virgl
    GALLIUM_DRIVER: virgl
    CROSVM_GALLIUM_DRIVER: iris
    CROSVM_GPU_ARGS: "gles=false,backend=virglrenderer,egl=true,surfaceless=true,width=1024,height=768"
    EGL_PLATFORM: surfaceless
    PIGLIT_PROFILES: replay
    PIGLIT_TRACES_FILE: traces-virgl-iris.yml
