.freedreno-test:
  extends:
    - .baremetal-test-arm64
    - .use-debian/arm_test
    - .freedreno-rules
  variables:
    FLAKES_CHANNEL: "#freedreno-ci"
    PIGLIT_PLATFORM: mixed_glx_egl
    BM_CMDLINE: "ip=dhcp console=ttyMSM0,115200n8 $BM_KERNEL_EXTRA_ARGS 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

.freedreno-test-traces:
  extends:
    - .piglit-traces-test
  variables:
    HWCI_TEST_SCRIPT: "/install/piglit/piglit-traces.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
    FDO_CI_CONCURRENT: 6
  parallel: 5

# New jobs. Leave it as manual for now.
.a306_piglit:
  extends:
    - .piglit-test
    - .a306-test
    - .test-manual-mr
  variables:
    HWCI_START_XORG: 1

a306_piglit_gl:
  extends:
    - .a306_piglit
  variables:
    PIGLIT_PROFILES: quick_gl
    BM_KERNEL_EXTRA_ARGS: "msm.num_hw_submissions=1"
    FDO_CI_CONCURRENT: 3

a306_piglit_shader:
  extends:
    - .a306_piglit
  variables:
    PIGLIT_PROFILES: quick_shader
    FDO_CI_CONCURRENT: 6

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_KERNEL_EXTRA_ARGS: maxcpus=2
    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_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"

a618_vk:
  extends:
    - .lava-test:arm64
    - .freedreno-rules
  parallel: 7
  variables:
    VK_DRIVER: freedreno
    DEQP_SUITE: freedreno-a618-vk
    GPU_VERSION: freedreno-a618
    MESA_VK_IGNORE_CONFORMANCE_WARNING: 1
    DEVICE_TYPE: sc7180-trogdor-lazor-limozeen
    DTB: sc7180-trogdor-lazor-limozeen-nots
    BOOT_METHOD: depthcharge
    KERNEL_IMAGE_TYPE: ""
  tags:
    - mesa-ci-x86-64-lava-sc7180-trogdor-lazor-limozeen

a618_vk_full:
  extends:
    - a618_vk
    - .test-manual-mr
  parallel: 2
  variables:
    DEQP_SUITE: freedreno-a618-vk-full

.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
  variables:
    DEQP_VER: gles31
    DEQP_FRACTION: 100
    DEQP_EXPECTED_RENDERER: FD630
    FDO_CI_CONCURRENT: 2 # We get OOMkills if we go too wide with asan enabled
    GPU_VERSION: freedreno-a630-asan

a630_skqp:
  extends:
    - .baremetal-skqp-test
    - .a630-test
  variables:
    # Possible skqp backends: gl, gles, unitTest and vk
    # Note: vk backend is not working yet.
    SKQP_BACKENDS: gl gles unitTest  # space separated values

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

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

a630_vk_asan:
  extends:
    - .a630-test
    - .baremetal-deqp-test-freedreno-vk
    - .baremetal-arm64-asan-test
  variables:
    DEQP_SUITE: freedreno-a630-vk-asan
    FDO_CI_CONCURRENT: 2 # We get OOMkills if we go too wide with asan enabled

a630_piglit:
  extends:
    - .piglit-test
    - .a630-test
  variables:
    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-file=${CI_JOB_JWT_FILE}
  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
