• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 #ifndef ANDROID_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
17 #define ANDROID_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
18 /*
19  * This file contains utility functions related to AHardwareBuffer, mostly to
20  * convert to/from HAL formats.
21  *
22  * These are PRIVATE methods, so this file can NEVER appear in a public NDK
23  * header. They are used by higher level libraries such as core/jni.
24  */
25 #include <stdint.h>
26 struct AHardwareBuffer;
27 struct ANativeWindowBuffer;
28 namespace android {
29 // whether this AHardwareBuffer format is valid
30 bool AHardwareBuffer_isValidPixelFormat(uint32_t ahardwarebuffer_format);
31 // convert AHardwareBuffer format to HAL format (note: this is a no-op)
32 uint32_t AHardwareBuffer_convertFromPixelFormat(uint32_t format);
33 // convert HAL format to AHardwareBuffer format (note: this is a no-op)
34 uint32_t AHardwareBuffer_convertToPixelFormat(uint32_t format);
35 // convert AHardwareBuffer usage bits to HAL usage bits (note: this is a no-op)
36 uint64_t AHardwareBuffer_convertFromGrallocUsageBits(uint64_t usage);
37 // convert HAL usage bits to AHardwareBuffer usage bits  (note: this is a no-op)
38 uint64_t AHardwareBuffer_convertToGrallocUsageBits(uint64_t usage);
39 class GraphicBuffer;
40 const GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(const AHardwareBuffer* buffer);
41 GraphicBuffer* AHardwareBuffer_to_GraphicBuffer(AHardwareBuffer* buffer);
42 const ANativeWindowBuffer* AHardwareBuffer_to_ANativeWindowBuffer(const AHardwareBuffer* buffer);
43 ANativeWindowBuffer* AHardwareBuffer_to_ANativeWindowBuffer(AHardwareBuffer* buffer);
44 AHardwareBuffer* AHardwareBuffer_from_GraphicBuffer(GraphicBuffer* buffer);
45 } // namespace android
46 #endif // ANDROID_PRIVATE_NATIVE_AHARDWARE_BUFFER_HELPERS_H
47