Add the GPU blobs and enable in the build.

The pvrsrvkm service was already present in the init script.

Bug: 110964307
Change-Id: I5258f6d30521138e15b5fc0bfeaeee844730932f
Signed-off-by: Alistair Strachan <astrachan@google.com>
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..8e64492
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,17 @@
+// Copyright 2018 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.
+
+subdirs = [
+    "gpu",
+]
diff --git a/BoardConfig.mk b/BoardConfig.mk
index ba063e1..5a2698f 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -67,3 +67,7 @@
 TARGET_UBOOT_CONFIGS += device/ti/beagle_x15/beagle_x15_uboot.conf
 TARGET_UBOOT_MAKE_TARGET := u-boot-img.bin
 TARGET_UBOOT_COPY_TARGETS := u-boot.img MLO
+
+# Graphics
+BOARD_VENDOR_KERNEL_MODULES += \
+	device/ti/beagle_x15-kernel/$(TARGET_KERNEL_USE)/pvrsrvkm.ko
diff --git a/device.mk b/device.mk
index 74911a0..34fe1d7 100644
--- a/device.mk
+++ b/device.mk
@@ -36,6 +36,13 @@
 	libdrm \
 	libdrm_omap \
 	hwcomposer.am57x \
+	gralloc.am57x \
+	libEGL_POWERVR_SGX544_116 \
+	libGLESv1_CM_POWERVR_SGX544_116 \
+	libGLESv2_POWERVR_SGX544_116 \
+	libPVRScopeServices \
+	memtrack.am57x \
+	pvrsrvctl \
 
 #Security
 PRODUCT_PACKAGES += \
