From cb9ce7dc1688465c34047c2f8510797b41efc103 Mon Sep 17 00:00:00 2001 From: Atneya Nair Date: Thu, 21 Nov 2024 10:39:36 -0800 Subject: [audio] Add new mute type to AudioManager For consistency between Java/native. Test: compiles Flag: EXEMPT, safe Bug: 376481063 Change-Id: I3368bdfd38623218f574ab60109df9b64700fa63 --- include/audiomanager/AudioManager.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/audiomanager/AudioManager.h b/include/audiomanager/AudioManager.h index 917d9a74db..203623dea7 100644 --- a/include/audiomanager/AudioManager.h +++ b/include/audiomanager/AudioManager.h @@ -22,6 +22,7 @@ namespace android { // must be kept in sync with definitions in AudioPlaybackConfiguration.java #define PLAYER_PIID_INVALID -1 +// TODO (b/309532236) remove manual IAudioManager impl in favor of AIDL. typedef enum { PLAYER_TYPE_SLES_AUDIOPLAYER_BUFFERQUEUE = 11, PLAYER_TYPE_SLES_AUDIOPLAYER_URI_FD = 12, @@ -60,6 +61,7 @@ enum { PLAYER_MUTE_CLIENT_VOLUME = (1 << 4), PLAYER_MUTE_VOLUME_SHAPER = (1 << 5), PLAYER_MUTE_PORT_VOLUME = (1 << 6), + PLAYER_MUTE_OP_AUDIO_CONTROL = (1 << 7), }; struct mute_state_t { @@ -77,6 +79,8 @@ struct mute_state_t { bool muteFromVolumeShaper = false; /** Flag used when volume is muted by port volume. */ bool muteFromPortVolume = false; + /** Flag used when volume is muted by audio control op. */ + bool muteFromOpAudioControl = false; explicit operator int() const { @@ -87,6 +91,7 @@ struct mute_state_t { result |= muteFromClientVolume * PLAYER_MUTE_CLIENT_VOLUME; result |= muteFromVolumeShaper * PLAYER_MUTE_VOLUME_SHAPER; result |= muteFromPortVolume * PLAYER_MUTE_PORT_VOLUME; + result |= muteFromOpAudioControl * PLAYER_MUTE_OP_AUDIO_CONTROL; return result; } -- cgit v1.2.3-59-g8ed1b From b4eafd35890b1651514feb602aba025e4c869d8d Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Mon, 18 Nov 2024 16:46:33 +0000 Subject: Add Accessor::from_binder This allows other processes to host the Accessor object from libbinder. This can be useful when another process has the sepolicy permissions to create the connection. Test: atest rustBinderTest Bug: 358427181 Change-Id: Iedc51e2fa5b50e91438690d5d551156927a91807 --- libs/binder/rust/src/system_only.rs | 26 ++++++++++++++++++++++++++ libs/binder/rust/tests/integration.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/libs/binder/rust/src/system_only.rs b/libs/binder/rust/src/system_only.rs index 3da59ab811..1a58d6b44d 100644 --- a/libs/binder/rust/src/system_only.rs +++ b/libs/binder/rust/src/system_only.rs @@ -91,6 +91,32 @@ impl Accessor { Accessor { accessor } } + /// Creates a new Accessor instance based on an existing Accessor's binder. + /// This is useful when the Accessor instance is hosted in another process + /// that has the permissions to create the socket connection FD. + /// + /// The `instance` argument must match the instance that the original Accessor + /// is responsible for. + /// `instance` must not contain null bytes and is used to create a CString to + /// pass through FFI. + /// The `binder` argument must be a valid binder from an Accessor + pub fn from_binder(instance: &str, binder: SpIBinder) -> Option { + let inst = CString::new(instance).unwrap(); + + // Safety: All `SpIBinder` objects (the `binder` argument) hold a valid pointer + // to an `AIBinder` that is guaranteed to remain valid for the lifetime of the + // SpIBinder. `ABinderRpc_Accessor_fromBinder` creates a new pointer to that binder + // that it is responsible for. + // The `inst` argument is a new CString that will copied by + // `ABinderRpc_Accessor_fromBinder` and not modified. + let accessor = + unsafe { sys::ABinderRpc_Accessor_fromBinder(inst.as_ptr(), binder.as_raw()) }; + if accessor.is_null() { + return None; + } + Some(Accessor { accessor }) + } + /// Get the underlying binder for this Accessor for when it needs to be either /// registered with service manager or sent to another process. pub fn as_binder(&self) -> Option { diff --git a/libs/binder/rust/tests/integration.rs b/libs/binder/rust/tests/integration.rs index 0e793e5761..da4f128e67 100644 --- a/libs/binder/rust/tests/integration.rs +++ b/libs/binder/rust/tests/integration.rs @@ -1038,6 +1038,34 @@ mod tests { assert!(deleted.load(Ordering::Relaxed)); } + #[test] + fn test_accessor_from_accessor_binder() { + let get_connection_info = move |_instance: &str| None; + let accessor = Accessor::new("foo.service", get_connection_info); + let accessor2 = + Accessor::from_binder("foo.service", accessor.as_binder().unwrap()).unwrap(); + assert_eq!(accessor.as_binder(), accessor2.as_binder()); + } + + #[test] + fn test_accessor_from_non_accessor_binder() { + let service_name = "rust_test_ibinder"; + let _process = ScopedServiceProcess::new(service_name); + let binder = binder::get_service(service_name).unwrap(); + assert!(binder.is_binder_alive()); + + let accessor = Accessor::from_binder("rust_test_ibinder", binder); + assert!(accessor.is_none()); + } + + #[test] + fn test_accessor_from_wrong_accessor_binder() { + let get_connection_info = move |_instance: &str| None; + let accessor = Accessor::new("foo.service", get_connection_info); + let accessor2 = Accessor::from_binder("NOT.foo.service", accessor.as_binder().unwrap()); + assert!(accessor2.is_none()); + } + #[tokio::test] async fn reassociate_rust_binder_async() { let service_name = "testing_service"; -- cgit v1.2.3-59-g8ed1b From 4a8e5f7ed7d23356d00be5f7bce010cef51bed5b Mon Sep 17 00:00:00 2001 From: Carlos Martinez Romero Date: Fri, 22 Nov 2024 11:11:39 -0800 Subject: Add permission checks for sfdo functions. The sfdo functions should only be called from a system uid. If the permission check fails the call return an error. Bug: 379296794 Test: adb shell sfdo debug-flash Flag: EXEMPT minor bug fix - permission check Change-Id: Iafff85704c61779b3b0ae43946238a86a0841760 --- services/surfaceflinger/SurfaceFlinger.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index a66380b358..20e891493e 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -9082,26 +9082,46 @@ binder::Status SurfaceComposerAIDL::setGameDefaultFrameRateOverride(int32_t uid, } binder::Status SurfaceComposerAIDL::enableRefreshRateOverlay(bool active) { + status_t status = checkAccessPermission(); + if (status != OK) { + return binderStatusFromStatusT(status); + } mFlinger->sfdo_enableRefreshRateOverlay(active); return binder::Status::ok(); } binder::Status SurfaceComposerAIDL::setDebugFlash(int delay) { + status_t status = checkAccessPermission(); + if (status != OK) { + return binderStatusFromStatusT(status); + } mFlinger->sfdo_setDebugFlash(delay); return binder::Status::ok(); } binder::Status SurfaceComposerAIDL::scheduleComposite() { + status_t status = checkAccessPermission(); + if (status != OK) { + return binderStatusFromStatusT(status); + } mFlinger->sfdo_scheduleComposite(); return binder::Status::ok(); } binder::Status SurfaceComposerAIDL::scheduleCommit() { + status_t status = checkAccessPermission(); + if (status != OK) { + return binderStatusFromStatusT(status); + } mFlinger->sfdo_scheduleCommit(); return binder::Status::ok(); } binder::Status SurfaceComposerAIDL::forceClientComposition(bool enabled) { + status_t status = checkAccessPermission(); + if (status != OK) { + return binderStatusFromStatusT(status); + } mFlinger->sfdo_forceClientComposition(enabled); return binder::Status::ok(); } -- cgit v1.2.3-59-g8ed1b From a5296cdb1d79be0378ad389811857cc91033c5ec Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 1 Oct 2024 09:59:47 +1300 Subject: Regenerate vulkan-loader for 1.4 Manual changes to scripts/generator_common.py, then generated by running scripts/code_generator.py Bug: b/370568136 Flag: NONE infeasible Change-Id: I91937577496488b18e6972224a79de31a863c327 --- vulkan/libvulkan/api_gen.cpp | 228 +++++++++++++++++++++++++++++++++++++ vulkan/libvulkan/api_gen.h | 19 ++++ vulkan/libvulkan/driver_gen.h | 1 + vulkan/nulldrv/null_driver_gen.cpp | 19 ++++ vulkan/nulldrv/null_driver_gen.h | 19 ++++ vulkan/scripts/generator_common.py | 3 + 6 files changed, 289 insertions(+) diff --git a/vulkan/libvulkan/api_gen.cpp b/vulkan/libvulkan/api_gen.cpp index 9ff0b46c0f..131c97ca85 100644 --- a/vulkan/libvulkan/api_gen.cpp +++ b/vulkan/libvulkan/api_gen.cpp @@ -266,6 +266,7 @@ bool InitDispatchTable( INIT_PROC(true, dev, CreateRenderPass); INIT_PROC(true, dev, DestroyRenderPass); INIT_PROC(true, dev, GetRenderAreaGranularity); + INIT_PROC(false, dev, GetRenderingAreaGranularity); INIT_PROC(true, dev, CreateCommandPool); INIT_PROC(true, dev, DestroyCommandPool); INIT_PROC(true, dev, ResetCommandPool); @@ -323,6 +324,7 @@ bool InitDispatchTable( INIT_PROC_EXT(KHR_swapchain, true, dev, GetSwapchainImagesKHR); INIT_PROC_EXT(KHR_swapchain, true, dev, AcquireNextImageKHR); INIT_PROC_EXT(KHR_swapchain, true, dev, QueuePresentKHR); + INIT_PROC(false, dev, CmdPushDescriptorSet); INIT_PROC(false, dev, TrimCommandPool); INIT_PROC(false, dev, GetDeviceGroupPeerMemoryFeatures); INIT_PROC(false, dev, BindBufferMemory2); @@ -335,6 +337,7 @@ bool InitDispatchTable( INIT_PROC(false, dev, CreateDescriptorUpdateTemplate); INIT_PROC(false, dev, DestroyDescriptorUpdateTemplate); INIT_PROC(false, dev, UpdateDescriptorSetWithTemplate); + INIT_PROC(false, dev, CmdPushDescriptorSetWithTemplate); INIT_PROC(false, dev, GetBufferMemoryRequirements2); INIT_PROC(false, dev, GetImageMemoryRequirements2); INIT_PROC(false, dev, GetImageSparseMemoryRequirements2); @@ -359,11 +362,13 @@ bool InitDispatchTable( INIT_PROC(false, dev, GetBufferOpaqueCaptureAddress); INIT_PROC(false, dev, GetBufferDeviceAddress); INIT_PROC(false, dev, GetDeviceMemoryOpaqueCaptureAddress); + INIT_PROC(false, dev, CmdSetLineStipple); INIT_PROC(false, dev, CmdSetCullMode); INIT_PROC(false, dev, CmdSetFrontFace); INIT_PROC(false, dev, CmdSetPrimitiveTopology); INIT_PROC(false, dev, CmdSetViewportWithCount); INIT_PROC(false, dev, CmdSetScissorWithCount); + INIT_PROC(false, dev, CmdBindIndexBuffer2); INIT_PROC(false, dev, CmdBindVertexBuffers2); INIT_PROC(false, dev, CmdSetDepthTestEnable); INIT_PROC(false, dev, CmdSetDepthWriteEnable); @@ -390,8 +395,22 @@ bool InitDispatchTable( INIT_PROC(false, dev, CmdPipelineBarrier2); INIT_PROC(false, dev, QueueSubmit2); INIT_PROC(false, dev, CmdWriteTimestamp2); + INIT_PROC(false, dev, CopyMemoryToImage); + INIT_PROC(false, dev, CopyImageToMemory); + INIT_PROC(false, dev, CopyImageToImage); + INIT_PROC(false, dev, TransitionImageLayout); INIT_PROC(false, dev, CmdBeginRendering); INIT_PROC(false, dev, CmdEndRendering); + INIT_PROC(false, dev, GetImageSubresourceLayout2); + INIT_PROC(false, dev, GetDeviceImageSubresourceLayout); + INIT_PROC(false, dev, MapMemory2); + INIT_PROC(false, dev, UnmapMemory2); + INIT_PROC(false, dev, CmdBindDescriptorSets2); + INIT_PROC(false, dev, CmdPushConstants2); + INIT_PROC(false, dev, CmdPushDescriptorSet2); + INIT_PROC(false, dev, CmdPushDescriptorSetWithTemplate2); + INIT_PROC(false, dev, CmdSetRenderingAttachmentLocations); + INIT_PROC(false, dev, CmdSetRenderingInputAttachmentIndices); // clang-format on return success; @@ -480,6 +499,7 @@ VKAPI_ATTR void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, c VKAPI_ATTR VkResult CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); VKAPI_ATTR void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); +VKAPI_ATTR void GetRenderingAreaGranularity(VkDevice device, const VkRenderingAreaInfo* pRenderingAreaInfo, VkExtent2D* pGranularity); VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); VKAPI_ATTR void DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); VKAPI_ATTR VkResult ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); @@ -550,6 +570,7 @@ VKAPI_ATTR VkResult GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phy VKAPI_ATTR void GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties); VKAPI_ATTR void GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties); VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties); +VKAPI_ATTR void CmdPushDescriptorSet(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites); VKAPI_ATTR void TrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); VKAPI_ATTR void GetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties); VKAPI_ATTR void GetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties); @@ -567,6 +588,7 @@ VKAPI_ATTR VkResult GetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physi VKAPI_ATTR VkResult CreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate); VKAPI_ATTR void DestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); VKAPI_ATTR void UpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData); +VKAPI_ATTR void CmdPushDescriptorSetWithTemplate(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData); VKAPI_ATTR void GetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); VKAPI_ATTR void GetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); VKAPI_ATTR void GetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); @@ -591,12 +613,14 @@ VKAPI_ATTR void CmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuf VKAPI_ATTR uint64_t GetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); VKAPI_ATTR VkDeviceAddress GetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); VKAPI_ATTR uint64_t GetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo); +VKAPI_ATTR void CmdSetLineStipple(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern); VKAPI_ATTR VkResult GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties); VKAPI_ATTR void CmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); VKAPI_ATTR void CmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace); VKAPI_ATTR void CmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); VKAPI_ATTR void CmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports); VKAPI_ATTR void CmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors); +VKAPI_ATTR void CmdBindIndexBuffer2(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType); VKAPI_ATTR void CmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides); VKAPI_ATTR void CmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); VKAPI_ATTR void CmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); @@ -623,8 +647,22 @@ VKAPI_ATTR void CmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCoun VKAPI_ATTR void CmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo); VKAPI_ATTR VkResult QueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence); VKAPI_ATTR void CmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query); +VKAPI_ATTR VkResult CopyMemoryToImage(VkDevice device, const VkCopyMemoryToImageInfo* pCopyMemoryToImageInfo); +VKAPI_ATTR VkResult CopyImageToMemory(VkDevice device, const VkCopyImageToMemoryInfo* pCopyImageToMemoryInfo); +VKAPI_ATTR VkResult CopyImageToImage(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo); +VKAPI_ATTR VkResult TransitionImageLayout(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions); VKAPI_ATTR void CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo); VKAPI_ATTR void CmdEndRendering(VkCommandBuffer commandBuffer); +VKAPI_ATTR void GetImageSubresourceLayout2(VkDevice device, VkImage image, const VkImageSubresource2* pSubresource, VkSubresourceLayout2* pLayout); +VKAPI_ATTR void GetDeviceImageSubresourceLayout(VkDevice device, const VkDeviceImageSubresourceInfo* pInfo, VkSubresourceLayout2* pLayout); +VKAPI_ATTR VkResult MapMemory2(VkDevice device, const VkMemoryMapInfo* pMemoryMapInfo, void** ppData); +VKAPI_ATTR VkResult UnmapMemory2(VkDevice device, const VkMemoryUnmapInfo* pMemoryUnmapInfo); +VKAPI_ATTR void CmdBindDescriptorSets2(VkCommandBuffer commandBuffer, const VkBindDescriptorSetsInfo* pBindDescriptorSetsInfo); +VKAPI_ATTR void CmdPushConstants2(VkCommandBuffer commandBuffer, const VkPushConstantsInfo* pPushConstantsInfo); +VKAPI_ATTR void CmdPushDescriptorSet2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo); +VKAPI_ATTR void CmdPushDescriptorSetWithTemplate2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetWithTemplateInfo* pPushDescriptorSetWithTemplateInfo); +VKAPI_ATTR void CmdSetRenderingAttachmentLocations(VkCommandBuffer commandBuffer, const VkRenderingAttachmentLocationInfo* pLocationInfo); +VKAPI_ATTR void CmdSetRenderingInputAttachmentIndices(VkCommandBuffer commandBuffer, const VkRenderingInputAttachmentIndexInfo* pInputAttachmentIndexInfo); VKAPI_ATTR VkResult EnumeratePhysicalDevices(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices) { return GetData(instance).dispatch.EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); @@ -764,7 +802,9 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkCmdBeginRenderPass2", reinterpret_cast(CmdBeginRenderPass2) }, { "vkCmdBeginRendering", reinterpret_cast(CmdBeginRendering) }, { "vkCmdBindDescriptorSets", reinterpret_cast(CmdBindDescriptorSets) }, + { "vkCmdBindDescriptorSets2", reinterpret_cast(CmdBindDescriptorSets2) }, { "vkCmdBindIndexBuffer", reinterpret_cast(CmdBindIndexBuffer) }, + { "vkCmdBindIndexBuffer2", reinterpret_cast(CmdBindIndexBuffer2) }, { "vkCmdBindPipeline", reinterpret_cast(CmdBindPipeline) }, { "vkCmdBindVertexBuffers", reinterpret_cast(CmdBindVertexBuffers) }, { "vkCmdBindVertexBuffers2", reinterpret_cast(CmdBindVertexBuffers2) }, @@ -802,6 +842,11 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkCmdPipelineBarrier", reinterpret_cast(CmdPipelineBarrier) }, { "vkCmdPipelineBarrier2", reinterpret_cast(CmdPipelineBarrier2) }, { "vkCmdPushConstants", reinterpret_cast(CmdPushConstants) }, + { "vkCmdPushConstants2", reinterpret_cast(CmdPushConstants2) }, + { "vkCmdPushDescriptorSet", reinterpret_cast(CmdPushDescriptorSet) }, + { "vkCmdPushDescriptorSet2", reinterpret_cast(CmdPushDescriptorSet2) }, + { "vkCmdPushDescriptorSetWithTemplate", reinterpret_cast(CmdPushDescriptorSetWithTemplate) }, + { "vkCmdPushDescriptorSetWithTemplate2", reinterpret_cast(CmdPushDescriptorSetWithTemplate2) }, { "vkCmdResetEvent", reinterpret_cast(CmdResetEvent) }, { "vkCmdResetEvent2", reinterpret_cast(CmdResetEvent2) }, { "vkCmdResetQueryPool", reinterpret_cast(CmdResetQueryPool) }, @@ -820,10 +865,13 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkCmdSetEvent", reinterpret_cast(CmdSetEvent) }, { "vkCmdSetEvent2", reinterpret_cast(CmdSetEvent2) }, { "vkCmdSetFrontFace", reinterpret_cast(CmdSetFrontFace) }, + { "vkCmdSetLineStipple", reinterpret_cast(CmdSetLineStipple) }, { "vkCmdSetLineWidth", reinterpret_cast(CmdSetLineWidth) }, { "vkCmdSetPrimitiveRestartEnable", reinterpret_cast(CmdSetPrimitiveRestartEnable) }, { "vkCmdSetPrimitiveTopology", reinterpret_cast(CmdSetPrimitiveTopology) }, { "vkCmdSetRasterizerDiscardEnable", reinterpret_cast(CmdSetRasterizerDiscardEnable) }, + { "vkCmdSetRenderingAttachmentLocations", reinterpret_cast(CmdSetRenderingAttachmentLocations) }, + { "vkCmdSetRenderingInputAttachmentIndices", reinterpret_cast(CmdSetRenderingInputAttachmentIndices) }, { "vkCmdSetScissor", reinterpret_cast(CmdSetScissor) }, { "vkCmdSetScissorWithCount", reinterpret_cast(CmdSetScissorWithCount) }, { "vkCmdSetStencilCompareMask", reinterpret_cast(CmdSetStencilCompareMask) }, @@ -838,6 +886,9 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkCmdWaitEvents2", reinterpret_cast(CmdWaitEvents2) }, { "vkCmdWriteTimestamp", reinterpret_cast(CmdWriteTimestamp) }, { "vkCmdWriteTimestamp2", reinterpret_cast(CmdWriteTimestamp2) }, + { "vkCopyImageToImage", reinterpret_cast(CopyImageToImage) }, + { "vkCopyImageToMemory", reinterpret_cast(CopyImageToMemory) }, + { "vkCopyMemoryToImage", reinterpret_cast(CopyMemoryToImage) }, { "vkCreateBuffer", reinterpret_cast(CreateBuffer) }, { "vkCreateBufferView", reinterpret_cast(CreateBufferView) }, { "vkCreateCommandPool", reinterpret_cast(CreateCommandPool) }, @@ -911,6 +962,7 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkGetDeviceGroupSurfacePresentModesKHR", reinterpret_cast(GetDeviceGroupSurfacePresentModesKHR) }, { "vkGetDeviceImageMemoryRequirements", reinterpret_cast(GetDeviceImageMemoryRequirements) }, { "vkGetDeviceImageSparseMemoryRequirements", reinterpret_cast(GetDeviceImageSparseMemoryRequirements) }, + { "vkGetDeviceImageSubresourceLayout", reinterpret_cast(GetDeviceImageSubresourceLayout) }, { "vkGetDeviceMemoryCommitment", reinterpret_cast(GetDeviceMemoryCommitment) }, { "vkGetDeviceMemoryOpaqueCaptureAddress", reinterpret_cast(GetDeviceMemoryOpaqueCaptureAddress) }, { "vkGetDeviceProcAddr", reinterpret_cast(GetDeviceProcAddr) }, @@ -923,16 +975,19 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkGetImageSparseMemoryRequirements", reinterpret_cast(GetImageSparseMemoryRequirements) }, { "vkGetImageSparseMemoryRequirements2", reinterpret_cast(GetImageSparseMemoryRequirements2) }, { "vkGetImageSubresourceLayout", reinterpret_cast(GetImageSubresourceLayout) }, + { "vkGetImageSubresourceLayout2", reinterpret_cast(GetImageSubresourceLayout2) }, { "vkGetInstanceProcAddr", reinterpret_cast(GetInstanceProcAddr) }, { "vkGetMemoryAndroidHardwareBufferANDROID", reinterpret_cast(GetMemoryAndroidHardwareBufferANDROID) }, { "vkGetPipelineCacheData", reinterpret_cast(GetPipelineCacheData) }, { "vkGetPrivateData", reinterpret_cast(GetPrivateData) }, { "vkGetQueryPoolResults", reinterpret_cast(GetQueryPoolResults) }, { "vkGetRenderAreaGranularity", reinterpret_cast(GetRenderAreaGranularity) }, + { "vkGetRenderingAreaGranularity", reinterpret_cast(GetRenderingAreaGranularity) }, { "vkGetSemaphoreCounterValue", reinterpret_cast(GetSemaphoreCounterValue) }, { "vkGetSwapchainImagesKHR", reinterpret_cast(GetSwapchainImagesKHR) }, { "vkInvalidateMappedMemoryRanges", reinterpret_cast(InvalidateMappedMemoryRanges) }, { "vkMapMemory", reinterpret_cast(MapMemory) }, + { "vkMapMemory2", reinterpret_cast(MapMemory2) }, { "vkMergePipelineCaches", reinterpret_cast(MergePipelineCaches) }, { "vkQueueBindSparse", reinterpret_cast(QueueBindSparse) }, { "vkQueuePresentKHR", reinterpret_cast(QueuePresentKHR) }, @@ -948,8 +1003,10 @@ VKAPI_ATTR PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const cha { "vkSetEvent", reinterpret_cast(SetEvent) }, { "vkSetPrivateData", reinterpret_cast(SetPrivateData) }, { "vkSignalSemaphore", reinterpret_cast(SignalSemaphore) }, + { "vkTransitionImageLayout", reinterpret_cast(TransitionImageLayout) }, { "vkTrimCommandPool", reinterpret_cast(TrimCommandPool) }, { "vkUnmapMemory", reinterpret_cast(UnmapMemory) }, + { "vkUnmapMemory2", reinterpret_cast(UnmapMemory2) }, { "vkUpdateDescriptorSetWithTemplate", reinterpret_cast(UpdateDescriptorSetWithTemplate) }, { "vkUpdateDescriptorSets", reinterpret_cast(UpdateDescriptorSets) }, { "vkWaitForFences", reinterpret_cast(WaitForFences) }, @@ -1273,6 +1330,10 @@ VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPas GetData(device).dispatch.GetRenderAreaGranularity(device, renderPass, pGranularity); } +VKAPI_ATTR void GetRenderingAreaGranularity(VkDevice device, const VkRenderingAreaInfo* pRenderingAreaInfo, VkExtent2D* pGranularity) { + GetData(device).dispatch.GetRenderingAreaGranularity(device, pRenderingAreaInfo, pGranularity); +} + VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) { return GetData(device).dispatch.CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); } @@ -1553,6 +1614,10 @@ VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice p GetData(physicalDevice).dispatch.GetPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pFormatInfo, pPropertyCount, pProperties); } +VKAPI_ATTR void CmdPushDescriptorSet(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites) { + GetData(commandBuffer).dispatch.CmdPushDescriptorSet(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); +} + VKAPI_ATTR void TrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) { GetData(device).dispatch.TrimCommandPool(device, commandPool, flags); } @@ -1621,6 +1686,10 @@ VKAPI_ATTR void UpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet GetData(device).dispatch.UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, pData); } +VKAPI_ATTR void CmdPushDescriptorSetWithTemplate(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData) { + GetData(commandBuffer).dispatch.CmdPushDescriptorSetWithTemplate(commandBuffer, descriptorUpdateTemplate, layout, set, pData); +} + VKAPI_ATTR void GetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) { GetData(device).dispatch.GetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements); } @@ -1717,6 +1786,10 @@ VKAPI_ATTR uint64_t GetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const V return GetData(device).dispatch.GetDeviceMemoryOpaqueCaptureAddress(device, pInfo); } +VKAPI_ATTR void CmdSetLineStipple(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) { + GetData(commandBuffer).dispatch.CmdSetLineStipple(commandBuffer, lineStippleFactor, lineStipplePattern); +} + VKAPI_ATTR VkResult GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties) { return GetData(physicalDevice).dispatch.GetPhysicalDeviceToolProperties(physicalDevice, pToolCount, pToolProperties); } @@ -1741,6 +1814,10 @@ VKAPI_ATTR void CmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t s GetData(commandBuffer).dispatch.CmdSetScissorWithCount(commandBuffer, scissorCount, pScissors); } +VKAPI_ATTR void CmdBindIndexBuffer2(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType) { + GetData(commandBuffer).dispatch.CmdBindIndexBuffer2(commandBuffer, buffer, offset, size, indexType); +} + VKAPI_ATTR void CmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides) { GetData(commandBuffer).dispatch.CmdBindVertexBuffers2(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides); } @@ -1845,6 +1922,22 @@ VKAPI_ATTR void CmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStag GetData(commandBuffer).dispatch.CmdWriteTimestamp2(commandBuffer, stage, queryPool, query); } +VKAPI_ATTR VkResult CopyMemoryToImage(VkDevice device, const VkCopyMemoryToImageInfo* pCopyMemoryToImageInfo) { + return GetData(device).dispatch.CopyMemoryToImage(device, pCopyMemoryToImageInfo); +} + +VKAPI_ATTR VkResult CopyImageToMemory(VkDevice device, const VkCopyImageToMemoryInfo* pCopyImageToMemoryInfo) { + return GetData(device).dispatch.CopyImageToMemory(device, pCopyImageToMemoryInfo); +} + +VKAPI_ATTR VkResult CopyImageToImage(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo) { + return GetData(device).dispatch.CopyImageToImage(device, pCopyImageToImageInfo); +} + +VKAPI_ATTR VkResult TransitionImageLayout(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions) { + return GetData(device).dispatch.TransitionImageLayout(device, transitionCount, pTransitions); +} + VKAPI_ATTR void CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) { GetData(commandBuffer).dispatch.CmdBeginRendering(commandBuffer, pRenderingInfo); } @@ -1853,6 +1946,46 @@ VKAPI_ATTR void CmdEndRendering(VkCommandBuffer commandBuffer) { GetData(commandBuffer).dispatch.CmdEndRendering(commandBuffer); } +VKAPI_ATTR void GetImageSubresourceLayout2(VkDevice device, VkImage image, const VkImageSubresource2* pSubresource, VkSubresourceLayout2* pLayout) { + GetData(device).dispatch.GetImageSubresourceLayout2(device, image, pSubresource, pLayout); +} + +VKAPI_ATTR void GetDeviceImageSubresourceLayout(VkDevice device, const VkDeviceImageSubresourceInfo* pInfo, VkSubresourceLayout2* pLayout) { + GetData(device).dispatch.GetDeviceImageSubresourceLayout(device, pInfo, pLayout); +} + +VKAPI_ATTR VkResult MapMemory2(VkDevice device, const VkMemoryMapInfo* pMemoryMapInfo, void** ppData) { + return GetData(device).dispatch.MapMemory2(device, pMemoryMapInfo, ppData); +} + +VKAPI_ATTR VkResult UnmapMemory2(VkDevice device, const VkMemoryUnmapInfo* pMemoryUnmapInfo) { + return GetData(device).dispatch.UnmapMemory2(device, pMemoryUnmapInfo); +} + +VKAPI_ATTR void CmdBindDescriptorSets2(VkCommandBuffer commandBuffer, const VkBindDescriptorSetsInfo* pBindDescriptorSetsInfo) { + GetData(commandBuffer).dispatch.CmdBindDescriptorSets2(commandBuffer, pBindDescriptorSetsInfo); +} + +VKAPI_ATTR void CmdPushConstants2(VkCommandBuffer commandBuffer, const VkPushConstantsInfo* pPushConstantsInfo) { + GetData(commandBuffer).dispatch.CmdPushConstants2(commandBuffer, pPushConstantsInfo); +} + +VKAPI_ATTR void CmdPushDescriptorSet2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo) { + GetData(commandBuffer).dispatch.CmdPushDescriptorSet2(commandBuffer, pPushDescriptorSetInfo); +} + +VKAPI_ATTR void CmdPushDescriptorSetWithTemplate2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetWithTemplateInfo* pPushDescriptorSetWithTemplateInfo) { + GetData(commandBuffer).dispatch.CmdPushDescriptorSetWithTemplate2(commandBuffer, pPushDescriptorSetWithTemplateInfo); +} + +VKAPI_ATTR void CmdSetRenderingAttachmentLocations(VkCommandBuffer commandBuffer, const VkRenderingAttachmentLocationInfo* pLocationInfo) { + GetData(commandBuffer).dispatch.CmdSetRenderingAttachmentLocations(commandBuffer, pLocationInfo); +} + +VKAPI_ATTR void CmdSetRenderingInputAttachmentIndices(VkCommandBuffer commandBuffer, const VkRenderingInputAttachmentIndexInfo* pInputAttachmentIndexInfo) { + GetData(commandBuffer).dispatch.CmdSetRenderingInputAttachmentIndices(commandBuffer, pInputAttachmentIndexInfo); +} + } // anonymous namespace @@ -2298,6 +2431,11 @@ VKAPI_ATTR void vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderP vulkan::api::GetRenderAreaGranularity(device, renderPass, pGranularity); } +__attribute__((visibility("default"))) +VKAPI_ATTR void vkGetRenderingAreaGranularity(VkDevice device, const VkRenderingAreaInfo* pRenderingAreaInfo, VkExtent2D* pGranularity) { + vulkan::api::GetRenderingAreaGranularity(device, pRenderingAreaInfo, pGranularity); +} + __attribute__((visibility("default"))) VKAPI_ATTR VkResult vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) { return vulkan::api::CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); @@ -2648,6 +2786,11 @@ VKAPI_ATTR void vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice vulkan::api::GetPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pFormatInfo, pPropertyCount, pProperties); } +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdPushDescriptorSet(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites) { + vulkan::api::CmdPushDescriptorSet(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); +} + __attribute__((visibility("default"))) VKAPI_ATTR void vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) { vulkan::api::TrimCommandPool(device, commandPool, flags); @@ -2733,6 +2876,11 @@ VKAPI_ATTR void vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorS vulkan::api::UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, pData); } +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdPushDescriptorSetWithTemplate(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData) { + vulkan::api::CmdPushDescriptorSetWithTemplate(commandBuffer, descriptorUpdateTemplate, layout, set, pData); +} + __attribute__((visibility("default"))) VKAPI_ATTR void vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements) { vulkan::api::GetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements); @@ -2853,6 +3001,11 @@ VKAPI_ATTR uint64_t vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const return vulkan::api::GetDeviceMemoryOpaqueCaptureAddress(device, pInfo); } +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdSetLineStipple(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) { + vulkan::api::CmdSetLineStipple(commandBuffer, lineStippleFactor, lineStipplePattern); +} + __attribute__((visibility("default"))) VKAPI_ATTR VkResult vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties) { return vulkan::api::GetPhysicalDeviceToolProperties(physicalDevice, pToolCount, pToolProperties); @@ -2883,6 +3036,11 @@ VKAPI_ATTR void vkCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t vulkan::api::CmdSetScissorWithCount(commandBuffer, scissorCount, pScissors); } +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdBindIndexBuffer2(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType) { + vulkan::api::CmdBindIndexBuffer2(commandBuffer, buffer, offset, size, indexType); +} + __attribute__((visibility("default"))) VKAPI_ATTR void vkCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides) { vulkan::api::CmdBindVertexBuffers2(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides); @@ -3013,6 +3171,26 @@ VKAPI_ATTR void vkCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineSt vulkan::api::CmdWriteTimestamp2(commandBuffer, stage, queryPool, query); } +__attribute__((visibility("default"))) +VKAPI_ATTR VkResult vkCopyMemoryToImage(VkDevice device, const VkCopyMemoryToImageInfo* pCopyMemoryToImageInfo) { + return vulkan::api::CopyMemoryToImage(device, pCopyMemoryToImageInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR VkResult vkCopyImageToMemory(VkDevice device, const VkCopyImageToMemoryInfo* pCopyImageToMemoryInfo) { + return vulkan::api::CopyImageToMemory(device, pCopyImageToMemoryInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR VkResult vkCopyImageToImage(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo) { + return vulkan::api::CopyImageToImage(device, pCopyImageToImageInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR VkResult vkTransitionImageLayout(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions) { + return vulkan::api::TransitionImageLayout(device, transitionCount, pTransitions); +} + __attribute__((visibility("default"))) VKAPI_ATTR void vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) { vulkan::api::CmdBeginRendering(commandBuffer, pRenderingInfo); @@ -3023,4 +3201,54 @@ VKAPI_ATTR void vkCmdEndRendering(VkCommandBuffer commandBuffer) { vulkan::api::CmdEndRendering(commandBuffer); } +__attribute__((visibility("default"))) +VKAPI_ATTR void vkGetImageSubresourceLayout2(VkDevice device, VkImage image, const VkImageSubresource2* pSubresource, VkSubresourceLayout2* pLayout) { + vulkan::api::GetImageSubresourceLayout2(device, image, pSubresource, pLayout); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkGetDeviceImageSubresourceLayout(VkDevice device, const VkDeviceImageSubresourceInfo* pInfo, VkSubresourceLayout2* pLayout) { + vulkan::api::GetDeviceImageSubresourceLayout(device, pInfo, pLayout); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR VkResult vkMapMemory2(VkDevice device, const VkMemoryMapInfo* pMemoryMapInfo, void** ppData) { + return vulkan::api::MapMemory2(device, pMemoryMapInfo, ppData); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR VkResult vkUnmapMemory2(VkDevice device, const VkMemoryUnmapInfo* pMemoryUnmapInfo) { + return vulkan::api::UnmapMemory2(device, pMemoryUnmapInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdBindDescriptorSets2(VkCommandBuffer commandBuffer, const VkBindDescriptorSetsInfo* pBindDescriptorSetsInfo) { + vulkan::api::CmdBindDescriptorSets2(commandBuffer, pBindDescriptorSetsInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdPushConstants2(VkCommandBuffer commandBuffer, const VkPushConstantsInfo* pPushConstantsInfo) { + vulkan::api::CmdPushConstants2(commandBuffer, pPushConstantsInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdPushDescriptorSet2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo) { + vulkan::api::CmdPushDescriptorSet2(commandBuffer, pPushDescriptorSetInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdPushDescriptorSetWithTemplate2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetWithTemplateInfo* pPushDescriptorSetWithTemplateInfo) { + vulkan::api::CmdPushDescriptorSetWithTemplate2(commandBuffer, pPushDescriptorSetWithTemplateInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdSetRenderingAttachmentLocations(VkCommandBuffer commandBuffer, const VkRenderingAttachmentLocationInfo* pLocationInfo) { + vulkan::api::CmdSetRenderingAttachmentLocations(commandBuffer, pLocationInfo); +} + +__attribute__((visibility("default"))) +VKAPI_ATTR void vkCmdSetRenderingInputAttachmentIndices(VkCommandBuffer commandBuffer, const VkRenderingInputAttachmentIndexInfo* pInputAttachmentIndexInfo) { + vulkan::api::CmdSetRenderingInputAttachmentIndices(commandBuffer, pInputAttachmentIndexInfo); +} + // clang-format on diff --git a/vulkan/libvulkan/api_gen.h b/vulkan/libvulkan/api_gen.h index b468a8911b..17dc62fa6b 100644 --- a/vulkan/libvulkan/api_gen.h +++ b/vulkan/libvulkan/api_gen.h @@ -139,6 +139,7 @@ struct DeviceDispatchTable { PFN_vkCreateRenderPass CreateRenderPass; PFN_vkDestroyRenderPass DestroyRenderPass; PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity; + PFN_vkGetRenderingAreaGranularity GetRenderingAreaGranularity; PFN_vkCreateCommandPool CreateCommandPool; PFN_vkDestroyCommandPool DestroyCommandPool; PFN_vkResetCommandPool ResetCommandPool; @@ -196,6 +197,7 @@ struct DeviceDispatchTable { PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR; PFN_vkAcquireNextImageKHR AcquireNextImageKHR; PFN_vkQueuePresentKHR QueuePresentKHR; + PFN_vkCmdPushDescriptorSet CmdPushDescriptorSet; PFN_vkTrimCommandPool TrimCommandPool; PFN_vkGetDeviceGroupPeerMemoryFeatures GetDeviceGroupPeerMemoryFeatures; PFN_vkBindBufferMemory2 BindBufferMemory2; @@ -208,6 +210,7 @@ struct DeviceDispatchTable { PFN_vkCreateDescriptorUpdateTemplate CreateDescriptorUpdateTemplate; PFN_vkDestroyDescriptorUpdateTemplate DestroyDescriptorUpdateTemplate; PFN_vkUpdateDescriptorSetWithTemplate UpdateDescriptorSetWithTemplate; + PFN_vkCmdPushDescriptorSetWithTemplate CmdPushDescriptorSetWithTemplate; PFN_vkGetBufferMemoryRequirements2 GetBufferMemoryRequirements2; PFN_vkGetImageMemoryRequirements2 GetImageMemoryRequirements2; PFN_vkGetImageSparseMemoryRequirements2 GetImageSparseMemoryRequirements2; @@ -232,11 +235,13 @@ struct DeviceDispatchTable { PFN_vkGetBufferOpaqueCaptureAddress GetBufferOpaqueCaptureAddress; PFN_vkGetBufferDeviceAddress GetBufferDeviceAddress; PFN_vkGetDeviceMemoryOpaqueCaptureAddress GetDeviceMemoryOpaqueCaptureAddress; + PFN_vkCmdSetLineStipple CmdSetLineStipple; PFN_vkCmdSetCullMode CmdSetCullMode; PFN_vkCmdSetFrontFace CmdSetFrontFace; PFN_vkCmdSetPrimitiveTopology CmdSetPrimitiveTopology; PFN_vkCmdSetViewportWithCount CmdSetViewportWithCount; PFN_vkCmdSetScissorWithCount CmdSetScissorWithCount; + PFN_vkCmdBindIndexBuffer2 CmdBindIndexBuffer2; PFN_vkCmdBindVertexBuffers2 CmdBindVertexBuffers2; PFN_vkCmdSetDepthTestEnable CmdSetDepthTestEnable; PFN_vkCmdSetDepthWriteEnable CmdSetDepthWriteEnable; @@ -263,8 +268,22 @@ struct DeviceDispatchTable { PFN_vkCmdPipelineBarrier2 CmdPipelineBarrier2; PFN_vkQueueSubmit2 QueueSubmit2; PFN_vkCmdWriteTimestamp2 CmdWriteTimestamp2; + PFN_vkCopyMemoryToImage CopyMemoryToImage; + PFN_vkCopyImageToMemory CopyImageToMemory; + PFN_vkCopyImageToImage CopyImageToImage; + PFN_vkTransitionImageLayout TransitionImageLayout; PFN_vkCmdBeginRendering CmdBeginRendering; PFN_vkCmdEndRendering CmdEndRendering; + PFN_vkGetImageSubresourceLayout2 GetImageSubresourceLayout2; + PFN_vkGetDeviceImageSubresourceLayout GetDeviceImageSubresourceLayout; + PFN_vkMapMemory2 MapMemory2; + PFN_vkUnmapMemory2 UnmapMemory2; + PFN_vkCmdBindDescriptorSets2 CmdBindDescriptorSets2; + PFN_vkCmdPushConstants2 CmdPushConstants2; + PFN_vkCmdPushDescriptorSet2 CmdPushDescriptorSet2; + PFN_vkCmdPushDescriptorSetWithTemplate2 CmdPushDescriptorSetWithTemplate2; + PFN_vkCmdSetRenderingAttachmentLocations CmdSetRenderingAttachmentLocations; + PFN_vkCmdSetRenderingInputAttachmentIndices CmdSetRenderingInputAttachmentIndices; // clang-format on }; diff --git a/vulkan/libvulkan/driver_gen.h b/vulkan/libvulkan/driver_gen.h index 649c0f1a17..204b16f65a 100644 --- a/vulkan/libvulkan/driver_gen.h +++ b/vulkan/libvulkan/driver_gen.h @@ -68,6 +68,7 @@ struct ProcHook { EXTENSION_CORE_1_1, EXTENSION_CORE_1_2, EXTENSION_CORE_1_3, + EXTENSION_CORE_1_4, EXTENSION_COUNT, EXTENSION_UNKNOWN, }; diff --git a/vulkan/nulldrv/null_driver_gen.cpp b/vulkan/nulldrv/null_driver_gen.cpp index 40a45af94e..30967c2add 100644 --- a/vulkan/nulldrv/null_driver_gen.cpp +++ b/vulkan/nulldrv/null_driver_gen.cpp @@ -75,7 +75,9 @@ const NameProc kInstanceProcs[] = { {"vkCmdBeginRenderPass2", reinterpret_cast(static_cast(CmdBeginRenderPass2))}, {"vkCmdBeginRendering", reinterpret_cast(static_cast(CmdBeginRendering))}, {"vkCmdBindDescriptorSets", reinterpret_cast(static_cast(CmdBindDescriptorSets))}, + {"vkCmdBindDescriptorSets2", reinterpret_cast(static_cast(CmdBindDescriptorSets2))}, {"vkCmdBindIndexBuffer", reinterpret_cast(static_cast(CmdBindIndexBuffer))}, + {"vkCmdBindIndexBuffer2", reinterpret_cast(static_cast(CmdBindIndexBuffer2))}, {"vkCmdBindPipeline", reinterpret_cast(static_cast(CmdBindPipeline))}, {"vkCmdBindVertexBuffers", reinterpret_cast(static_cast(CmdBindVertexBuffers))}, {"vkCmdBindVertexBuffers2", reinterpret_cast(static_cast(CmdBindVertexBuffers2))}, @@ -113,6 +115,11 @@ const NameProc kInstanceProcs[] = { {"vkCmdPipelineBarrier", reinterpret_cast(static_cast(CmdPipelineBarrier))}, {"vkCmdPipelineBarrier2", reinterpret_cast(static_cast(CmdPipelineBarrier2))}, {"vkCmdPushConstants", reinterpret_cast(static_cast(CmdPushConstants))}, + {"vkCmdPushConstants2", reinterpret_cast(static_cast(CmdPushConstants2))}, + {"vkCmdPushDescriptorSet", reinterpret_cast(static_cast(CmdPushDescriptorSet))}, + {"vkCmdPushDescriptorSet2", reinterpret_cast(static_cast(CmdPushDescriptorSet2))}, + {"vkCmdPushDescriptorSetWithTemplate", reinterpret_cast(static_cast(CmdPushDescriptorSetWithTemplate))}, + {"vkCmdPushDescriptorSetWithTemplate2", reinterpret_cast(static_cast(CmdPushDescriptorSetWithTemplate2))}, {"vkCmdResetEvent", reinterpret_cast(static_cast(CmdResetEvent))}, {"vkCmdResetEvent2", reinterpret_cast(static_cast(CmdResetEvent2))}, {"vkCmdResetQueryPool", reinterpret_cast(static_cast(CmdResetQueryPool))}, @@ -131,10 +138,13 @@ const NameProc kInstanceProcs[] = { {"vkCmdSetEvent", reinterpret_cast(static_cast(CmdSetEvent))}, {"vkCmdSetEvent2", reinterpret_cast(static_cast(CmdSetEvent2))}, {"vkCmdSetFrontFace", reinterpret_cast(static_cast(CmdSetFrontFace))}, + {"vkCmdSetLineStipple", reinterpret_cast(static_cast(CmdSetLineStipple))}, {"vkCmdSetLineWidth", reinterpret_cast(static_cast(CmdSetLineWidth))}, {"vkCmdSetPrimitiveRestartEnable", reinterpret_cast(static_cast(CmdSetPrimitiveRestartEnable))}, {"vkCmdSetPrimitiveTopology", reinterpret_cast(static_cast(CmdSetPrimitiveTopology))}, {"vkCmdSetRasterizerDiscardEnable", reinterpret_cast(static_cast(CmdSetRasterizerDiscardEnable))}, + {"vkCmdSetRenderingAttachmentLocations", reinterpret_cast(static_cast(CmdSetRenderingAttachmentLocations))}, + {"vkCmdSetRenderingInputAttachmentIndices", reinterpret_cast(static_cast(CmdSetRenderingInputAttachmentIndices))}, {"vkCmdSetScissor", reinterpret_cast(static_cast(CmdSetScissor))}, {"vkCmdSetScissorWithCount", reinterpret_cast(static_cast(CmdSetScissorWithCount))}, {"vkCmdSetStencilCompareMask", reinterpret_cast(static_cast(CmdSetStencilCompareMask))}, @@ -149,6 +159,9 @@ const NameProc kInstanceProcs[] = { {"vkCmdWaitEvents2", reinterpret_cast(static_cast(CmdWaitEvents2))}, {"vkCmdWriteTimestamp", reinterpret_cast(static_cast(CmdWriteTimestamp))}, {"vkCmdWriteTimestamp2", reinterpret_cast(static_cast(CmdWriteTimestamp2))}, + {"vkCopyImageToImage", reinterpret_cast(static_cast(CopyImageToImage))}, + {"vkCopyImageToMemory", reinterpret_cast(static_cast(CopyImageToMemory))}, + {"vkCopyMemoryToImage", reinterpret_cast(static_cast(CopyMemoryToImage))}, {"vkCreateBuffer", reinterpret_cast(static_cast(CreateBuffer))}, {"vkCreateBufferView", reinterpret_cast(static_cast(CreateBufferView))}, {"vkCreateCommandPool", reinterpret_cast(static_cast(CreateCommandPool))}, @@ -222,6 +235,7 @@ const NameProc kInstanceProcs[] = { {"vkGetDeviceGroupPeerMemoryFeatures", reinterpret_cast(static_cast(GetDeviceGroupPeerMemoryFeatures))}, {"vkGetDeviceImageMemoryRequirements", reinterpret_cast(static_cast(GetDeviceImageMemoryRequirements))}, {"vkGetDeviceImageSparseMemoryRequirements", reinterpret_cast(static_cast(GetDeviceImageSparseMemoryRequirements))}, + {"vkGetDeviceImageSubresourceLayout", reinterpret_cast(static_cast(GetDeviceImageSubresourceLayout))}, {"vkGetDeviceMemoryCommitment", reinterpret_cast(static_cast(GetDeviceMemoryCommitment))}, {"vkGetDeviceMemoryOpaqueCaptureAddress", reinterpret_cast(static_cast(GetDeviceMemoryOpaqueCaptureAddress))}, {"vkGetDeviceProcAddr", reinterpret_cast(static_cast(GetDeviceProcAddr))}, @@ -234,6 +248,7 @@ const NameProc kInstanceProcs[] = { {"vkGetImageSparseMemoryRequirements", reinterpret_cast(static_cast(GetImageSparseMemoryRequirements))}, {"vkGetImageSparseMemoryRequirements2", reinterpret_cast(static_cast(GetImageSparseMemoryRequirements2))}, {"vkGetImageSubresourceLayout", reinterpret_cast(static_cast(GetImageSubresourceLayout))}, + {"vkGetImageSubresourceLayout2", reinterpret_cast(static_cast(GetImageSubresourceLayout2))}, {"vkGetInstanceProcAddr", reinterpret_cast(static_cast(GetInstanceProcAddr))}, {"vkGetPhysicalDeviceExternalBufferProperties", reinterpret_cast(static_cast(GetPhysicalDeviceExternalBufferProperties))}, {"vkGetPhysicalDeviceExternalFenceProperties", reinterpret_cast(static_cast(GetPhysicalDeviceExternalFenceProperties))}, @@ -264,6 +279,7 @@ const NameProc kInstanceProcs[] = { {"vkGetPrivateData", reinterpret_cast(static_cast(GetPrivateData))}, {"vkGetQueryPoolResults", reinterpret_cast(static_cast(GetQueryPoolResults))}, {"vkGetRenderAreaGranularity", reinterpret_cast(static_cast(GetRenderAreaGranularity))}, + {"vkGetRenderingAreaGranularity", reinterpret_cast(static_cast(GetRenderingAreaGranularity))}, {"vkGetSemaphoreCounterValue", reinterpret_cast(static_cast(GetSemaphoreCounterValue))}, {"vkGetSwapchainGrallocUsage2ANDROID", reinterpret_cast(static_cast(GetSwapchainGrallocUsage2ANDROID))}, {"vkGetSwapchainGrallocUsage3ANDROID", reinterpret_cast(static_cast(GetSwapchainGrallocUsage3ANDROID))}, @@ -271,6 +287,7 @@ const NameProc kInstanceProcs[] = { {"vkGetSwapchainGrallocUsageANDROID", reinterpret_cast(static_cast(GetSwapchainGrallocUsageANDROID))}, {"vkInvalidateMappedMemoryRanges", reinterpret_cast(static_cast(InvalidateMappedMemoryRanges))}, {"vkMapMemory", reinterpret_cast(static_cast(MapMemory))}, + {"vkMapMemory2", reinterpret_cast(static_cast(MapMemory2))}, {"vkMergePipelineCaches", reinterpret_cast(static_cast(MergePipelineCaches))}, {"vkQueueBindSparse", reinterpret_cast(static_cast(QueueBindSparse))}, {"vkQueueSignalReleaseImageANDROID", reinterpret_cast(static_cast(QueueSignalReleaseImageANDROID))}, @@ -286,8 +303,10 @@ const NameProc kInstanceProcs[] = { {"vkSetEvent", reinterpret_cast(static_cast(SetEvent))}, {"vkSetPrivateData", reinterpret_cast(static_cast(SetPrivateData))}, {"vkSignalSemaphore", reinterpret_cast(static_cast(SignalSemaphore))}, + {"vkTransitionImageLayout", reinterpret_cast(static_cast(TransitionImageLayout))}, {"vkTrimCommandPool", reinterpret_cast(static_cast(TrimCommandPool))}, {"vkUnmapMemory", reinterpret_cast(static_cast(UnmapMemory))}, + {"vkUnmapMemory2", reinterpret_cast(static_cast(UnmapMemory2))}, {"vkUpdateDescriptorSetWithTemplate", reinterpret_cast(static_cast(UpdateDescriptorSetWithTemplate))}, {"vkUpdateDescriptorSets", reinterpret_cast(static_cast(UpdateDescriptorSets))}, {"vkWaitForFences", reinterpret_cast(static_cast(WaitForFences))}, diff --git a/vulkan/nulldrv/null_driver_gen.h b/vulkan/nulldrv/null_driver_gen.h index 0d1e223226..f609e7edb2 100644 --- a/vulkan/nulldrv/null_driver_gen.h +++ b/vulkan/nulldrv/null_driver_gen.h @@ -118,6 +118,7 @@ VKAPI_ATTR void DestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, c VKAPI_ATTR VkResult CreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); VKAPI_ATTR void DestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); VKAPI_ATTR void GetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); +VKAPI_ATTR void GetRenderingAreaGranularity(VkDevice device, const VkRenderingAreaInfo* pRenderingAreaInfo, VkExtent2D* pGranularity); VKAPI_ATTR VkResult CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); VKAPI_ATTR void DestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); VKAPI_ATTR VkResult ResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); @@ -187,6 +188,7 @@ VKAPI_ATTR void GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevi VKAPI_ATTR void GetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties); VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties); VKAPI_ATTR void GetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties); +VKAPI_ATTR void CmdPushDescriptorSet(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites); VKAPI_ATTR void TrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); VKAPI_ATTR void GetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties); VKAPI_ATTR void GetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties); @@ -200,6 +202,7 @@ VKAPI_ATTR void CmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGrou VKAPI_ATTR VkResult CreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate); VKAPI_ATTR void DestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); VKAPI_ATTR void UpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData); +VKAPI_ATTR void CmdPushDescriptorSetWithTemplate(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData); VKAPI_ATTR void GetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); VKAPI_ATTR void GetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); VKAPI_ATTR void GetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); @@ -228,12 +231,14 @@ VKAPI_ATTR void CmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuf VKAPI_ATTR uint64_t GetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); VKAPI_ATTR VkDeviceAddress GetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); VKAPI_ATTR uint64_t GetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo); +VKAPI_ATTR void CmdSetLineStipple(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern); VKAPI_ATTR VkResult GetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolProperties* pToolProperties); VKAPI_ATTR void CmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); VKAPI_ATTR void CmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace); VKAPI_ATTR void CmdSetPrimitiveTopology(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); VKAPI_ATTR void CmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports); VKAPI_ATTR void CmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors); +VKAPI_ATTR void CmdBindIndexBuffer2(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType); VKAPI_ATTR void CmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides); VKAPI_ATTR void CmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); VKAPI_ATTR void CmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); @@ -260,8 +265,22 @@ VKAPI_ATTR void CmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCoun VKAPI_ATTR void CmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo); VKAPI_ATTR VkResult QueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence); VKAPI_ATTR void CmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage, VkQueryPool queryPool, uint32_t query); +VKAPI_ATTR VkResult CopyMemoryToImage(VkDevice device, const VkCopyMemoryToImageInfo* pCopyMemoryToImageInfo); +VKAPI_ATTR VkResult CopyImageToMemory(VkDevice device, const VkCopyImageToMemoryInfo* pCopyImageToMemoryInfo); +VKAPI_ATTR VkResult CopyImageToImage(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo); +VKAPI_ATTR VkResult TransitionImageLayout(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions); VKAPI_ATTR void CmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo); VKAPI_ATTR void CmdEndRendering(VkCommandBuffer commandBuffer); +VKAPI_ATTR void GetImageSubresourceLayout2(VkDevice device, VkImage image, const VkImageSubresource2* pSubresource, VkSubresourceLayout2* pLayout); +VKAPI_ATTR void GetDeviceImageSubresourceLayout(VkDevice device, const VkDeviceImageSubresourceInfo* pInfo, VkSubresourceLayout2* pLayout); +VKAPI_ATTR VkResult MapMemory2(VkDevice device, const VkMemoryMapInfo* pMemoryMapInfo, void** ppData); +VKAPI_ATTR VkResult UnmapMemory2(VkDevice device, const VkMemoryUnmapInfo* pMemoryUnmapInfo); +VKAPI_ATTR void CmdBindDescriptorSets2(VkCommandBuffer commandBuffer, const VkBindDescriptorSetsInfo* pBindDescriptorSetsInfo); +VKAPI_ATTR void CmdPushConstants2(VkCommandBuffer commandBuffer, const VkPushConstantsInfo* pPushConstantsInfo); +VKAPI_ATTR void CmdPushDescriptorSet2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo); +VKAPI_ATTR void CmdPushDescriptorSetWithTemplate2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetWithTemplateInfo* pPushDescriptorSetWithTemplateInfo); +VKAPI_ATTR void CmdSetRenderingAttachmentLocations(VkCommandBuffer commandBuffer, const VkRenderingAttachmentLocationInfo* pLocationInfo); +VKAPI_ATTR void CmdSetRenderingInputAttachmentIndices(VkCommandBuffer commandBuffer, const VkRenderingInputAttachmentIndexInfo* pInputAttachmentIndexInfo); // clang-format on } // namespace null_driver diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py index 6b4cbad2e2..aa1e7f2c8d 100644 --- a/vulkan/scripts/generator_common.py +++ b/vulkan/scripts/generator_common.py @@ -379,6 +379,9 @@ def parse_vulkan_registry(): version_dict[cmd_name] = apiversion for feature in root.iter('feature'): + # hack, 'feature' element has multiple meanings.. should be more precise with path match + if feature.get('api') is None: + continue if 'vulkan' not in feature.get('api').split(','): continue -- cgit v1.2.3-59-g8ed1b From 8f9e4e1e289e540abaa5cc6a93078b0275df5a21 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 1 Oct 2024 11:02:10 +1300 Subject: Add support for vulkan api level 1.4 in loader Bug: b/370568136 Flag: com.android.graphics.libvulkan.flags.vulkan_1_4_instance_api Change-Id: Ibf168e24f5be16cdf87b683322d291336b11244f --- vulkan/libvulkan/api.cpp | 5 ++++- vulkan/libvulkan/driver.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vulkan/libvulkan/api.cpp b/vulkan/libvulkan/api.cpp index c335e2a952..8451ad1c9e 100644 --- a/vulkan/libvulkan/api.cpp +++ b/vulkan/libvulkan/api.cpp @@ -45,6 +45,9 @@ #include "driver.h" #include "layers_extensions.h" +#include + +using namespace com::android::graphics::libvulkan; namespace vulkan { namespace api { @@ -1473,7 +1476,7 @@ VkResult EnumerateInstanceVersion(uint32_t* pApiVersion) { if (!EnsureInitialized()) return VK_ERROR_OUT_OF_HOST_MEMORY; - *pApiVersion = VK_API_VERSION_1_3; + *pApiVersion = flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3; return VK_SUCCESS; } diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp index 01436db4ae..7d0f545774 100644 --- a/vulkan/libvulkan/driver.cpp +++ b/vulkan/libvulkan/driver.cpp @@ -398,7 +398,7 @@ CreateInfoWrapper::CreateInfoWrapper(const VkInstanceCreateInfo& create_info, const VkAllocationCallbacks& allocator) : is_instance_(true), allocator_(allocator), - loader_api_version_(VK_API_VERSION_1_3), + loader_api_version_(flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3), icd_api_version_(icd_api_version), physical_dev_(VK_NULL_HANDLE), instance_info_(create_info), @@ -410,7 +410,7 @@ CreateInfoWrapper::CreateInfoWrapper(VkPhysicalDevice physical_dev, const VkAllocationCallbacks& allocator) : is_instance_(false), allocator_(allocator), - loader_api_version_(VK_API_VERSION_1_3), + loader_api_version_(flags::vulkan_1_4_instance_api() ? VK_API_VERSION_1_4 : VK_API_VERSION_1_3), icd_api_version_(icd_api_version), physical_dev_(physical_dev), dev_info_(create_info), @@ -552,6 +552,10 @@ VkResult CreateInfoWrapper::SanitizeExtensions() { is_instance_ ? loader_api_version_ : std::min(icd_api_version_, loader_api_version_); switch (api_version) { + case VK_API_VERSION_1_4: + hook_extensions_.set(ProcHook::EXTENSION_CORE_1_4); + hal_extensions_.set(ProcHook::EXTENSION_CORE_1_4); + [[clang::fallthrough]]; case VK_API_VERSION_1_3: hook_extensions_.set(ProcHook::EXTENSION_CORE_1_3); hal_extensions_.set(ProcHook::EXTENSION_CORE_1_3); @@ -701,6 +705,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) { case ProcHook::EXTENSION_CORE_1_1: case ProcHook::EXTENSION_CORE_1_2: case ProcHook::EXTENSION_CORE_1_3: + case ProcHook::EXTENSION_CORE_1_4: case ProcHook::EXTENSION_COUNT: // Device and meta extensions. If we ever get here it's a bug in // our code. But enumerating them lets us avoid having a default @@ -766,6 +771,7 @@ void CreateInfoWrapper::FilterExtension(const char* name) { case ProcHook::EXTENSION_CORE_1_1: case ProcHook::EXTENSION_CORE_1_2: case ProcHook::EXTENSION_CORE_1_3: + case ProcHook::EXTENSION_CORE_1_4: case ProcHook::EXTENSION_COUNT: // Instance and meta extensions. If we ever get here it's a bug // in our code. But enumerating them lets us avoid having a -- cgit v1.2.3-59-g8ed1b From 612281d2fa936fa15d4c7ef11f9906282baf2425 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 1 Oct 2024 12:44:14 +1300 Subject: Allow vkjson to report on 1.4 instances Does not yet output any 1.4 capabilities, but allows the tool to at least work. Bug: b/370568136 Flag: NONE bugfix Change-Id: I969581e9472d8cfd789dd3e5f9b750e54c91c4df --- vulkan/vkjson/vkjson.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vulkan/vkjson/vkjson.cc b/vulkan/vkjson/vkjson.cc index bfb7bd6d6f..9b508aa5ce 100644 --- a/vulkan/vkjson/vkjson.cc +++ b/vulkan/vkjson/vkjson.cc @@ -1050,6 +1050,9 @@ inline bool Iterate(Visitor* visitor, VkJsonDevice* device) { bool ret = true; switch (device->properties.apiVersion ^ VK_API_VERSION_PATCH(device->properties.apiVersion)) { + case VK_API_VERSION_1_4: + // TODO: real 1.4 support here + FALLTHROUGH_INTENDED; case VK_API_VERSION_1_3: ret &= visitor->Visit("core13", &device->core13); FALLTHROUGH_INTENDED; @@ -1110,6 +1113,8 @@ template inline bool Iterate(Visitor* visitor, VkJsonInstance* instance) { bool ret = true; switch (instance->api_version ^ VK_API_VERSION_PATCH(instance->api_version)) { + case VK_API_VERSION_1_4: + FALLTHROUGH_INTENDED; case VK_API_VERSION_1_3: FALLTHROUGH_INTENDED; case VK_API_VERSION_1_2: -- cgit v1.2.3-59-g8ed1b From 500ce8817666b1688dd34e973b6f0edcaf4213c2 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 8 Oct 2024 17:47:31 +1300 Subject: Add support for Vulkan 1.4 core entrypoints to nulldrv Bug: b/370568136 Flag: NONE infeasible Change-Id: I06b343858dc3fe6e95e57a0ee0593c6fc64965c9 --- vulkan/nulldrv/null_driver.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/vulkan/nulldrv/null_driver.cpp b/vulkan/nulldrv/null_driver.cpp index 973e71c892..48de3d6d33 100644 --- a/vulkan/nulldrv/null_driver.cpp +++ b/vulkan/nulldrv/null_driver.cpp @@ -1767,6 +1767,69 @@ VkResult SetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objec return VK_SUCCESS; } +void GetRenderingAreaGranularity(VkDevice device, const VkRenderingAreaInfo* pRenderingAreaInfo, VkExtent2D* pGranularity) { +} + +void CmdPushDescriptorSet(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites) { +} + +void CmdPushDescriptorSetWithTemplate(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData) { +} + +void CmdSetLineStipple(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) { +} + +void CmdBindIndexBuffer2(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType) { +} + +VkResult CopyMemoryToImage(VkDevice device, const VkCopyMemoryToImageInfo* pCopyMemoryToImageInfo) { + return VK_SUCCESS; +} + +VkResult CopyImageToMemory(VkDevice device, const VkCopyImageToMemoryInfo* pCopyImageToMemoryInfo) { + return VK_SUCCESS; +} + +VkResult CopyImageToImage(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo) { + return VK_SUCCESS; +} + +VkResult TransitionImageLayout(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions) { + return VK_SUCCESS; +} + +void GetImageSubresourceLayout2(VkDevice device, VkImage image, const VkImageSubresource2* pSubresource, VkSubresourceLayout2* pLayout) { +} + +void GetDeviceImageSubresourceLayout(VkDevice device, const VkDeviceImageSubresourceInfo* pInfo, VkSubresourceLayout2* pLayout) { +} + +VkResult MapMemory2(VkDevice device, const VkMemoryMapInfo* pMemoryMapInfo, void** ppData) { + return VK_SUCCESS; +} + +VkResult UnmapMemory2(VkDevice device, const VkMemoryUnmapInfo* pMemoryUnmapInfo) { + return VK_SUCCESS; +} + +void CmdBindDescriptorSets2(VkCommandBuffer commandBuffer, const VkBindDescriptorSetsInfo* pBindDescriptorSetsInfo) { +} + +void CmdPushConstants2(VkCommandBuffer commandBuffer, const VkPushConstantsInfo* pPushConstantsInfo) { +} + +void CmdPushDescriptorSet2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfo* pPushDescriptorSetInfo) { +} + +void CmdPushDescriptorSetWithTemplate2(VkCommandBuffer commandBuffer, const VkPushDescriptorSetWithTemplateInfo* pPushDescriptorSetWithTemplateInfo) { +} + +void CmdSetRenderingAttachmentLocations(VkCommandBuffer commandBuffer, const VkRenderingAttachmentLocationInfo* pLocationInfo) { +} + +void CmdSetRenderingInputAttachmentIndices(VkCommandBuffer commandBuffer, const VkRenderingInputAttachmentIndexInfo* pInputAttachmentIndexInfo) { +} + #pragma clang diagnostic pop // clang-format on -- cgit v1.2.3-59-g8ed1b From 550cc22ef3e5e3175bee937c1ac081fe6050a9fa Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 9 Oct 2024 10:59:08 +1300 Subject: Add feature xml for Vulkan version 1.4 Bug: b/370568136 Flag: NONE infeasible Change-Id: Iec86c0cb5ef3697d6c5c35a6773c19e0215a93e5 --- data/etc/android.hardware.vulkan.version-1_4.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 data/etc/android.hardware.vulkan.version-1_4.xml diff --git a/data/etc/android.hardware.vulkan.version-1_4.xml b/data/etc/android.hardware.vulkan.version-1_4.xml new file mode 100644 index 0000000000..010f6daee7 --- /dev/null +++ b/data/etc/android.hardware.vulkan.version-1_4.xml @@ -0,0 +1,21 @@ + + + + + + + -- cgit v1.2.3-59-g8ed1b From 4d74653b0e9b4cc04015294a92e2511da01ed0dc Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Wed, 9 Oct 2024 15:35:17 +1300 Subject: Update libvulkan linker map for 1.4 Bug: b/370568136 Flag: NONE infeasible Change-Id: Ib8e22978d100ce3007992ca1c107c763821067c6 --- vulkan/libvulkan/libvulkan.map.txt | 86 +++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/vulkan/libvulkan/libvulkan.map.txt b/vulkan/libvulkan/libvulkan.map.txt index b189c6888d..ffe46f7c58 100644 --- a/vulkan/libvulkan/libvulkan.map.txt +++ b/vulkan/libvulkan/libvulkan.map.txt @@ -6,32 +6,34 @@ LIBVULKAN { vkAllocateDescriptorSets; vkAllocateMemory; vkBeginCommandBuffer; - vkBindBufferMemory; vkBindBufferMemory2; # introduced=28 - vkBindImageMemory; + vkBindBufferMemory; vkBindImageMemory2; # introduced=28 + vkBindImageMemory; vkCmdBeginQuery; - vkCmdBeginRendering; # introduced=33 - vkCmdBeginRenderPass; vkCmdBeginRenderPass2; # introduced=31 + vkCmdBeginRenderPass; + vkCmdBeginRendering; # introduced=33 + vkCmdBindDescriptorSets2; #introduced=36 vkCmdBindDescriptorSets; + vkCmdBindIndexBuffer2; #introduced=36 vkCmdBindIndexBuffer; vkCmdBindPipeline; - vkCmdBindVertexBuffers; vkCmdBindVertexBuffers2; #introduced=33 - vkCmdBlitImage; + vkCmdBindVertexBuffers; vkCmdBlitImage2; #introduced=33 + vkCmdBlitImage; vkCmdClearAttachments; vkCmdClearColorImage; vkCmdClearDepthStencilImage; - vkCmdCopyBuffer; vkCmdCopyBuffer2; #introduced=33 - vkCmdCopyBufferToImage; + vkCmdCopyBuffer; vkCmdCopyBufferToImage2; #introduced=33 - vkCmdCopyImage; + vkCmdCopyBufferToImage; vkCmdCopyImage2; #introduced=33 - vkCmdCopyImageToBuffer; + vkCmdCopyImage; vkCmdCopyImageToBuffer2; #introduced=33 + vkCmdCopyImageToBuffer; vkCmdCopyQueryPoolResults; vkCmdDispatch; vkCmdDispatchBase; # introduced=28 @@ -43,21 +45,26 @@ LIBVULKAN { vkCmdDrawIndirect; vkCmdDrawIndirectCount; # introduced=31 vkCmdEndQuery; - vkCmdEndRendering; #introduced=33 - vkCmdEndRenderPass; vkCmdEndRenderPass2; # introduced=31 + vkCmdEndRenderPass; + vkCmdEndRendering; #introduced=33 vkCmdExecuteCommands; vkCmdFillBuffer; - vkCmdNextSubpass; vkCmdNextSubpass2; # introduced=31 - vkCmdPipelineBarrier; + vkCmdNextSubpass; vkCmdPipelineBarrier2; #introduced=33 + vkCmdPipelineBarrier; + vkCmdPushConstants2; #introduced=36 vkCmdPushConstants; - vkCmdResetEvent; + vkCmdPushDescriptorSet2; #introduced=36 + vkCmdPushDescriptorSet; #introduced=36 + vkCmdPushDescriptorSetWithTemplate2; #introduced=36 + vkCmdPushDescriptorSetWithTemplate; #introduced=36 vkCmdResetEvent2; #introduced=33 + vkCmdResetEvent; vkCmdResetQueryPool; - vkCmdResolveImage; vkCmdResolveImage2; #introduced=33 + vkCmdResolveImage; vkCmdSetBlendConstants; vkCmdSetCullMode; #introduced=33 vkCmdSetDepthBias; @@ -68,13 +75,16 @@ LIBVULKAN { vkCmdSetDepthTestEnable; #introduced=33 vkCmdSetDepthWriteEnable; #introduced=33 vkCmdSetDeviceMask; # introduced=28 - vkCmdSetEvent; vkCmdSetEvent2; #introduced=33 + vkCmdSetEvent; vkCmdSetFrontFace; #introduced=33 + vkCmdSetLineStipple; #introduced=36 vkCmdSetLineWidth; vkCmdSetPrimitiveRestartEnable; #introduced=33 vkCmdSetPrimitiveTopology; #introduced=33 vkCmdSetRasterizerDiscardEnable; #introduced=33 + vkCmdSetRenderingAttachmentLocations; #introduced=36 + vkCmdSetRenderingInputAttachmentIndices; #introduced=36 vkCmdSetScissor; vkCmdSetScissorWithCount; #introduced=33 vkCmdSetStencilCompareMask; @@ -85,10 +95,12 @@ LIBVULKAN { vkCmdSetViewport; vkCmdSetViewportWithCount; #introduced=33 vkCmdUpdateBuffer; - vkCmdWaitEvents; vkCmdWaitEvents2; #introduced=33 - vkCmdWriteTimestamp; + vkCmdWaitEvents; vkCmdWriteTimestamp2; #introduced=33 + vkCmdWriteTimestamp; + vkCopyImageToMemory; #introduced=36 + vkCopyMemoryToImage; #introduced=36 vkCreateAndroidSurfaceKHR; vkCreateBuffer; vkCreateBufferView; @@ -109,8 +121,8 @@ LIBVULKAN { vkCreatePipelineLayout; vkCreatePrivateDataSlot; #introduced=33 vkCreateQueryPool; - vkCreateRenderPass; vkCreateRenderPass2; # introduced=31 + vkCreateRenderPass; vkCreateSampler; vkCreateSamplerYcbcrConversion; # introduced=28 vkCreateSemaphore; @@ -156,8 +168,8 @@ LIBVULKAN { vkFreeMemory; vkGetAndroidHardwareBufferPropertiesANDROID; # introduced=28 vkGetBufferDeviceAddress; # introduced=31 - vkGetBufferMemoryRequirements; vkGetBufferMemoryRequirements2; # introduced=28 + vkGetBufferMemoryRequirements; vkGetBufferOpaqueCaptureAddress; # introduced=31 vkGetDescriptorSetLayoutSupport; # introduced=28 vkGetDeviceBufferMemoryRequirements; #introduced=33 @@ -166,39 +178,41 @@ LIBVULKAN { vkGetDeviceGroupSurfacePresentModesKHR; # introduced=28 vkGetDeviceImageMemoryRequirements; #introduced=33 vkGetDeviceImageSparseMemoryRequirements; #introduced=33 + vkGetDeviceImageSubresourceLayout; #introduced=36 vkGetDeviceMemoryCommitment; vkGetDeviceMemoryOpaqueCaptureAddress; # introduced=31 vkGetDeviceProcAddr; - vkGetDeviceQueue; vkGetDeviceQueue2; # introduced=28 + vkGetDeviceQueue; vkGetEventStatus; vkGetFenceStatus; - vkGetImageMemoryRequirements; vkGetImageMemoryRequirements2; # introduced=28 - vkGetImageSparseMemoryRequirements; + vkGetImageMemoryRequirements; vkGetImageSparseMemoryRequirements2; # introduced=28 - vkGetImageSubresourceLayout; + vkGetImageSparseMemoryRequirements; + vkGetImageSubresourceLayout2; #introduced=36 vkGetImageSubresourceLayout2EXT; # introduced=UpsideDownCake + vkGetImageSubresourceLayout; vkGetInstanceProcAddr; vkGetMemoryAndroidHardwareBufferANDROID; # introduced=28 vkGetPhysicalDeviceExternalBufferProperties; # introduced=28 vkGetPhysicalDeviceExternalFenceProperties; # introduced=28 vkGetPhysicalDeviceExternalSemaphoreProperties; # introduced=28 - vkGetPhysicalDeviceFeatures; vkGetPhysicalDeviceFeatures2; # introduced=28 - vkGetPhysicalDeviceFormatProperties; + vkGetPhysicalDeviceFeatures; vkGetPhysicalDeviceFormatProperties2; # introduced=28 - vkGetPhysicalDeviceImageFormatProperties; + vkGetPhysicalDeviceFormatProperties; vkGetPhysicalDeviceImageFormatProperties2; # introduced=28 - vkGetPhysicalDeviceMemoryProperties; + vkGetPhysicalDeviceImageFormatProperties; vkGetPhysicalDeviceMemoryProperties2; # introduced=28 + vkGetPhysicalDeviceMemoryProperties; vkGetPhysicalDevicePresentRectanglesKHR; # introduced=28 - vkGetPhysicalDeviceProperties; vkGetPhysicalDeviceProperties2; # introduced=28 - vkGetPhysicalDeviceQueueFamilyProperties; + vkGetPhysicalDeviceProperties; vkGetPhysicalDeviceQueueFamilyProperties2; # introduced=28 - vkGetPhysicalDeviceSparseImageFormatProperties; + vkGetPhysicalDeviceQueueFamilyProperties; vkGetPhysicalDeviceSparseImageFormatProperties2; # introduced=28 + vkGetPhysicalDeviceSparseImageFormatProperties; vkGetPhysicalDeviceSurfaceCapabilitiesKHR; vkGetPhysicalDeviceSurfaceFormatsKHR; vkGetPhysicalDeviceSurfacePresentModesKHR; @@ -208,15 +222,17 @@ LIBVULKAN { vkGetPrivateData; #introduced=33 vkGetQueryPoolResults; vkGetRenderAreaGranularity; + vkGetRenderingAreaGranularity; #introduced=36 vkGetSemaphoreCounterValue; # introduced=31 vkGetSwapchainImagesKHR; vkInvalidateMappedMemoryRanges; + vkMapMemory2; #introduced=36 vkMapMemory; vkMergePipelineCaches; vkQueueBindSparse; vkQueuePresentKHR; - vkQueueSubmit; vkQueueSubmit2; #introduced=33 + vkQueueSubmit; vkQueueWaitIdle; vkResetCommandBuffer; vkResetCommandPool; @@ -227,10 +243,12 @@ LIBVULKAN { vkSetEvent; vkSetPrivateData; # introduced=33 vkSignalSemaphore; # introduced=31 + vkTransitionImageLayout; #introduced=36 vkTrimCommandPool; # introduced=28 + vkUnmapMemory2; #introduced=36 vkUnmapMemory; - vkUpdateDescriptorSets; vkUpdateDescriptorSetWithTemplate; # introduced=28 + vkUpdateDescriptorSets; vkWaitForFences; vkWaitSemaphores; # introduced=31 local: -- cgit v1.2.3-59-g8ed1b From 36349ac27afda87a1a6ad17399075da41b05e24b Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Mon, 25 Nov 2024 08:00:26 +0000 Subject: [Lut backend] Fix a bug where we were passing a nullptr to the HWC when we wanted to clear the LUTs. Bug: 329472856 Change-Id: Ia9c771b348061d5bf40bd3190ac5ebe3e77de388 Test: libcompositionengine_test Flag: EXEMPT no flag needed --- .../CompositionEngine/src/OutputLayer.cpp | 42 +++++++++++----------- .../CompositionEngine/tests/OutputLayerTest.cpp | 1 + 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp index a040c88e78..143c192686 100644 --- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp @@ -589,28 +589,30 @@ void OutputLayer::writeOutputIndependentGeometryStateToHWC( void OutputLayer::writeLutToHWC(HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState) { - if (!outputIndependentState.luts) { - return; - } - auto& lutFileDescriptor = outputIndependentState.luts->getLutFileDescriptor(); - auto lutOffsets = outputIndependentState.luts->offsets; - auto& lutProperties = outputIndependentState.luts->lutProperties; + Luts luts; + // if outputIndependentState.luts is nullptr, it means we want to clear the LUTs + // and we pass an empty Luts object to the HWC. + if (outputIndependentState.luts) { + auto& lutFileDescriptor = outputIndependentState.luts->getLutFileDescriptor(); + auto lutOffsets = outputIndependentState.luts->offsets; + auto& lutProperties = outputIndependentState.luts->lutProperties; + + std::vector aidlProperties; + aidlProperties.reserve(lutProperties.size()); + for (size_t i = 0; i < lutOffsets.size(); i++) { + LutProperties properties; + properties.dimension = static_cast(lutProperties[i].dimension); + properties.size = lutProperties[i].size; + properties.samplingKeys = { + static_cast(lutProperties[i].samplingKey)}; + aidlProperties.emplace_back(properties); + } - std::vector aidlProperties; - aidlProperties.reserve(lutProperties.size()); - for (size_t i = 0; i < lutOffsets.size(); i++) { - LutProperties properties; - properties.dimension = static_cast(lutProperties[i].dimension); - properties.size = lutProperties[i].size; - properties.samplingKeys = { - static_cast(lutProperties[i].samplingKey)}; - aidlProperties.emplace_back(properties); - } - Luts luts; - luts.pfd = ndk::ScopedFileDescriptor(dup(lutFileDescriptor.get())); - luts.offsets = lutOffsets; - luts.lutProperties = std::move(aidlProperties); + luts.pfd = ndk::ScopedFileDescriptor(dup(lutFileDescriptor.get())); + luts.offsets = lutOffsets; + luts.lutProperties = std::move(aidlProperties); + } switch (auto error = hwcLayer->setLuts(luts)) { case hal::Error::NONE: diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp index dbffe80a3a..034c768ff3 100644 --- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp @@ -901,6 +901,7 @@ struct OutputLayerWriteStateToHWCTest : public OutputLayerTest { EXPECT_CALL(*mHwcLayer, setSurfaceDamage(RegionEq(surfaceDamage))).WillOnce(Return(kError)); EXPECT_CALL(*mHwcLayer, setBlockingRegion(RegionEq(blockingRegion))) .WillOnce(Return(kError)); + EXPECT_CALL(*mHwcLayer, setLuts(_)).WillOnce(Return(kError)); } void expectSetCompositionTypeCall(Composition compositionType) { -- cgit v1.2.3-59-g8ed1b From eb63bbfd16ed9732be13d2ea6699edc6d7e4b545 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Wed, 13 Nov 2024 15:13:29 -0800 Subject: Do not crash when server channel has closed If the publisher has been destroyed (or, equivalently, if the server channel was closed), the consumer should not crash. Instead, we should allow consumer to exit gracefully. In this CL, we specifically check for DEAD_OBJECT and drain the queue, printing all of the events that will never be delivered to the publisher for useful debugging purposes. Bug: 305165753 Test: TEST=libinput_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST Flag: EXEMPT bugfix Change-Id: I00973ebb87e0f59bfd3c0f58edf7355b28988c15 --- libs/input/InputConsumerNoResampling.cpp | 15 +++++++ .../InputPublisherAndConsumerNoResampling_test.cpp | 48 +++++++++++++++------- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/libs/input/InputConsumerNoResampling.cpp b/libs/input/InputConsumerNoResampling.cpp index 2c0f77a814..cd8582182a 100644 --- a/libs/input/InputConsumerNoResampling.cpp +++ b/libs/input/InputConsumerNoResampling.cpp @@ -169,6 +169,12 @@ InputMessage createTimelineMessage(int32_t inputEventId, nsecs_t gpuCompletedTim msg.body.timeline.graphicsTimeline[GraphicsTimeline::PRESENT_TIME] = presentTime; return msg; } + +std::ostream& operator<<(std::ostream& out, const InputMessage& msg) { + out << ftl::enum_string(msg.header.type); + return out; +} + } // namespace // --- InputConsumerNoResampling --- @@ -272,6 +278,15 @@ void InputConsumerNoResampling::processOutboundEvents() { return; // try again later } + if (result == DEAD_OBJECT) { + // If there's no one to receive events in the channel, there's no point in sending them. + // Drop all outbound events. + LOG(INFO) << "Channel " << mChannel->getName() << " died. Dropping outbound event " + << outboundMsg; + mOutboundQueue.pop(); + setFdEvents(0); + continue; + } // Some other error. Give up LOG(FATAL) << "Failed to send outbound event on channel '" << mChannel->getName() << "'. status=" << statusToString(result) << "(" << result << ")"; diff --git a/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp b/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp index 39bb841c0a..1dadae98e4 100644 --- a/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp +++ b/libs/input/tests/InputPublisherAndConsumerNoResampling_test.cpp @@ -319,6 +319,8 @@ protected: protected: // Interaction with the looper thread + void blockLooper(); + void unblockLooper(); enum class LooperMessage : int { CALL_PROBABLY_HAS_INPUT, CREATE_CONSUMER, @@ -389,6 +391,26 @@ private: }; }; +void InputPublisherAndConsumerNoResamplingTest::blockLooper() { + { + std::scoped_lock l(mLock); + mLooperMayProceed = false; + } + sendMessage(LooperMessage::BLOCK_LOOPER); + { + std::unique_lock l(mLock); + mNotifyLooperWaiting.wait(l, [this] { return mLooperIsBlocked; }); + } +} + +void InputPublisherAndConsumerNoResamplingTest::unblockLooper() { + { + std::scoped_lock l(mLock); + mLooperMayProceed = true; + } + mNotifyLooperMayProceed.notify_all(); +} + void InputPublisherAndConsumerNoResamplingTest::sendMessage(LooperMessage message) { Message msg{ftl::to_underlying(message)}; mLooper->sendMessage(mMessageHandler, msg); @@ -600,15 +622,7 @@ void InputPublisherAndConsumerNoResamplingTest::publishAndConsumeSinglePointerMu std::queue publishedSequenceNumbers; // Block Looper to increase the chance of batching events - { - std::scoped_lock l(mLock); - mLooperMayProceed = false; - } - sendMessage(LooperMessage::BLOCK_LOOPER); - { - std::unique_lock l(mLock); - mNotifyLooperWaiting.wait(l, [this] { return mLooperIsBlocked; }); - } + blockLooper(); uint32_t firstSampleId; for (size_t i = 0; i < nSamples; ++i) { @@ -629,12 +643,7 @@ void InputPublisherAndConsumerNoResamplingTest::publishAndConsumeSinglePointerMu std::vector singleSampledMotionEvents; - // Unblock Looper - { - std::scoped_lock l(mLock); - mLooperMayProceed = true; - } - mNotifyLooperMayProceed.notify_all(); + unblockLooper(); // We have no control over the socket behavior, so the consumer can receive // the motion as a batched event, or as a sequence of multiple single-sample MotionEvents (or a @@ -809,6 +818,15 @@ void InputPublisherAndConsumerNoResamplingTest::publishAndConsumeTouchModeEvent( verifyFinishedSignal(*mPublisher, seq, publishTime); } +/** + * If the publisher has died, consumer should not crash when trying to send an outgoing message. + */ +TEST_F(InputPublisherAndConsumerNoResamplingTest, ConsumerWritesAfterPublisherDies) { + mPublisher.reset(); // The publisher has died + mReportTimelineArgs.emplace(/*inputEventId=*/10, /*gpuCompletedTime=*/20, /*presentTime=*/30); + sendMessage(LooperMessage::CALL_REPORT_TIMELINE); +} + TEST_F(InputPublisherAndConsumerNoResamplingTest, SendTimeline) { const int32_t inputEventId = 20; const nsecs_t gpuCompletedTime = 30; -- cgit v1.2.3-59-g8ed1b From 7918c82519d65001c21057319793816898cfe0f1 Mon Sep 17 00:00:00 2001 From: Arpit Singh Date: Wed, 20 Nov 2024 11:28:44 +0000 Subject: Refactor PointerChoreographer lock Pointer choreographer and WindowInfoListener use separate locks which is problematic. As WindowInfosUpdate callback is triggered from the display thread, a deadlock might occur due to race between display and reader thread. Both trying to acquire both the locks. This becomes much more likely when we have multiple displays connected. Test: Verify pointer indicators are hidden on screenshots of secure windows Test: atest inputflinger_tests Bug: 367660694 Flag: EXEMPT refactor Change-Id: I7417c0071322a093643734432f8f0236bd89a317 --- services/inputflinger/PointerChoreographer.cpp | 92 ++++++++++++++------------ services/inputflinger/PointerChoreographer.h | 92 +++++++++++++++----------- 2 files changed, 101 insertions(+), 83 deletions(-) diff --git a/services/inputflinger/PointerChoreographer.cpp b/services/inputflinger/PointerChoreographer.cpp index 006d507a40..a67df58fe4 100644 --- a/services/inputflinger/PointerChoreographer.cpp +++ b/services/inputflinger/PointerChoreographer.cpp @@ -139,23 +139,24 @@ PointerChoreographer::PointerChoreographer( mShowTouchesEnabled(false), mStylusPointerIconEnabled(false), mCurrentFocusedDisplay(ui::LogicalDisplayId::DEFAULT), + mIsWindowInfoListenerRegistered(false), + mWindowInfoListener(sp::make(this)), mRegisterListener(registerListener), mUnregisterListener(unregisterListener) {} PointerChoreographer::~PointerChoreographer() { - std::scoped_lock _l(mLock); - if (mWindowInfoListener == nullptr) { - return; + if (mIsWindowInfoListenerRegistered) { + mUnregisterListener(mWindowInfoListener); + mIsWindowInfoListenerRegistered = false; } mWindowInfoListener->onPointerChoreographerDestroyed(); - mUnregisterListener(mWindowInfoListener); } void PointerChoreographer::notifyInputDevicesChanged(const NotifyInputDevicesChangedArgs& args) { PointerDisplayChange pointerDisplayChange; { // acquire lock - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); mInputDeviceInfos = args.inputDeviceInfos; pointerDisplayChange = updatePointerControllersLocked(); @@ -191,7 +192,7 @@ void PointerChoreographer::fadeMouseCursorOnKeyPress(const android::NotifyKeyArg return; } - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); ui::LogicalDisplayId targetDisplay = args.displayId; if (targetDisplay == ui::LogicalDisplayId::INVALID) { targetDisplay = mCurrentFocusedDisplay; @@ -204,7 +205,7 @@ void PointerChoreographer::fadeMouseCursorOnKeyPress(const android::NotifyKeyArg } NotifyMotionArgs PointerChoreographer::processMotion(const NotifyMotionArgs& args) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); if (isFromMouse(args)) { return processMouseEventLocked(args); @@ -433,7 +434,7 @@ void PointerChoreographer::notifyDeviceReset(const NotifyDeviceResetArgs& args) } void PointerChoreographer::processDeviceReset(const NotifyDeviceResetArgs& args) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); mTouchPointersByDevice.erase(args.deviceId); mStylusPointersByDevice.erase(args.deviceId); mDrawingTabletPointersByDevice.erase(args.deviceId); @@ -447,17 +448,22 @@ void PointerChoreographer::onControllerAddedOrRemovedLocked() { bool requireListener = !mTouchPointersByDevice.empty() || !mMousePointersByDisplay.empty() || !mDrawingTabletPointersByDevice.empty() || !mStylusPointersByDevice.empty(); - if (requireListener && mWindowInfoListener == nullptr) { - mWindowInfoListener = sp::make(this); - mWindowInfoListener->setInitialDisplayInfos(mRegisterListener(mWindowInfoListener)); - onPrivacySensitiveDisplaysChangedLocked(mWindowInfoListener->getPrivacySensitiveDisplays()); - } else if (!requireListener && mWindowInfoListener != nullptr) { + // PointerChoreographer uses Listener's lock which is already held by caller + base::ScopedLockAssertion assumeLocked(mWindowInfoListener->mLock); + + if (requireListener && !mIsWindowInfoListenerRegistered) { + mIsWindowInfoListenerRegistered = true; + mWindowInfoListener->setInitialDisplayInfosLocked(mRegisterListener(mWindowInfoListener)); + onPrivacySensitiveDisplaysChangedLocked( + mWindowInfoListener->getPrivacySensitiveDisplaysLocked()); + } else if (!requireListener && mIsWindowInfoListenerRegistered) { + mIsWindowInfoListenerRegistered = false; mUnregisterListener(mWindowInfoListener); - mWindowInfoListener = nullptr; - } else if (requireListener && mWindowInfoListener != nullptr) { + } else if (requireListener) { // controller may have been added to an existing privacy sensitive display, we need to // update all controllers again - onPrivacySensitiveDisplaysChangedLocked(mWindowInfoListener->getPrivacySensitiveDisplays()); + onPrivacySensitiveDisplaysChangedLocked( + mWindowInfoListener->getPrivacySensitiveDisplaysLocked()); } } @@ -494,7 +500,7 @@ void PointerChoreographer::onPrivacySensitiveDisplaysChangedLocked( void PointerChoreographer::notifyPointerCaptureChanged( const NotifyPointerCaptureChangedArgs& args) { if (args.request.isEnable()) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); for (const auto& [_, mousePointerController] : mMousePointersByDisplay) { mousePointerController->fade(PointerControllerInterface::Transition::IMMEDIATE); } @@ -502,14 +508,8 @@ void PointerChoreographer::notifyPointerCaptureChanged( mNextListener.notify(args); } -void PointerChoreographer::onPrivacySensitiveDisplaysChanged( - const std::unordered_set& privacySensitiveDisplays) { - std::scoped_lock _l(mLock); - onPrivacySensitiveDisplaysChangedLocked(privacySensitiveDisplays); -} - void PointerChoreographer::dump(std::string& dump) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); dump += "PointerChoreographer:\n"; dump += StringPrintf(INDENT "Show Touches Enabled: %s\n", @@ -579,6 +579,10 @@ bool PointerChoreographer::canUnfadeOnDisplay(ui::LogicalDisplayId displayId) { return mDisplaysWithPointersHidden.find(displayId) == mDisplaysWithPointersHidden.end(); } +std::mutex& PointerChoreographer::getLock() const { + return mWindowInfoListener->mLock; +} + PointerChoreographer::PointerDisplayChange PointerChoreographer::updatePointerControllersLocked() { std::set mouseDisplaysToKeep; std::set touchDevicesToKeep; @@ -641,7 +645,7 @@ PointerChoreographer::PointerDisplayChange PointerChoreographer::updatePointerCo std::erase_if(mDrawingTabletPointersByDevice, [&drawingTabletDevicesToKeep](const auto& pair) { return drawingTabletDevicesToKeep.find(pair.first) == drawingTabletDevicesToKeep.end(); }); - std::erase_if(mMouseDevices, [&](DeviceId id) REQUIRES(mLock) { + std::erase_if(mMouseDevices, [&](DeviceId id) REQUIRES(getLock()) { return std::find_if(mInputDeviceInfos.begin(), mInputDeviceInfos.end(), [id](const auto& info) { return info.getId() == id; }) == mInputDeviceInfos.end(); @@ -677,7 +681,7 @@ void PointerChoreographer::setDefaultMouseDisplayId(ui::LogicalDisplayId display PointerDisplayChange pointerDisplayChange; { // acquire lock - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); mDefaultMouseDisplayId = displayId; pointerDisplayChange = updatePointerControllersLocked(); @@ -690,7 +694,7 @@ void PointerChoreographer::setDisplayViewports(const std::vector PointerChoreographer::getViewportForPointerDevice( ui::LogicalDisplayId associatedDisplayId) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); const ui::LogicalDisplayId resolvedDisplayId = getTargetMouseDisplayLocked(associatedDisplayId); if (const auto viewport = findViewportByIdLocked(resolvedDisplayId); viewport) { return *viewport; @@ -728,7 +732,7 @@ std::optional PointerChoreographer::getViewportForPointerDevice } FloatPoint PointerChoreographer::getMouseCursorPosition(ui::LogicalDisplayId displayId) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); const ui::LogicalDisplayId resolvedDisplayId = getTargetMouseDisplayLocked(displayId); if (auto it = mMousePointersByDisplay.find(resolvedDisplayId); it != mMousePointersByDisplay.end()) { @@ -741,7 +745,7 @@ void PointerChoreographer::setShowTouchesEnabled(bool enabled) { PointerDisplayChange pointerDisplayChange; { // acquire lock - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); if (mShowTouchesEnabled == enabled) { return; } @@ -756,7 +760,7 @@ void PointerChoreographer::setStylusPointerIconEnabled(bool enabled) { PointerDisplayChange pointerDisplayChange; { // acquire lock - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); if (mStylusPointerIconEnabled == enabled) { return; } @@ -770,7 +774,7 @@ void PointerChoreographer::setStylusPointerIconEnabled(bool enabled) { bool PointerChoreographer::setPointerIcon( std::variant, PointerIconStyle> icon, ui::LogicalDisplayId displayId, DeviceId deviceId) { - std::scoped_lock _l(mLock); + std::scoped_lock _l(getLock()); if (deviceId < 0) { LOG(WARNING) << "Invalid device id " << deviceId << ". Cannot set pointer icon."; return false; @@ -821,7 +825,7 @@ bool PointerChoreographer::setPointerIcon( } void PointerChoreographer::setPointerIconVisibility(ui::LogicalDisplayId displayId, bool visible) { - std::scoped_lock lock(mLock); + std::scoped_lock lock(getLock()); if (visible) { mDisplaysWithPointersHidden.erase(displayId); // We do not unfade the icons here, because we don't know when the last event happened. @@ -843,14 +847,14 @@ void PointerChoreographer::setPointerIconVisibility(ui::LogicalDisplayId display } void PointerChoreographer::setFocusedDisplay(ui::LogicalDisplayId displayId) { - std::scoped_lock lock(mLock); + std::scoped_lock lock(getLock()); mCurrentFocusedDisplay = displayId; } PointerChoreographer::ControllerConstructor PointerChoreographer::getMouseControllerConstructor( ui::LogicalDisplayId displayId) { std::function()> ctor = - [this, displayId]() REQUIRES(mLock) { + [this, displayId]() REQUIRES(getLock()) { auto pc = mPolicy.createPointerController( PointerControllerInterface::ControllerType::MOUSE); if (const auto viewport = findViewportByIdLocked(displayId); viewport) { @@ -864,7 +868,7 @@ PointerChoreographer::ControllerConstructor PointerChoreographer::getMouseContro PointerChoreographer::ControllerConstructor PointerChoreographer::getStylusControllerConstructor( ui::LogicalDisplayId displayId) { std::function()> ctor = - [this, displayId]() REQUIRES(mLock) { + [this, displayId]() REQUIRES(getLock()) { auto pc = mPolicy.createPointerController( PointerControllerInterface::ControllerType::STYLUS); if (const auto viewport = findViewportByIdLocked(displayId); viewport) { @@ -875,9 +879,11 @@ PointerChoreographer::ControllerConstructor PointerChoreographer::getStylusContr return ConstructorDelegate(std::move(ctor)); } +// --- PointerChoreographer::PointerChoreographerDisplayInfoListener --- + void PointerChoreographer::PointerChoreographerDisplayInfoListener::onWindowInfosChanged( const gui::WindowInfosUpdate& windowInfosUpdate) { - std::scoped_lock _l(mListenerLock); + std::scoped_lock _l(mLock); if (mPointerChoreographer == nullptr) { return; } @@ -885,25 +891,25 @@ void PointerChoreographer::PointerChoreographerDisplayInfoListener::onWindowInfo getPrivacySensitiveDisplaysFromWindowInfos(windowInfosUpdate.windowInfos); if (newPrivacySensitiveDisplays != mPrivacySensitiveDisplays) { mPrivacySensitiveDisplays = std::move(newPrivacySensitiveDisplays); - mPointerChoreographer->onPrivacySensitiveDisplaysChanged(mPrivacySensitiveDisplays); + // PointerChoreographer uses Listener's lock. + base::ScopedLockAssertion assumeLocked(mPointerChoreographer->getLock()); + mPointerChoreographer->onPrivacySensitiveDisplaysChangedLocked(mPrivacySensitiveDisplays); } } -void PointerChoreographer::PointerChoreographerDisplayInfoListener::setInitialDisplayInfos( +void PointerChoreographer::PointerChoreographerDisplayInfoListener::setInitialDisplayInfosLocked( const std::vector& windowInfos) { - std::scoped_lock _l(mListenerLock); mPrivacySensitiveDisplays = getPrivacySensitiveDisplaysFromWindowInfos(windowInfos); } std::unordered_set -PointerChoreographer::PointerChoreographerDisplayInfoListener::getPrivacySensitiveDisplays() { - std::scoped_lock _l(mListenerLock); +PointerChoreographer::PointerChoreographerDisplayInfoListener::getPrivacySensitiveDisplaysLocked() { return mPrivacySensitiveDisplays; } void PointerChoreographer::PointerChoreographerDisplayInfoListener:: onPointerChoreographerDestroyed() { - std::scoped_lock _l(mListenerLock); + std::scoped_lock _l(mLock); mPointerChoreographer = nullptr; } diff --git a/services/inputflinger/PointerChoreographer.h b/services/inputflinger/PointerChoreographer.h index 635487be6b..85f51e06bc 100644 --- a/services/inputflinger/PointerChoreographer.h +++ b/services/inputflinger/PointerChoreographer.h @@ -118,31 +118,38 @@ public: private: using PointerDisplayChange = std::optional< std::tuple>; - [[nodiscard]] PointerDisplayChange updatePointerControllersLocked() REQUIRES(mLock); - [[nodiscard]] PointerDisplayChange calculatePointerDisplayChangeToNotify() REQUIRES(mLock); + + // PointerChoreographer's DisplayInfoListener can outlive the PointerChoreographer because when + // the listener is registered and called from display thread, a strong pointer to the listener + // (which can extend its lifecycle) is given away. + // If we use two locks it can also cause deadlocks due to race in acquiring them between the + // display and reader thread. + // To avoid these problems we use DisplayInfoListener's lock in PointerChoreographer. + std::mutex& getLock() const; + + [[nodiscard]] PointerDisplayChange updatePointerControllersLocked() REQUIRES(getLock()); + [[nodiscard]] PointerDisplayChange calculatePointerDisplayChangeToNotify() REQUIRES(getLock()); const DisplayViewport* findViewportByIdLocked(ui::LogicalDisplayId displayId) const - REQUIRES(mLock); + REQUIRES(getLock()); ui::LogicalDisplayId getTargetMouseDisplayLocked(ui::LogicalDisplayId associatedDisplayId) const - REQUIRES(mLock); + REQUIRES(getLock()); std::pair - ensureMouseControllerLocked(ui::LogicalDisplayId associatedDisplayId) REQUIRES(mLock); - InputDeviceInfo* findInputDeviceLocked(DeviceId deviceId) REQUIRES(mLock); - bool canUnfadeOnDisplay(ui::LogicalDisplayId displayId) REQUIRES(mLock); + ensureMouseControllerLocked(ui::LogicalDisplayId associatedDisplayId) REQUIRES(getLock()); + InputDeviceInfo* findInputDeviceLocked(DeviceId deviceId) REQUIRES(getLock()); + bool canUnfadeOnDisplay(ui::LogicalDisplayId displayId) REQUIRES(getLock()); void fadeMouseCursorOnKeyPress(const NotifyKeyArgs& args); NotifyMotionArgs processMotion(const NotifyMotionArgs& args); - NotifyMotionArgs processMouseEventLocked(const NotifyMotionArgs& args) REQUIRES(mLock); - NotifyMotionArgs processTouchpadEventLocked(const NotifyMotionArgs& args) REQUIRES(mLock); - void processDrawingTabletEventLocked(const NotifyMotionArgs& args) REQUIRES(mLock); - void processTouchscreenAndStylusEventLocked(const NotifyMotionArgs& args) REQUIRES(mLock); - void processStylusHoverEventLocked(const NotifyMotionArgs& args) REQUIRES(mLock); + NotifyMotionArgs processMouseEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); + NotifyMotionArgs processTouchpadEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); + void processDrawingTabletEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); + void processTouchscreenAndStylusEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); + void processStylusHoverEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); void processDeviceReset(const NotifyDeviceResetArgs& args); - void onControllerAddedOrRemovedLocked() REQUIRES(mLock); + void onControllerAddedOrRemovedLocked() REQUIRES(getLock()); void onPrivacySensitiveDisplaysChangedLocked( const std::unordered_set& privacySensitiveDisplays) - REQUIRES(mLock); - void onPrivacySensitiveDisplaysChanged( - const std::unordered_set& privacySensitiveDisplays); + REQUIRES(getLock()); /* This listener keeps tracks of visible privacy sensitive displays and updates the * choreographer if there are any changes. @@ -156,49 +163,50 @@ private: explicit PointerChoreographerDisplayInfoListener(PointerChoreographer* pc) : mPointerChoreographer(pc){}; void onWindowInfosChanged(const gui::WindowInfosUpdate&) override; - void setInitialDisplayInfos(const std::vector& windowInfos); - std::unordered_set getPrivacySensitiveDisplays(); + void setInitialDisplayInfosLocked(const std::vector& windowInfos) + REQUIRES(mLock); + std::unordered_set getPrivacySensitiveDisplaysLocked() + REQUIRES(mLock); void onPointerChoreographerDestroyed(); + // This lock is also used by PointerChoreographer. See PointerChoreographer::getLock(). + std::mutex mLock; + private: - std::mutex mListenerLock; - PointerChoreographer* mPointerChoreographer GUARDED_BY(mListenerLock); + PointerChoreographer* mPointerChoreographer GUARDED_BY(mLock); std::unordered_set mPrivacySensitiveDisplays - GUARDED_BY(mListenerLock); + GUARDED_BY(mLock); }; - sp mWindowInfoListener GUARDED_BY(mLock); using ControllerConstructor = ConstructorDelegate()>>; - ControllerConstructor mTouchControllerConstructor GUARDED_BY(mLock); + ControllerConstructor mTouchControllerConstructor GUARDED_BY(getLock()); ControllerConstructor getMouseControllerConstructor(ui::LogicalDisplayId displayId) - REQUIRES(mLock); + REQUIRES(getLock()); ControllerConstructor getStylusControllerConstructor(ui::LogicalDisplayId displayId) - REQUIRES(mLock); - - std::mutex mLock; + REQUIRES(getLock()); InputListenerInterface& mNextListener; PointerChoreographerPolicyInterface& mPolicy; std::map> - mMousePointersByDisplay GUARDED_BY(mLock); + mMousePointersByDisplay GUARDED_BY(getLock()); std::map> mTouchPointersByDevice - GUARDED_BY(mLock); + GUARDED_BY(getLock()); std::map> mStylusPointersByDevice - GUARDED_BY(mLock); + GUARDED_BY(getLock()); std::map> mDrawingTabletPointersByDevice - GUARDED_BY(mLock); - - ui::LogicalDisplayId mDefaultMouseDisplayId GUARDED_BY(mLock); - ui::LogicalDisplayId mNotifiedPointerDisplayId GUARDED_BY(mLock); - std::vector mInputDeviceInfos GUARDED_BY(mLock); - std::set mMouseDevices GUARDED_BY(mLock); - std::vector mViewports GUARDED_BY(mLock); - bool mShowTouchesEnabled GUARDED_BY(mLock); - bool mStylusPointerIconEnabled GUARDED_BY(mLock); + GUARDED_BY(getLock()); + + ui::LogicalDisplayId mDefaultMouseDisplayId GUARDED_BY(getLock()); + ui::LogicalDisplayId mNotifiedPointerDisplayId GUARDED_BY(getLock()); + std::vector mInputDeviceInfos GUARDED_BY(getLock()); + std::set mMouseDevices GUARDED_BY(getLock()); + std::vector mViewports GUARDED_BY(getLock()); + bool mShowTouchesEnabled GUARDED_BY(getLock()); + bool mStylusPointerIconEnabled GUARDED_BY(getLock()); std::set mDisplaysWithPointersHidden; - ui::LogicalDisplayId mCurrentFocusedDisplay GUARDED_BY(mLock); + ui::LogicalDisplayId mCurrentFocusedDisplay GUARDED_BY(getLock()); protected: using WindowListenerRegisterConsumer = std::function( @@ -211,6 +219,10 @@ protected: const WindowListenerUnregisterConsumer& unregisterListener); private: + // WindowInfoListener object should always exist while PointerChoreographer exists, because we + // need to use the lock from it. But we don't always need to register the listener. + bool mIsWindowInfoListenerRegistered GUARDED_BY(getLock()); + const sp mWindowInfoListener; const WindowListenerRegisterConsumer mRegisterListener; const WindowListenerUnregisterConsumer mUnregisterListener; }; -- cgit v1.2.3-59-g8ed1b From 5cd7497f3e9d6869ff414c216c88b6eb3a57c6fc Mon Sep 17 00:00:00 2001 From: Arpit Singh Date: Mon, 25 Nov 2024 11:17:42 +0000 Subject: Refactor processing of relative pointer movements Refactor to extract common code that controls cursor movement of a relative mouse in processing of motion events in PointerChoreographer. Bug: 367660694 Test: atest inputflinger_tests Flag: EXEMPT refactor Change-Id: I7f8683f7cda7de6c7bcaf82ceb02dc54b70c71ee --- services/inputflinger/PointerChoreographer.cpp | 42 +++++++++++--------------- services/inputflinger/PointerChoreographer.h | 2 ++ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/services/inputflinger/PointerChoreographer.cpp b/services/inputflinger/PointerChoreographer.cpp index a67df58fe4..38e5974c3f 100644 --- a/services/inputflinger/PointerChoreographer.cpp +++ b/services/inputflinger/PointerChoreographer.cpp @@ -243,14 +243,7 @@ NotifyMotionArgs PointerChoreographer::processMouseEventLocked(const NotifyMotio pc.setPosition(args.xCursorPosition, args.yCursorPosition); } else { // This is a relative mouse, so move the cursor by the specified amount. - const float deltaX = args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X); - const float deltaY = args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y); - pc.move(deltaX, deltaY); - const auto [x, y] = pc.getPosition(); - newArgs.pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); - newArgs.pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); - newArgs.xCursorPosition = x; - newArgs.yCursorPosition = y; + processPointerDeviceMotionEventLocked(/*byref*/ newArgs, /*byref*/ pc); } if (canUnfadeOnDisplay(displayId)) { pc.unfade(PointerControllerInterface::Transition::IMMEDIATE); @@ -266,24 +259,9 @@ NotifyMotionArgs PointerChoreographer::processTouchpadEventLocked(const NotifyMo newArgs.displayId = displayId; if (args.getPointerCount() == 1 && args.classification == MotionClassification::NONE) { // This is a movement of the mouse pointer. - const float deltaX = args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X); - const float deltaY = args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y); - pc.move(deltaX, deltaY); - if (canUnfadeOnDisplay(displayId)) { - pc.unfade(PointerControllerInterface::Transition::IMMEDIATE); - } - - const auto [x, y] = pc.getPosition(); - newArgs.pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); - newArgs.pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); - newArgs.xCursorPosition = x; - newArgs.yCursorPosition = y; + processPointerDeviceMotionEventLocked(/*byref*/ newArgs, /*byref*/ pc); } else { // This is a trackpad gesture with fake finger(s) that should not move the mouse pointer. - if (canUnfadeOnDisplay(displayId)) { - pc.unfade(PointerControllerInterface::Transition::IMMEDIATE); - } - const auto [x, y] = pc.getPosition(); for (uint32_t i = 0; i < newArgs.getPointerCount(); i++) { newArgs.pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_X, @@ -294,9 +272,25 @@ NotifyMotionArgs PointerChoreographer::processTouchpadEventLocked(const NotifyMo newArgs.xCursorPosition = x; newArgs.yCursorPosition = y; } + if (canUnfadeOnDisplay(displayId)) { + pc.unfade(PointerControllerInterface::Transition::IMMEDIATE); + } return newArgs; } +void PointerChoreographer::processPointerDeviceMotionEventLocked(NotifyMotionArgs& newArgs, + PointerControllerInterface& pc) { + const float deltaX = newArgs.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_X); + const float deltaY = newArgs.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_RELATIVE_Y); + + pc.move(deltaX, deltaY); + const auto [x, y] = pc.getPosition(); + newArgs.pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); + newArgs.pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); + newArgs.xCursorPosition = x; + newArgs.yCursorPosition = y; +} + void PointerChoreographer::processDrawingTabletEventLocked(const android::NotifyMotionArgs& args) { if (args.displayId == ui::LogicalDisplayId::INVALID) { return; diff --git a/services/inputflinger/PointerChoreographer.h b/services/inputflinger/PointerChoreographer.h index 85f51e06bc..fba1aef260 100644 --- a/services/inputflinger/PointerChoreographer.h +++ b/services/inputflinger/PointerChoreographer.h @@ -145,6 +145,8 @@ private: void processDrawingTabletEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); void processTouchscreenAndStylusEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); void processStylusHoverEventLocked(const NotifyMotionArgs& args) REQUIRES(getLock()); + void processPointerDeviceMotionEventLocked(NotifyMotionArgs& newArgs, + PointerControllerInterface& pc) REQUIRES(getLock()); void processDeviceReset(const NotifyDeviceResetArgs& args); void onControllerAddedOrRemovedLocked() REQUIRES(getLock()); void onPrivacySensitiveDisplaysChangedLocked( -- cgit v1.2.3-59-g8ed1b