gfxstream: nuke ResourceTracker::Impl
The big giant Vulkan singleton might have an underlying implementation. However, it's unlikely we'll have more than impl since it it's pretty giant. Nuke ResourceTracker::Impl to reduce the number of layers one must traverse to modify things. Since this was mega-change, clang-format was also applied. Reviewed-by: Aaron Ruby <aruby@blackberry.com> Acked-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
committed by
Marge Bot
parent
0e8582d6da
commit
df2b17c4b8
@@ -14,7 +14,7 @@ lib_vulkan_cereal = shared_library(
|
||||
cpp_args: cpp_args,
|
||||
include_directories: [inc_vulkan_headers, inc_android_emu, inc_android_compat,
|
||||
inc_opengl_system, inc_guest_iostream, inc_opengl_codec, inc_render_enc,
|
||||
inc_vulkan_enc, inc_platform],
|
||||
inc_vulkan_enc, inc_platform, inc_goldfish_address_space],
|
||||
link_with: [lib_android_compat, lib_emu_android_base, lib_stream,
|
||||
lib_vulkan_enc],
|
||||
install: true,
|
||||
|
||||
@@ -67,10 +67,8 @@ void updateMemoryTypeBits(uint32_t* memoryTypeBits, uint32_t colorBufferMemoryIn
|
||||
}
|
||||
|
||||
VkResult getAndroidHardwareBufferPropertiesANDROID(
|
||||
Gralloc* grallocHelper,
|
||||
const AHardwareBuffer* buffer,
|
||||
gfxstream::Gralloc* grallocHelper, const AHardwareBuffer* buffer,
|
||||
VkAndroidHardwareBufferPropertiesANDROID* pProperties) {
|
||||
|
||||
VkAndroidHardwareBufferFormatPropertiesANDROID* ahbFormatProps =
|
||||
vk_find_struct<VkAndroidHardwareBufferFormatPropertiesANDROID>(pProperties);
|
||||
|
||||
@@ -227,20 +225,18 @@ VkResult getAndroidHardwareBufferPropertiesANDROID(
|
||||
}
|
||||
|
||||
// Based on Intel ANV implementation.
|
||||
VkResult getMemoryAndroidHardwareBufferANDROID(
|
||||
Gralloc* gralloc,
|
||||
struct AHardwareBuffer **pBuffer) {
|
||||
|
||||
/* Some quotes from Vulkan spec:
|
||||
*
|
||||
* "If the device memory was created by importing an Android hardware
|
||||
* buffer, vkGetMemoryAndroidHardwareBufferANDROID must return that same
|
||||
* Android hardware buffer object."
|
||||
*
|
||||
* "VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID must
|
||||
* have been included in VkExportMemoryAllocateInfo::handleTypes when
|
||||
* memory was created."
|
||||
*/
|
||||
VkResult getMemoryAndroidHardwareBufferANDROID(gfxstream::Gralloc* gralloc,
|
||||
struct AHardwareBuffer** pBuffer) {
|
||||
/* Some quotes from Vulkan spec:
|
||||
*
|
||||
* "If the device memory was created by importing an Android hardware
|
||||
* buffer, vkGetMemoryAndroidHardwareBufferANDROID must return that same
|
||||
* Android hardware buffer object."
|
||||
*
|
||||
* "VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID must
|
||||
* have been included in VkExportMemoryAllocateInfo::handleTypes when
|
||||
* memory was created."
|
||||
*/
|
||||
|
||||
if (!pBuffer) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
if (!(*pBuffer)) return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
@@ -249,11 +245,9 @@ VkResult getMemoryAndroidHardwareBufferANDROID(
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult importAndroidHardwareBuffer(
|
||||
Gralloc* grallocHelper,
|
||||
const VkImportAndroidHardwareBufferInfoANDROID* info,
|
||||
struct AHardwareBuffer **importOut) {
|
||||
|
||||
VkResult importAndroidHardwareBuffer(gfxstream::Gralloc* grallocHelper,
|
||||
const VkImportAndroidHardwareBufferInfoANDROID* info,
|
||||
struct AHardwareBuffer** importOut) {
|
||||
if (!info || !info->buffer) {
|
||||
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
}
|
||||
@@ -272,19 +266,13 @@ VkResult importAndroidHardwareBuffer(
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult createAndroidHardwareBuffer(
|
||||
Gralloc* gralloc,
|
||||
bool hasDedicatedImage,
|
||||
bool hasDedicatedBuffer,
|
||||
const VkExtent3D& imageExtent,
|
||||
uint32_t imageLayers,
|
||||
VkFormat imageFormat,
|
||||
VkImageUsageFlags imageUsage,
|
||||
VkImageCreateFlags imageCreateFlags,
|
||||
VkDeviceSize bufferSize,
|
||||
VkDeviceSize allocationInfoAllocSize,
|
||||
struct AHardwareBuffer **out) {
|
||||
|
||||
VkResult createAndroidHardwareBuffer(gfxstream::Gralloc* gralloc, bool hasDedicatedImage,
|
||||
bool hasDedicatedBuffer, const VkExtent3D& imageExtent,
|
||||
uint32_t imageLayers, VkFormat imageFormat,
|
||||
VkImageUsageFlags imageUsage,
|
||||
VkImageCreateFlags imageCreateFlags, VkDeviceSize bufferSize,
|
||||
VkDeviceSize allocationInfoAllocSize,
|
||||
struct AHardwareBuffer** out) {
|
||||
uint32_t w = 0;
|
||||
uint32_t h = 1;
|
||||
uint32_t layers = 1;
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
// limitations under the License.
|
||||
#pragma once
|
||||
|
||||
#include "HostVisibleMemoryVirtualization.h"
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "../OpenglSystemCommon/Gralloc.h"
|
||||
#include "HostVisibleMemoryVirtualization.h"
|
||||
|
||||
// Structure similar to
|
||||
// https://github.com/mesa3d/mesa/blob/master/src/intel/vulkan/anv_android.c
|
||||
|
||||
class Gralloc;
|
||||
|
||||
namespace gfxstream {
|
||||
namespace vk {
|
||||
|
||||
@@ -34,31 +33,23 @@ getAndroidHardwareBufferUsageFromVkUsage(
|
||||
void updateMemoryTypeBits(uint32_t* memoryTypeBits, uint32_t colorBufferMemoryIndex);
|
||||
|
||||
VkResult getAndroidHardwareBufferPropertiesANDROID(
|
||||
Gralloc* grallocHelper,
|
||||
const AHardwareBuffer* buffer,
|
||||
gfxstream::Gralloc* grallocHelper, const AHardwareBuffer* buffer,
|
||||
VkAndroidHardwareBufferPropertiesANDROID* pProperties);
|
||||
|
||||
VkResult getMemoryAndroidHardwareBufferANDROID(
|
||||
Gralloc* grallocHelper,
|
||||
struct AHardwareBuffer **pBuffer);
|
||||
VkResult getMemoryAndroidHardwareBufferANDROID(gfxstream::Gralloc* grallocHelper,
|
||||
struct AHardwareBuffer** pBuffer);
|
||||
|
||||
VkResult importAndroidHardwareBuffer(
|
||||
Gralloc* grallocHelper,
|
||||
const VkImportAndroidHardwareBufferInfoANDROID* info,
|
||||
struct AHardwareBuffer **importOut);
|
||||
VkResult importAndroidHardwareBuffer(gfxstream::Gralloc* grallocHelper,
|
||||
const VkImportAndroidHardwareBufferInfoANDROID* info,
|
||||
struct AHardwareBuffer** importOut);
|
||||
|
||||
VkResult createAndroidHardwareBuffer(
|
||||
Gralloc* grallocHelper,
|
||||
bool hasDedicatedImage,
|
||||
bool hasDedicatedBuffer,
|
||||
const VkExtent3D& imageExtent,
|
||||
uint32_t imageLayers,
|
||||
VkFormat imageFormat,
|
||||
VkImageUsageFlags imageUsage,
|
||||
VkImageCreateFlags imageCreateFlags,
|
||||
VkDeviceSize bufferSize,
|
||||
VkDeviceSize allocationInfoAllocSize,
|
||||
struct AHardwareBuffer **out);
|
||||
VkResult createAndroidHardwareBuffer(gfxstream::Gralloc* grallocHelper, bool hasDedicatedImage,
|
||||
bool hasDedicatedBuffer, const VkExtent3D& imageExtent,
|
||||
uint32_t imageLayers, VkFormat imageFormat,
|
||||
VkImageUsageFlags imageUsage,
|
||||
VkImageCreateFlags imageCreateFlags, VkDeviceSize bufferSize,
|
||||
VkDeviceSize allocationInfoAllocSize,
|
||||
struct AHardwareBuffer** out);
|
||||
|
||||
} // namespace vk
|
||||
} // namespace gfxstream
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user