Enable the SwiftShader wrapper

BUG: 77218110
Test: Local build and boot
Change-Id: I15605cbb271c20f89c9a9fdfeb792580cb64caea
diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk
index 5840808..6e10d72 100644
--- a/shared/BoardConfig.mk
+++ b/shared/BoardConfig.mk
@@ -79,6 +79,8 @@
 
 USE_OPENGL_RENDERER := true
 
+BOARD_SWIFTSHADER_RELATIVE_PATH := gl_impl/swiftshader
+
 # Wifi.
 BOARD_WLAN_DEVICE           := wlan0
 BOARD_HOSTAPD_DRIVER        := NL80211
diff --git a/shared/config/README_egl.md b/shared/config/README_egl.md
new file mode 100644
index 0000000..1cee739
--- /dev/null
+++ b/shared/config/README_egl.md
@@ -0,0 +1,4 @@
+# EGL placeholder
+
+This is a placeholder for the actual egl implementation. Normally init would
+have bind mounted the actual implementation here in the early boot.
diff --git a/shared/config/init.vsoc.rc b/shared/config/init.vsoc.rc
index 867c7f1..cd96c51 100644
--- a/shared/config/init.vsoc.rc
+++ b/shared/config/init.vsoc.rc
@@ -7,6 +7,7 @@
     mkdir /dev/gce 0750
     chown system system /dev/gce
 
+    mount none /vendor/lib/gl_impl/locking_wrapper /vendor/lib/egl bind rec
     mount debugfs debugfs /sys/kernel/debug
     chmod 0755 /sys/kernel/debug
     setprop service.adb.tcp.port 5555
diff --git a/shared/device.mk b/shared/device.mk
index 12d42c0..c6dfab5 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -85,12 +85,24 @@
 
 #
 # Packages for the OpenGL implementation
-# TODO(ghartman): Remove this vendor dependency when possible
 #
+
+# Placeholder to ensure that /vendor/lib/egl exists
+PRODUCT_COPY_FILES += \
+    device/google/cuttlefish/shared/config/README_egl.md:$(TARGET_COPY_OUT_VENDOR)/lib/egl/README.md
+
+# SwiftShader provides a software-only implementation that is not thread-safe
 PRODUCT_PACKAGES += \
     libEGL_swiftshader \
     libGLESv1_CM_swiftshader \
-    libGLESv2_swiftshader \
+    libGLESv2_swiftshader
+
+# The locking_wrapper puts a lock around all of the SwiftShader entry points to
+# serialize all access to the library, reducing the chances for races.
+PRODUCT_PACKAGES += \
+    libEGL_locking_wrapper \
+    libGLESv1_CM_locking_wrapper \
+    libGLESv2_locking_wrapper
 
 DEVICE_PACKAGE_OVERLAYS := device/google/cuttlefish/shared/overlay
 PRODUCT_AAPT_CONFIG := normal large xlarge hdpi xhdpi