| Alec Mouri | 9fa2cb6 | 2019-07-15 17:36:26 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright 2019 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
|  | 15 | */ | 
|  | 16 |  | 
|  | 17 | #pragma once | 
|  | 18 |  | 
|  | 19 | #include <nativebase/nativebase.h> | 
|  | 20 |  | 
|  | 21 | // apex is a superset of the NDK | 
|  | 22 | #include <android/native_window.h> | 
|  | 23 |  | 
|  | 24 | __BEGIN_DECLS | 
|  | 25 |  | 
|  | 26 | /** | 
|  | 27 | * Retrieves how long it took for the last time a buffer was dequeued. | 
|  | 28 | * | 
|  | 29 | * \return a negative value on error, otherwise returns the duration in | 
| Alec Mouri | 72670c5 | 2019-08-31 01:54:33 -0700 | [diff] [blame] | 30 | * nanoseconds | 
| Alec Mouri | 9fa2cb6 | 2019-07-15 17:36:26 -0700 | [diff] [blame] | 31 | */ | 
| Alec Mouri | 72670c5 | 2019-08-31 01:54:33 -0700 | [diff] [blame] | 32 | int64_t ANativeWindow_getLastDequeueDuration(ANativeWindow* window); | 
| Alec Mouri | 9fa2cb6 | 2019-07-15 17:36:26 -0700 | [diff] [blame] | 33 |  | 
| Alec Mouri | 0d1398b | 2019-08-14 10:53:50 -0700 | [diff] [blame] | 34 | /** | 
|  | 35 | * Retrieves how long it took for the last time a buffer was queued. | 
|  | 36 | * | 
|  | 37 | * \return a negative value on error, otherwise returns the duration in | 
| Alec Mouri | 72670c5 | 2019-08-31 01:54:33 -0700 | [diff] [blame] | 38 | * nanoseconds. | 
| Alec Mouri | 0d1398b | 2019-08-14 10:53:50 -0700 | [diff] [blame] | 39 | */ | 
| Alec Mouri | 72670c5 | 2019-08-31 01:54:33 -0700 | [diff] [blame] | 40 | int64_t ANativeWindow_getLastQueueDuration(ANativeWindow* window); | 
| Alec Mouri | 0d1398b | 2019-08-14 10:53:50 -0700 | [diff] [blame] | 41 |  | 
| Alec Mouri | a161966 | 2019-08-21 19:30:48 -0700 | [diff] [blame] | 42 | /** | 
|  | 43 | * Retrieves the system time in nanoseconds when the last time a buffer | 
|  | 44 | * was dequeued. | 
|  | 45 | * | 
|  | 46 | * \return a negative value on error, otherwise returns the duration in | 
|  | 47 | * nanoseconds. | 
|  | 48 | */ | 
|  | 49 | int64_t ANativeWindow_getLastDequeueStartTime(ANativeWindow* window); | 
|  | 50 |  | 
| Alec Mouri | 04fdb60 | 2019-08-23 19:41:43 -0700 | [diff] [blame] | 51 | /** | 
|  | 52 | * Sets a timeout in nanoseconds for dequeue calls. All subsequent dequeue calls | 
|  | 53 | * made by the window will return -ETIMEDOUT after the timeout if the dequeue | 
|  | 54 | * takes too long. | 
|  | 55 | * | 
|  | 56 | * \return NO_ERROR on succes, -errno on error. | 
|  | 57 | */ | 
|  | 58 | int ANativeWindow_setDequeueTimeout(ANativeWindow* window, int64_t timeout); | 
|  | 59 |  | 
| Alec Mouri | 9fa2cb6 | 2019-07-15 17:36:26 -0700 | [diff] [blame] | 60 | __END_DECLS |