Cleanup dvr_api.h to make it closer to the exported SDK version
Also fixed include guards on dvr_display_manager.h to avoid
collision with display_manager_client.h.
build_sdk.py has been moved to vendor/google_daydream/build.
Bug: b/38379392
Test: Built libdvr, surfaceflinger, ran libdvr/tests
Change-Id: I2807be6d2fd5c2814e86e5d8fae8de181397e4a6
diff --git a/libs/vr/libdvr/build_sdk.py b/libs/vr/libdvr/build_sdk.py
deleted file mode 100755
index b3c2e44..0000000
--- a/libs/vr/libdvr/build_sdk.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python
-import sys
-import os
-import argparse
-
-# Run this script to generate dvr_api.h in the current directory.
-
-def make_argument_parser():
- parser = argparse.ArgumentParser(
- description='Process DVR API headers into exportable SDK files.')
- return parser
-
-parser = make_argument_parser()
-
-in_file = open("include/dvr/dvr_api.h", "r")
-out_file = open("./dvr_api.h", "w")
-
-h_filename = ""
-for line in in_file:
- if line.startswith("// dvr_") and line.endswith(".h\n"):
- h_filename = "include/dvr/" + line[3:].strip()
- if line.startswith("typedef ") and "(*Dvr" in line:
- start = line.find("(*Dvr") + 5
- end = line.find("Ptr)")
- if end != -1:
- name = "dvr" + line[start:end]
- # Find the comments for this function and insert into output.
- with open(h_filename, 'r') as h_file:
- h_lines = h_file.readlines()
- i = 1
- while i < len(h_lines):
- if name in h_lines[i]:
- end_i = i
- while h_lines[i - 1].startswith("//"): i -= 1
- while i < end_i:
- out_file.write(h_lines[i])
- i += 1
- break
- i += 1
- if line.startswith('#include "dvr_api_entries.h"'):
- with open("include/dvr/dvr_api_entries.h") as f:
- out_file.write(f.read())
- else:
- out_file.write(line)
-
-in_file.close()
-out_file.close()
diff --git a/libs/vr/libdvr/include/dvr/dvr_api.h b/libs/vr/libdvr/include/dvr/dvr_api.h
index 06f89da..499c641 100644
--- a/libs/vr/libdvr/include/dvr/dvr_api.h
+++ b/libs/vr/libdvr/include/dvr/dvr_api.h
@@ -4,12 +4,15 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#include <sys/cdefs.h>
-#include <unistd.h>
+#include <cstdio>
+#include <dvr/dvr_display_types.h>
#include <dvr/dvr_hardware_composer_defs.h>
+#include <dvr/dvr_pose.h>
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef struct ANativeWindow ANativeWindow;
@@ -38,6 +41,11 @@
typedef struct DvrSurfaceAttributeValue DvrSurfaceAttributeValue;
typedef struct DvrSurfaceAttribute DvrSurfaceAttribute;
+// native_handle contains the fds for the underlying ION allocations inside
+// the gralloc buffer. This is needed temporarily while GPU vendors work on
+// better support for AHardwareBuffer via glBindSharedBuffer APIs. See
+// b/37207909. For now we can declare the native_handle struct where it is
+// used for GPU late latching. See cutils/native_handle.h for the struct layout.
struct native_handle;
// dvr_display_manager.h
@@ -173,7 +181,7 @@
uint32_t layer_count, uint64_t usage, size_t capacity,
DvrWriteBufferQueue** queue_out);
-// vsync_client_api.h
+// dvr_vsync.h
typedef int (*DvrVSyncClientCreatePtr)(DvrVSyncClient** client_out);
typedef void (*DvrVSyncClientDestroyPtr)(DvrVSyncClient* client);
typedef int (*DvrVSyncClientGetSchedInfoPtr)(DvrVSyncClient* client,
@@ -316,6 +324,8 @@
int dvrGetApi(void* api, size_t struct_size, int version);
-__END_DECLS
+#ifdef __cplusplus
+} // extern "C"
+#endif
#endif // ANDROID_DVR_API_H_
diff --git a/libs/vr/libdvr/include/dvr/dvr_display_manager.h b/libs/vr/libdvr/include/dvr/dvr_display_manager.h
index eb1e711..86ea5b6 100644
--- a/libs/vr/libdvr/include/dvr/dvr_display_manager.h
+++ b/libs/vr/libdvr/include/dvr/dvr_display_manager.h
@@ -1,5 +1,5 @@
-#ifndef DVR_DISPLAY_MANAGER_CLIENT_H_
-#define DVR_DISPLAY_MANAGER_CLIENT_H_
+#ifndef ANDROID_DVR_DISPLAY_MANAGER_H_
+#define ANDROID_DVR_DISPLAY_MANAGER_H_
#include <stdbool.h>
#include <stddef.h>
@@ -160,4 +160,4 @@
__END_DECLS
-#endif // DVR_DISPLAY_MANAGER_CLIENT_H_
+#endif // ANDROID_DVR_DISPLAY_MANAGER_H_
diff --git a/libs/vr/libdisplay/include/dvr/dvr_display_types.h b/libs/vr/libdvr/include/dvr/dvr_display_types.h
similarity index 100%
rename from libs/vr/libdisplay/include/dvr/dvr_display_types.h
rename to libs/vr/libdvr/include/dvr/dvr_display_types.h