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"
35 #define HAL_DATASPACE_RANGE_FULL 0x8000000
39 // for GBM_BO_IMPORT_FD
40 struct gbm_import_fd_data fd_data;
41 // for GBM_BO_IMPORT_FD_MODIFIER
42 struct gbm_import_fd_modifier_data fd_modifier_data;
44 struct gbm_bo* bo = NULL;
45 struct gbm_bo* imported_bo = NULL;
47 bool hwc_buffer_ = false;
48 void* pixel_memory_ = NULL;
49 uint32_t gbm_flags = 0;
50 uint32_t layer_type_ = hwcomposer::kLayerNormal;
53 typedef struct gbm_handle* HWCNativeHandle;
59 #define VTRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
60 #define DTRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
61 #define ITRACE(fmt, ...) fprintf(stderr, "\n" fmt, ##__VA_ARGS__)
62 #define WTRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
63 #define ETRACE(fmt, ...) fprintf(stderr, "%s: \n" fmt, __func__, ##__VA_ARGS__)
64 #define STRACE() ((void)0)
66 inline uint32_t GetNativeBuffer(uint32_t gpu_fd, HWCNativeHandle handle) {
68 uint32_t prime_fd = -1;
69 if (!handle->meta_data_.fb_modifiers_[0]) {
70 prime_fd = handle->import_data.fd_data.fd;
72 prime_fd = handle->import_data.fd_modifier_data.fds[0];
74 if (drmPrimeFDToHandle(gpu_fd, prime_fd, &id)) {
75 ETRACE("Error generate handle from prime fd %d", prime_fd);
85 #endif // OS_LINUX_PLATFORMDEFINES_H_