Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy ahb without CPU read mask v2 #2042

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions android/framework/graphics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ target_sources(gfxrecon_graphics
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_check_buffer_references.cpp
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_device_util.h
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_device_util.cpp
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_instance_util.h
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_instance_util.cpp
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_resources_util.h
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_resources_util.cpp
${GFXRECON_SOURCE_DIR}/framework/graphics/vulkan_util.h
Expand Down
1 change: 1 addition & 0 deletions framework/decode/api_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class ApiDecoder

virtual void
DispatchCreateHardwareBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
1 change: 1 addition & 0 deletions framework/decode/custom_ags_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class AgsDecoder : public ApiDecoder

virtual void
DispatchCreateHardwareBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
3 changes: 2 additions & 1 deletion framework/decode/dx12_decoder_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ void Dx12DecoderBase::DispatchResizeWindowCommand2(

void Dx12DecoderBase::DispatchCreateHardwareBufferCommand(
format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand All @@ -124,7 +125,7 @@ void Dx12DecoderBase::DispatchCreateHardwareBufferCommand(
for (auto consumer : consumers_)
{
consumer->ProcessCreateHardwareBufferCommand(
memory_id, buffer_id, format, width, height, stride, usage, layers, plane_info);
device_id, memory_id, buffer_id, format, width, height, stride, usage, layers, plane_info);
}
}

Expand Down
1 change: 1 addition & 0 deletions framework/decode/dx12_decoder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class Dx12DecoderBase : public ApiDecoder

virtual void
DispatchCreateHardwareBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
75 changes: 75 additions & 0 deletions framework/decode/file_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,79 @@ bool FileProcessor::ProcessMetaData(const format::BlockHeader& block_header, for
if (decoder->SupportsMetaDataId(meta_data_id))
{
decoder->DispatchCreateHardwareBufferCommand(header.thread_id,
0u,
header.memory_id,
header.buffer_id,
header.format,
header.width,
header.height,
header.stride,
header.usage,
header.layers,
entries);
}
}
}
else
{
if (format::IsBlockCompressed(block_header.type))
{
HandleBlockReadError(kErrorReadingCompressedBlockData,
"Failed to read create hardware buffer meta-data block");
}
else
{
HandleBlockReadError(kErrorReadingBlockData,
"Failed to read create hardware buffer meta-data block");
}
}
}
else
{
HandleBlockReadError(kErrorReadingBlockHeader,
"Failed to read create hardware buffer meta-data block header");
}
}
else if (meta_data_type == format::MetaDataType::kCreateHardwareBufferCommand_deprecated2)
{
format::CreateHardwareBufferCommandHeader_deprecated2 header;

success = ReadBytes(&header.thread_id, sizeof(header.thread_id));
success = success && ReadBytes(&header.memory_id, sizeof(header.memory_id));
success = success && ReadBytes(&header.buffer_id, sizeof(header.buffer_id));
success = success && ReadBytes(&header.format, sizeof(header.format));
success = success && ReadBytes(&header.width, sizeof(header.width));
success = success && ReadBytes(&header.height, sizeof(header.height));
success = success && ReadBytes(&header.stride, sizeof(header.stride));
success = success && ReadBytes(&header.usage, sizeof(header.usage));
success = success && ReadBytes(&header.layers, sizeof(header.layers));
success = success && ReadBytes(&header.planes, sizeof(header.planes));

if (success)
{
std::vector<format::HardwareBufferPlaneInfo> entries;

for (uint64_t i = 0; i < header.planes; ++i)
{
format::HardwareBufferPlaneInfo entry;

if (!ReadBytes(&entry, sizeof(entry)))
{
success = false;
break;
}

entries.emplace_back(std::move(entry));
}

if (success)
{
for (auto decoder : decoders_)
{
if (decoder->SupportsMetaDataId(meta_data_id))
{
decoder->DispatchCreateHardwareBufferCommand(header.thread_id,
0u,
header.memory_id,
header.buffer_id,
header.format,
Expand Down Expand Up @@ -1135,6 +1208,7 @@ bool FileProcessor::ProcessMetaData(const format::BlockHeader& block_header, for
format::CreateHardwareBufferCommandHeader header;

success = ReadBytes(&header.thread_id, sizeof(header.thread_id));
success = success && ReadBytes(&header.device_id, sizeof(header.device_id));
success = success && ReadBytes(&header.memory_id, sizeof(header.memory_id));
success = success && ReadBytes(&header.buffer_id, sizeof(header.buffer_id));
success = success && ReadBytes(&header.format, sizeof(header.format));
Expand Down Expand Up @@ -1169,6 +1243,7 @@ bool FileProcessor::ProcessMetaData(const format::BlockHeader& block_header, for
if (decoder->SupportsMetaDataId(meta_data_id))
{
decoder->DispatchCreateHardwareBufferCommand(header.thread_id,
header.device_id,
header.memory_id,
header.buffer_id,
header.format,
Expand Down
1 change: 1 addition & 0 deletions framework/decode/info_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class InfoDecoder : public ApiDecoder

virtual void
DispatchCreateHardwareBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
3 changes: 2 additions & 1 deletion framework/decode/metadata_consumer_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class MetadataConsumerBase
virtual void
ProcessResizeWindowCommand2(format::HandleId surface_id, uint32_t width, uint32_t height, uint32_t pre_transform)
{}
virtual void ProcessCreateHardwareBufferCommand(format::HandleId memory_id,
virtual void ProcessCreateHardwareBufferCommand(format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
uint32_t width,
Expand Down
4 changes: 3 additions & 1 deletion framework/decode/metadata_json_consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ class MetadataJsonConsumer : public Base
}

virtual void
ProcessCreateHardwareBufferCommand(format::HandleId memory_id,
ProcessCreateHardwareBufferCommand(format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
uint32_t width,
Expand All @@ -133,6 +134,7 @@ class MetadataJsonConsumer : public Base
{
const util::JsonOptions& json_options = GetOptions();
auto& jdata = WriteMetaCommandStart("CreateHardwareBufferCommand");
HandleToJson(jdata["device_id"], device_id, json_options);
HandleToJson(jdata["memory_id"], memory_id, json_options);
HandleToJson(jdata["buffer_id"], buffer_id, json_options);
FieldToJson(jdata["format"], format, json_options);
Expand Down
1 change: 1 addition & 0 deletions framework/decode/stat_decoder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class StatDecoderBase : public ApiDecoder

virtual void
DispatchCreateHardwareBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
2 changes: 1 addition & 1 deletion framework/decode/vulkan_address_replacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ VulkanAddressReplacer::VulkanAddressReplacer(const VulkanDeviceInfo*
GFXRECON_ASSERT(physical_device_info_ != nullptr);
device_ = device_info->handle;
resource_allocator_ = device_info->allocator.get();
get_device_address_fn_ = physical_device_info_->parent_api_version >= VK_API_VERSION_1_2
get_device_address_fn_ = physical_device_info_->parent_info.api_version >= VK_API_VERSION_1_2
? device_table->GetBufferDeviceAddress
: device_table->GetBufferDeviceAddressKHR;

Expand Down
1 change: 1 addition & 0 deletions framework/decode/vulkan_cpp_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3208,6 +3208,7 @@ void VulkanCppConsumerBase::ProcessResizeWindowCommand2(format::HandleId surface
}

void VulkanCppConsumerBase::ProcessCreateHardwareBufferCommand(
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
3 changes: 2 additions & 1 deletion framework/decode/vulkan_cpp_consumer_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ class VulkanCppConsumerBase : public VulkanConsumer
uint32_t height,
uint32_t pre_transform) override;
virtual void
ProcessCreateHardwareBufferCommand(format::HandleId memory_id,
ProcessCreateHardwareBufferCommand(format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
uint32_t width,
Expand Down
3 changes: 2 additions & 1 deletion framework/decode/vulkan_decoder_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void VulkanDecoderBase::DispatchResizeWindowCommand2(

void VulkanDecoderBase::DispatchCreateHardwareBufferCommand(
format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand All @@ -141,7 +142,7 @@ void VulkanDecoderBase::DispatchCreateHardwareBufferCommand(
for (auto consumer : consumers_)
{
consumer->ProcessCreateHardwareBufferCommand(
memory_id, buffer_id, format, width, height, stride, usage, layers, plane_info);
device_id, memory_id, buffer_id, format, width, height, stride, usage, layers, plane_info);
}
}

Expand Down
1 change: 1 addition & 0 deletions framework/decode/vulkan_decoder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class VulkanDecoderBase : public ApiDecoder

virtual void
DispatchCreateHardwareBufferCommand(format::ThreadId thread_id,
format::HandleId device_id,
format::HandleId memory_id,
uint64_t buffer_id,
uint32_t format,
Expand Down
16 changes: 16 additions & 0 deletions framework/decode/vulkan_feature_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ bool IsSupportedExtension(const std::vector<const char*>& extensions_names, cons
return false;
}

bool EnableExtensionIfSupported(const std::vector<VkExtensionProperties>& properties,
std::vector<const char*>* extensions,
const char* extension)
{
GFXRECON_ASSERT(extensions != nullptr);
GFXRECON_ASSERT(extension != nullptr);

if (IsSupportedExtension(properties, extension))
{
extensions->push_back(extension);
return true;
}

return false;
}

bool IsIgnorableExtension(const char* extension)
{
return kIgnorableExtensions.count(extension) > 0;
Expand Down
4 changes: 4 additions & 0 deletions framework/decode/vulkan_feature_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ VkResult GetDeviceExtensions(VkPhysicalDevice physical_d
bool IsSupportedExtension(const std::vector<VkExtensionProperties>& properties, const char* extension);
bool IsSupportedExtension(const std::vector<const char*>& extensions_names, const char* extension);

bool EnableExtensionIfSupported(const std::vector<VkExtensionProperties>& properties,
std::vector<const char*>* extensions,
const char* extension);

void RemoveUnsupportedExtensions(const std::vector<VkExtensionProperties>& properties,
std::vector<const char*>* extensions);

Expand Down
15 changes: 8 additions & 7 deletions framework/decode/vulkan_object_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "format/format.h"
#include "generated/generated_vulkan_dispatch_table.h"
#include "graphics/vulkan_device_util.h"
#include "graphics/vulkan_instance_util.h"
#include "graphics/vulkan_shader_group_handle.h"
#include "util/defines.h"
#include "util/spirv_parsing_util.h"
Expand Down Expand Up @@ -255,8 +256,7 @@ typedef VulkanObjectInfo<VkIndirectExecutionSetEXT> VulkanIndirectExecutionSet

struct VulkanInstanceInfo : public VulkanObjectInfo<VkInstance>
{
uint32_t api_version{ VK_MAKE_VERSION(1, 0, 0) };
std::vector<std::string> enabled_extensions;
graphics::VulkanInstanceUtilInfo util_info{};
std::unordered_map<uint32_t, size_t> array_counts;

// Capture and replay devices sorted in the order that they were originally retrieved from
Expand All @@ -269,9 +269,10 @@ struct VulkanInstanceInfo : public VulkanObjectInfo<VkInstance>

struct VulkanPhysicalDeviceInfo : public VulkanObjectInfo<VkPhysicalDevice>
{
VkInstance parent{ VK_NULL_HANDLE };
uint32_t parent_api_version{ 0 };
std::vector<std::string> parent_enabled_extensions;
VkInstance parent{ VK_NULL_HANDLE };

graphics::VulkanInstanceUtilInfo parent_info{};

std::unordered_map<uint32_t, size_t> array_counts;

// Capture device properties.
Expand Down Expand Up @@ -400,6 +401,7 @@ struct VulkanImageInfo : public VulkanObjectInfo<VkImage>
VkImageType type{};
VkFormat format{};
bool external_format{ false };
bool external_memory_android{ false };
VkExtent3D extent{ 0, 0, 0 };
VkImageTiling tiling{};
VkSampleCountFlagBits sample_count{};
Expand Down Expand Up @@ -439,8 +441,7 @@ struct VulkanShaderModuleInfo : public VulkanObjectInfo<VkShaderModule>
{
ShaderDescriptorInfo(
VkDescriptorType _type, bool _readonly, uint32_t _accessed, uint32_t _count, bool _is_array) :
type(_type),
readonly(_readonly), accessed(_accessed), count(_count), is_array(_is_array)
type(_type), readonly(_readonly), accessed(_accessed), count(_count), is_array(_is_array)
{}

ShaderDescriptorInfo(const ShaderDescriptorInfo& other) = default;
Expand Down
Loading