diff --git a/gpu/Android.bp b/gpu/Android.bp
new file mode 100644
index 0000000..c812249
--- /dev/null
+++ b/gpu/Android.bp
@@ -0,0 +1,132 @@
+// Copyright 2018 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.
+
+
+// Core dependencies
+
+cc_prebuilt_library_shared {
+    name: "libIMGegl",
+    srcs: ["libIMGegl.so"],
+    required: ["libpvrANDROID_WSEGL", "libsrv_um"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libglslcompiler",
+    srcs: ["libglslcompiler.so"],
+    required: ["libsrv_um", "libusc"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libpvr2d",
+    srcs: ["libpvr2d.so"],
+    required: ["libsrv_um"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libpvrANDROID_WSEGL",
+    srcs: ["libpvrANDROID_WSEGL.so"],
+    required: ["libsrv_um"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libsrv_init",
+    srcs: ["libsrv_init.so"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libsrv_um",
+    srcs: ["libsrv_um.so"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libusc",
+    srcs: ["libusc.so"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+// Pulled in as-needed
+
+cc_prebuilt_library_shared {
+    name: "gralloc.am57x",
+    srcs: ["gralloc.am57x.so"],
+    required: ["libpvr2d", "libsrv_um"],
+    relative_install_path: "hw",
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libEGL_POWERVR_SGX544_116",
+    srcs: ["libEGL_POWERVR_SGX544_116.so"],
+    required: ["libIMGegl"],
+    relative_install_path: "egl",
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libGLESv1_CM_POWERVR_SGX544_116",
+    srcs: ["libGLESv1_CM_POWERVR_SGX544_116.so"],
+    required: ["libIMGegl", "libsrv_um", "libusc"],
+    relative_install_path: "egl",
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libGLESv2_POWERVR_SGX544_116",
+    srcs: ["libGLESv2_POWERVR_SGX544_116.so"],
+    required: ["libIMGegl", "libglslcompiler", "libsrv_um"],
+    relative_install_path: "egl",
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "libPVRScopeServices",
+    srcs: ["libPVRScopeServices.so"],
+    required: ["libsrv_um"],
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_library_shared {
+    name: "memtrack.am57x",
+    srcs: ["memtrack.am57x.so"],
+    required: ["libsrv_um"],
+    relative_install_path: "hw",
+    strip: { none: true, },
+    vendor: true,
+}
+
+cc_prebuilt_binary {
+    name: "pvrsrvctl",
+    srcs: ["pvrsrvctl"],
+    required: ["libsrv_init", "libsrv_um"],
+    strip: { none: true, },
+    vendor: true,
+}
diff --git a/gpu/NOTICE b/gpu/NOTICE
new file mode 100644
index 0000000..8d388cb
--- /dev/null
+++ b/gpu/NOTICE
@@ -0,0 +1,137 @@
+/*
+ * TECHNOLOGY AND SOFTWARE PUBLICLY AVAILABLE
+ * SOFTWARE LICENSE FOR OMAP(TM) 4 USER SPACE GRAPHICS DRIVER BINARY
+ *
+ * Copyright (c) 2018, Texas Instruments Incorporated.
+ * Portions (c), Imagination Technologies Limited.
+ *
+ * All rights reserved not granted herein.
+ * Limited License.
+ *
+ * Texas Instruments Incorporated grants a world-wide, royalty-free,
+ * non-exclusive license under copyrights and patents it now or hereafter
+ * owns or controls to make, have made, use, import,
+ * offer to sell and sell ("Utilize") this software subject to the terms herein.
+ * With respect to the foregoing patent license, such license is granted
+ * solely to the extent that any such patent is necessary to Utilize the
+ * software alone.  The patent license shall not apply to any combinations which
+ * include this software, other than combinations with devices manufactured by
+ * or for TI ('TI Devices').
+ * No hardware patent is licensed hereunder.
+ *
+ * Redistributions must preserve existing copyright notices and reproduce this
+ * license (including the above copyright notice and the disclaimer and
+ * (if applicable) source code license limitations below) in the documentation
+ * and/or other materials provided with the distribution
+ *
+ * Redistribution and use in binary form, without modification, are permitted
+ * provided that the following conditions are met:
+ *
+ * * No reverse engineering, decompilation, or disassembly of this software is
+ * permitted with respect to any software provided in binary form.
+ * * any redistribution and use are licensed by TI for use only with TI Devices.
+ * * Nothing shall obligate TI to provide you with source code for the software
+ * licensed and provided to you in object code.
+ *
+ * If software source code is provided to you, modification and redistribution
+ * of the source code are permitted
+ * * provided that the following conditions are met:
+ *
+ * * any redistribution and use of the source code, including any resulting
+ * derivative works, are licensed by TI for use only with TI Devices.
+ * * any redistribution and use of any object code compiled from the source code
+ * and any resulting derivative works, are licensed by TI for use only
+ * with TI Devices.
+ *
+ * Neither the name of Texas Instruments Incorporated nor the names of its
+ * suppliers may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * DISCLAIMER.
+ *
+ * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Certain third party licenses not included:
+ *
+ * Certain software may (a) require patent licenses from third parties
+ * claiming patent rights covering implementation of the software or (b) be
+ * based on industry recognized standards or software programs published by
+ * industry recognized standards bodies and certain third parties may claim
+ * to own patents or copyrights that cover implementation of those standards.
+ * You acknowledge and agree that (i) this License does not convey a license
+ * to any such third party patents and copyrights, (ii) you are responsible
+ * for any fees or royalties that may be payable to any third party based on
+ * such third party's interests in such software and (iii) you will indemnify
+ * TI against your failure to make any such payments and will defend any
+ * claim, suit or proceeding brought against TI insofar as such claim, suit
+ * or proceeding is based on or arises from such failure.
+ *
+ */
+
+-----------------------------------------------------------------------------
+
+Additional legal notices pertaining to portions of included software:
+
+
+Copyright (c) 2007-2009 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+
+
+--------
+
+SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+
+Copyright (C) 2006 Silicon Graphics, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice including the dates of first publication and
+either this permission notice or a reference to
+http://oss.sgi.com/projects/FreeB/ shall be included in all copies or
+substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+Except as contained in this notice, the name of Silicon Graphics, Inc.
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+from Silicon Graphics, Inc.
+#257696v2
diff --git a/gpu/gralloc.am57x.so b/gpu/gralloc.am57x.so
new file mode 100644
index 0000000..42403b2
--- /dev/null
+++ b/gpu/gralloc.am57x.so
Binary files differ
diff --git a/gpu/libEGL_POWERVR_SGX544_116.so b/gpu/libEGL_POWERVR_SGX544_116.so
new file mode 100644
index 0000000..4c5d525
--- /dev/null
+++ b/gpu/libEGL_POWERVR_SGX544_116.so
Binary files differ
diff --git a/gpu/libGLESv1_CM_POWERVR_SGX544_116.so b/gpu/libGLESv1_CM_POWERVR_SGX544_116.so
new file mode 100644
index 0000000..1714b94
--- /dev/null
+++ b/gpu/libGLESv1_CM_POWERVR_SGX544_116.so
Binary files differ
diff --git a/gpu/libGLESv2_POWERVR_SGX544_116.so b/gpu/libGLESv2_POWERVR_SGX544_116.so
new file mode 100644
index 0000000..683c122
--- /dev/null
+++ b/gpu/libGLESv2_POWERVR_SGX544_116.so
Binary files differ
diff --git a/gpu/libIMGegl.so b/gpu/libIMGegl.so
new file mode 100644
index 0000000..9b92ef9
--- /dev/null
+++ b/gpu/libIMGegl.so
Binary files differ
diff --git a/gpu/libPVRScopeServices.so b/gpu/libPVRScopeServices.so
new file mode 100644
index 0000000..d898582
--- /dev/null
+++ b/gpu/libPVRScopeServices.so
Binary files differ
diff --git a/gpu/libglslcompiler.so b/gpu/libglslcompiler.so
new file mode 100644
index 0000000..02f90a2
--- /dev/null
+++ b/gpu/libglslcompiler.so
Binary files differ
diff --git a/gpu/libpvr2d.so b/gpu/libpvr2d.so
new file mode 100644
index 0000000..fde2e05
--- /dev/null
+++ b/gpu/libpvr2d.so
Binary files differ
diff --git a/gpu/libpvrANDROID_WSEGL.so b/gpu/libpvrANDROID_WSEGL.so
new file mode 100644
index 0000000..46bdb3f
--- /dev/null
+++ b/gpu/libpvrANDROID_WSEGL.so
Binary files differ
diff --git a/gpu/libsrv_init.so b/gpu/libsrv_init.so
new file mode 100644
index 0000000..7d7697a
--- /dev/null
+++ b/gpu/libsrv_init.so
Binary files differ
diff --git a/gpu/libsrv_um.so b/gpu/libsrv_um.so
new file mode 100644
index 0000000..f53468c
--- /dev/null
+++ b/gpu/libsrv_um.so
Binary files differ
diff --git a/gpu/libusc.so b/gpu/libusc.so
new file mode 100644
index 0000000..2557496
--- /dev/null
+++ b/gpu/libusc.so
Binary files differ
diff --git a/gpu/memtrack.am57x.so b/gpu/memtrack.am57x.so
new file mode 100644
index 0000000..46bb88b
--- /dev/null
+++ b/gpu/memtrack.am57x.so
Binary files differ
diff --git a/gpu/pvrsrvctl b/gpu/pvrsrvctl
new file mode 100755
index 0000000..23e035c
--- /dev/null
+++ b/gpu/pvrsrvctl
Binary files differ