.freedreno-test:
  extends:
    - .baremetal-test
    - .use-debian/arm_test
    - .freedreno-rules
  variables:
    MINIO_ARTIFACT_NAME: mesa-arm64
    BM_ROOTFS: /rootfs-arm64
    FLAKES_CHANNEL: "#freedreno-ci"
    PIGLIT_PLATFORM: mixed_glx_egl
    BM_CMDLINE: "ip=dhcp console=ttyMSM0,115200n8 root=/dev/nfs rw nfsrootdebug nfsroot=,tcp,nfsvers=4.2 init=/init $BM_KERNELARGS"
  script:
    - ./install/bare-metal/fastboot.sh
  needs:
    - debian/arm_test
    - job: debian-arm64
      artifacts: false
  tags:
    - google-freedreno-db410c

.baremetal-deqp-test-freedreno-vk:
  extends:
    - .baremetal-deqp-test
  variables:
    DEQP_VER: vk
    VK_DRIVER: freedreno
    MESA_VK_IGNORE_CONFORMANCE_WARNING: 1

.freedreno-test-traces:
  extends:
    - .piglit-traces-test
  variables:
    HWCI_TEST_SCRIPT: "/install/piglit/run.sh"
    HWCI_START_XORG: 1
    PIGLIT_REPLAY_DESCRIPTION_FILE: "/install/traces-freedreno.yml"
  artifacts:
    reports:
      junit: results/junit.xml

.a306-test:
  extends:
    - .freedreno-test
  variables:
    BM_KERNEL: /baremetal-files/Image.gz
    BM_DTB: /baremetal-files/apq8016-sbc.dtb
    GPU_VERSION: freedreno-a307

a306_gl:
  extends:
    - .baremetal-deqp-test
    - .a306-test
  variables:
    DEQP_SUITE: freedreno-a307
  parallel: 5

a306-traces:
  extends:
    - .freedreno-test-traces
    - .a306-test
  variables:
    PIGLIT_REPLAY_DEVICE_NAME: "freedreno-a306"
    PIGLIT_RESULTS: "freedreno-a306-replay"

.a530-test:
  extends:
    - .freedreno-test
    - .test-manual-mr
  variables:
    BM_KERNEL: /baremetal-files/Image.gz
    BM_DTB: /baremetal-files/apq8096-db820c.dtb
    GPU_VERSION: freedreno-a530
  tags:
    - google-freedreno-db820c

a530_gl:
  extends:
    - .baremetal-deqp-test
    - .a530-test
  variables:
    DEQP_SUITE: freedreno-a530
  parallel: 5

.a530_piglit:
  extends:
    - .piglit-test
    - .a530-test
  variables:
    HWCI_TEST_SCRIPT: "/install/piglit/piglit-runner.sh"
    HWCI_START_XORG: 1

# piglit_gl since it takes a bit under 20 minutes and has a lot of flakes, so
# leave it as manual.
a530_piglit_gl:
  extends:
    - .a530_piglit
    - .test-manual-mr
  variables:
    PIGLIT_PROFILES: quick_gl

a530_piglit_shader:
  extends:
    - .a530_piglit
  parallel: 2
  variables:
    PIGLIT_PROFILES: quick_shader

a530-traces:
  extends:
    - .freedreno-test-traces
    - .a530-test
  variables:
    PIGLIT_REPLAY_DEVICE_NAME: "freedreno-a530"
    PIGLIT_RESULTS: "freedreno-a530-replay"

.a630-test:
  extends:
    - .freedreno-test
  variables:
    FDO_CI_CONCURRENT: 10
    BM_KERNEL: /baremetal-files/cheza-kernel
    BM_CMDLINE: "ip=dhcp console=ttyMSM0,115200n8 root=/dev/nfs rw nfsrootdebug nfsroot=,tcp,nfsvers=4.2 init=/init"
    GPU_VERSION: freedreno-a630
  tags:
    - google-freedreno-cheza
  script:
    - ./install/bare-metal/cros-servo.sh

a630_gl:
  extends:
    - .baremetal-deqp-test
    - .a630-test
  parallel: 4
  variables:
    DEQP_SUITE: freedreno-a630

