summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot2017-03-28 15:55:50 -0500
committerAndroid (Google) Code Review2017-03-28 15:55:51 -0500
commitdf937b8255d86d97c97fd8d9ca7ea5352e2d8975 (patch)
tree16b82dbf837c7fd95f667b0de42b1a0a0df16404 /libgrallocusage/include/grallocusage/GrallocUsageConversion.h
parentbc41166d563d7e8d90ab48216730920d6eb90440 (diff)
parent33eab3a829fee3bc89e435e10ec581d87d68797c (diff)
downloadplatform-system-core-df937b8255d86d97c97fd8d9ca7ea5352e2d8975.tar.gz
platform-system-core-df937b8255d86d97c97fd8d9ca7ea5352e2d8975.tar.xz
platform-system-core-df937b8255d86d97c97fd8d9ca7ea5352e2d8975.zip
Merge "Add gralloc usage conversion functions" into oc-dev
Diffstat (limited to 'libgrallocusage/include/grallocusage/GrallocUsageConversion.h')
-rw-r--r--libgrallocusage/include/grallocusage/GrallocUsageConversion.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/libgrallocusage/include/grallocusage/GrallocUsageConversion.h b/libgrallocusage/include/grallocusage/GrallocUsageConversion.h
new file mode 100644
index 000000000..5c94343c2
--- /dev/null
+++ b/libgrallocusage/include/grallocusage/GrallocUsageConversion.h
@@ -0,0 +1,47 @@
1/*
2 * Copyright 2017 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#ifndef ANDROID_GRALLOCUSAGE_GRALLOC_USAGE_CONVERSION_H
18#define ANDROID_GRALLOCUSAGE_GRALLOC_USAGE_CONVERSION_H 1
19
20#include <stdint.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26// Conversion functions are out-of-line so that users don't have to be exposed to
27// android/hardware/graphics/allocator/2.0/types.h and link against
28// android.hardware.graphics.allocator@2.0 to get that in their search path.
29
30// Convert a 32-bit gralloc0 usage mask to a producer/consumer pair of 64-bit usage masks as used
31// by android.hardware.graphics.allocator@2.0 (and gralloc1). This conversion properly handles the
32// mismatch between a.h.g.allocator@2.0's CPU_{READ,WRITE}_OFTEN and gralloc0's
33// SW_{READ,WRITE}_OFTEN.
34void android_convertGralloc0To1Usage(int32_t usage, uint64_t* producerUsage,
35 uint64_t* consumerUsage);
36
37// Convert a producer/consumer pair of 64-bit usage masks as used by
38// android.hardware.graphics.allocator@2.0 (and gralloc1) to a 32-bit gralloc0 usage mask. This
39// conversion properly handles the mismatch between a.h.g.allocator@2.0's CPU_{READ,WRITE}_OFTEN
40// and gralloc0's SW_{READ,WRITE}_OFTEN.
41int32_t android_convertGralloc1To0Usage(uint64_t producerUsage, uint64_t consumerUsage);
42
43#ifdef __cplusplus
44}
45#endif
46
47#endif // ANDROID_GRALLOCUSAGE_GRALLOC_USAGE_CONVERSION_H