include:
  - local: 'src/gallium/drivers/zink/ci/gitlab-ci-inc.yml'

zink-lvp:
  extends:
    - .test-gl
    - .deqp-test
    - .zink-lvp-test
  variables:
    DEQP_SUITE: zink-lvp
    DEQP_FRACTION: 8
    PIGLIT_NO_WINDOW: 1
    # Enable validation (except for on piglit, see deqp-zink-lvp.toml), logging
    # to stdout and aborting on unknown failures.
    ZINK_DEBUG: validation
    XVFB_SCRIPT: "VK_DRIVER=lvp install/deqp-runner.sh"
  script: |
    xvfb-run --server-args='-noreset' bash -c ". $SCRIPTS_DIR/setup-test-env.sh && ${XVFB_SCRIPT}"

zink-venus-lvp:
  extends:
    - .test-gl
    - .deqp-test
    - .zink-venus-lvp-test
  timeout: 15min  # base run time = 5min, but it's on the shared runners so it can go up
  variables:
    DEQP_SUITE: zink-venus-lvp
    PIGLIT_NO_WINDOW: 1
    # Enable validation (except for on piglit, see deqp-zink-venus-lvp.toml), logging
    # to stdout and aborting on unknown failures.
    ZINK_DEBUG: validation
    LP_NUM_THREADS: 2
    CROSVM_MEMORY: 12288
    CROSVM_CPU: $FDO_CI_CONCURRENT
  script:
    - xvfb-run --server-args='-noreset' bash -c "./install/crosvm-runner.sh ./install/deqp-runner.sh"

zink-anv-adl:
  extends:
    - .zink-anv-adl-test
  variables:
    DEQP_SUITE: zink-anv-adl
    PIGLIT_NO_WINDOW: 1
    HWCI_START_WESTON: 1
    # We use gbm because its a copy of tgl job
    PIGLIT_PLATFORM: gbm
  timeout: 30m

# Manual full run when you want to double-check the full status.
zink-anv-adl-full:
  extends:
    - zink-anv-adl
    - .zink-anv-manual-rules
  variables:
    DEQP_SUITE: zink-anv-adl-full
    JOB_TIMEOUT: 105
    HWCI_START_WESTON: 1
  timeout: 2h
  parallel: 2

zink-anv-tgl:
  extends:
    - .zink-anv-tgl-test
  timeout: 1h
  variables:
    DEQP_SUITE: zink-anv-tgl
    PIGLIT_NO_WINDOW: 1
    HWCI_START_WESTON: 1
    # We use gbm because X can die:
    # MESA: error: ZINK: vkQueueSubmit failed (VK_ERROR_DEVICE_LOST)
    # Xorg: ../src/gallium/drivers/zink/zink_batch.c:599: zink_end_batch: Assertion `!ctx->batch_states' failed.
    PIGLIT_PLATFORM: gbm

# Manual full run when you want to double-check the full status.
zink-anv-tgl-full:
  extends:
    - zink-anv-tgl
    - .zink-anv-manual-rules
  variables:
    DEQP_SUITE: zink-anv-tgl-full
    JOB_TIMEOUT: 105
    HWCI_START_WESTON: 1
  timeout: 1h 45m
  parallel: 3

zink-anv-tgl-traces:
  extends:
    - .lava-piglit-traces:x86_64
    - .zink-anv-tgl-test
    - .zink-trace-test
    # Add .lava-traces-base again to override .zink-anv-tgl-test setting the
    # HWCI_TEST_SCRIPT, but .lava-piglit-traces having to come first to get
    # dependencies right.
    - .lava-traces-base
  variables:
    PIGLIT_TRACES_FILE: traces-zink.yml

zink-anv-tgl-traces-restricted:
  extends:
    - zink-anv-tgl-traces
    - .zink-anv-rules-restricted
  variables:
    PIGLIT_TRACES_FILE: traces-zink-restricted.yml
    PIGLIT_REPLAY_EXTRA_ARGS: --db-path ${CI_PROJECT_DIR}/replayer-db/ --minio_bucket=${S3_TRACIE_PRIVATE_BUCKET} --jwt-file=${S3_JWT_FILE}
  allow_failure: true