# Robustness tests may be disruptive to other tests, so we run EGL's robustness
# tests separately.
a630_egl:
  extends:
    - .baremetal-deqp-test
    - .a630-test
  variables:
    DEQP_VER: egl
    HWCI_START_XORG: 1
    HWCI_TEST_SCRIPT: "/install/bare-metal/arm64_a630_egl.sh"

a630_gles_asan:
  extends:
    - .baremetal-deqp-test
    - .a630-test
    - .baremetal-arm64-asan-test
    - .test-manual
  variables:
    DEQP_VER: gles31
    DEQP_FRACTION: 10
    DEQP_EXPECTED_RENDERER: FD630
    GPU_VERSION: freedreno-a630-asan

a630_vk:
  extends:
    - .a630-test
    - .baremetal-deqp-test-freedreno-vk
  parallel: 3
  variables:
    DEQP_SUITE: freedreno-a630-vk

a630_vk_full:
  extends:
    - a630_vk
    - .test-manual-mr
  parallel: 2
  variables:
    DEQP_SUITE: freedreno-a630-vk-full

# Disabled by default until we can sort out what looks like timeouts before
# getting to the first test (or is it at cleanup after tests completed?).
# Clicking play can show you some useful areas for fixing turnip, though.
a630_vk_asan:
  extends:
    - .a630-test
    - .baremetal-deqp-test-freedreno-vk
    - .baremetal-arm64-asan-test
    - .test-manual
  variables:
    DEQP_EXPECTED_RENDERER: "Turnip Adreno (TM) 630"
    DEQP_FRACTION: 100
    FDO_CI_CONCURRENT: 4 # We get OOMkills if we go too wide with asan enabled
    TU_DEBUG: forcebin
    # Disable the leak checks, since the library gets dlclose()d and thus get
    # totally useless leak reports.  We can still catch buffer overflows.
    ASAN_OPTIONS: "detect_leaks=0"

a630_piglit:
  extends:
    - .piglit-test
    - .a630-test
  variables:
    HWCI_TEST_SCRIPT: "/install/piglit/piglit-runner.sh"
    HWCI_START_XORG: 1
    PIGLIT_PROFILES: gpu

a630-traces:
  extends:
    - .freedreno-test-traces
    - .a630-test
  variables:
    PIGLIT_REPLAY_DEVICE_NAME: "freedreno-a630"
    PIGLIT_RESULTS: "freedreno-a630-replay"
    # This lets us run several more traces which don't use any features we're
    # missing.
    MESA_GLSL_VERSION_OVERRIDE: "460"
    MESA_GL_VERSION_OVERRIDE: "4.6"

a630-traces-restricted:
  extends:
    - a630-traces
    - .freedreno-rules-restricted
  variables:
    PIGLIT_REPLAY_DESCRIPTION_FILE: "/install/restricted-traces-freedreno.yml"
    PIGLIT_REPLAY_EXTRA_ARGS:  --keep-image --db-path ${CI_PROJECT_DIR}/replayer-db/ --minio_host=minio-packet.freedesktop.org --minio_bucket=mesa-tracie-private --role-session-name=${CI_PROJECT_PATH}:${CI_JOB_ID} --jwt=${CI_JOB_JWT}
  allow_failure: true

a630-traces-performance:
  extends:
    - a630-traces
    - .freedreno-rules-performance
  variables:
    PIGLIT_REPLAY_SUBCOMMAND: "profile"
    PIGLIT_REPLAY_EXTRA_ARGS: "--db-path ${CI_PROJECT_DIR}/replayer-db/"
    # More than this can hit OOM due to BOs leaked during the replay of the last frame
    PIGLIT_REPLAY_LOOP_TIMES: 150
    # We don't want for more than one workload to be submitted to the GPU at a time
    FDO_CI_CONCURRENT: 1
    # So we aren't capped by VSync by the X server
    EGL_PLATFORM: surfaceless
    GIT_STRATEGY: none
    HWCI_FREQ_MAX: "true"
  allow_failure: true
