Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | #ifndef ANDROID_HARDWARE_GRALLOC1_ADAPTER_H |
| 17 | #define ANDROID_HARDWARE_GRALLOC1_ADAPTER_H |
| 18 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 19 | #include <hardware/hardware.h> |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 20 | |
| 21 | __BEGIN_DECLS |
| 22 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 23 | #define GRALLOC1_ADAPTER_MODULE_API_VERSION_1_0 \ |
| 24 | HARDWARE_MODULE_API_VERSION(1, 0) |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 25 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 26 | enum { |
| 27 | GRALLOC1_ADAPTER_PERFORM_FIRST = 10000, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 28 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 29 | // void getRealModuleApiVersionMinor(..., int* outMinorVersion); |
| 30 | GRALLOC1_ADAPTER_PERFORM_GET_REAL_MODULE_API_VERSION_MINOR = |
| 31 | GRALLOC1_ADAPTER_PERFORM_FIRST, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 32 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 33 | // void setUsages(..., buffer_handle_t buffer, |
| 34 | // int producerUsage, |
| 35 | // int consumerUsage); |
| 36 | GRALLOC1_ADAPTER_PERFORM_SET_USAGES = |
| 37 | GRALLOC1_ADAPTER_PERFORM_FIRST + 1, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 38 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 39 | // void getDimensions(..., buffer_handle_t buffer, |
| 40 | // int* outWidth, |
| 41 | // int* outHeight); |
| 42 | GRALLOC1_ADAPTER_PERFORM_GET_DIMENSIONS = |
| 43 | GRALLOC1_ADAPTER_PERFORM_FIRST + 2, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 44 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 45 | // void getFormat(..., buffer_handle_t buffer, int* outFormat); |
| 46 | GRALLOC1_ADAPTER_PERFORM_GET_FORMAT = |
| 47 | GRALLOC1_ADAPTER_PERFORM_FIRST + 3, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 48 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 49 | // void getProducerUsage(..., buffer_handle_t buffer, int* outUsage); |
| 50 | GRALLOC1_ADAPTER_PERFORM_GET_PRODUCER_USAGE = |
| 51 | GRALLOC1_ADAPTER_PERFORM_FIRST + 4, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 52 | |
Chia-I Wu | 939e401 | 2016-12-12 21:51:33 +0800 | [diff] [blame^] | 53 | // void getConsumerUsage(..., buffer_handle_t buffer, int* outUsage); |
| 54 | GRALLOC1_ADAPTER_PERFORM_GET_CONSUMER_USAGE = |
| 55 | GRALLOC1_ADAPTER_PERFORM_FIRST + 5, |
| 56 | |
| 57 | // void getBackingStore(..., buffer_handle_t buffer, |
| 58 | // uint64_t* outBackingStore); |
| 59 | GRALLOC1_ADAPTER_PERFORM_GET_BACKING_STORE = |
| 60 | GRALLOC1_ADAPTER_PERFORM_FIRST + 6, |
| 61 | |
| 62 | // void getNumFlexPlanes(..., buffer_handle_t buffer, |
| 63 | // int* outNumFlexPlanes); |
| 64 | GRALLOC1_ADAPTER_PERFORM_GET_NUM_FLEX_PLANES = |
| 65 | GRALLOC1_ADAPTER_PERFORM_FIRST + 7, |
| 66 | |
| 67 | // void getStride(..., buffer_handle_t buffer, int* outStride); |
| 68 | GRALLOC1_ADAPTER_PERFORM_GET_STRIDE = |
| 69 | GRALLOC1_ADAPTER_PERFORM_FIRST + 8, |
| 70 | |
| 71 | // void lockFlex(..., buffer_handle_t buffer, |
| 72 | // int producerUsage, |
| 73 | // int consumerUsage, |
| 74 | // int left, |
| 75 | // int top, |
| 76 | // int width, |
| 77 | // int height, |
| 78 | // android_flex_layout* outLayout, |
| 79 | // int acquireFence); |
| 80 | GRALLOC1_ADAPTER_PERFORM_LOCK_FLEX = |
| 81 | GRALLOC1_ADAPTER_PERFORM_FIRST + 9, |
Chia-I Wu | 109571a | 2016-09-05 11:46:36 +0800 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | int gralloc1_adapter_device_open(const struct hw_module_t* module, |
| 85 | const char* id, struct hw_device_t** device); |
| 86 | |
| 87 | __END_DECLS |
| 88 | |
| 89 | #endif /* ANDROID_HARDWARE_GRALLOC1_ADAPTER_H */ |