Add vivante drm support
Upstream-Status: Pending
Signed-off-by: Yong Gan <yong.gan@nxp.com>
diff --git a/Makefile.am b/Makefile.am
index 7b86214..649160d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,6 +38,7 @@
--enable-freedreno-kgsl\
--enable-tegra-experimental-api \
--enable-etnaviv-experimental-api \
+ --enable-vivante-experimental-api \
--enable-install-test-programs \
--enable-cairo-tests \
--enable-manpages \
@@ -89,6 +90,9 @@
if HAVE_ETNAVIV
ETNAVIV_SUBDIR = etnaviv
endif
+if HAVE_VIVANTE
+VIVANTE_SUBDIR = vivante
+endif
if BUILD_MANPAGES
if HAVE_MANPAGES_STYLESHEET
@@ -108,6 +112,7 @@
$(FREEDRENO_SUBDIR) \
$(TEGRA_SUBDIR) \
$(VC4_SUBDIR) \
+ $(VIVANTE_SUBDIR) \
$(ETNAVIV_SUBDIR) \
data \
tests \
diff --git a/Makefile.sources b/Makefile.sources
index 10aa1d0..88d4f86 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -34,6 +34,7 @@
include/drm/sis_drm.h \
include/drm/tegra_drm.h \
include/drm/vc4_drm.h \
+ include/drm/vivante_drm.h \
include/drm/via_drm.h \
include/drm/virtgpu_drm.h
diff --git a/configure.ac b/configure.ac
index ccb910a..1259a8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,11 @@
[Enable support for Tegra's experimental API (default: disabled)]),
[TEGRA=$enableval], [TEGRA=no])
+AC_ARG_ENABLE(vivante-experimental-api,
+ AS_HELP_STRING([--enable-vivante-experimental-api],
+ [Enable support for vivante's experimental API (default: disabled)]),
+ [VIVANTE=$enableval], [VIVANTE=no])
+
AC_ARG_ENABLE(vc4,
AS_HELP_STRING([--disable-vc4],
[Enable support for vc4's API (default: auto, enabled on arm)]),
@@ -436,6 +441,11 @@
AC_DEFINE(HAVE_TEGRA, 1, [Have Tegra support])
fi
+AM_CONDITIONAL(HAVE_VIVANTE, [test "x$VIVANTE" = xyes])
+if test "x$VIVANTE" = xyes; then
+ AC_DEFINE(HAVE_VIVANTE, 1, [Have vivante support])
+fi
+
AM_CONDITIONAL(HAVE_VC4, [test "x$VC4" = xyes])
if test "x$VC4" = xyes; then
AC_DEFINE(HAVE_VC4, 1, [Have VC4 support])
@@ -549,6 +559,8 @@
freedreno/libdrm_freedreno.pc
tegra/Makefile
tegra/libdrm_tegra.pc
+ vivante/Makefile
+ vivante/libdrm_vivante.pc
vc4/Makefile
vc4/libdrm_vc4.pc
etnaviv/Makefile
@@ -564,6 +576,7 @@
tests/vbltest/Makefile
tests/exynos/Makefile
tests/tegra/Makefile
+ tests/vivante/Makefile
tests/nouveau/Makefile
tests/etnaviv/Makefile
tests/util/Makefile
@@ -584,6 +597,7 @@
echo " EXYNOS API $EXYNOS"
echo " Freedreno API $FREEDRENO (kgsl: $FREEDRENO_KGSL)"
echo " Tegra API $TEGRA"
+echo " Vivante API $VIVANTE"
echo " VC4 API $VC4"
echo " Etnaviv API $ETNAVIV"
echo ""
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 3ad838d..8ae9fd5 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -42,11 +42,15 @@
#define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
/* 16 bpp Red */
-#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
+#define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
/* 16 bpp RG */
-#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */
-#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */
+#define DRM_FORMAT_RG88 fourcc_code('R', 'G', '8', '8') /* [15:0] R:G 8:8 little endian */
+#define DRM_FORMAT_GR88 fourcc_code('G', 'R', '8', '8') /* [15:0] G:R 8:8 little endian */
+
+/* 32 bpp RG */
+#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */
+#define DRM_FORMAT_GR1616 fourcc_code('G', 'R', '3', '2') /* [31:0] G:R 16:16 little endian */
/* 32 bpp RG */
#define DRM_FORMAT_RG1616 fourcc_code('R', 'G', '3', '2') /* [31:0] R:G 16:16 little endian */
@@ -294,7 +298,7 @@
* - multiple of 128 pixels for the width
* - multiple of 32 pixels for the height
*
- * For more information: see https://linuxtv.org/downloads/v4l-dvb-apis/re32.html
+ * For more information: see http://linuxtv.org/downloads/v4l-dvb-apis/re32.html
*/
#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1)
diff --git a/include/drm/vivante_drm.h b/include/drm/vivante_drm.h
new file mode 100644
index 0000000..29c7f27
--- /dev/null
+++ b/include/drm/vivante_drm.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright © 2017 VIVANTE Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __VIVNATE_DRM_H__
+#define __VIVNATE_DRM_H__
+
+#include <drm.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+struct drm_viv_gem_create {
+ __u64 size; /* in */
+ __u32 flags; /* in */
+ __u32 handle; /* out */
+};
+
+struct drm_viv_gem_lock {
+ __u32 handle;
+ __u32 cacheable;
+ __u32 gpu_va;
+ __u64 cpu_va;
+};
+
+struct drm_viv_gem_unlock {
+ __u32 handle;
+};
+
+struct drm_viv_gem_cache {
+ __u32 handle;
+ __u32 op;
+ __u64 logical;
+ __u64 bytes;
+};
+
+struct drm_viv_gem_getinfo {
+ __u32 handle;
+ __u32 param;
+ __u64 value;
+};
+
+#define DRM_VIV_GEM_CREATE 0x00
+#define DRM_VIV_GEM_LOCK 0x01
+#define DRM_VIV_GEM_UNLOCK 0x02
+#define DRM_VIV_GEM_CACHE 0x03
+#define DRM_VIV_GEM_GETINFO 0x04
+#define DRM_VIV_NUM_IOCTLS 0x05
+
+#define DRM_IOCTL_VIV_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_CREATE, struct drm_viv_gem_create)
+#define DRM_IOCTL_VIV_GEM_LOCK DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_LOCK, struct drm_viv_gem_lock)
+#define DRM_IOCTL_VIV_GEM_UNLOCK DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_UNLOCK, struct drm_viv_gem_unlock)
+#define DRM_IOCTL_VIV_GEM_CACHE DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_CACHE, struct drm_viv_gem_cache)
+#define DRM_IOCTL_VIV_GEM_GETINFO DRM_IOWR(DRM_COMMAND_BASE + DRM_VIV_GEM_GETINFO, struct drm_viv_gem_getinfo)
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __VIVNATE_DRM_H__ */
diff --git a/tests/vivante/Makefile.am b/tests/vivante/Makefile.am
new file mode 100644
index 0000000..8a0dedb
--- /dev/null
+++ b/tests/vivante/Makefile.am
@@ -0,0 +1,16 @@
+AM_CFLAGS = \
+ -pthread \
+ $(WARN_CFLAGS) \
+ -I$(top_srcdir)/include/drm \
+ -I$(top_srcdir)/vivante \
+ -I$(top_srcdir)
+
+LDADD = \
+ ../../vivante/libdrm_vivante.la \
+ ../../libdrm.la \
+ -ldl
+
+TESTS = viv_bo_test
+
+bin_PROGRAMS = $(TESTS)
+
diff --git a/tests/vivante/viv_bo_test.c b/tests/vivante/viv_bo_test.c
new file mode 100644
index 0000000..aa21af3
--- /dev/null
+++ b/tests/vivante/viv_bo_test.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright © 2015 Canonical Ltd. (Maarten Lankhorst)
+ *
+ * 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 and this permission notice 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
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <sys/ioctl.h>
+#include <dlfcn.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <pthread.h>
+
+#include "xf86drm.h"
+#include "vivante.h"
+
+static int import_fd;
+
+static void *
+openclose(void *dev)
+{
+ int fd = (intptr_t)dev;
+ uint32_t bo_handle;
+ int i;
+
+ for (i = 0; i < 100000; ++i) {
+ if (!drmPrimeFDToHandle(fd, import_fd, &bo_handle))
+ drm_vivante_bo_destroy(fd, bo_handle);
+ }
+ return NULL;
+}
+
+int main(int argc, char *argv[])
+{
+ drmVersionPtr version;
+ const char *device = NULL;
+ int err, fd1, fd2;
+ uint32_t bo_handle;
+ pthread_t t1, t2;
+
+ if (argc < 2) {
+ fd1 = drmOpenWithType("vivante", NULL, DRM_NODE_RENDER);
+ if (fd1 >= 0)
+ fd2 = drmOpenWithType("vivante", NULL, DRM_NODE_RENDER);
+ } else {
+ device = argv[1];
+
+ fd1 = open(device, O_RDWR);
+ if (fd1 >= 0)
+ fd2 = open(device, O_RDWR);
+ else
+ fd2 = fd1 = -errno;
+ }
+
+ if (fd1 < 0) {
+ fprintf(stderr, "Opening 1st vivante render node failed with %i\n", fd1);
+ return device ? -fd1 : 77;
+ }
+
+ if (fd2 < 0) {
+ fprintf(stderr, "Opening 2nd vivante render node failed with %i\n", -errno);
+ return errno;
+ }
+
+ version = drmGetVersion(fd1);
+ if (version) {
+ printf("Version: %d.%d.%d\n", version->version_major,
+ version->version_minor, version->version_patchlevel);
+ printf(" Name: %s\n", version->name);
+ printf(" Date: %s\n", version->date);
+ printf(" Description: %s\n", version->desc);
+
+ drmFreeVersion(version);
+ }
+
+ err = drm_vivante_bo_create(fd2, 0, 4096, &bo_handle);
+ if (!err)
+ err = drmPrimeHandleToFD(fd2, bo_handle, DRM_CLOEXEC, &import_fd);
+
+ if (!err) {
+ pthread_create(&t1, NULL, openclose, (void*)(intptr_t)fd1);
+ pthread_create(&t2, NULL, openclose, (void*)(intptr_t)fd1);
+ }
+
+ pthread_join(t1, NULL);
+ pthread_join(t2, NULL);
+
+ close(import_fd);
+ drm_vivante_bo_destroy(fd2, bo_handle);
+
+ if (device) {
+ close(fd2);
+ close(fd1);
+ } else {
+ drmClose(fd2);
+ drmClose(fd1);
+ }
+
+ return 0;
+}
diff --git a/vivante/Android.mk b/vivante/Android.mk
new file mode 100644
index 0000000..234028a
--- /dev/null
+++ b/vivante/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libdrm_vivante
+
+LOCAL_SHARED_LIBRARIES := libdrm
+
+LOCAL_SRC_FILES := vivante.c
+
+include $(LIBDRM_COMMON_MK)
+include $(BUILD_SHARED_LIBRARY)
diff --git a/vivante/Makefile.am b/vivante/Makefile.am
new file mode 100644
index 0000000..8963bf0
--- /dev/null
+++ b/vivante/Makefile.am
@@ -0,0 +1,24 @@
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/include/drm
+
+AM_CFLAGS = \
+ @PTHREADSTUBS_CFLAGS@ \
+ $(WARN_CFLAGS)
+
+libdrm_vivante_ladir = $(libdir)
+libdrm_vivante_la_LTLIBRARIES = libdrm_vivante.la
+libdrm_vivante_la_LDFLAGS = -version-number 1:0:0 -no-undefined
+libdrm_vivante_la_LIBADD = ../libdrm.la @PTHREADSTUBS_LIBS@
+
+libdrm_vivante_la_SOURCES = \
+ vivante.c
+
+libdrm_vivanteincludedir = ${includedir}/libdrm
+libdrm_vivanteinclude_HEADERS = vivante.h
+
+pkgconfigdir = @pkgconfigdir@
+pkgconfig_DATA = libdrm_vivante.pc
+
+TESTS = vivante-symbol-check
+EXTRA_DIST = $(TESTS)
diff --git a/vivante/libdrm_vivante.pc.in b/vivante/libdrm_vivante.pc.in
new file mode 100644
index 0000000..2598d6b
--- /dev/null
+++ b/vivante/libdrm_vivante.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libdrm_vivante
+Description: Userspace interface to Vivante kernel DRM services
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -ldrm_vivante
+Cflags: -I${includedir} -I${includedir}/libdrm
+Requires.private: libdrm
diff --git a/vivante/vivante-symbol-check b/vivante/vivante-symbol-check
new file mode 100644
index 0000000..29c12a0
--- /dev/null
+++ b/vivante/vivante-symbol-check
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# The following symbols (past the first nine) are taken from vivante.h.
+
+FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_vivante.so} | awk '{print $3}'| while read func; do
+( grep -q "^$func$" || echo $func ) <<EOF
+__bss_end__
+__bss_start__
+__bss_start
+__end__
+_bss_end__
+_edata
+_end
+_fini
+_init
+drm_vivante_bo_create
+drm_vivante_bo_destroy
+drm_vivante_bo_lock
+drm_vivante_bo_unlock
+drm_vivante_bo_cache
+drm_vivante_bo_getinfo
+EOF
+done)
diff --git a/vivante/vivante.c b/vivante/vivante.c
new file mode 100644
index 0000000..b82138c
--- /dev/null
+++ b/vivante/vivante.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright © 2012, 2013 Thierry Reding
+ * Copyright © 2013 Erik Faye-Lund
+ * Copyright © 2014 NVIDIA Corporation
+ *
+ * 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 and this permission notice 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
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sys/mman.h>
+
+#include <xf86drm.h>
+
+#include <vivante_drm.h>
+
+#include "vivante.h"
+
+int drm_vivante_bo_create(int fd, uint32_t flags, uint32_t size, uint32_t *handle)
+{
+ struct drm_viv_gem_create args;
+ int err = 0;
+
+ if (size == 0 || !handle)
+ return -EINVAL;
+
+ memset(&args, 0, sizeof(args));
+ args.flags = flags;
+ args.size = size;
+
+ if (drmIoctl(fd, DRM_IOCTL_VIV_GEM_CREATE, &args))
+ return -errno;
+
+ *handle = args.handle;
+
+ return 0;
+}
+
+int drm_vivante_bo_destroy(int fd, uint32_t handle)
+{
+ struct drm_gem_close args;
+
+ if (!handle)
+ return -EINVAL;
+
+ args.handle = handle;
+ if (drmIoctl(fd, DRM_IOCTL_GEM_CLOSE, &args))
+ return -errno;
+
+ return 0;
+}
+
+void* drm_vivante_bo_lock(int fd, uint32_t handle, uint32_t *gpu_va)
+{
+ struct drm_viv_gem_lock args;
+
+ if (!handle)
+ return NULL;
+
+ args.handle = handle;
+ args.cacheable = 0;
+ if (drmIoctl(fd, DRM_IOCTL_VIV_GEM_LOCK, &args))
+ return NULL;
+
+ if (gpu_va)
+ {
+ *gpu_va = args.gpu_va;
+ }
+
+ return (void*)(intptr_t)args.cpu_va;
+}
+
+int drm_vivante_bo_unlock(int fd, uint32_t handle)
+{
+ struct drm_viv_gem_unlock args;
+
+ if (!handle)
+ return -EINVAL;
+
+ args.handle = handle;
+ if (drmIoctl(fd, DRM_IOCTL_VIV_GEM_UNLOCK, &args))
+ return -errno;
+
+ return 0;
+}
+
+int drm_vivante_bo_cache(int fd, uint32_t handle, uint32_t op, void* logical, uint32_t bytes)
+{
+ struct drm_viv_gem_cache args;
+
+ if (!handle)
+ return -EINVAL;
+
+ args.handle = handle;
+ args.op = handle;
+ args.logical = (uintptr_t)logical;
+ args.bytes = bytes;
+ if (drmIoctl(fd, DRM_IOCTL_VIV_GEM_CACHE, &args))
+ return -errno;
+
+ return 0;
+}
+
+int drm_vivante_bo_getinfo(int fd, uint32_t handle, uint32_t param, uint64_t *value)
+{
+ struct drm_viv_gem_getinfo args;
+
+ if (!handle)
+ return -EINVAL;
+
+ args.handle = handle;
+ args.param = param;
+ if (drmIoctl(fd, DRM_IOCTL_VIV_GEM_GETINFO, &args))
+ return -errno;
+
+ *value = args.value;
+
+ return 0;
+}
+
+
+
diff --git a/vivante/vivante.h b/vivante/vivante.h
new file mode 100644
index 0000000..2492e5a
--- /dev/null
+++ b/vivante/vivante.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright © 2017 VIVANTE Corporation
+ *
+ * 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 and this permission notice (including the next
+ * paragraph) 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
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ */
+
+#ifndef __DRM_VIVANTE_H__
+#define __DRM_VIVANTE_H__ 1
+
+#include <stdint.h>
+#include <stdlib.h>
+
+enum VIV_CACHE_OP {
+ VIV_CACHE_CLEAN = 0x01,
+ VIV_CACHE_INVALIDATE = 0x02,
+ VIV_CACHE_FLUSH = VIV_CACHE_CLEAN | VIV_CACHE_INVALIDATE,
+ VIV_CACHE_BARRIER = 0x04
+};
+
+enum VIV_GEM_PARAM {
+ VIV_GEM_PARAM_NODE = 0,
+ VIV_GEM_PARAM_POOL,
+ VIV_GEM_PARAM_SIZE,
+};
+
+int drm_vivante_bo_create(int fd, uint32_t flags, uint32_t size, uint32_t *handle);
+int drm_vivante_bo_destroy(int fd, uint32_t handle);
+void* drm_vivante_bo_lock(int fd, uint32_t handle, uint32_t *gpu_va);
+int drm_vivante_bo_unlock(int fd, uint32_t handle);
+int drm_vivante_bo_cache(int fd, uint32_t handle, uint32_t op, void* logical, uint32_t bytes);
+int drm_vivante_bo_getinfo(int fd, uint32_t handle, uint32_t param, uint64_t *value);
+
+#endif /* __DRM_VIVANTE_H__ */