.broadcom-common-rules:
  rules:
    - changes: &broadcom_file_list
        - src/broadcom/meson.build
        - src/broadcom/ci/gitlab-ci.yml
        - src/broadcom/ci/gitlab-ci-inc.yml
        - src/broadcom/ci/deqp-$DEQP_SUITE.toml
        - src/broadcom/ci/$GPU_VERSION-fails.txt
        - src/broadcom/ci/$GPU_VERSION-flakes.txt
        - src/broadcom/ci/$GPU_VERSION-skips.txt
        - src/broadcom/ci/$VK_DRIVER-skips.txt
        - src/broadcom/ci/$GALLIUM_DRIVER-skips.txt
        - src/broadcom/ci/$DRIVER_NAME-skips.txt
        - src/broadcom/ci/$PIGLIT_TRACES_FILE
        - src/broadcom/cle/**/*
        - src/broadcom/clif/**/*
        - src/broadcom/common/**/*
        - src/broadcom/compiler/**/*
        - src/broadcom/drm-shim/**/*
        - src/broadcom/qpu/**/*
        - src/broadcom/simulator/**/*
      when: on_success

.broadcom-common-manual-rules:
  rules:
    - changes: *broadcom_file_list
      when: manual

.vc4-rules:
  stage: broadcom
  rules:
    - if: $FORCE_KERNEL_TAG != null
      when: never
    - !reference [.test, rules]
    - !reference [.igalia-farm-rules, rules]
    - !reference [.gl-rules, rules]
    - !reference [.broadcom-common-rules, rules]
    - changes: &vc4_file_list
        - src/gallium/drivers/vc4/**/*
        - src/gallium/winsys/vc4/**/*
        - src/gallium/auxiliary/renderonly/**/*
        - src/gallium/winsys/kmsro/**/*
      when: on_success

.vc4-manual-rules:
  stage: broadcom-postmerge
  extends: .no-auto-retry
  rules:
    - !reference [.test, rules]
    - !reference [.igalia-farm-manual-rules, rules]
    - !reference [.gl-manual-rules, rules]
    - !reference [.broadcom-common-manual-rules, rules]
    - changes: *vc4_file_list
      when: manual

.v3d-rules:
  stage: broadcom
  rules:
    - if: $FORCE_KERNEL_TAG != null
      when: never
    - !reference [.test, rules]
    - !reference [.igalia-farm-rules, rules]
    - !reference [.gl-rules, rules]
    - !reference [.broadcom-common-rules, rules]
    - changes: &v3d_file_list
        - src/gallium/drivers/v3d/**/*
        - src/gallium/winsys/v3d/**/*
        - src/gallium/auxiliary/renderonly/**/*
        - src/gallium/winsys/kmsro/**/*
      when: on_success

.v3d-manual-rules:
  stage: broadcom-postmerge
  extends: .no-auto-retry
  rules:
    - !reference [.test, rules]
    - !reference [.igalia-farm-manual-rules, rules]
    - !reference [.gl-manual-rules, rules]
    - !reference [.broadcom-common-manual-rules, rules]
    - changes:
        *v3d_file_list
      when: manual

.v3d-rusticl-rules:
  stage: broadcom
  rules:
    - !reference [.v3d-rules, rules]
    - !reference [.rusticl-rules, rules]

.v3d-rusticl-manual-rules:
  stage: broadcom-postmerge
  extends: .no-auto-retry
  rules:
    - !reference [.v3d-manual-rules, rules]
    - !reference [.rusticl-manual-rules, rules]

.v3dv-rules:
  stage: broadcom
  rules:
    - if: $FORCE_KERNEL_TAG != null
      when: never
    - !reference [.test, rules]
    - !reference [.igalia-farm-rules, rules]
    - !reference [.vulkan-rules, rules]
    - !reference [.broadcom-common-rules, rules]
    - changes: &v3dv_file_list
        - src/broadcom/vulkan/**/*
      when: on_success

.v3dv-manual-rules:
  stage: broadcom-postmerge
  extends: .no-auto-retry
  rules:
    - !reference [.test, rules]
    - !reference [.igalia-farm-manual-rules, rules]
    - !reference [.vulkan-manual-rules, rules]
    - !reference [.broadcom-common-manual-rules, rules]
    - changes: *v3dv_file_list
      when: manual

# 8 devices (2023-12-18)
.igalia-bcm2837-rpi-3-b:
  variables:
    DEVICE_TYPE: rpi3
    GPU_VERSION: broadcom-rpi3
  script:
    - ./install/bare-metal/poe-powered.sh
  tags:
    - igalia-rpi3

# 21 devices (2023-12-18)
.igalia-bcm2711-rpi-4:
  variables:
    DEVICE_TYPE: rpi4
    GPU_VERSION: broadcom-rpi4
    VK_DRIVER: broadcom
  script:
    - ./install/bare-metal/poe-powered.sh
  tags:
    - igalia-rpi4

# 10 devices (2024-07-31)
.igalia-bcm2712-rpi-5:
  variables:
    DEVICE_TYPE: rpi5
    GPU_VERSION: broadcom-rpi5
    VK_DRIVER: broadcom
  script:
    - ./install/bare-metal/poe-powered.sh
  tags:
    - igalia-rpi5

.broadcom-test:
  script:
    - ./install/bare-metal/poe-powered.sh
  variables:
    BOOT_PHASE_TIMEOUT_SECONDS: 90
    HWCI_TEST_SCRIPT: "/install/deqp-runner.sh"
    FLAKES_CHANNEL: "#videocore-ci"
    FARM: igalia
  timeout: 25m

.broadcom-test:arm64:
  extends:
    - .broadcom-test
    - .baremetal-test-arm64
  variables:
    BM_BOOTFS: /boot/raspberrypi_arm64

.broadcom-asan-test:arm64:
  extends:
    - .broadcom-test:arm64
    - .baremetal-arm64-asan-test

.broadcom-test:arm32:
  extends:
    - .broadcom-test
    - .baremetal-test-arm32
  variables:
    BM_BOOTFS: /boot/raspberrypi_arm32
