| Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 1 | #include <sched.h> | 
|  | 2 | #include <unistd.h> | 
|  | 3 |  | 
| Alex Vakulenko | 4fe6058 | 2017-02-02 11:35:59 -0800 | [diff] [blame] | 4 | #include <log/log.h> | 
| Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 5 |  | 
|  | 6 | #include <dvr/performance_client_api.h> | 
| Alex Vakulenko | 5a244ed | 2017-06-09 16:29:04 -0700 | [diff] [blame] | 7 | #include <pdx/service_dispatcher.h> | 
| Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 8 |  | 
|  | 9 | #include "buffer_hub.h" | 
|  | 10 |  | 
|  | 11 | int main(int, char**) { | 
|  | 12 | int ret = -1; | 
|  | 13 | std::shared_ptr<android::pdx::Service> service; | 
|  | 14 | std::unique_ptr<android::pdx::ServiceDispatcher> dispatcher; | 
|  | 15 |  | 
|  | 16 | // We need to be able to create endpoints with full perms. | 
|  | 17 | umask(0000); | 
|  | 18 |  | 
| Alex Vakulenko | 5a244ed | 2017-06-09 16:29:04 -0700 | [diff] [blame] | 19 | dispatcher = android::pdx::ServiceDispatcher::Create(); | 
| Alex Vakulenko | e4eec20 | 2017-01-27 14:41:04 -0800 | [diff] [blame] | 20 | CHECK_ERROR(!dispatcher, error, "Failed to create service dispatcher\n"); | 
|  | 21 |  | 
|  | 22 | service = android::dvr::BufferHubService::Create(); | 
|  | 23 | CHECK_ERROR(!service, error, "Failed to create buffer hub service\n"); | 
|  | 24 | dispatcher->AddService(service); | 
|  | 25 |  | 
|  | 26 | ret = dvrSetSchedulerClass(0, "graphics"); | 
|  | 27 | CHECK_ERROR(ret < 0, error, "Failed to set thread priority"); | 
|  | 28 |  | 
|  | 29 | ALOGI("Entering message loop."); | 
|  | 30 |  | 
|  | 31 | ret = dispatcher->EnterDispatchLoop(); | 
|  | 32 | CHECK_ERROR(ret < 0, error, "Dispatch loop exited because: %s\n", | 
|  | 33 | strerror(-ret)); | 
|  | 34 |  | 
|  | 35 | error: | 
|  | 36 | return -ret; | 
|  | 37 | } |