minigbm: Android.bp: Add virgl varient of gralloc.minigbm am: 7658cd6a0e am: d0d2cf377a am: 70a57f9ab2

Original change: https://android-review.googlesource.com/c/platform/external/minigbm/+/1881150

Change-Id: I94d3e44345a215ecc54f080b5e3ca4e2c696b9e1
diff --git a/Android.bp b/Android.bp
index 9d8a567..31bb424 100644
--- a/Android.bp
+++ b/Android.bp
@@ -241,3 +241,16 @@
     defaults: ["minigbm_cros_gralloc0_defaults"],
     shared_libs: ["libminigbm_gralloc_msm"],
 }
+
+// VirGL
+cc_library_shared {
+    name: "libminigbm_gralloc_virgl",
+    defaults: ["minigbm_cros_gralloc_library_defaults"],
+    cflags: ["-DVIRTIO_GPU_NEXT"],
+}
+
+cc_library_shared {
+    name: "gralloc.minigbm_virgl",
+    defaults: ["minigbm_cros_gralloc0_defaults"],
+    shared_libs: ["libminigbm_gralloc_virgl"],
+}
diff --git a/cros_gralloc/gralloc4/Android.bp b/cros_gralloc/gralloc4/Android.bp
index c9de525..e8bc722 100644
--- a/cros_gralloc/gralloc4/Android.bp
+++ b/cros_gralloc/gralloc4/Android.bp
@@ -81,6 +81,14 @@
 }
 
 cc_binary {
+    name: "android.hardware.graphics.allocator@4.0-service.minigbm_virgl",
+    defaults: ["minigbm_gralloc4_allocator_defaults"],
+    shared_libs: ["libminigbm_gralloc_virgl"],
+    vintf_fragments: ["android.hardware.graphics.allocator@4.0.xml"],
+    init_rc: ["android.hardware.graphics.allocator@4.0-service.minigbm_virgl.rc"],
+}
+
+cc_binary {
     name: "android.hardware.graphics.allocator@4.0-service.minigbm_intel",
     defaults: ["minigbm_gralloc4_allocator_defaults"],
     shared_libs: ["libminigbm_gralloc_intel"],
@@ -114,6 +122,14 @@
 }
 
 cc_library_shared {
+    name: "android.hardware.graphics.mapper@4.0-impl.minigbm_virgl",
+    defaults: ["minigbm_gralloc4_common_defaults"],
+    shared_libs: ["libminigbm_gralloc_virgl"],
+    vintf_fragments: ["android.hardware.graphics.mapper@4.0.xml"],
+    srcs: [":minigbm_gralloc4_mapper_files"],
+}
+
+cc_library_shared {
     name: "android.hardware.graphics.mapper@4.0-impl.minigbm_intel",
     defaults: ["minigbm_gralloc4_common_defaults"],
     shared_libs: ["libminigbm_gralloc_intel"],
diff --git a/cros_gralloc/gralloc4/android.hardware.graphics.allocator@4.0-service.minigbm_virgl.rc b/cros_gralloc/gralloc4/android.hardware.graphics.allocator@4.0-service.minigbm_virgl.rc
new file mode 100644
index 0000000..979f081
--- /dev/null
+++ b/cros_gralloc/gralloc4/android.hardware.graphics.allocator@4.0-service.minigbm_virgl.rc
@@ -0,0 +1,24 @@
+#
+# Copyright 2021 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+service vendor.graphics.allocator-4-0 /vendor/bin/hw/android.hardware.graphics.allocator@4.0-service.minigbm_virgl
+    interface android.hardware.graphics.allocator@4.0::IAllocator default
+    class hal animation
+    user system
+    group graphics drmrpc
+    capabilities SYS_NICE
+    onrestart restart surfaceflinger
+    task_profiles ServiceCapacityLow