Add DaydreamVR native libraries and services
Upstreaming the main VR system components from master-dreamos-dev
into goog/master.
Bug: None
Test: `m -j32` succeeds. Sailfish boots and basic_vr sample app works
Change-Id: I853015872afc443aecee10411ef2d6b79184d051
diff --git a/services/vr/bufferhubd/bufferhubd.cpp b/services/vr/bufferhubd/bufferhubd.cpp
new file mode 100644
index 0000000..a8e2ddf
--- /dev/null
+++ b/services/vr/bufferhubd/bufferhubd.cpp
@@ -0,0 +1,37 @@
+#include <sched.h>
+#include <unistd.h>
+
+#include <cutils/log.h>
+
+#include <dvr/performance_client_api.h>
+#include <pdx/default_transport/service_dispatcher.h>
+
+#include "buffer_hub.h"
+
+int main(int, char**) {
+ int ret = -1;
+ std::shared_ptr<android::pdx::Service> service;
+ std::unique_ptr<android::pdx::ServiceDispatcher> dispatcher;
+
+ // We need to be able to create endpoints with full perms.
+ umask(0000);
+
+ dispatcher = android::pdx::default_transport::ServiceDispatcher::Create();
+ CHECK_ERROR(!dispatcher, error, "Failed to create service dispatcher\n");
+
+ service = android::dvr::BufferHubService::Create();
+ CHECK_ERROR(!service, error, "Failed to create buffer hub service\n");
+ dispatcher->AddService(service);
+
+ ret = dvrSetSchedulerClass(0, "graphics");
+ CHECK_ERROR(ret < 0, error, "Failed to set thread priority");
+
+ ALOGI("Entering message loop.");
+
+ ret = dispatcher->EnterDispatchLoop();
+ CHECK_ERROR(ret < 0, error, "Dispatch loop exited because: %s\n",
+ strerror(-ret));
+
+error:
+ return -ret;
+}