Reland^2: Use "gfxstream" namespace
This reverts commit d37d7c8c0cdf6b84d453cb41e358094880a8f3b5.
Reland adds in aosp/2516595 which was only built on the "full"
target and removes namespace around window methods to satisfy
MacOS build.
Bug: b/271464937
Test: android build
Test: cmake build
Test: ATP MacOS build
Change-Id: Ida36ac16f9c3b98aedd744d21c9b27e9063a8eea
diff --git a/stream-servers/vulkan/BorrowedImageVk.cpp b/stream-servers/vulkan/BorrowedImageVk.cpp
index 13c169c..9d11a7c 100644
--- a/stream-servers/vulkan/BorrowedImageVk.cpp
+++ b/stream-servers/vulkan/BorrowedImageVk.cpp
@@ -14,6 +14,9 @@
#include "BorrowedImageVk.h"
+namespace gfxstream {
+namespace vk {
+
void addNeededBarriersToUseBorrowedImage(
const BorrowedImageInfoVk& borrowedImageInfo, uint32_t usedQueueFamilyIndex,
VkImageLayout usedInitialImageLayout, VkImageLayout usedFinalImageLayout,
@@ -111,3 +114,6 @@
postUseQueueTransferBarriers->emplace_back(queueTransferBarrier);
}
}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/BorrowedImageVk.h b/stream-servers/vulkan/BorrowedImageVk.h
index 26ebd98..4df04ea 100644
--- a/stream-servers/vulkan/BorrowedImageVk.h
+++ b/stream-servers/vulkan/BorrowedImageVk.h
@@ -20,6 +20,9 @@
#include "BorrowedImage.h"
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
+namespace gfxstream {
+namespace vk {
+
struct BorrowedImageInfoVk : public BorrowedImageInfo {
VkImage image = VK_NULL_HANDLE;
VkImageView imageView = VK_NULL_HANDLE;
@@ -58,3 +61,6 @@
std::vector<VkImageMemoryBarrier>* preUseLayoutTransitionBarriers,
std::vector<VkImageMemoryBarrier>* postUseLayoutTransitionBarriers,
std::vector<VkImageMemoryBarrier>* postUseQueueTransferBarriers);
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/BufferVk.cpp b/stream-servers/vulkan/BufferVk.cpp
index 9de53c2..46f4540 100644
--- a/stream-servers/vulkan/BufferVk.cpp
+++ b/stream-servers/vulkan/BufferVk.cpp
@@ -17,11 +17,11 @@
#include "VkCommonOperations.h"
namespace gfxstream {
+namespace vk {
/*static*/
std::unique_ptr<BufferVk> BufferVk::create(uint32_t handle, uint64_t size, bool vulkanOnly) {
- if (!goldfish_vk::setupVkBuffer(size, handle, vulkanOnly,
- VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
+ if (!setupVkBuffer(size, handle, vulkanOnly, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
ERR("Failed to create BufferVk:%d", handle);
return nullptr;
}
@@ -32,17 +32,18 @@
BufferVk::BufferVk(uint32_t handle) : mHandle(handle) {}
BufferVk::~BufferVk() {
- if (!goldfish_vk::teardownVkBuffer(mHandle)) {
+ if (!teardownVkBuffer(mHandle)) {
ERR("Failed to destroy BufferVk:%d", mHandle);
}
}
void BufferVk::readToBytes(uint64_t offset, uint64_t size, void* outBytes) {
- goldfish_vk::readBufferToBytes(mHandle, offset, size, outBytes);
+ readBufferToBytes(mHandle, offset, size, outBytes);
}
bool BufferVk::updateFromBytes(uint64_t offset, uint64_t size, const void* bytes) {
- return goldfish_vk::updateBufferFromBytes(mHandle, offset, size, bytes);
+ return updateBufferFromBytes(mHandle, offset, size, bytes);
}
+} // namespace vk
} // namespace gfxstream
\ No newline at end of file
diff --git a/stream-servers/vulkan/BufferVk.h b/stream-servers/vulkan/BufferVk.h
index ac7b4b9..9016fd7 100644
--- a/stream-servers/vulkan/BufferVk.h
+++ b/stream-servers/vulkan/BufferVk.h
@@ -16,6 +16,7 @@
#include <vector>
namespace gfxstream {
+namespace vk {
class BufferVk {
public:
@@ -33,4 +34,5 @@
const uint32_t mHandle;
};
+} // namespace vk
} // namespace gfxstream
diff --git a/stream-servers/vulkan/ColorBufferVk.cpp b/stream-servers/vulkan/ColorBufferVk.cpp
index f4e13a6..72860c4 100644
--- a/stream-servers/vulkan/ColorBufferVk.cpp
+++ b/stream-servers/vulkan/ColorBufferVk.cpp
@@ -17,14 +17,15 @@
#include "VkCommonOperations.h"
namespace gfxstream {
+namespace vk {
/*static*/
std::unique_ptr<ColorBufferVk> ColorBufferVk::create(uint32_t handle, uint32_t width,
uint32_t height, GLenum format,
FrameworkFormat frameworkFormat,
bool vulkanOnly, uint32_t memoryProperty) {
- if (!goldfish_vk::setupVkColorBuffer(width, height, format, frameworkFormat, handle, vulkanOnly,
- memoryProperty)) {
+ if (!setupVkColorBuffer(width, height, format, frameworkFormat, handle, vulkanOnly,
+ memoryProperty)) {
GL_LOG("Failed to create ColorBufferVk:%d", handle);
return nullptr;
}
@@ -35,26 +36,27 @@
ColorBufferVk::ColorBufferVk(uint32_t handle) : mHandle(handle) {}
ColorBufferVk::~ColorBufferVk() {
- if (!goldfish_vk::teardownVkColorBuffer(mHandle)) {
+ if (!teardownVkColorBuffer(mHandle)) {
ERR("Failed to destroy ColorBufferVk:%d", mHandle);
}
}
bool ColorBufferVk::readToBytes(std::vector<uint8_t>* outBytes) {
- return goldfish_vk::readColorBufferToBytes(mHandle, outBytes);
+ return readColorBufferToBytes(mHandle, outBytes);
}
bool ColorBufferVk::readToBytes(uint32_t x, uint32_t y, uint32_t w, uint32_t h, void* outBytes) {
- return goldfish_vk::readColorBufferToBytes(mHandle, x, y, w, h, outBytes);
+ return readColorBufferToBytes(mHandle, x, y, w, h, outBytes);
}
bool ColorBufferVk::updateFromBytes(const std::vector<uint8_t>& bytes) {
- return goldfish_vk::updateColorBufferFromBytes(mHandle, bytes);
+ return updateColorBufferFromBytes(mHandle, bytes);
}
bool ColorBufferVk::updateFromBytes(uint32_t x, uint32_t y, uint32_t w, uint32_t h,
const void* bytes) {
- return goldfish_vk::updateColorBufferFromBytes(mHandle, x, y, w, h, bytes);
+ return updateColorBufferFromBytes(mHandle, x, y, w, h, bytes);
}
-} // namespace gfxstream
\ No newline at end of file
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/ColorBufferVk.h b/stream-servers/vulkan/ColorBufferVk.h
index a5016c0..c049bf3 100644
--- a/stream-servers/vulkan/ColorBufferVk.h
+++ b/stream-servers/vulkan/ColorBufferVk.h
@@ -20,6 +20,7 @@
#include "FrameworkFormats.h"
namespace gfxstream {
+namespace vk {
class ColorBufferVk {
public:
@@ -41,4 +42,5 @@
const uint32_t mHandle;
};
-} // namespace gfxstream
\ No newline at end of file
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/CompositorVk.cpp b/stream-servers/vulkan/CompositorVk.cpp
index 01fe90d..08cf00d 100644
--- a/stream-servers/vulkan/CompositorVk.cpp
+++ b/stream-servers/vulkan/CompositorVk.cpp
@@ -10,6 +10,9 @@
#include "vulkan/vk_enum_string_helper.h"
#include "vulkan/vk_util.h"
+namespace gfxstream {
+namespace vk {
+
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
@@ -79,7 +82,7 @@
static const std::vector<uint16_t> k_indices = {0, 1, 2, 2, 3, 0};
-static VkShaderModule createShaderModule(const goldfish_vk::VulkanDispatch& vk, VkDevice device,
+static VkShaderModule createShaderModule(const VulkanDispatch& vk, VkDevice device,
const std::vector<uint32_t>& code) {
const VkShaderModuleCreateInfo shaderModuleCi = {
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
@@ -93,7 +96,7 @@
} // namespace
-CompositorVk::RenderTarget::RenderTarget(const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice,
+CompositorVk::RenderTarget::RenderTarget(const VulkanDispatch& vk, VkDevice vkDevice,
VkImage vkImage, VkImageView vkImageView, uint32_t width,
uint32_t height, VkRenderPass vkRenderPass)
: m_vk(vk),
@@ -126,10 +129,12 @@
}
}
-std::unique_ptr<CompositorVk> CompositorVk::create(
- const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice, VkPhysicalDevice vkPhysicalDevice,
- VkQueue vkQueue, std::shared_ptr<android::base::Lock> queueLock, uint32_t queueFamilyIndex,
- uint32_t maxFramesInFlight) {
+std::unique_ptr<CompositorVk> CompositorVk::create(const VulkanDispatch& vk, VkDevice vkDevice,
+ VkPhysicalDevice vkPhysicalDevice,
+ VkQueue vkQueue,
+ std::shared_ptr<android::base::Lock> queueLock,
+ uint32_t queueFamilyIndex,
+ uint32_t maxFramesInFlight) {
auto res = std::unique_ptr<CompositorVk>(new CompositorVk(
vk, vkDevice, vkPhysicalDevice, vkQueue, queueLock, queueFamilyIndex, maxFramesInFlight));
res->setUpCommandPool();
@@ -143,7 +148,7 @@
return res;
}
-CompositorVk::CompositorVk(const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice,
+CompositorVk::CompositorVk(const VulkanDispatch& vk, VkDevice vkDevice,
VkPhysicalDevice vkPhysicalDevice, VkQueue vkQueue,
std::shared_ptr<android::base::Lock> queueLock,
uint32_t queueFamilyIndex, uint32_t maxFramesInFlight)
@@ -1110,3 +1115,6 @@
frameResources->m_vkDescriptorSetsContents = descriptorSetsContents;
}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/CompositorVk.h b/stream-servers/vulkan/CompositorVk.h
index 6265e3c..b8aa131 100644
--- a/stream-servers/vulkan/CompositorVk.h
+++ b/stream-servers/vulkan/CompositorVk.h
@@ -21,6 +21,9 @@
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
#include "vulkan/vk_util.h"
+namespace gfxstream {
+namespace vk {
+
// We do see a composition requests with 12 layers. (b/222700096)
// Inside hwc2, we will ask for surfaceflinger to
// do the composition, if the layers more than 16.
@@ -33,7 +36,7 @@
struct CompositorVkBase : public vk_util::MultiCrtp<CompositorVkBase, //
vk_util::FindMemoryType, //
vk_util::RunSingleTimeCommand> {
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
const VkDevice m_vkDevice;
const VkPhysicalDevice m_vkPhysicalDevice;
const VkQueue m_vkQueue;
@@ -98,7 +101,7 @@
std::vector<PerFrameResources> m_frameResources;
std::deque<std::shared_future<PerFrameResources*>> m_availableFrameResources;
- explicit CompositorVkBase(const goldfish_vk::VulkanDispatch& vk, VkDevice device,
+ explicit CompositorVkBase(const VulkanDispatch& vk, VkDevice device,
VkPhysicalDevice physicalDevice, VkQueue queue,
std::shared_ptr<android::base::Lock> queueLock,
uint32_t queueFamilyIndex, uint32_t maxFramesInFlight)
@@ -124,8 +127,7 @@
class CompositorVk : protected CompositorVkBase, public Compositor {
public:
- static std::unique_ptr<CompositorVk> create(const goldfish_vk::VulkanDispatch& vk,
- VkDevice vkDevice,
+ static std::unique_ptr<CompositorVk> create(const VulkanDispatch& vk, VkDevice vkDevice,
VkPhysicalDevice vkPhysicalDevice, VkQueue vkQueue,
std::shared_ptr<android::base::Lock> queueLock,
uint32_t queueFamilyIndex,
@@ -142,7 +144,7 @@
}
private:
- explicit CompositorVk(const goldfish_vk::VulkanDispatch&, VkDevice, VkPhysicalDevice, VkQueue,
+ explicit CompositorVk(const VulkanDispatch&, VkDevice, VkPhysicalDevice, VkQueue,
std::shared_ptr<android::base::Lock> queueLock, uint32_t queueFamilyIndex,
uint32_t maxFramesInFlight);
@@ -203,11 +205,11 @@
private:
friend class CompositorVk;
- RenderTarget(const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice, VkImage vkImage,
+ RenderTarget(const VulkanDispatch& vk, VkDevice vkDevice, VkImage vkImage,
VkImageView vkImageView, uint32_t width, uint32_t height,
VkRenderPass vkRenderPass);
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
VkDevice m_vkDevice;
VkImage m_vkImage;
VkFramebuffer m_vkFramebuffer;
@@ -231,4 +233,7 @@
android::base::LruCache<uint32_t, std::unique_ptr<RenderTarget>> m_renderTargetCache;
};
+} // namespace vk
+} // namespace gfxstream
+
#endif /* COMPOSITOR_VK_H */
diff --git a/stream-servers/vulkan/DebugUtilsHelper.cpp b/stream-servers/vulkan/DebugUtilsHelper.cpp
index e719c86..0c2269a 100644
--- a/stream-servers/vulkan/DebugUtilsHelper.cpp
+++ b/stream-servers/vulkan/DebugUtilsHelper.cpp
@@ -21,7 +21,8 @@
#include "host-common/logging.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
/*static*/ DebugUtilsHelper DebugUtilsHelper::withUtilsDisabled() {
return DebugUtilsHelper(false, VK_NULL_HANDLE, nullptr);
@@ -91,4 +92,5 @@
m_vk->vkCmdEndDebugUtilsLabelEXT(commandBuffer);
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/DebugUtilsHelper.h b/stream-servers/vulkan/DebugUtilsHelper.h
index d93efb5..f1dad84 100644
--- a/stream-servers/vulkan/DebugUtilsHelper.h
+++ b/stream-servers/vulkan/DebugUtilsHelper.h
@@ -18,7 +18,8 @@
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
class DebugUtilsHelper {
public:
@@ -73,4 +74,5 @@
const VulkanDispatch* m_vk = nullptr;
};
-} // namespace goldfish_vk
\ No newline at end of file
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/DisplaySurfaceVk.cpp b/stream-servers/vulkan/DisplaySurfaceVk.cpp
index 7a61a9c..4228b3e 100644
--- a/stream-servers/vulkan/DisplaySurfaceVk.cpp
+++ b/stream-servers/vulkan/DisplaySurfaceVk.cpp
@@ -18,13 +18,15 @@
#include "host-common/logging.h"
#include "vk_util.h"
+namespace gfxstream {
+namespace vk {
+
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
-std::unique_ptr<DisplaySurfaceVk> DisplaySurfaceVk::create(
- const goldfish_vk::VulkanDispatch& vk,
- VkInstance instance,
- FBNativeWindowType window) {
+std::unique_ptr<DisplaySurfaceVk> DisplaySurfaceVk::create(const VulkanDispatch& vk,
+ VkInstance instance,
+ FBNativeWindowType window) {
VkSurfaceKHR surface = VK_NULL_HANDLE;
#ifdef _WIN32
const VkWin32SurfaceCreateInfoKHR surfaceCi = {
@@ -47,15 +49,15 @@
return std::unique_ptr<DisplaySurfaceVk>(new DisplaySurfaceVk(vk, instance, surface));
}
-DisplaySurfaceVk::DisplaySurfaceVk(const goldfish_vk::VulkanDispatch& vk,
- VkInstance instance,
+DisplaySurfaceVk::DisplaySurfaceVk(const VulkanDispatch& vk, VkInstance instance,
VkSurfaceKHR surface)
- : mVk(vk),
- mInstance(instance),
- mSurface(surface) {}
+ : mVk(vk), mInstance(instance), mSurface(surface) {}
DisplaySurfaceVk::~DisplaySurfaceVk() {
if (mSurface != VK_NULL_HANDLE) {
mVk.vkDestroySurfaceKHR(mInstance, mSurface, nullptr);
}
}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/DisplaySurfaceVk.h b/stream-servers/vulkan/DisplaySurfaceVk.h
index 2ff8ff7..b31318f 100644
--- a/stream-servers/vulkan/DisplaySurfaceVk.h
+++ b/stream-servers/vulkan/DisplaySurfaceVk.h
@@ -21,23 +21,25 @@
#include "render-utils/render_api_platform_types.h"
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
+namespace gfxstream {
+namespace vk {
+
class DisplaySurfaceVk : public gfxstream::DisplaySurfaceImpl {
public:
- static std::unique_ptr<DisplaySurfaceVk> create(
- const goldfish_vk::VulkanDispatch& vk,
- VkInstance vkInstance,
- FBNativeWindowType window);
+ static std::unique_ptr<DisplaySurfaceVk> create(const VulkanDispatch& vk, VkInstance vkInstance,
+ FBNativeWindowType window);
- ~DisplaySurfaceVk();
+ ~DisplaySurfaceVk();
- VkSurfaceKHR getSurface() const { return mSurface; }
+ VkSurfaceKHR getSurface() const { return mSurface; }
private:
- DisplaySurfaceVk(const goldfish_vk::VulkanDispatch& vk,
- VkInstance vkInstance,
- VkSurfaceKHR vkSurface);
+ DisplaySurfaceVk(const VulkanDispatch& vk, VkInstance vkInstance, VkSurfaceKHR vkSurface);
- const goldfish_vk::VulkanDispatch& mVk;
- VkInstance mInstance = VK_NULL_HANDLE;
- VkSurfaceKHR mSurface = VK_NULL_HANDLE;
+ const VulkanDispatch& mVk;
+ VkInstance mInstance = VK_NULL_HANDLE;
+ VkSurfaceKHR mSurface = VK_NULL_HANDLE;
};
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/DisplayVk.cpp b/stream-servers/vulkan/DisplayVk.cpp
index 97e7e80..1d646fa 100644
--- a/stream-servers/vulkan/DisplayVk.cpp
+++ b/stream-servers/vulkan/DisplayVk.cpp
@@ -9,6 +9,9 @@
#include "vulkan/VkFormatUtils.h"
#include "vulkan/vk_enum_string_helper.h"
+namespace gfxstream {
+namespace vk {
+
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
@@ -45,7 +48,7 @@
} // namespace
-DisplayVk::DisplayVk(const goldfish_vk::VulkanDispatch& vk, VkPhysicalDevice vkPhysicalDevice,
+DisplayVk::DisplayVk(const VulkanDispatch& vk, VkPhysicalDevice vkPhysicalDevice,
uint32_t swapChainQueueFamilyIndex, uint32_t compositorQueueFamilyIndex,
VkDevice vkDevice, VkQueue compositorVkQueue,
std::shared_ptr<android::base::Lock> compositorVkQueueLock,
@@ -235,7 +238,7 @@
// borrowed image.
const auto* sourceImageInfoVk = static_cast<const BorrowedImageInfoVk*>(sourceImageInfo);
struct ImageBorrower {
- ImageBorrower(const goldfish_vk::VulkanDispatch& vk, VkQueue queue,
+ ImageBorrower(const VulkanDispatch& vk, VkQueue queue,
std::shared_ptr<android::base::Lock> queueLock, uint32_t usedQueueFamilyIndex,
const BorrowedImageInfoVk& image, const ImageBorrowResource& acquireResource,
const ImageBorrowResource& releaseResource)
@@ -322,7 +325,7 @@
}
}
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
const VkQueue m_vkQueue;
std::shared_ptr<android::base::Lock> m_queueLock;
const ImageBorrowResource& m_releaseResource;
@@ -678,7 +681,7 @@
}
std::shared_ptr<DisplayVk::PostResource> DisplayVk::PostResource::create(
- const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice, VkCommandPool vkCommandPool) {
+ const VulkanDispatch& vk, VkDevice vkDevice, VkCommandPool vkCommandPool) {
VkFenceCreateInfo fenceCi = {
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
};
@@ -710,7 +713,7 @@
m_vk.vkDestroySemaphore(m_vkDevice, m_swapchainImageReleaseSemaphore, nullptr);
}
-DisplayVk::PostResource::PostResource(const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice,
+DisplayVk::PostResource::PostResource(const VulkanDispatch& vk, VkDevice vkDevice,
VkCommandPool vkCommandPool,
VkFence swapchainImageReleaseFence,
VkSemaphore swapchainImageAcquireSemaphore,
@@ -725,7 +728,7 @@
m_vkCommandPool(vkCommandPool) {}
std::unique_ptr<DisplayVk::ImageBorrowResource> DisplayVk::ImageBorrowResource::create(
- const goldfish_vk::VulkanDispatch& vk, VkDevice device, VkCommandPool commandPool) {
+ const VulkanDispatch& vk, VkDevice device, VkCommandPool commandPool) {
const VkCommandBufferAllocateInfo allocInfo = {
.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
.pNext = nullptr,
@@ -750,11 +753,14 @@
m_vk.vkFreeCommandBuffers(m_vkDevice, m_vkCommandPool, 1, &m_vkCommandBuffer);
}
-DisplayVk::ImageBorrowResource::ImageBorrowResource(const goldfish_vk::VulkanDispatch& vk,
- VkDevice device, VkCommandPool commandPool,
- VkFence fence, VkCommandBuffer commandBuffer)
+DisplayVk::ImageBorrowResource::ImageBorrowResource(const VulkanDispatch& vk, VkDevice device,
+ VkCommandPool commandPool, VkFence fence,
+ VkCommandBuffer commandBuffer)
: m_completeFence(fence),
m_vkCommandBuffer(commandBuffer),
m_vk(vk),
m_vkDevice(device),
m_vkCommandPool(commandPool) {}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/DisplayVk.h b/stream-servers/vulkan/DisplayVk.h
index cd649ba..e137134 100644
--- a/stream-servers/vulkan/DisplayVk.h
+++ b/stream-servers/vulkan/DisplayVk.h
@@ -22,12 +22,15 @@
// The DisplayVk class holds the Vulkan and other states required to draw a
// frame in a host window.
+namespace gfxstream {
+namespace vk {
+
class DisplayVk : public gfxstream::Display {
public:
- DisplayVk(const goldfish_vk::VulkanDispatch&, VkPhysicalDevice,
- uint32_t swapChainQueueFamilyIndex, uint32_t compositorQueueFamilyIndex, VkDevice,
- VkQueue compositorVkQueue, std::shared_ptr<android::base::Lock> compositorVkQueueLock,
- VkQueue swapChainVkQueue, std::shared_ptr<android::base::Lock> swapChainVkQueueLock);
+ DisplayVk(const VulkanDispatch&, VkPhysicalDevice, uint32_t swapChainQueueFamilyIndex,
+ uint32_t compositorQueueFamilyIndex, VkDevice, VkQueue compositorVkQueue,
+ std::shared_ptr<android::base::Lock> compositorVkQueueLock, VkQueue swapChainVkQueue,
+ std::shared_ptr<android::base::Lock> swapChainVkQueueLock);
~DisplayVk();
PostResult post(const BorrowedImageInfo* info);
@@ -53,7 +56,7 @@
VkFormatFeatureFlags getFormatFeatures(VkFormat, VkImageTiling);
bool canPost(const VkImageCreateInfo&);
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
VkPhysicalDevice m_vkPhysicalDevice;
uint32_t m_swapChainQueueFamilyIndex;
uint32_t m_compositorQueueFamilyIndex;
@@ -70,16 +73,15 @@
const VkSemaphore m_swapchainImageAcquireSemaphore;
const VkSemaphore m_swapchainImageReleaseSemaphore;
const VkCommandBuffer m_vkCommandBuffer;
- static std::shared_ptr<PostResource> create(const goldfish_vk::VulkanDispatch&, VkDevice,
- VkCommandPool);
+ static std::shared_ptr<PostResource> create(const VulkanDispatch&, VkDevice, VkCommandPool);
~PostResource();
DISALLOW_COPY_ASSIGN_AND_MOVE(PostResource);
private:
- PostResource(const goldfish_vk::VulkanDispatch&, VkDevice, VkCommandPool,
+ PostResource(const VulkanDispatch&, VkDevice, VkCommandPool,
VkFence swapchainImageReleaseFence, VkSemaphore swapchainImageAcquireSemaphore,
VkSemaphore swapchainImageReleaseSemaphore, VkCommandBuffer);
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
const VkDevice m_vkDevice;
const VkCommandPool m_vkCommandPool;
};
@@ -93,15 +95,15 @@
public:
const VkFence m_completeFence;
const VkCommandBuffer m_vkCommandBuffer;
- static std::unique_ptr<ImageBorrowResource> create(const goldfish_vk::VulkanDispatch&,
- VkDevice, VkCommandPool);
+ static std::unique_ptr<ImageBorrowResource> create(const VulkanDispatch&, VkDevice,
+ VkCommandPool);
~ImageBorrowResource();
DISALLOW_COPY_ASSIGN_AND_MOVE(ImageBorrowResource);
private:
- ImageBorrowResource(const goldfish_vk::VulkanDispatch&, VkDevice, VkCommandPool, VkFence,
+ ImageBorrowResource(const VulkanDispatch&, VkDevice, VkCommandPool, VkFence,
VkCommandBuffer);
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
const VkDevice m_vkDevice;
const VkCommandPool m_vkCommandPool;
};
@@ -112,4 +114,8 @@
std::unordered_map<VkFormat, VkFormatProperties> m_vkFormatProperties;
};
+
+} // namespace vk
+} // namespace gfxstream
+
#endif
diff --git a/stream-servers/vulkan/RenderThreadInfoVk.h b/stream-servers/vulkan/RenderThreadInfoVk.h
index bbacebf..578b962 100644
--- a/stream-servers/vulkan/RenderThreadInfoVk.h
+++ b/stream-servers/vulkan/RenderThreadInfoVk.h
@@ -19,10 +19,12 @@
#include "VkDecoder.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
struct RenderThreadInfoVk {
VkDecoder m_vkDec;
};
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/SwapChainStateVk.cpp b/stream-servers/vulkan/SwapChainStateVk.cpp
index 8ad0097..1090f25 100644
--- a/stream-servers/vulkan/SwapChainStateVk.cpp
+++ b/stream-servers/vulkan/SwapChainStateVk.cpp
@@ -8,6 +8,9 @@
#include "vulkan/vk_enum_string_helper.h"
#include "vulkan/vk_util.h"
+namespace gfxstream {
+namespace vk {
+
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
@@ -72,11 +75,8 @@
}
}
-
-
std::unique_ptr<SwapChainStateVk> SwapChainStateVk::createSwapChainVk(
- const goldfish_vk::VulkanDispatch& vk,
- VkDevice vkDevice, const VkSwapchainCreateInfoKHR& swapChainCi) {
+ const VulkanDispatch& vk, VkDevice vkDevice, const VkSwapchainCreateInfoKHR& swapChainCi) {
std::unique_ptr<SwapChainStateVk> swapChainVk(new SwapChainStateVk(vk, vkDevice));
if (swapChainVk->initSwapChainStateVk(swapChainCi) != VK_SUCCESS) {
return nullptr;
@@ -84,13 +84,12 @@
return swapChainVk;
}
-SwapChainStateVk::SwapChainStateVk(const goldfish_vk::VulkanDispatch& vk, VkDevice vkDevice)
+SwapChainStateVk::SwapChainStateVk(const VulkanDispatch& vk, VkDevice vkDevice)
: m_vk(vk),
m_vkDevice(vkDevice),
m_vkSwapChain(VK_NULL_HANDLE),
m_vkImages(0),
- m_vkImageViews(0) {
-}
+ m_vkImageViews(0) {}
VkResult SwapChainStateVk::initSwapChainStateVk(const VkSwapchainCreateInfoKHR& swapChainCi) {
VkResult res = m_vk.vkCreateSwapchainKHR(m_vkDevice, &swapChainCi, nullptr, &m_vkSwapChain);
@@ -154,7 +153,7 @@
};
}
-bool SwapChainStateVk::validateQueueFamilyProperties(const goldfish_vk::VulkanDispatch& vk,
+bool SwapChainStateVk::validateQueueFamilyProperties(const VulkanDispatch& vk,
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t queueFamilyIndex) {
@@ -165,8 +164,8 @@
}
std::optional<SwapchainCreateInfoWrapper> SwapChainStateVk::createSwapChainCi(
- const goldfish_vk::VulkanDispatch& vk, VkSurfaceKHR surface, VkPhysicalDevice physicalDevice,
- uint32_t width, uint32_t height, const std::unordered_set<uint32_t>& queueFamilyIndices) {
+ const VulkanDispatch& vk, VkSurfaceKHR surface, VkPhysicalDevice physicalDevice, uint32_t width,
+ uint32_t height, const std::unordered_set<uint32_t>& queueFamilyIndices) {
uint32_t formatCount = 0;
VK_CHECK(
vk.vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, &formatCount, nullptr));
@@ -305,3 +304,6 @@
const std::vector<VkImageView>& SwapChainStateVk::getVkImageViews() const { return m_vkImageViews; }
VkSwapchainKHR SwapChainStateVk::getSwapChain() const { return m_vkSwapChain; }
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/SwapChainStateVk.h b/stream-servers/vulkan/SwapChainStateVk.h
index 6734272..49ad577 100644
--- a/stream-servers/vulkan/SwapChainStateVk.h
+++ b/stream-servers/vulkan/SwapChainStateVk.h
@@ -10,6 +10,9 @@
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
+namespace gfxstream {
+namespace vk {
+
struct SwapchainCreateInfoWrapper {
VkSwapchainCreateInfoKHR mCreateInfo;
std::vector<uint32_t> mQueueFamilyIndices;
@@ -34,18 +37,18 @@
public:
static std::vector<const char*> getRequiredInstanceExtensions();
static std::vector<const char*> getRequiredDeviceExtensions();
- static bool validateQueueFamilyProperties(const goldfish_vk::VulkanDispatch&, VkPhysicalDevice,
- VkSurfaceKHR, uint32_t queueFamilyIndex);
+ static bool validateQueueFamilyProperties(const VulkanDispatch&, VkPhysicalDevice, VkSurfaceKHR,
+ uint32_t queueFamilyIndex);
static std::optional<SwapchainCreateInfoWrapper> createSwapChainCi(
- const goldfish_vk::VulkanDispatch&, VkSurfaceKHR, VkPhysicalDevice, uint32_t width,
- uint32_t height, const std::unordered_set<uint32_t>& queueFamilyIndices);
+ const VulkanDispatch&, VkSurfaceKHR, VkPhysicalDevice, uint32_t width, uint32_t height,
+ const std::unordered_set<uint32_t>& queueFamilyIndices);
SwapChainStateVk() = delete;
SwapChainStateVk(const SwapChainStateVk&) = delete;
SwapChainStateVk& operator = (const SwapChainStateVk&) = delete;
- static std::unique_ptr<SwapChainStateVk> createSwapChainVk(const goldfish_vk::VulkanDispatch&,
- VkDevice, const VkSwapchainCreateInfoKHR&);
+ static std::unique_ptr<SwapChainStateVk> createSwapChainVk(const VulkanDispatch&, VkDevice,
+ const VkSwapchainCreateInfoKHR&);
~SwapChainStateVk();
VkFormat getFormat();
@@ -55,13 +58,13 @@
VkSwapchainKHR getSwapChain() const;
private:
- explicit SwapChainStateVk(const goldfish_vk::VulkanDispatch&, VkDevice);
+ explicit SwapChainStateVk(const VulkanDispatch&, VkDevice);
VkResult initSwapChainStateVk(const VkSwapchainCreateInfoKHR& swapChainCi);
const static VkFormat k_vkFormat = VK_FORMAT_B8G8R8A8_UNORM;
const static VkColorSpaceKHR k_vkColorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
- const goldfish_vk::VulkanDispatch& m_vk;
+ const VulkanDispatch& m_vk;
VkDevice m_vkDevice;
VkSwapchainKHR m_vkSwapChain;
VkExtent2D m_vkImageExtent;
@@ -69,4 +72,7 @@
std::vector<VkImageView> m_vkImageViews;
};
+} // namespace vk
+} // namespace gfxstream
+
#endif
\ No newline at end of file
diff --git a/stream-servers/vulkan/VkAndroidNativeBuffer.cpp b/stream-servers/vulkan/VkAndroidNativeBuffer.cpp
index ca8fb1d..be28d76 100644
--- a/stream-servers/vulkan/VkAndroidNativeBuffer.cpp
+++ b/stream-servers/vulkan/VkAndroidNativeBuffer.cpp
@@ -27,6 +27,9 @@
#include "stream-servers/FrameBuffer.h"
#include "vulkan/vk_enum_string_helper.h"
+namespace gfxstream {
+namespace vk {
+
#define VK_ANB_ERR(fmt, ...) fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, ##__VA_ARGS__);
#define ENABLE_VK_ANB_DEBUG 0
@@ -46,8 +49,6 @@
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
-namespace goldfish_vk {
-
AndroidNativeBufferInfo::QsriWaitFencePool::QsriWaitFencePool(VulkanDispatch* vk, VkDevice device)
: mVk(vk), mDevice(device) {}
@@ -814,4 +815,5 @@
return VK_SUCCESS;
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkAndroidNativeBuffer.h b/stream-servers/vulkan/VkAndroidNativeBuffer.h
index 4cfb714..d43bfd0 100644
--- a/stream-servers/vulkan/VkAndroidNativeBuffer.h
+++ b/stream-servers/vulkan/VkAndroidNativeBuffer.h
@@ -28,7 +28,8 @@
#include "aemu/base/synchronization/Lock.h"
#include "cereal/common/goldfish_vk_private_defs.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
struct AndroidNativeBufferInfo;
struct VulkanDispatch;
@@ -167,4 +168,5 @@
const VkSemaphore* pWaitSemaphores, int* pNativeFenceFd,
std::shared_ptr<AndroidNativeBufferInfo> anbInfo);
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkCommonOperations.cpp b/stream-servers/vulkan/VkCommonOperations.cpp
index b5032c5..32795d3 100644
--- a/stream-servers/vulkan/VkCommonOperations.cpp
+++ b/stream-servers/vulkan/VkCommonOperations.cpp
@@ -49,6 +49,10 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
+namespace gfxstream {
+namespace vk {
+namespace {
+
#define VK_COMMON_ERROR(fmt, ...) \
fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, ##__VA_ARGS__);
#define VK_COMMON_LOG(fmt, ...) \
@@ -58,19 +62,14 @@
fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, ##__VA_ARGS__);
using android::base::AutoLock;
+using android::base::kNullopt;
using android::base::ManagedDescriptor;
using android::base::Optional;
using android::base::StaticLock;
using android::base::StaticMap;
-
-using android::base::kNullopt;
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
-namespace goldfish_vk {
-
-namespace {
-
constexpr size_t kPageBits = 12;
constexpr size_t kPageSize = 1u << kPageBits;
@@ -509,7 +508,7 @@
if (sVkEmulation) return sVkEmulation;
- if (!emugl::vkDispatchValid(vk)) {
+ if (!vkDispatchValid(vk)) {
VK_EMU_INIT_RETURN_OR_ABORT_ON_ERROR(ABORT_REASON_OTHER, "Dispatch is invalid.");
}
@@ -3226,4 +3225,5 @@
return compositorInfo;
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkCommonOperations.h b/stream-servers/vulkan/VkCommonOperations.h
index 9017f22..f8415df 100644
--- a/stream-servers/vulkan/VkCommonOperations.h
+++ b/stream-servers/vulkan/VkCommonOperations.h
@@ -34,7 +34,8 @@
#include "utils/GfxApiLogger.h"
#include "utils/RenderDoc.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
struct VulkanDispatch;
@@ -491,4 +492,5 @@
bool colorBufferIsTarget);
std::unique_ptr<BorrowedImageInfoVk> borrowColorBufferForDisplay(uint32_t colorBufferHandle);
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkDecoder.cpp b/stream-servers/vulkan/VkDecoder.cpp
index 93791a5..72f6fa4 100644
--- a/stream-servers/vulkan/VkDecoder.cpp
+++ b/stream-servers/vulkan/VkDecoder.cpp
@@ -55,11 +55,11 @@
#define MAX_PACKET_LENGTH (400 * 1024 * 1024) // 400MB
+namespace gfxstream {
+namespace vk {
+
using android::base::MetricEventBadPacketLength;
using android::base::MetricEventDuplicateSequenceNum;
-using emugl::vkDispatch;
-
-using namespace goldfish_vk;
class VkDecoder::Impl {
public:
@@ -34543,3 +34543,6 @@
return ptr - (unsigned char*)buf;
;
}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkDecoder.h b/stream-servers/vulkan/VkDecoder.h
index f661d65..ebc9dfe 100644
--- a/stream-servers/vulkan/VkDecoder.h
+++ b/stream-servers/vulkan/VkDecoder.h
@@ -43,8 +43,13 @@
} // namespace base
} // namespace android
-class ProcessResources;
+namespace gfxstream {
class IOStream;
+class ProcessResources;
+} // namespace gfxstream
+
+namespace gfxstream {
+namespace vk {
class VkDecoder {
public:
@@ -58,6 +63,10 @@
class Impl;
std::unique_ptr<Impl> mImpl;
};
+
+} // namespace vk
+} // namespace gfxstream
+
#ifdef VK_VERSION_1_0
#endif
#ifdef VK_VERSION_1_1
diff --git a/stream-servers/vulkan/VkDecoderContext.h b/stream-servers/vulkan/VkDecoderContext.h
index 096c32e..4a997cf 100644
--- a/stream-servers/vulkan/VkDecoderContext.h
+++ b/stream-servers/vulkan/VkDecoderContext.h
@@ -21,9 +21,15 @@
#include "aemu/base/Metrics.h"
#include "utils/GfxApiLogger.h"
+namespace gfxstream {
+namespace vk {
+
struct VkDecoderContext {
const char* processName = nullptr;
emugl::GfxApiLogger* gfxApiLogger = nullptr;
emugl::HealthMonitor<>* healthMonitor = nullptr;
emugl::MetricsLogger* metricsLogger = nullptr;
-};
\ No newline at end of file
+};
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkDecoderGlobalState.cpp b/stream-servers/vulkan/VkDecoderGlobalState.cpp
index e798a9e..914be22 100644
--- a/stream-servers/vulkan/VkDecoderGlobalState.cpp
+++ b/stream-servers/vulkan/VkDecoderGlobalState.cpp
@@ -66,6 +66,9 @@
#include <climits>
+namespace gfxstream {
+namespace vk {
+
using android::base::AutoLock;
using android::base::ConditionVariable;
using android::base::DescriptorType;
@@ -109,8 +112,6 @@
}
}
-namespace goldfish_vk {
-
// A list of device extensions that should not be passed to the host driver.
// These will mainly include Vulkan features that we emulate ourselves.
static constexpr const char* const kEmulatedDeviceExtensions[] = {
@@ -294,7 +295,7 @@
class VkDecoderGlobalState::Impl {
public:
Impl()
- : m_vk(emugl::vkDispatch()),
+ : m_vk(vkDispatch()),
m_emu(getGlobalVkEmulation()),
mRenderDocWithMultipleVkInstances(m_emu->guestRenderDoc.get()) {
mSnapshotsEnabled = feature_is_enabled(kFeature_VulkanSnapshots);
@@ -4955,14 +4956,13 @@
// For AHardwareBufferImage binding, we can't know which ColorBuffer this
// to-be-created VkImage will bind to, so we try our best to infer the creation
// parameters.
- colorBufferVkImageCi = goldfish_vk::generateColorBufferVkImageCreateInfo(
+ colorBufferVkImageCi = generateColorBufferVkImageCreateInfo(
resolvedFormat, imageCreateInfo.extent.width, imageCreateInfo.extent.height,
imageCreateInfo.tiling);
importSource = "AHardwareBuffer";
} else if (pNativeBufferANDROID) {
// For native buffer binding, we can query the creation parameters from handle.
- auto colorBufferInfo =
- goldfish_vk::getColorBufferInfo(*pNativeBufferANDROID->handle);
+ auto colorBufferInfo = getColorBufferInfo(*pNativeBufferANDROID->handle);
if (colorBufferInfo.handle == *pNativeBufferANDROID->handle) {
colorBufferVkImageCi =
std::make_unique<VkImageCreateInfo>(colorBufferInfo.imageCreateInfoShallow);
@@ -5383,7 +5383,7 @@
}
// Whether the VkInstance associated with this physical device was created by ANGLE
- bool isAngleInstance(VkPhysicalDevice physicalDevice, goldfish_vk::VulkanDispatch* vk) {
+ bool isAngleInstance(VkPhysicalDevice physicalDevice, VulkanDispatch* vk) {
std::lock_guard<std::recursive_mutex> lock(mLock);
VkInstance* instance = android::base::find(mPhysicalDeviceToInstance, physicalDevice);
if (!instance) return false;
@@ -5392,14 +5392,14 @@
return instanceInfo->isAngle;
}
- bool enableEmulatedEtc2(VkPhysicalDevice physicalDevice, goldfish_vk::VulkanDispatch* vk) {
+ bool enableEmulatedEtc2(VkPhysicalDevice physicalDevice, VulkanDispatch* vk) {
if (!m_emu->enableEtc2Emulation) return false;
// Don't enable ETC2 emulation for ANGLE, let it do its own emulation.
return !isAngleInstance(physicalDevice, vk);
}
- bool enableEmulatedAstc(VkPhysicalDevice physicalDevice, goldfish_vk::VulkanDispatch* vk) {
+ bool enableEmulatedAstc(VkPhysicalDevice physicalDevice, VulkanDispatch* vk) {
if (m_emu->astcLdrEmulationMode == AstcEmulationMode::Disabled) {
return false;
}
@@ -5408,7 +5408,7 @@
return !isAngleInstance(physicalDevice, vk);
}
- bool needEmulatedEtc2(VkPhysicalDevice physicalDevice, goldfish_vk::VulkanDispatch* vk) {
+ bool needEmulatedEtc2(VkPhysicalDevice physicalDevice, VulkanDispatch* vk) {
if (!enableEmulatedEtc2(physicalDevice, vk)) {
return false;
}
@@ -5417,7 +5417,7 @@
return !feature.textureCompressionETC2;
}
- bool needEmulatedAstc(VkPhysicalDevice physicalDevice, goldfish_vk::VulkanDispatch* vk) {
+ bool needEmulatedAstc(VkPhysicalDevice physicalDevice, VulkanDispatch* vk) {
if (!enableEmulatedAstc(physicalDevice, vk)) {
return false;
}
@@ -5427,7 +5427,7 @@
}
bool isEmulatedCompressedTexture(VkFormat format, VkPhysicalDevice physicalDevice,
- goldfish_vk::VulkanDispatch* vk) {
+ VulkanDispatch* vk) {
return (CompressedImageInfo::isEtc2(format) && needEmulatedEtc2(physicalDevice, vk)) ||
(CompressedImageInfo::isAstc(format) && needEmulatedAstc(physicalDevice, vk));
}
@@ -5462,7 +5462,7 @@
void getPhysicalDeviceFormatPropertiesCore(
std::function<void(VkPhysicalDevice, VkFormat, VkFormatProperties1or2*)>
getPhysicalDeviceFormatPropertiesFunc,
- goldfish_vk::VulkanDispatch* vk, VkPhysicalDevice physicalDevice, VkFormat format,
+ VulkanDispatch* vk, VkPhysicalDevice physicalDevice, VkFormat format,
VkFormatProperties1or2* pFormatProperties) {
if (isEmulatedCompressedTexture(format, physicalDevice, vk)) {
getPhysicalDeviceFormatPropertiesFunc(
@@ -7415,4 +7415,5 @@
GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(
BOXED_NON_DISPATCHABLE_HANDLE_UNWRAP_AND_DELETE_PRESERVE_BOXED_IMPL)
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkDecoderGlobalState.h b/stream-servers/vulkan/VkDecoderGlobalState.h
index 2a3e304..5c1f6a3 100644
--- a/stream-servers/vulkan/VkDecoderGlobalState.h
+++ b/stream-servers/vulkan/VkDecoderGlobalState.h
@@ -49,7 +49,8 @@
} // namespace base
} // namespace android
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
// Class for tracking host-side state. Currently we only care about
// tracking VkDeviceMemory to make it easier to pass the right data
@@ -951,4 +952,5 @@
int mMaxSize;
};
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkDecoderGlobalState_unittest.cpp b/stream-servers/vulkan/VkDecoderGlobalState_unittest.cpp
index 44935e4..7126869 100644
--- a/stream-servers/vulkan/VkDecoderGlobalState_unittest.cpp
+++ b/stream-servers/vulkan/VkDecoderGlobalState_unittest.cpp
@@ -19,7 +19,8 @@
#include "aemu/base/testing/TestUtils.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
namespace {
using ::testing::_;
using ::testing::InSequence;
@@ -143,4 +144,5 @@
}
} // namespace
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkDecoderSnapshot.cpp b/stream-servers/vulkan/VkDecoderSnapshot.cpp
index c5f545d..add885e 100644
--- a/stream-servers/vulkan/VkDecoderSnapshot.cpp
+++ b/stream-servers/vulkan/VkDecoderSnapshot.cpp
@@ -36,7 +36,7 @@
#include "VulkanHandleMapping.h"
#include "aemu/base/synchronization/Lock.h"
-using namespace goldfish_vk;
+using namespace gfxstream::vk;
using emugl::GfxApiLogger;
using emugl::HealthMonitor;
diff --git a/stream-servers/vulkan/VkFormatUtils.cpp b/stream-servers/vulkan/VkFormatUtils.cpp
index 7685ea6..a51f1a6 100644
--- a/stream-servers/vulkan/VkFormatUtils.cpp
+++ b/stream-servers/vulkan/VkFormatUtils.cpp
@@ -16,6 +16,8 @@
#include <unordered_map>
+namespace gfxstream {
+namespace vk {
namespace {
struct FormatPlaneLayout {
@@ -191,3 +193,6 @@
return true;
}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkFormatUtils.h b/stream-servers/vulkan/VkFormatUtils.h
index 323146d..5728f7e 100644
--- a/stream-servers/vulkan/VkFormatUtils.h
+++ b/stream-servers/vulkan/VkFormatUtils.h
@@ -20,6 +20,9 @@
#include "host-common/logging.h"
#include "vulkan/vk_enum_string_helper.h"
+namespace gfxstream {
+namespace vk {
+
// Header library that captures common patterns when working with
// Vulkan formats:
// - Macros to iterate over categories of formats
@@ -655,3 +658,6 @@
bool getFormatTransferInfo(VkFormat format, uint32_t width, uint32_t height,
VkDeviceSize* outStagingBufferCopySize,
std::vector<VkBufferImageCopy>* outBufferImageCopies);
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkFormatUtils_unittest.cpp b/stream-servers/vulkan/VkFormatUtils_unittest.cpp
index 3cdb76a..db724a5 100644
--- a/stream-servers/vulkan/VkFormatUtils_unittest.cpp
+++ b/stream-servers/vulkan/VkFormatUtils_unittest.cpp
@@ -17,6 +17,8 @@
#include "VkFormatUtils.h"
+namespace gfxstream {
+namespace vk {
namespace {
using ::testing::AllOf;
@@ -256,4 +258,6 @@
})));
}
-} // namespace
\ No newline at end of file
+} // namespace
+} // namespace vk
+} // namespace gfxstream
\ No newline at end of file
diff --git a/stream-servers/vulkan/VkQsriTimeline.h b/stream-servers/vulkan/VkQsriTimeline.h
index 19e8ea0..e8a9526 100644
--- a/stream-servers/vulkan/VkQsriTimeline.h
+++ b/stream-servers/vulkan/VkQsriTimeline.h
@@ -9,7 +9,9 @@
#include "host-common/logging.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
class VkQsriTimeline {
public:
using Callback = std::function<void()>;
@@ -60,6 +62,8 @@
mPendingCallbacks.erase(mPendingCallbacks.begin(), firstPendingCallback);
}
};
-} // namespace goldfish_vk
+
+} // namespace vk
+} // namespace gfxstream
#endif // VK_QSRI_TIMELINE_H
\ No newline at end of file
diff --git a/stream-servers/vulkan/VkQsriTimeline_unittest.cpp b/stream-servers/vulkan/VkQsriTimeline_unittest.cpp
index d5d7af7..3516c6a 100644
--- a/stream-servers/vulkan/VkQsriTimeline_unittest.cpp
+++ b/stream-servers/vulkan/VkQsriTimeline_unittest.cpp
@@ -3,7 +3,8 @@
#include "VkQsriTimeline.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
namespace {
using ::testing::InSequence;
using ::testing::MockFunction;
@@ -39,4 +40,5 @@
}
} // namespace
-} // namespace goldfish_vk
\ No newline at end of file
+} // namespace vk
+} // namespace gfxstream
\ No newline at end of file
diff --git a/stream-servers/vulkan/VkReconstruction.cpp b/stream-servers/vulkan/VkReconstruction.cpp
index 3926dc7..8de635b 100644
--- a/stream-servers/vulkan/VkReconstruction.cpp
+++ b/stream-servers/vulkan/VkReconstruction.cpp
@@ -22,6 +22,9 @@
#include "VkDecoder.h"
#include "aemu/base/containers/EntityManager.h"
+namespace gfxstream {
+namespace vk {
+
#define DEBUG_RECONSTRUCTION 0
#if DEBUG_RECONSTRUCTION
@@ -299,7 +302,7 @@
mApiTrace.forEachLiveEntry_const(
[&traceBytesTotal](bool live, uint64_t handle, const ApiInfo& info) {
fprintf(stderr, "VkReconstruction::%s: api handle 0x%llx: %s\n", __func__,
- (unsigned long long)handle, goldfish_vk::api_opcode_to_string(info.opCode));
+ (unsigned long long)handle, api_opcode_to_string(info.opCode));
traceBytesTotal += info.traceBytes;
});
@@ -310,8 +313,7 @@
(unsigned long long)entityHandle);
for (auto apiHandle : reconstruction.apiRefs) {
auto apiInfo = mApiTrace.get(apiHandle);
- const char* apiName =
- apiInfo ? goldfish_vk::api_opcode_to_string(apiInfo->opCode) : "unalloced";
+ const char* apiName = apiInfo ? api_opcode_to_string(apiInfo->opCode) : "unalloced";
fprintf(stderr, "VkReconstruction::%s: 0x%llx: %s\n", __func__,
(unsigned long long)apiHandle, apiName);
for (auto createdHandle : apiInfo->createdHandles) {
@@ -328,8 +330,7 @@
(unsigned long long)entityHandle);
for (auto apiHandle : modification.apiRefs) {
auto apiInfo = mApiTrace.get(apiHandle);
- const char* apiName =
- apiInfo ? goldfish_vk::api_opcode_to_string(apiInfo->opCode) : "unalloced";
+ const char* apiName = apiInfo ? api_opcode_to_string(apiInfo->opCode) : "unalloced";
fprintf(stderr, "VkReconstruction::%s: mod: 0x%llx: %s\n", __func__,
(unsigned long long)apiHandle, apiName);
}
@@ -473,3 +474,6 @@
return orderedUniqueModifyApis;
}
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VkReconstruction.h b/stream-servers/vulkan/VkReconstruction.h
index 863c249..beb5816 100644
--- a/stream-servers/vulkan/VkReconstruction.h
+++ b/stream-servers/vulkan/VkReconstruction.h
@@ -21,6 +21,9 @@
#include "common/goldfish_vk_marshaling.h"
#include "utils/GfxApiLogger.h"
+namespace gfxstream {
+namespace vk {
+
// A class that captures all important data structures for
// reconstructing a Vulkan system state via trimmed API record and replay.
class VkReconstruction {
@@ -93,3 +96,6 @@
std::vector<uint8_t> mLoadedTrace;
};
+
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanDispatch.cpp b/stream-servers/vulkan/VulkanDispatch.cpp
index c018428..9c87278 100644
--- a/stream-servers/vulkan/VulkanDispatch.cpp
+++ b/stream-servers/vulkan/VulkanDispatch.cpp
@@ -24,7 +24,8 @@
using android::base::Lock;
using android::base::pj;
-namespace emugl {
+namespace gfxstream {
+namespace vk {
static void setIcdPath(const std::string& path) {
if (android::base::pathExists(path.c_str())) {
@@ -276,7 +277,7 @@
}
void* dlsym(void* lib, const char* name) {
- return (void*)((emugl::SharedLibraries*)(lib))->dlsym(name);
+ return (void*)((SharedLibraries*)(lib))->dlsym(name);
}
VulkanDispatch* dispatch() { return &mDispatch; }
@@ -310,8 +311,8 @@
mForTesting = forTesting;
initIcdPaths(mForTesting);
- goldfish_vk::init_vulkan_dispatch_from_system_loader(sVulkanDispatchDlOpen,
- sVulkanDispatchDlSym, &mDispatch);
+ init_vulkan_dispatch_from_system_loader(sVulkanDispatchDlOpen, sVulkanDispatchDlSym,
+ &mDispatch);
mInitialized = true;
}
@@ -326,4 +327,5 @@
vk->vkGetInstanceProcAddr != nullptr || vk->vkGetDeviceProcAddr != nullptr;
}
-} // namespace emugl
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanDispatch.h b/stream-servers/vulkan/VulkanDispatch.h
index f238fb8..a717548 100644
--- a/stream-servers/vulkan/VulkanDispatch.h
+++ b/stream-servers/vulkan/VulkanDispatch.h
@@ -15,11 +15,11 @@
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
-using goldfish_vk::VulkanDispatch;
-
-namespace emugl {
+namespace gfxstream {
+namespace vk {
VulkanDispatch* vkDispatch(bool forTesting = false);
bool vkDispatchValid(const VulkanDispatch* vk);
-} // namespace emugl
\ No newline at end of file
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanHandleMapping.cpp b/stream-servers/vulkan/VulkanHandleMapping.cpp
index a91f5ed..1b5c6a6 100644
--- a/stream-servers/vulkan/VulkanHandleMapping.cpp
+++ b/stream-servers/vulkan/VulkanHandleMapping.cpp
@@ -16,7 +16,8 @@
#include <vulkan/vulkan.h>
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
#define DEFAULT_HANDLE_MAP_DEFINE(type) \
void DefaultHandleMapping::mapHandles_##type(type*, size_t) { return; } \
@@ -35,4 +36,5 @@
GOLDFISH_VK_LIST_HANDLE_TYPES(DEFAULT_HANDLE_MAP_DEFINE)
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanHandleMapping.h b/stream-servers/vulkan/VulkanHandleMapping.h
index 490c6e6..2ea379f 100644
--- a/stream-servers/vulkan/VulkanHandleMapping.h
+++ b/stream-servers/vulkan/VulkanHandleMapping.h
@@ -21,7 +21,8 @@
#include "VulkanDispatch.h"
#include "VulkanHandles.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
class VkDecoderGlobalState;
@@ -74,4 +75,5 @@
GOLDFISH_VK_LIST_NON_DISPATCHABLE_HANDLE_TYPES(DEFINE_BOXED_NON_DISPATCHABLE_HANDLE_GLOBAL_API_DECL)
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanStream.cpp b/stream-servers/vulkan/VulkanStream.cpp
index 60b4a87..aab3de1 100644
--- a/stream-servers/vulkan/VulkanStream.cpp
+++ b/stream-servers/vulkan/VulkanStream.cpp
@@ -22,13 +22,14 @@
#include "host-common/GfxstreamFatalError.h"
#include "host-common/feature_control.h"
+namespace gfxstream {
+namespace vk {
+
#define E(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
using emugl::ABORT_REASON_OTHER;
using emugl::FatalError;
-namespace goldfish_vk {
-
VulkanStream::VulkanStream(IOStream* stream) : mStream(stream) {
unsetHandleMapping();
@@ -219,4 +220,5 @@
void VulkanMemReadingStream::resetTrace() { mTraceStart = mStart + mReadPos; }
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanStream.h b/stream-servers/vulkan/VulkanStream.h
index 854650d..ee18476 100644
--- a/stream-servers/vulkan/VulkanStream.h
+++ b/stream-servers/vulkan/VulkanStream.h
@@ -26,15 +26,18 @@
#define E(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)
-class IOStream;
-
namespace android {
namespace base {
class BumpPool;
} // namespace base
} // namespace android
-namespace goldfish_vk {
+namespace gfxstream {
+class IOStream;
+} // namespace gfxstream
+
+namespace gfxstream {
+namespace vk {
class VulkanStream : public android::base::Stream {
public:
@@ -109,4 +112,5 @@
uintptr_t mReadPos = 0;
};
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/VulkanStream_unittest.cpp b/stream-servers/vulkan/VulkanStream_unittest.cpp
index eb38747..6198e56 100644
--- a/stream-servers/vulkan/VulkanStream_unittest.cpp
+++ b/stream-servers/vulkan/VulkanStream_unittest.cpp
@@ -27,9 +27,11 @@
#include "common/goldfish_vk_reserved_marshaling.h"
#include "common/goldfish_vk_testing.h"
-using android::base::arraySize;
+namespace gfxstream {
+namespace vk {
+namespace {
-namespace goldfish_vk {
+using android::base::arraySize;
class TestStream : public IOStream {
public:
@@ -707,4 +709,6 @@
}
}
-} // namespace goldfish_vk
+} // namespace
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.cpp
index 47d7fe0..98410e6 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.cpp
@@ -37,7 +37,8 @@
#include "goldfish_vk_private_defs.h"
#include "vk_util.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void deepcopy_extension_struct(Allocator* alloc, VkStructureType rootType,
const void* structExtension, void* structExtension_out);
@@ -21021,4 +21022,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.h b/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.h
index db290f9..eb14ba8 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_deepcopy.h
@@ -38,7 +38,9 @@
using android::base::Allocator;
using android::base::BumpPool;
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
#ifdef VK_VERSION_1_0
void deepcopy_VkExtent2D(Allocator* alloc, VkStructureType rootType, const VkExtent2D* from,
VkExtent2D* to);
@@ -3945,4 +3947,5 @@
#endif
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.cpp
index 7b00124..6244a7b 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.cpp
@@ -35,7 +35,8 @@
#include <stdlib.h>
#include <string.h>
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
#ifdef VK_VERSION_1_0
#endif
@@ -5524,4 +5525,5 @@
return good;
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.h b/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.h
index afbf14b..546d961 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.h
@@ -34,15 +34,18 @@
#include "goldfish_vk_private_defs.h"
#include "vk_android_native_buffer.h"
#include "vulkan_gfxstream.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
struct VulkanDispatch;
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
using DlOpenFunc = void*(void);
using DlSymFunc = void*(void*, const char*);
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void init_vulkan_dispatch_from_system_loader(DlOpenFunc dlOpenFunc, DlSymFunc dlSymFunc,
VulkanDispatch* dispatch_out);
@@ -1163,4 +1166,5 @@
#endif
};
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.cpp
index 4895f05..310a340 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.cpp
@@ -31,7 +31,8 @@
#include "goldfish_vk_extension_structs.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
#ifdef VK_VERSION_1_0
#endif
@@ -3424,4 +3425,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.h b/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.h
index 261cefb..fd0296b 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_extension_structs.h
@@ -35,7 +35,9 @@
#include "vk_android_native_buffer.h"
#include "vulkan_gfxstream.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
uint32_t goldfish_vk_struct_type(const void* structExtension);
size_t goldfish_vk_extension_struct_size(VkStructureType rootType, const void* structExtension);
@@ -587,4 +589,5 @@
#ifdef VK_KHR_ray_query
#endif
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.cpp
index b523f18..813046c 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.cpp
@@ -36,7 +36,8 @@
#include "goldfish_vk_extension_structs.h"
#include "goldfish_vk_private_defs.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void handlemap_extension_struct(VulkanHandleMapping* handlemap, void* structExtension_out);
@@ -10574,4 +10575,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.h b/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.h
index bc2d79c..65f2989 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_handlemap.h
@@ -36,7 +36,9 @@
#include "vk_android_native_buffer.h"
#include "vulkan_gfxstream.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
#ifdef VK_VERSION_1_0
void handlemap_VkExtent2D(VulkanHandleMapping* handlemap, VkExtent2D* toMap);
@@ -2999,4 +3001,5 @@
#endif
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.cpp
index 982106d..e1a2247 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.cpp
@@ -36,7 +36,8 @@
#include "goldfish_vk_extension_structs.h"
#include "goldfish_vk_private_defs.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void marshal_extension_struct(VulkanStream* vkStream, VkStructureType rootType,
const void* structExtension);
@@ -40942,4 +40943,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.h b/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.h
index a6f4827..e390da2 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_marshaling.h
@@ -37,7 +37,9 @@
#include "vk_android_native_buffer.h"
#include "vulkan_gfxstream.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
#ifdef VK_VERSION_1_0
void marshal_VkExtent2D(VulkanStream* vkStream, VkStructureType rootType,
const VkExtent2D* forMarshaling);
@@ -6947,4 +6949,5 @@
#define OP_vkFirst 200000000
#define OP_vkLast 300000000
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.cpp
index ff4364e..87d4904 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.cpp
@@ -36,7 +36,8 @@
#include "goldfish_vk_extension_structs.h"
#include "goldfish_vk_private_defs.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void reservedmarshal_extension_struct(VulkanStream* vkStream, VkStructureType rootType,
const void* structExtension, uint8_t** ptr);
@@ -28919,4 +28920,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.h b/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.h
index 0f44245..e8c04bb 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_reserved_marshaling.h
@@ -37,7 +37,9 @@
#include "vk_android_native_buffer.h"
#include "vulkan_gfxstream.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
#ifdef VK_VERSION_1_0
void reservedunmarshal_VkExtent2D(VulkanStream* vkStream, VkStructureType rootType,
VkExtent2D* forUnmarshaling, uint8_t** ptr);
@@ -3799,4 +3801,5 @@
#endif
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_testing.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_testing.cpp
index 64ac323..0f6c7dc 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_testing.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_testing.cpp
@@ -36,7 +36,8 @@
#include "goldfish_vk_extension_structs.h"
#include "goldfish_vk_private_defs.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void checkEqual_extension_struct(const void* structExtension, const void* structExtension2,
OnFailCompareFunc onFail);
@@ -21015,4 +21016,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_testing.h b/stream-servers/vulkan/cereal/common/goldfish_vk_testing.h
index cb352af..b0cf026 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_testing.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_testing.h
@@ -39,7 +39,9 @@
#include "vulkan_gfxstream.h"
using OnFailCompareFunc = std::function<void(const char*)>;
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
#ifdef VK_VERSION_1_0
void checkEqual_VkExtent2D(const VkExtent2D* a, const VkExtent2D* b, OnFailCompareFunc onFail);
@@ -3687,4 +3689,5 @@
#endif
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_transform.cpp b/stream-servers/vulkan/cereal/common/goldfish_vk_transform.cpp
index 85c07c7..c251329 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_transform.cpp
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_transform.cpp
@@ -33,7 +33,8 @@
#include "VkDecoderGlobalState.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
void transform_tohost_extension_struct(VkDecoderGlobalState* resourceTracker,
void* structExtension_out);
@@ -21206,4 +21207,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/cereal/common/goldfish_vk_transform.h b/stream-servers/vulkan/cereal/common/goldfish_vk_transform.h
index b8584cd..4f27087 100644
--- a/stream-servers/vulkan/cereal/common/goldfish_vk_transform.h
+++ b/stream-servers/vulkan/cereal/common/goldfish_vk_transform.h
@@ -36,7 +36,9 @@
#include "vk_android_native_buffer.h"
#include "vulkan_gfxstream.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
+
class VkDecoderGlobalState;
#define LIST_TRIVIAL_TRANSFORMED_TYPES(f) \
f(VkPhysicalDeviceExternalImageFormatInfo) \
@@ -6032,4 +6034,5 @@
#endif
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/emulated_textures/AstcTexture.cpp b/stream-servers/vulkan/emulated_textures/AstcTexture.cpp
index a942958..5057ad7 100644
--- a/stream-servers/vulkan/emulated_textures/AstcTexture.cpp
+++ b/stream-servers/vulkan/emulated_textures/AstcTexture.cpp
@@ -24,7 +24,8 @@
#include "host-common/logging.h"
#include "stream-servers/vulkan/vk_util.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
namespace {
using std::chrono::milliseconds;
@@ -257,4 +258,5 @@
}
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/emulated_textures/AstcTexture.h b/stream-servers/vulkan/emulated_textures/AstcTexture.h
index 4af34f4..6b491a7 100644
--- a/stream-servers/vulkan/emulated_textures/AstcTexture.h
+++ b/stream-servers/vulkan/emulated_textures/AstcTexture.h
@@ -18,7 +18,8 @@
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
#include "vulkan/vulkan.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
// Holds the resources necessary to perform CPU ASTC decompression of a single texture.
class AstcTexture {
@@ -58,4 +59,5 @@
AstcCpuDecompressor* mDecompressor;
};
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/emulated_textures/CompressedImageInfo.cpp b/stream-servers/vulkan/emulated_textures/CompressedImageInfo.cpp
index 4b398eb..0110103 100644
--- a/stream-servers/vulkan/emulated_textures/CompressedImageInfo.cpp
+++ b/stream-servers/vulkan/emulated_textures/CompressedImageInfo.cpp
@@ -18,8 +18,8 @@
#include "stream-servers/vulkan/VkFormatUtils.h"
#include "stream-servers/vulkan/emulated_textures/shaders/DecompressionShaders.h"
-namespace goldfish_vk {
-
+namespace gfxstream {
+namespace vk {
namespace {
#define _RETURN_ON_FAILURE(cmd) \
@@ -157,7 +157,7 @@
// Note the potential integer overflow for large numbers.
inline constexpr uint32_t ceil_div(uint32_t x, uint32_t y) { return (x + y - 1) / y; }
-VkImageView createDefaultImageView(goldfish_vk::VulkanDispatch* vk, VkDevice device, VkImage image,
+VkImageView createDefaultImageView(VulkanDispatch* vk, VkDevice device, VkImage image,
VkFormat format, VkImageType imageType, uint32_t mipLevel,
uint32_t layerCount) {
VkImageViewCreateInfo imageViewInfo = {};
@@ -462,7 +462,7 @@
return result;
}
-void CompressedImageInfo::createCompressedMipmapImages(goldfish_vk::VulkanDispatch* vk,
+void CompressedImageInfo::createCompressedMipmapImages(VulkanDispatch* vk,
const VkImageCreateInfo& createInfo) {
if (!mCompressedMipmaps.empty()) {
return;
@@ -505,8 +505,7 @@
mBlock.height, &AstcCpuDecompressor::get());
}
-bool CompressedImageInfo::decompressIfNeeded(goldfish_vk::VulkanDispatch* vk,
- VkCommandBuffer commandBuffer,
+bool CompressedImageInfo::decompressIfNeeded(VulkanDispatch* vk, VkCommandBuffer commandBuffer,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags dstStageMask,
const VkImageMemoryBarrier& targetBarrier,
@@ -578,8 +577,7 @@
};
}
-VkResult CompressedImageInfo::bindCompressedMipmapsMemory(goldfish_vk::VulkanDispatch* vk,
- VkDeviceMemory memory,
+VkResult CompressedImageInfo::bindCompressedMipmapsMemory(VulkanDispatch* vk, VkDeviceMemory memory,
VkDeviceSize memoryOffset) {
VkResult result = VK_SUCCESS;
for (size_t i = 0; i < mCompressedMipmaps.size(); i++) {
@@ -643,7 +641,7 @@
vk->vkDestroyImage(mDevice, mDecompressedImage, nullptr);
}
-VkDeviceSize CompressedImageInfo::getImageSize(goldfish_vk::VulkanDispatch* vk, VkImage image) {
+VkDeviceSize CompressedImageInfo::getImageSize(VulkanDispatch* vk, VkImage image) {
VkMemoryRequirements memRequirements;
vk->vkGetImageMemoryRequirements(mDevice, image, &memRequirements);
mAlignment = std::max(mAlignment, memRequirements.alignment);
@@ -685,8 +683,7 @@
return result;
}
-VkResult CompressedImageInfo::initializeDecompressionPipeline(goldfish_vk::VulkanDispatch* vk,
- VkDevice device) {
+VkResult CompressedImageInfo::initializeDecompressionPipeline(VulkanDispatch* vk, VkDevice device) {
if (mDecompPipeline != nullptr) {
return VK_SUCCESS;
}
@@ -829,7 +826,7 @@
return VK_SUCCESS;
}
-void CompressedImageInfo::decompress(goldfish_vk::VulkanDispatch* vk, VkCommandBuffer commandBuffer,
+void CompressedImageInfo::decompress(VulkanDispatch* vk, VkCommandBuffer commandBuffer,
const VkImageSubresourceRange& range) {
vk->vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, mDecompPipeline);
uint32_t dispatchZ = mExtent.depth == 1 ? range.layerCount : mExtent.depth;
@@ -897,4 +894,5 @@
};
}
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/emulated_textures/CompressedImageInfo.h b/stream-servers/vulkan/emulated_textures/CompressedImageInfo.h
index ac9ea1a..88e3c7b 100644
--- a/stream-servers/vulkan/emulated_textures/CompressedImageInfo.h
+++ b/stream-servers/vulkan/emulated_textures/CompressedImageInfo.h
@@ -23,7 +23,8 @@
#include "vulkan/cereal/common/goldfish_vk_dispatch.h"
#include "vulkan/vulkan.h"
-namespace goldfish_vk {
+namespace gfxstream {
+namespace vk {
class CompressedImageInfo {
public:
@@ -60,8 +61,7 @@
VkImageCreateInfo getDecompressedCreateInfo(const VkImageCreateInfo& createInfo) const;
// Creates the compressed mipmap images, that is the VkImages holding the compressed data
- void createCompressedMipmapImages(goldfish_vk::VulkanDispatch* vk,
- const VkImageCreateInfo& createInfo);
+ void createCompressedMipmapImages(VulkanDispatch* vk, const VkImageCreateInfo& createInfo);
// Initializes the resources needed to perform CPU decompression of ASTC textures
void initAstcCpuDecompression(VulkanDispatch* vk, VkPhysicalDevice physicalDevice);
@@ -73,7 +73,7 @@
// outputBarriers: any barrier that needs to be passed to the vkCmdPipelineBarrier call will be
// added to this vector.
// Returns whether image decompression happened.
- bool decompressIfNeeded(goldfish_vk::VulkanDispatch* vk, VkCommandBuffer commandBuffer,
+ bool decompressIfNeeded(VulkanDispatch* vk, VkCommandBuffer commandBuffer,
VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
const VkImageMemoryBarrier& targetBarrier,
std::vector<VkImageMemoryBarrier>& outputBarriers);
@@ -84,7 +84,7 @@
VkMemoryRequirements getMemoryRequirements() const;
- VkResult bindCompressedMipmapsMemory(goldfish_vk::VulkanDispatch* vk, VkDeviceMemory memory,
+ VkResult bindCompressedMipmapsMemory(VulkanDispatch* vk, VkDeviceMemory memory,
VkDeviceSize memoryOffset);
// Given a VkBufferImageCopy object for the original image, returns a new
@@ -110,7 +110,7 @@
private:
// Returns the size in bytes needed for the storage of a given image.
// Also updates the alignment field of this class.
- VkDeviceSize getImageSize(goldfish_vk::VulkanDispatch* vk, VkImage image);
+ VkDeviceSize getImageSize(VulkanDispatch* vk, VkImage image);
// Returns a vector of image barriers for the compressed mipmap images and the decompressed
// image.
@@ -120,10 +120,10 @@
// Initializes the compute shader pipeline to decompress the image.
// No-op if this was already called successfully.
- VkResult initializeDecompressionPipeline(goldfish_vk::VulkanDispatch* vk, VkDevice device);
+ VkResult initializeDecompressionPipeline(VulkanDispatch* vk, VkDevice device);
// Runs the decompression shader
- void decompress(goldfish_vk::VulkanDispatch* vk, VkCommandBuffer commandBuffer,
+ void decompress(VulkanDispatch* vk, VkCommandBuffer commandBuffer,
const VkImageSubresourceRange& range);
// Returns the size of the image at a given mip level
@@ -175,4 +175,5 @@
std::vector<VkImageView> mDecompImageViews;
};
-} // namespace goldfish_vk
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/emulated_textures/shaders/DecompressionShaders.h b/stream-servers/vulkan/emulated_textures/shaders/DecompressionShaders.h
index a96e56f..f720f40 100644
--- a/stream-servers/vulkan/emulated_textures/shaders/DecompressionShaders.h
+++ b/stream-servers/vulkan/emulated_textures/shaders/DecompressionShaders.h
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-namespace goldfish_vk::decompression_shaders {
+namespace gfxstream {
+namespace vk {
+namespace decompression_shaders {
// Compiled code of the image decompression shaders
//
@@ -83,4 +85,6 @@
#include "compiled/Etc2RGBA8_3D.inl"
};
-} // namespace goldfish_vk::decompression_shaders
+} // namespace decompression_shaders
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/testing/VkDecoderTestDispatch.h b/stream-servers/vulkan/testing/VkDecoderTestDispatch.h
index 72419f6..a38ff8d 100644
--- a/stream-servers/vulkan/testing/VkDecoderTestDispatch.h
+++ b/stream-servers/vulkan/testing/VkDecoderTestDispatch.h
@@ -18,7 +18,9 @@
#include "stream-servers/vulkan/cereal/common/goldfish_vk_dispatch.h"
#include "vulkan/vulkan.h"
-namespace goldfish_vk::testing {
+namespace gfxstream {
+namespace vk {
+namespace testing {
// TODO(gregschlom): This class should be auto-generated
class VkDecoderTestDispatch {
@@ -288,4 +290,6 @@
VkDecoderContext* mDecoderContext;
};
-} // namespace goldfish_vk::testing
\ No newline at end of file
+} // namespace testing
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/testing/VulkanTestHelper.cpp b/stream-servers/vulkan/testing/VulkanTestHelper.cpp
index 96582d4..c210cd4 100644
--- a/stream-servers/vulkan/testing/VulkanTestHelper.cpp
+++ b/stream-servers/vulkan/testing/VulkanTestHelper.cpp
@@ -19,7 +19,9 @@
#include "host-common/logging.h"
#include "host-common/vm_operations.h"
-namespace goldfish_vk::testing {
+namespace gfxstream {
+namespace vk {
+namespace testing {
namespace {
using ::android::base::BumpPool;
@@ -43,7 +45,7 @@
VulkanTestHelper::VulkanTestHelper()
: mLock(mMutex),
- mVk(emugl::vkDispatch(/*forTesting=*/true)),
+ mVk(vkDispatch(/*forTesting=*/true)),
mLogger(),
mMetricsLogger(android::base::CreateMetricsLogger()),
mHealthMonitor(*mMetricsLogger),
@@ -340,4 +342,6 @@
&barrier);
}
-} // namespace goldfish_vk::testing
+} // namespace testing
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/testing/VulkanTestHelper.h b/stream-servers/vulkan/testing/VulkanTestHelper.h
index 6606cb3..d3c3edc 100644
--- a/stream-servers/vulkan/testing/VulkanTestHelper.h
+++ b/stream-servers/vulkan/testing/VulkanTestHelper.h
@@ -24,7 +24,9 @@
#include "stream-servers/vulkan/testing/VkDecoderTestDispatch.h"
#include "utils/include/utils/GfxApiLogger.h"
-namespace goldfish_vk::testing {
+namespace gfxstream {
+namespace vk {
+namespace testing {
// This class provides facilities to write tests that call into the Vulkan API through VkDecoder and
// VkDecoderGlobalState.
@@ -115,4 +117,6 @@
VkDebugUtilsMessengerEXT mDebugMessenger = VK_NULL_HANDLE;
};
-} // namespace goldfish_vk::testing
+} // namespace testing
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/vk_fn_info.h b/stream-servers/vulkan/vk_fn_info.h
index 11c61b9..a44fb8d 100644
--- a/stream-servers/vulkan/vk_fn_info.h
+++ b/stream-servers/vulkan/vk_fn_info.h
@@ -20,6 +20,8 @@
#include <initializer_list>
#include <tuple>
+namespace gfxstream {
+namespace vk {
namespace vk_util {
namespace vk_fn_info {
template <class T>
@@ -40,7 +42,10 @@
"vkGetPhysicalDeviceImageFormatProperties2"))
REGISTER_VK_FN_INFO(GetPhysicalDeviceFeatures2,
("vkGetPhysicalDeviceFeatures2", "vkGetPhysicalDeviceFeatures2KHR"));
+
} // namespace vk_fn_info
} // namespace vk_util
+} // namespace vk
+} // namespace gfxstream
#endif /* VK_FN_INFO_H */
diff --git a/stream-servers/vulkan/vk_format_info.h b/stream-servers/vulkan/vk_format_info.h
index e9b41ba..ad10df2 100644
--- a/stream-servers/vulkan/vk_format_info.h
+++ b/stream-servers/vulkan/vk_format_info.h
@@ -30,6 +30,9 @@
#include <vndk/hardware_buffer.h>
#include <vulkan/vulkan.h>
+namespace gfxstream {
+namespace vk {
+
/* See i915_private_android_types.h in minigbm. */
#define HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL 0x100
@@ -135,4 +138,7 @@
return aspects & VK_IMAGE_ASPECT_DEPTH_BIT;
}
+} // namespace vk
+} // namespace gfxstream
+
#endif /* VK_FORMAT_INFO_H */
\ No newline at end of file
diff --git a/stream-servers/vulkan/vk_util.cpp b/stream-servers/vulkan/vk_util.cpp
index 0e715f5..096f03a 100644
--- a/stream-servers/vulkan/vk_util.cpp
+++ b/stream-servers/vulkan/vk_util.cpp
@@ -16,6 +16,8 @@
#include "vk_util.h"
+namespace gfxstream {
+namespace vk {
namespace vk_util {
namespace {
@@ -45,3 +47,5 @@
}
} // namespace vk_util
+} // namespace vk
+} // namespace gfxstream
diff --git a/stream-servers/vulkan/vk_util.h b/stream-servers/vulkan/vk_util.h
index 312a8eb..ba7f9ea 100644
--- a/stream-servers/vulkan/vk_util.h
+++ b/stream-servers/vulkan/vk_util.h
@@ -48,6 +48,9 @@
#include "vk_fn_info.h"
#include "vulkan/cereal/common/vk_struct_id.h"
+namespace gfxstream {
+namespace vk {
+
struct vk_struct_common {
VkStructureType sType;
struct vk_struct_common* pNext;
@@ -274,34 +277,34 @@
}
}
-#define VK_CHECK(x) \
- do { \
- VkResult err = x; \
- if (err != VK_SUCCESS) { \
- if (err == VK_ERROR_DEVICE_LOST) { \
- ::vk_util::getVkCheckCallbacks().callIfExists( \
- &::vk_util::VkCheckCallbacks::onVkErrorDeviceLost); \
- } \
- if (err == VK_ERROR_OUT_OF_HOST_MEMORY || err == VK_ERROR_OUT_OF_DEVICE_MEMORY || \
- err == VK_ERROR_OUT_OF_POOL_MEMORY) { \
- ::vk_util::getVkCheckCallbacks().callIfExists( \
- &::vk_util::VkCheckCallbacks::onVkErrorOutOfMemory, err, __func__, __LINE__); \
- } \
- GFXSTREAM_ABORT(::emugl::FatalError(err)); \
- } \
+#define VK_CHECK(x) \
+ do { \
+ VkResult err = x; \
+ if (err != VK_SUCCESS) { \
+ if (err == VK_ERROR_DEVICE_LOST) { \
+ vk_util::getVkCheckCallbacks().callIfExists( \
+ &vk_util::VkCheckCallbacks::onVkErrorDeviceLost); \
+ } \
+ if (err == VK_ERROR_OUT_OF_HOST_MEMORY || err == VK_ERROR_OUT_OF_DEVICE_MEMORY || \
+ err == VK_ERROR_OUT_OF_POOL_MEMORY) { \
+ vk_util::getVkCheckCallbacks().callIfExists( \
+ &vk_util::VkCheckCallbacks::onVkErrorOutOfMemory, err, __func__, __LINE__); \
+ } \
+ GFXSTREAM_ABORT(::emugl::FatalError(err)); \
+ } \
} while (0)
-#define VK_CHECK_MEMALLOC(x, allocateInfo) \
- do { \
- VkResult err = x; \
- if (err != VK_SUCCESS) { \
- if (err == VK_ERROR_OUT_OF_HOST_MEMORY || err == VK_ERROR_OUT_OF_DEVICE_MEMORY) { \
- ::vk_util::getVkCheckCallbacks().callIfExists( \
- &::vk_util::VkCheckCallbacks::onVkErrorOutOfMemoryOnAllocation, err, __func__, \
- __LINE__, allocateInfo.allocationSize); \
- } \
- GFXSTREAM_ABORT(::emugl::FatalError(err)); \
- } \
+#define VK_CHECK_MEMALLOC(x, allocateInfo) \
+ do { \
+ VkResult err = x; \
+ if (err != VK_SUCCESS) { \
+ if (err == VK_ERROR_OUT_OF_HOST_MEMORY || err == VK_ERROR_OUT_OF_DEVICE_MEMORY) { \
+ vk_util::getVkCheckCallbacks().callIfExists( \
+ &vk_util::VkCheckCallbacks::onVkErrorOutOfMemoryOnAllocation, err, __func__, \
+ __LINE__, allocateInfo.allocationSize); \
+ } \
+ GFXSTREAM_ABORT(::emugl::FatalError(err)); \
+ } \
} while (0)
typedef void* MTLTextureRef;
@@ -494,6 +497,9 @@
}
return nullptr;
}
+
} // namespace vk_util
+} // namespace vk
+} // namespace gfxstream
#endif /* VK_UTIL_H */
diff --git a/stream-servers/vulkan/vk_util_unittest.cpp b/stream-servers/vulkan/vk_util_unittest.cpp
index 3d6105a..d723872 100644
--- a/stream-servers/vulkan/vk_util_unittest.cpp
+++ b/stream-servers/vulkan/vk_util_unittest.cpp
@@ -21,6 +21,8 @@
#include <tuple>
+namespace gfxstream {
+namespace vk {
namespace vk_util {
namespace vk_fn_info {
@@ -261,3 +263,5 @@
} // namespace
} // namespace vk_fn_info
} // namespace vk_util
+} // namespace vk
+} // namespace gfxstream