Skip to content

layersvt: Refactor DebugMarker to inherit from LayerBase - #32

Open
olehkuznetsov wants to merge 2 commits into
android-graphics:mainfrom
olehkuznetsov:pr-debugmarker
Open

layersvt: Refactor DebugMarker to inherit from LayerBase#32
olehkuznetsov wants to merge 2 commits into
android-graphics:mainfrom
olehkuznetsov:pr-debugmarker

Conversation

@olehkuznetsov

Copy link
Copy Markdown

Important

Dependent PR: This PR is stacked on top of #31 (layersvt_common foundation). Please review and merge #31 first.
The changes specific to this PR are in layersvt/debug_marker/ and layersvt/test/test_debugmarker.cpp.

Refactor the DebugMarker layer to inherit from LayerBase, replacing handwritten Vulkan lifecycle boilerplate and dispatch bookkeeping with shared layersvt_common infrastructure:

  • Inherit from LayerBase: inherit DebugMarker from LayerBase and configure LayerManifest with VK_EXT_debug_marker and VK_EXT_debug_utils extensions.
  • Dispatch & Instance Tracking: replace manual dispatch tables and physical device tracking maps with DispatchTableManager and DeviceInstanceTracker.
  • Boilerplate Elimination: remove handwritten vkCreateInstance, vkDestroyInstance, vkCreateDevice, vkDestroyDevice, and extension enumeration boilerplate from debug_marker_handwritten_dispatch.cpp.
  • Virtual Dispatch Hooks: implement GetLayerSpecificInstanceFunction and GetLayerSpecificDeviceFunction virtual hooks to dispatch debug marker and debug utils commands via DispatchDownstream.
  • Device Teardown Cleanup: override PostDestroyDevice to automatically clean up tracked debug objects associated with destroyed logical devices.
  • Cleanup: delete debug_marker_handwritten_functions.h header.
  • Unit Tests: add unit tests in test_debugmarker.cpp covering manifest queries, LayerBase lifecycle, object tracking cleanup, and dispatch fallback.

Bug:
Test: new tests - DebugMarkerTests

Implement the common layer support library (layersvt_common) as an
OBJECT library to provide shared, thread-safe infrastructure across
Vulkan layers:

- DeviceInstanceTracker: thread-safe VkPhysicalDevice to VkInstance
  mapping using std::shared_mutex with eager device enumeration
  (EagerMapDevices).
- DispatchTableManager: thread-safe instance and device dispatch table
  storage with DispatchDownstream compile-time dispatch helper and
  loader callback tracking.
- LayerManifest: declarative layer metadata container with downstream
  extension merging and Android b/143293104 compatibility workaround.
- LayerBase: standardized layer lifecycle implementation with runtime
  loader chain validation, teardown ordering, and extensible virtual
  hooks for custom command interception.
- layer_keep_alive: Android RTLD_NODELETE self-pinning with explicit
  EnsureLayerKeepAlive() to prevent static linker dead-stripping.
- log.h: cross-platform VT_LOGI, VT_LOGW, VT_LOGE logging macros.
- Unit test suite (test_common_layer) covering all common components,
  eager mapping, and lifecycle execution under a mock loader.

Bug:
Test: new tests
Change-Id: Id6bb4faeb1e545003242b61cbdf491356a6a6964
Refactor the DebugMarker layer to inherit from LayerBase, replacing
handwritten Vulkan lifecycle boilerplate and dispatch bookkeeping with
shared layersvt_common infrastructure:

- Inherit DebugMarker from LayerBase and configure LayerManifest with
  VK_EXT_debug_marker and VK_EXT_debug_utils extensions.
- Replace manual instance and device dispatch tables and physical
  device tracking with DispatchTableManager and DeviceInstanceTracker.
- Remove handwritten vkCreateInstance, vkDestroyInstance,
  vkCreateDevice, vkDestroyDevice, and extension enumeration
  boilerplate from debug_marker_handwritten_dispatch.cpp.
- Implement GetLayerSpecificInstanceFunction and
  GetLayerSpecificDeviceFunction virtual hooks to dispatch
  debug marker and debug utils commands via DispatchDownstream.
- Override PostDestroyDevice to automatically clean up tracked debug
  objects associated with destroyed logical devices.
- Delete debug_marker_handwritten_functions.h header.
- Add unit tests in test_debugmarker.cpp covering manifest queries,
  LayerBase lifecycle, object tracking cleanup, and dispatch fallback.

Bug:
Test: new tests - DebugMarkerTests
Change-Id: I5ad00681e85f15d0779ad5dcea806b8e6a6a6964
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant