2 // Copyright (c) 2017 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_PLATFORMCOMMONDEFINES_H_
18 #define OS_LINUX_PLATFORMCOMMONDEFINES_H_
21 #include <vulkan/vulkan.h>
23 VkFormat NativeToVkFormat(int native_format);
26 #include <hwcbuffer.h>
29 #include <xf86drmMode.h>
31 #define DRM_FORMAT_NONE fourcc_code('0', '0', '0', '0')
33 #define DRM_FORMAT_NV12_Y_TILED_INTEL fourcc_code('9', '9', '9', '6')
34 // minigbm specific DRM_FORMAT_YVU420_ANDROID enum
35 #define DRM_FORMAT_YVU420_ANDROID fourcc_code('9', '9', '9', '7')
37 #define HWC_UNUSED(x) ((void)&(x))
39 inline void hash_combine_hwc(size_t& seed, size_t value) {
40 seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
43 typedef struct FBKey {
44 uint32_t gem_handles_[4];
47 FBKey(const uint32_t &num_planes, const uint32_t (&igem_handles)[4]) {
48 for (uint32_t i = 0; i < 4; i++) {
49 gem_handles_[i] = igem_handles[i];
51 num_planes_ = num_planes;
55 int CreateFrameBuffer(const uint32_t &iwidth, const uint32_t &iheight,
56 const uint32_t &iframe_buffer_format,
57 const uint32_t (&igem_handles)[4],
58 const uint32_t (&ipitches)[4],
59 const uint32_t (&ioffsets)[4], uint32_t gpu_fd,
62 int ReleaseFrameBuffer(const FBKey &key, uint32_t fd, uint32_t gpu_fd);
64 #endif // OS_LINUX_PLATFORMCOMMONDEFINES_H_