From 4ab7e88994234c14972cde4731e73e5c3bef9502 Mon Sep 17 00:00:00 2001
From: suijingfeng <suijingfeng@loongson.cn>
Date: Sun, 11 Jul 2021 04:23:59 +0800
Subject: [PATCH 1/4] meson: add loongarch64 build support

Signed-off-by: suijingfeng <suijingfeng@loongson.cn>
---
 meson.build | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meson.build b/meson.build
index bd54e78..3242bb7 100644
--- a/meson.build
+++ b/meson.build
@@ -176,6 +176,8 @@ if dri_drivers.contains('auto')
       dri_drivers = []
     elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
       dri_drivers = ['r100', 'r200', 'nouveau']
+    elif ['loongarch64'].contains(host_machine.cpu_family())
+      dri_drivers = []
     else
       error('Unknown architecture @0@. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.'.format(
             host_machine.cpu_family()))
@@ -215,6 +217,11 @@ if gallium_drivers.contains('auto')
       gallium_drivers = [
         'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'swrast'
       ]
+    elif ['loongarch64'].contains(host_machine.cpu_family())
+      gallium_drivers = [
+        'r300', 'r600', 'radeonsi', 'nouveau', 'etnaviv', 'kmsro', 'swrast',
+        'virgl'
+      ]
     else
       error('Unknown architecture @0@. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.'.format(
             host_machine.cpu_family()))
@@ -268,6 +275,8 @@ if _vulkan_drivers.contains('auto')
       _vulkan_drivers = ['swrast']
     elif ['mips', 'mips64', 'riscv32', 'riscv64'].contains(host_machine.cpu_family())
       _vulkan_drivers = ['amd', 'swrast']
+    elif ['loongarch64'].contains(host_machine.cpu_family())
+      _vulkan_drivers = ['amd', 'swrast']
     else
       error('Unknown architecture @0@. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.'.format(
             host_machine.cpu_family()))
-- 
2.20.1

