2 // Copyright (c) 2016 Intel Corporation
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef OS_LINUX_PLATFORMDEFINES_H_
18 #define OS_LINUX_PLATFORMDEFINES_H_
25 #include <va/va_drm.h>
33 #include "platformcommondefines.h"
37 struct gbm_import_fd_planar_data import_data;
40 // for GBM_BO_IMPORT_FD
41 struct gbm_import_fd_data fd_data;
42 // for GBM_BO_IMPORT_FD_MODIFIER
43 struct gbm_import_fd_modifier_data fd_modifier_data;
46 struct gbm_bo* bo = NULL;
47 struct gbm_bo* imported_bo = NULL;
48 uint32_t total_planes = 0;
50 bool hwc_buffer_ = false;
51 // In case this is true, we expect meta_data_
52 // to be filled with correct width, height and
54 void* pixel_memory_ = NULL;
55 uint32_t gbm_flags = 0;
56 uint32_t layer_type_ = hwcomposer::kLayerNormal;
57 uint64_t modifier = 0;
60 typedef struct gbm_handle* HWCNativeHandle;
66 #define VTRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
67 #define DTRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
68 #define ITRACE(fmt, ...) fprintf(stderr, "\n" fmt, ##__VA_ARGS__)
69 #define WTRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
70 #define ETRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
71 #define STRACE() ((void)0)
74 inline uint32_t GetNativeBuffer(uint32_t gpu_fd, HWCNativeHandle handle) {
76 uint32_t prime_fd = handle->import_data.fds[0];
77 if (drmPrimeFDToHandle(gpu_fd, prime_fd, &id)) {
78 ETRACE("Error generate handle from prime fd %d", prime_fd);
83 inline uint32_t GetNativeBuffer(uint32_t gpu_fd, HWCNativeHandle handle) {
85 uint32_t prime_fd = handle->import_data.fd;
86 if (drmPrimeFDToHandle(gpu_fd, prime_fd, &id)) {
87 ETRACE("Error generate handle from prime fd %d", prime_fd);
98 #endif // OS_LINUX_PLATFORMDEFINES_H_