zink-tu-a618:
  extends:
    - .lava-test-deqp:arm64
    - .zink-turnip-collabora-rules
    - .zink-test
    - .lava-sc7180-trogdor-lazor-limozeen:arm64
  variables:
    DEQP_FRACTION: 2
    DEQP_SUITE: zink-freedreno-a618
    FLAKES_CHANNEL: "#freedreno-ci"
    HWCI_START_WESTON: 1
    GPU_VERSION: zink-freedreno-a618

zink-tu-a618-full:
  extends:
    - zink-tu-a618
    - .zink-turnip-collabora-manual-rules
  variables:
    DEQP_FRACTION: 1

zink-tu-a618-traces:
  extends:
    - a618-traces
    - .zink-turnip-collabora-rules
    - .zink-trace-test
  parallel: null
  variables:
    PIGLIT_REPLAY_DEVICE_NAME: "zink-a618"

zink-tu-a618-traces-performance:
  extends:
    - zink-tu-a618-traces
    - .zink-turnip-collabora-manual-rules
    - .piglit-performance:arm64
  rules:
    - !reference [.piglit-performance:arm64, rules]
    - !reference [.zink-turnip-collabora-manual-rules, rules]
  variables:
    # Always use the same device
    # a618 tag starts with cbg-1 (not cbg-0) for some reason
    LAVA_TAGS: "cbg-1"
  needs:
    - !reference [zink-tu-a618-traces, needs]
    - !reference [.piglit-performance:arm64, needs]

zink-tu-a750:
  extends:
    - .tu-zink-test-valve
    - .a750-mupuf
    - .zink-turnip-valve-manual-rules
  timeout: 25m  # base runtime 11min total, 9min of testing
  variables:
    B2C_TIMEOUT_BOOT_MINUTES: 15
    B2C_TIMEOUT_OVERALL_MINUTES: 20
    DEQP_SUITE: zink-tu-a750
    GPU_VERSION: zink-tu-a750
    HWCI_START_WESTON: 1

############### Combined testing (GL, GLES, Piglit) on NVK / RADV
zink-nvk-ga106-valve:
  timeout: 60m
  extends:
    - .zink-nvk-test-valve
    - .zink-nvk-manual-rules
    - .nvk-ga106-valve
  variables:
    GPU_VERSION: zink-nvk-ga106
    B2C_TIMEOUT_BOOT_MINUTES: 50
    B2C_TIMEOUT_OVERALL_MINUTES: 55  # usual run time: 35min

zink-radv-polaris10-valve:
  extends:
    - .radv-zink-test-valve
    - .polaris10-test-valve-kws
    - .zink-radv-manual-rules
  variables:
    GPU_VERSION: zink-radv-polaris10
    ZINK_DEBUG: quiet

zink-radv-navi10-valve:
  extends:
    - .radv-zink-test-valve
    - .navi10-test-valve-mupuf
    - .zink-radv-manual-rules
  timeout: 40m
  variables:
    B2C_TIMEOUT_OVERALL_MINUTES: 30
    GPU_VERSION: zink-radv-navi10

zink-radv-vangogh-valve:
  timeout: 35m
  parallel: 3
  extends:
    - .radv-zink-test-valve
    - .vangogh-test-valve
    - .zink-radv-rules
  variables:
    GPU_VERSION: zink-radv-vangogh
    B2C_SESSION_REBOOT_REGEX: 'BUG: kernel NULL pointer dereference, address'
    B2C_TIMEOUT_BOOT_RETRIES: 1
    B2C_TIMEOUT_BOOT_MINUTES: 30
    B2C_TIMEOUT_OVERALL_MINUTES: 30
    FDO_CI_CONCURRENT: 6
  # Override the list of tags to drop `priority:low`
  tags:
    - farm:$RUNNER_FARM_LOCATION
    - amdgpu:codename:VANGOGH

zink-radv-navi31-valve:
  extends:
    - .radv-zink-test-valve
    - .navi31-test-valve
    - .zink-radv-manual-rules
  timeout: 1h 20m
  variables:
    GPU_VERSION: zink-radv-navi31
    B2C_TIMEOUT_BOOT_MINUTES: 75
    B2C_TIMEOUT_OVERALL_MINUTES: 75
