diff options
author | Gurchetan Singh <gurchetansingh@chromium.org> | 2021-10-22 15:56:06 -0700 |
---|---|---|
committer | Gurchetan Singh <gurchetansingh@google.com> | 2022-01-05 19:17:56 -0800 |
commit | cc675d7e37a20c8617e6b6a3b04f04761b947734 (patch) | |
tree | fd9a8b5c7dfb0cdca1b840c6b1ca93124ab370c2 | |
parent | 3f92a0a3acef1b4400586c76e707a9325426990d (diff) | |
download | goldfish-opengl-cc675d7e37a20c8617e6b6a3b04f04761b947734.tar.gz |
goldfish-opengl: more compat
- Define the cros_gralloc_handle when not building Android
- Define <vulkan_android.h> headers when building for Linux
and Fuchsia.
* Long-term, we should import the vulkan_android.h headers
inside goldfish-opengl and not define them in
goldfish_vk_private_defs.h
BUG=202552093
TEST=compile
Change-Id: Ie1e0aeda88bf8ce192de9a4f7a203b3c0a6df99c
-rw-r--r-- | fuchsia/include/cros_gralloc_handle.h | 51 | ||||
-rw-r--r-- | system/OpenglSystemCommon/HostConnection.cpp | 2 | ||||
-rw-r--r-- | system/vulkan_enc/goldfish_vk_private_defs.h | 2 |
3 files changed, 53 insertions, 2 deletions
diff --git a/fuchsia/include/cros_gralloc_handle.h b/fuchsia/include/cros_gralloc_handle.h new file mode 100644 index 00000000..2b70d4ba --- /dev/null +++ b/fuchsia/include/cros_gralloc_handle.h @@ -0,0 +1,51 @@ +/* + * Copyright 2016 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef CROS_GRALLOC_HANDLE_H +#define CROS_GRALLOC_HANDLE_H + +#include <cstdint> +#include <cutils/native_handle.h> + +#define DRV_MAX_PLANES 4 +#define DRV_MAX_FDS (DRV_MAX_PLANES + 1) + +struct cros_gralloc_handle : public native_handle_t { + /* + * File descriptors must immediately follow the native_handle_t base and used file + * descriptors must be packed at the beginning of this array to work with + * native_handle_clone(). + * + * This field contains 'num_planes' plane file descriptors followed by an optional metadata + * reserved region file descriptor if 'reserved_region_size' is greater than zero. + */ + int32_t fds[DRV_MAX_FDS]; + uint32_t strides[DRV_MAX_PLANES]; + uint32_t offsets[DRV_MAX_PLANES]; + uint32_t sizes[DRV_MAX_PLANES]; + uint32_t id; + uint32_t width; + uint32_t height; + uint32_t format; /* DRM format */ + uint32_t tiling; + uint64_t format_modifier; + uint64_t use_flags; /* Buffer creation flags */ + uint32_t magic; + uint32_t pixel_stride; + int32_t droid_format; + int32_t usage; /* Android usage. */ + uint32_t num_planes; + uint64_t reserved_region_size; + uint64_t total_size; /* Total allocation size */ + /* + * Name is a null terminated char array located at handle->base.data[handle->name_offset]. + */ + uint32_t name_offset; +} __attribute__((packed)); + +typedef const struct cros_gralloc_handle *cros_gralloc_handle_t; + +#endif diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp index 8399f2ad..2e630f1f 100644 --- a/system/OpenglSystemCommon/HostConnection.cpp +++ b/system/OpenglSystemCommon/HostConnection.cpp @@ -182,7 +182,7 @@ static inline uint32_t align_up(uint32_t n, uint32_t a) { return ((n + a - 1) / a) * a; } -#ifdef VIRTIO_GPU +#if defined(VIRTIO_GPU) class MinigbmGralloc : public Gralloc { public: diff --git a/system/vulkan_enc/goldfish_vk_private_defs.h b/system/vulkan_enc/goldfish_vk_private_defs.h index 2b442d8b..df18d27b 100644 --- a/system/vulkan_enc/goldfish_vk_private_defs.h +++ b/system/vulkan_enc/goldfish_vk_private_defs.h @@ -129,7 +129,7 @@ struct AHardwareBuffer; struct VkAndroidHardwareBufferPropertiesANDROID; struct VkMemoryGetAndroidHardwareBufferInfoANDROID; -#ifdef __Fuchsia__ +#ifndef VK_USE_PLATFORM_ANDROID_KHR typedef struct VkAndroidHardwareBufferUsageANDROID { VkStructureType sType; |