diff options
-rw-r--r-- | host/FrameBuffer.cpp | 8 | ||||
-rw-r--r-- | host/PostWorkerGl.cpp | 2 | ||||
-rw-r--r-- | host/vulkan/VkDecoderGlobalState.cpp | 37 | ||||
-rw-r--r-- | host/vulkan/VkDecoderInternalStructs.h | 3 | ||||
-rw-r--r-- | host/vulkan/meson.build | 1 |
5 files changed, 38 insertions, 13 deletions
diff --git a/host/FrameBuffer.cpp b/host/FrameBuffer.cpp index 1e363365..5e2854ae 100644 --- a/host/FrameBuffer.cpp +++ b/host/FrameBuffer.cpp @@ -1988,9 +1988,15 @@ static void loadProcOwnedCollection(Stream* stream, Collection* c) { int FrameBuffer::getScreenshot(unsigned int nChannels, unsigned int* width, unsigned int* height, uint8_t* pixels, size_t* cPixels, int displayId, int desiredWidth, int desiredHeight, int desiredRotation, Rect rect) { - if (emugl::shouldSkipDraw()) { +#ifdef CONFIG_AEMU + if (emugl::shouldSkipDraw()) { + *width = 0; + *height = 0; + *cPixels = 0; return -1; } +#endif + AutoLock mutex(m_lock); uint32_t w, h, cb, screenWidth, screenHeight; if (!emugl::get_emugl_multi_display_operations().getMultiDisplay( diff --git a/host/PostWorkerGl.cpp b/host/PostWorkerGl.cpp index 7d25ec47..f44254ee 100644 --- a/host/PostWorkerGl.cpp +++ b/host/PostWorkerGl.cpp @@ -88,11 +88,13 @@ std::shared_future<void> PostWorkerGl::postImpl(ColorBuffer* cb) { const auto& multiDisplay = emugl::get_emugl_multi_display_operations(); const bool pixel_fold = multiDisplay.isPixelFold(); if (pixel_fold) { +#ifdef CONFIG_AEMU if (emugl::shouldSkipDraw()) { post.layers.clear(); } else { post.layers.push_back(postWithOverlay(cb)); } +#endif } else if (multiDisplay.isMultiDisplayEnabled()) { if (multiDisplay.isMultiDisplayWindow()) { diff --git a/host/vulkan/VkDecoderGlobalState.cpp b/host/vulkan/VkDecoderGlobalState.cpp index 0d8f5b65..cbf70374 100644 --- a/host/vulkan/VkDecoderGlobalState.cpp +++ b/host/vulkan/VkDecoderGlobalState.cpp @@ -655,15 +655,6 @@ class VkDecoderGlobalState::Impl { std::vector<const char*> finalExts = filteredInstanceExtensionNames( pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames); - if (pCreateInfo->pApplicationInfo) { - if (pCreateInfo->pApplicationInfo->pApplicationName) - INFO("Creating Vulkan instance for app: %s", - pCreateInfo->pApplicationInfo->pApplicationName); - if (pCreateInfo->pApplicationInfo->pEngineName) - INFO("Creating Vulkan instance for engine: %s", - pCreateInfo->pApplicationInfo->pEngineName); - } - // Create higher version instance whenever it is possible. uint32_t apiVersion = VK_MAKE_VERSION(1, 0, 0); if (pCreateInfo->pApplicationInfo) { @@ -730,10 +721,21 @@ class VkDecoderGlobalState::Impl { InstanceInfo info; info.apiVersion = apiVersion; + if (pCreateInfo->pApplicationInfo) { + if (pCreateInfo->pApplicationInfo->pApplicationName) { + info.applicationName = pCreateInfo->pApplicationInfo->pApplicationName; + } + if (pCreateInfo->pApplicationInfo->pEngineName) { + info.engineName = pCreateInfo->pApplicationInfo->pEngineName; + } + } for (uint32_t i = 0; i < createInfoFiltered.enabledExtensionCount; ++i) { info.enabledExtensionNames.push_back(createInfoFiltered.ppEnabledExtensionNames[i]); } + INFO("Created VkInstance:%p for application:%s engine:%s.", *pInstance, + info.applicationName.c_str(), info.engineName.c_str()); + // Box it up VkInstance boxed = new_boxed_VkInstance(*pInstance, nullptr, true /* own dispatch */); init_vulkan_dispatch_from_instance(m_vk, *pInstance, dispatch_VkInstance(boxed)); @@ -905,7 +907,7 @@ class VkDecoderGlobalState::Impl { mPhysicalDeviceToInstance[validPhysicalDevices[i]] = instance; auto& physdevInfo = mPhysdevInfo[validPhysicalDevices[i]]; - + physdevInfo.instance = instance; physdevInfo.boxed = new_boxed_VkPhysicalDevice(validPhysicalDevices[i], vk, false /* does not own dispatch */); @@ -1464,6 +1466,14 @@ class VkDecoderGlobalState::Impl { mDeviceToPhysicalDevice[*pDevice] = physicalDevice; + auto physicalDeviceInfoIt = mPhysdevInfo.find(physicalDevice); + if (physicalDeviceInfoIt == mPhysdevInfo.end()) return VK_ERROR_INITIALIZATION_FAILED; + auto& physicalDeviceInfo = physicalDeviceInfoIt->second; + + auto instanceInfoIt = mInstanceInfo.find(physicalDeviceInfo.instance); + if (instanceInfoIt == mInstanceInfo.end()) return VK_ERROR_INITIALIZATION_FAILED; + auto& instanceInfo = instanceInfoIt->second; + // Fill out information about the logical device here. auto& deviceInfo = mDeviceInfo[*pDevice]; deviceInfo.physicalDevice = physicalDevice; @@ -1474,8 +1484,11 @@ class VkDecoderGlobalState::Impl { AstcCpuDecompressor::get().available(); deviceInfo.decompPipelines = std::make_unique<GpuDecompressionPipelineManager>(m_vk, *pDevice); - INFO("Created new VkDevice. ASTC emulation? %d. CPU decoding? %d", - deviceInfo.emulateTextureAstc, deviceInfo.useAstcCpuDecompression); + + INFO("Created VkDevice:%p for application:%s engine:%s ASTC emulation:%s CPU decoding:%s.", + *pDevice, instanceInfo.applicationName.c_str(), instanceInfo.engineName.c_str(), + deviceInfo.emulateTextureAstc ? "on" : "off", + deviceInfo.useAstcCpuDecompression ? "on" : "off"); for (uint32_t i = 0; i < createInfoFiltered.enabledExtensionCount; ++i) { deviceInfo.enabledExtensionNames.push_back( diff --git a/host/vulkan/VkDecoderInternalStructs.h b/host/vulkan/VkDecoderInternalStructs.h index 78a0de89..5c5e86b1 100644 --- a/host/vulkan/VkDecoderInternalStructs.h +++ b/host/vulkan/VkDecoderInternalStructs.h @@ -174,9 +174,12 @@ struct InstanceInfo { uint32_t apiVersion = VK_MAKE_VERSION(1, 0, 0); VkInstance boxed = nullptr; bool isAngle = false; + std::string applicationName; + std::string engineName; }; struct PhysicalDeviceInfo { + VkInstance instance = VK_NULL_HANDLE; VkPhysicalDeviceProperties props; std::unique_ptr<EmulatedPhysicalDeviceMemoryProperties> memoryPropertiesHelper; std::vector<VkQueueFamilyProperties> queueFamilyProperties; diff --git a/host/vulkan/meson.build b/host/vulkan/meson.build index 5ecfaed0..4ffd3308 100644 --- a/host/vulkan/meson.build +++ b/host/vulkan/meson.build @@ -22,6 +22,7 @@ files_lib_vulkan_server = files( 'VkAndroidNativeBuffer.cpp', 'VkCommonOperations.cpp', 'VkDecoder.cpp', + 'VkEmulatedPhysicalDeviceMemory.cpp', 'VkDecoderGlobalState.cpp', 'VkDecoderSnapshot.cpp', 'VkDecoderSnapshotUtils.cpp', |