OSDN Git Service

Ensure we close all the gem handles.
[android-x86/external-IA-Hardware-Composer.git] / os / android / platformdefines.h
1 /*
2 // Copyright (c) 2016 Intel Corporation
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 OS_ANDROID_PLATFORMDEFINES_H_
18 #define OS_ANDROID_PLATFORMDEFINES_H_
19
20 #ifndef LOG_TAG
21 #define LOG_TAG "iahwcomposer"
22 #endif
23
24 #ifndef ATRACE_TAG
25 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
26 #endif
27
28 #include <utils/Trace.h>
29 #include <cutils/log.h>
30 #include <hardware/hardware.h>
31 #include <hardware/hwcomposer.h>
32
33 #include <ui/GraphicBuffer.h>
34
35 #include <sw_sync.h>
36 #include <sync/sync.h>
37
38 #ifdef _cplusplus
39 extern "C" {
40 #endif
41
42 struct gralloc_handle {
43   buffer_handle_t handle_ = NULL;
44   android::sp<android::GraphicBuffer> buffer_ = NULL;
45   native_handle_t* imported_handle_ = NULL;
46   uint32_t gem_handle_ = 0;
47   bool hwc_buffer_ = false;
48 };
49
50 typedef struct gralloc_handle* HWCNativeHandle;
51
52 #define VTRACE(fmt, ...) ALOGV("%s: " fmt, __func__, ##__VA_ARGS__)
53 #define DTRACE(fmt, ...) ALOGD("%s: " fmt, __func__, ##__VA_ARGS__)
54 #define ITRACE(fmt, ...) ALOGI(fmt, ##__VA_ARGS__)
55 #define WTRACE(fmt, ...) ALOGW("%s: " fmt, __func__, ##__VA_ARGS__)
56 #define ETRACE(fmt, ...) ALOGE("%s: " fmt, __func__, ##__VA_ARGS__)
57 #define STRACE() ATRACE_CALL()
58 // _cplusplus
59 #ifdef _cplusplus
60 }
61 #endif
62
63 #endif  // OS_ANDROID_PLATFORMDEFINES_H_