This commit is contained in:
elwrcl committed 2026-06-06 13:25:15 +03:00
1 parent 04d4dc8b09
commit 818cab85dc
12511 files changed
+6156641

No files matched your search

@@ -0,0 +1,3 @@
x86_64 CtsGraphicsTestCases
x86_64 CtsNativeHardwareTestCases
x86_64 CtsSkQPTestCases
@@ -0,0 +1,27 @@
# First test run details: https://gallo.pages.freedesktop.org/-/mesa/-/jobs/78930621/artifacts/results/test_result.html
## First run result==fail
x86_64 CtsGraphicsTestCases android.graphics.cts.VulkanFeaturesTest#testVulkanHardwareFeatures
### Must support the core Vulkan 1.1
x86_64 CtsGraphicsTestCases android.graphics.cts.VulkanFeaturesTest#testVulkanApplicationBinaryInterfaceRequirements
### no support for ABP 2021
x86_64 CtsGraphicsTestCases android.graphics.cts.VulkanFeaturesTest#testAndroidBaselineProfile2021Support
# Appears to cause crashes with Android 16
x86_64 CtsGraphicsTestCases android.graphics.cts.SetFrameRateTest#testFixedSource_NonSeamless_arr
# Failed due to non-gfx issues
x86_64 CtsGraphicsTestCases android.graphics.fonts.SystemFontsTest#testFontsFallbackUnreadable[0]
x86_64 CtsGraphicsTestCases android.graphics.fonts.SystemFontsTest#testAvailableFonts_ReadOnlyFile[0]
# Instrumentation ran for longer than the configured timeout.
x86_64 CtsNativeHardwareTestCases android.hardware.nativehardware.cts.AHardwareBufferNativeTests#AHardwareBufferTest_AllocateLockUnlockDeallocateStressTest
# Invalid test, spec violation: https://gitlab.khronos.org/vulkan/vulkan/-/issues/4713
x86_64 CtsSkQPTestCases org.skia.skqp.SkQPRunner#UnitTest_VkBackendSurfaceMutableStateTest
# Can trigger a full system crash (DeadSystemException), making the device unresponsive and causing instrumentation to abort
x86_64 CtsGraphicsTestCases android.graphics.cts.AnimatorLeakTest#testPauseResume
@@ -0,0 +1,5 @@
# New failures with Android 16
dEQP-VK.synchronization.timeline_semaphore.wait_before_signal.write_blit_image_read_image_compute_indirect.image_128x128_r32g32b32a32_sfloat,Fail
dEQP-VK.synchronization.timeline_semaphore.wait_before_signal.write_copy_buffer_to_image_read_copy_image.image_128x128_r8g8b8a8_unorm,Fail
dEQP-VK.synchronization2.timeline_semaphore.wait_before_signal.write_blit_image_read_image_vertex.image_128x128_r16g16b16a16_uint,Fail
dEQP-VK.synchronization2.timeline_semaphore.wait_before_signal.write_copy_buffer_to_image_read_image_tess_eval.image_128x128_r8g8b8a8_unorm,Fail
@@ -0,0 +1,17 @@
## This test mostly times out
ahb-dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.device_only.import_multiple_times
ahb-dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.host_visible.import_multiple_times
ahb-dEQP-VK.api.external.memory.android_hardware_buffer.suballocated.device_only.import_multiple_times
ahb-dEQP-VK.api.external.memory.android_hardware_buffer.suballocated.host_visible.import_multiple_times
# These can cause hangs
dEQP-VK.robustness.buffer_access.*
dEQP-VK.robustness.pipeline_robustness_buffer_access.*
dEQP-VK.robustness.robustness2.*
dEQP-VK.synchronization.op.multi_queue.*
dEQP-VK.synchronization2.op.multi_queue.*
dEQP-VK.synchronization.timeline_semaphore.*
dEQP-VK.synchronization2.timeline_semaphore.*
# Mainly for testing platform features. Skip as take too long. Flaky on both ANV and Turnip.
awsi-dEQP-VK.wsi.android.incremental_present.*
@@ -0,0 +1,2 @@
# Turnip host failure
dEQP-VK.transform_feedback.simple_fast_gpl.draw_indirect_counter_offset_244,Fail
@@ -0,0 +1,6 @@
# Triggers an assertion on the Turnip host and hangs Cuttlefish
# virgl_render_server: ../src/freedreno/vulkan/tu_knl_drm_msm.cc:1400: VkResult msm_queue_submit(tu_queue*, void*, vk_sync_wait*, uint32_t, vk_sync_signal*, uint32_t, tu_u_trace_submission_data*): Assertion `errno_ != EINVAL' failed.
dEQP-VK.sparse_resources.*
# Mainly for testing platform features. Skip as take too long. Flaky on both ANV and Turnip.
awsi-dEQP-VK.wsi.android.incremental_present.*
@@ -0,0 +1,37 @@
# Android-specific vkcts test set
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = ["/data/deqp/vk-main.txt"]
include = ["dEQP-VK.api.external.memory.android_hardware_buffer.*"]
timeout = 120
prefix = "ahb-"
renderer_check = "Virtio-GPU Venus.*Intel"
# Vulkan WSI test set
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = ["/data/deqp/vk-main.txt"]
include = ["dEQP-VK.wsi.android.*"]
timeout = 120
prefix = "awsi-"
# Basic fractioned vkcts test set
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = [ "/data/deqp/vk-main.txt" ]
tests_per_group = 10000
skips = ["/data/deqp/android-skips.txt"]
timeout = 120
fraction = 100
# EGL test set
[[deqp]]
deqp = "/data/deqp/deqp-egl-android"
caselists = ["/data/deqp/egl-main.txt"]
deqp_args = [
"--deqp-surface-width=256",
"--deqp-surface-height=256",
"--deqp-surface-type=pbuffer",
"--deqp-gl-config-name=rgba8888d24s8ms0",
"--deqp-visibility=hidden"
]
@@ -0,0 +1,37 @@
# Android-specific vkcts test set
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = ["/data/deqp/vk-main.txt"]
include = ["dEQP-VK.api.external.memory.android_hardware_buffer.*"]
timeout = 120
prefix = "ahb-"
renderer_check = "Virtio-GPU Venus.*Adreno"
# Vulkan WSI test set
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = ["/data/deqp/vk-main.txt"]
include = ["dEQP-VK.wsi.android.*"]
timeout = 120
prefix = "awsi-"
# Basic fractioned vkcts test set
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = [ "/data/deqp/vk-main.txt" ]
tests_per_group = 10000
skips = ["/data/deqp/android-skips.txt"]
timeout = 120
fraction = 100
# EGL test set
[[deqp]]
deqp = "/data/deqp/deqp-egl-android"
caselists = ["/data/deqp/egl-main.txt"]
deqp_args = [
"--deqp-surface-width=256",
"--deqp-surface-height=256",
"--deqp-surface-type=pbuffer",
"--deqp-gl-config-name=rgba8888d24s8ms0",
"--deqp-visibility=hidden"
]
@@ -0,0 +1,10 @@
[[deqp]]
deqp = "/data/deqp/deqp-egl-android"
caselists = ["/data/deqp/egl-main.txt"]
deqp_args = [
"--deqp-surface-width=256",
"--deqp-surface-height=256",
"--deqp-surface-type=pbuffer",
"--deqp-gl-config-name=rgba8888d24s8ms0",
"--deqp-visibility=hidden"
]
+5
View File
@@ -0,0 +1,5 @@
[[deqp]]
deqp = "/data/deqp/deqp-vk"
caselists = [ "/data/deqp/vk-main.txt" ]
timeout = 30.0 # Starting lots of Crosvm instances simultaneously can take some time
renderer_check = "Virtio-GPU Venus.*llvmpipe"
+6
View File
@@ -0,0 +1,6 @@
[[deqp]]
deqp = "/deqp-vk/external/vulkancts/modules/vulkan/deqp-vk"
caselists = [ "/deqp-vk/mustpass/vk-main.txt" ]
timeout = 30.0 # Starting lots of Crosvm instances simultaneously can take some time
renderer_check = "Virtio-GPU Venus.*llvmpipe"
tests_per_group = 5000
+101
View File
@@ -0,0 +1,101 @@
.venus-rules:
rules:
- !reference [.test, rules]
- !reference [.vulkan-rules, rules]
- changes: &venus_file_list
- src/virtio/**/*
when: on_success
.venus-manual-rules:
rules:
- !reference [.test, rules]
- !reference [.vulkan-manual-rules, rules]
- changes: *venus_file_list
when: manual
.venus-collabora-rules:
rules:
- !reference [.test, rules]
- !reference [.collabora-farm-rules, rules]
- !reference [.vulkan-rules, rules]
- changes: *venus_file_list
when: on_success
.venus-collabora-manual-rules:
rules:
- !reference [.test, rules]
- !reference [.collabora-farm-manual-rules, rules]
- !reference [.vulkan-manual-rules, rules]
- changes: *venus_file_list
when: manual
.venus-lavapipe-rules:
stage: layered-backends
rules:
- !reference [.venus-rules, rules]
- !reference [.lavapipe-rules, rules]
.venus-lavapipe-manual-rules:
stage: layered-backends-nightly
extends: .no-auto-retry
rules:
- !reference [.venus-manual-rules, rules]
- !reference [.lavapipe-manual-rules, rules]
.venus-anv-rules:
stage: layered-backends
rules:
- !reference [.venus-collabora-rules, rules]
- !reference [.anv-rules, rules]
.venus-anv-manual-rules:
stage: layered-backends-nightly
extends: .no-auto-retry
rules:
- !reference [.venus-collabora-manual-rules, rules]
- !reference [.anv-manual-rules, rules]
.venus-tu-rules:
stage: layered-backends
rules:
- !reference [.venus-collabora-rules, rules]
- !reference [.collabora-turnip-rules, rules]
.venus-tu-manual-rules:
stage: layered-backends-nightly
extends: .no-auto-retry
rules:
- !reference [.venus-collabora-manual-rules, rules]
- !reference [.collabora-turnip-manual-rules, rules]
.venus-lavapipe-test:
extends:
- .test-vk
- .test-crosvm
- .venus-lavapipe-rules
timeout: 15m
variables:
VK_DRIVER: virtio
CROSVM_GALLIUM_DRIVER: "llvmpipe"
CROSVM_VK_DRIVER: "lvp"
CROSVM_GPU_ARGS: "vulkan=true,gles=false,backend=virglrenderer,egl=true,surfaceless=true,fixed-blob-mapping=false"
tags:
- $FDO_RUNNER_JOB_PRIORITY_TAG_X86_64_KVM
.android-angle-venus-anv-test:
extends:
- .lava-x86_64-test-android
- .anv-test
- .test-angle
variables:
CUTTLEFISH_GPU_MODE: venus_guest_angle
VK_DRIVER: intel
.android-angle-venus-tu-test:
extends:
- .lava-arm64-test-android
- .test-angle
variables:
CUTTLEFISH_GPU_MODE: venus_guest_angle
VK_DRIVER: freedreno
+102
View File
@@ -0,0 +1,102 @@
include:
- local: 'src/virtio/ci/gitlab-ci-inc.yml'
venus-lavapipe:
extends:
- .deqp-test
- .venus-lavapipe-test
variables:
DEQP_FRACTION: 60
DEQP_SUITE: venus
GPU_VERSION: venus
LP_NUM_THREADS: 2
CROSVM_MEMORY: 12288
CROSVM_CPU: $FDO_CI_CONCURRENT
FLAKES_CHANNEL: "#virgl-ci"
script: |
export LD_LIBRARY_PATH="$CI_PROJECT_DIR/install/lib"
export LIBGL_DRIVERS_PATH="$CI_PROJECT_DIR/install/lib/dri"
./install/crosvm-runner.sh ./install/deqp-runner.sh
venus-lavapipe-full:
extends:
- venus-lavapipe
- .venus-lavapipe-manual-rules
timeout: 3h
variables:
DEQP_FRACTION: 6 # 1 would take 12h so this is as close as we can get
.android-venus-lavapipe:
extends:
- .test-android
- .venus-lavapipe-manual-rules
variables:
CUTTLEFISH_GPU_MODE: venus
GPU_VERSION: venus
DEQP_SUITE: android-venus
# TODO: define DEQP_FRACTION?
.android-venus-angle-lavapipe:
extends:
- .test-android
- .venus-lavapipe-manual-rules
- .test-angle
variables:
CUTTLEFISH_GPU_MODE: venus_guest_angle
GPU_VERSION: venus
DEQP_SUITE: android-venus-angle
# TODO: define DEQP_FRACTION?
android-angle-venus-anv-cml:
extends:
- .android-angle-venus-anv-test
- .lava-asus-C436FA-Flip-hatch:x86_64
- .venus-anv-rules
variables:
DEQP_SUITE: android-angle-venus-anv
GPU_VERSION: android-angle-venus-anv
HWCI_KERNEL_MODULES: "i915,vhost_vsock"
parallel: 3
android-angle-venus-anv-cml-cts:
extends:
- .android-angle-venus-anv-test
- .lava-asus-C436FA-Flip-hatch:x86_64
- .test-android-cts
- .venus-anv-manual-rules
variables:
GPU_VERSION: android-angle-venus-anv
HWCI_KERNEL_MODULES: "i915,vhost_vsock"
DEVICE_HANGING_TIMEOUT_SEC: 5400 # Android CTS might not print anything for minutes
timeout: 2h
android-angle-venus-anv-tgl:
extends:
- .android-angle-venus-anv-test
- .lava-acer-cp514-2h-1130g7-volteer:x86_64
- .venus-anv-manual-rules
variables:
DEQP_SUITE: android-angle-venus-anv
GPU_VERSION: android-angle-venus-anv
HWCI_KERNEL_MODULES: "i915,vhost_vsock"
timeout: 1h 30m
android-angle-venus-anv-adl:
extends:
- .android-angle-venus-anv-test
- .lava-acer-cbv514-1h-34uz-brya:x86_64
- .venus-anv-manual-rules
variables:
DEQP_SUITE: android-angle-venus-anv
GPU_VERSION: android-angle-venus-anv
HWCI_KERNEL_MODULES: "xe,vhost_vsock"
android-angle-venus-tu-a618:
extends:
- .android-angle-venus-tu-test
- .lava-sc7180-trogdor-kingoftown:arm64
- .venus-tu-manual-rules
variables:
DEQP_SUITE: android-angle-venus-tu
GPU_VERSION: android-angle-venus-tu
FDO_CI_CONCURRENT: 6 # We get OOMkills if we go too wide since VKCTS 1.4.4.0
+24
View File
@@ -0,0 +1,24 @@
dEQP-VK.api.external.memory.dma_buf.dedicated.buffer.info,Fail
dEQP-VK.api.external.memory.opaque_fd.dedicated.buffer.info,Fail
dEQP-VK.api.external.memory.opaque_fd.suballocated.buffer.info,Fail
dEQP-VK.draw.renderpass.basic_draw.misc.maintenance5,Crash
dEQP-VK.pipeline.monolithic.timestamp.misc_tests.consistent_results,Fail
# From venus-lavapipe-full
dEQP-VK.draw.renderpass.multiple_interpolation.structured.with_sample_decoration.4_samples,Fail
# Failed with native lavapipe as well with "Non-standard block shape used"
dEQP-VK.sparse_resources.image_block_shapes.2d.g8b8g8r8_422_unorm.samples_1,Fail
dEQP-VK.sparse_resources.image_block_shapes.2d.b8g8r8g8_422_unorm.samples_1,Fail
dEQP-VK.sparse_resources.image_block_shapes.2d_array.g8b8g8r8_422_unorm.samples_1,Fail
dEQP-VK.sparse_resources.image_block_shapes.2d_array.b8g8r8g8_422_unorm.samples_1,Fail
# Failed with native lavapipe as well
dEQP-VK.mesh_shader.ext.misc.emit_in_control_flow_bad_emit_last,Fail
dEQP-VK.mesh_shader.ext.smoke.fast_lib.depth_only_points_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.fast_lib.depth_only_triangles_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.monolithic.depth_only_points_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.monolithic.depth_only_triangles_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.optimized_lib.depth_only_points_position_components,Fail
dEQP-VK.mesh_shader.ext.smoke.optimized_lib.depth_only_triangles_position_components,Fail
+17
View File
@@ -0,0 +1,17 @@
dEQP-VK.pipeline.monolithic.timestamp.calibrated.calibration_test
dEQP-VK.robustness.buffer_access.through_pointers.graphics.writes.fragment.32B_in_memory_with_vec4_s32
dEQP-VK.transform_feedback.primitives_generated_query.get.*reset.*
# Seen in https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/1364513
dEQP-VK.api.image_clearing.dedicated_allocation.clear_color_image.2d.linear.remaining_array_layers.b10g11r11_ufloat_pack32
dEQP-VK.renderpasses.dynamic_rendering.graphics_pipeline_library.dedicated_allocation.formats.a8b8g8r8_unorm_pack32.input.clear.store.self_dep_draw
dEQP-VK.renderpasses.dynamic_rendering.graphics_pipeline_library.suballocation.formats.a8b8g8r8_unorm_pack32.input.load.store.self_dep_clear_draw
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.suballocation.formats.a8b8g8r8_unorm_pack32.input.clear.store.self_dep_draw
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.suballocation.formats.r8g8b8a8_unorm.input.dont_care.store.self_dep_clear_draw
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.suballocation.formats.r8g8b8a8_unorm.input.load.store.self_dep_clear_draw
dEQP-VK.image.host_image_copy.draw_r32g32b32a32_sfloat_r32g32b32a32_sfloat.host_transition_host_copy.memory_to_image.transfer_src_transfer_dst.shader_read_only_optimal.optimal.0_4_4.16x16
+81
View File
@@ -0,0 +1,81 @@
# These are taking too much memory (7.6GB and 6.2GB respectively) and can cause EOM issues
dEQP-VK.api.object_management.max_concurrent.graphics_pipeline
dEQP-VK.api.object_management.max_concurrent.compute_pipeline
# Can timeout
dEQP-VK.api.descriptor_pool.repeated_free_reset_long
dEQP-VK.api.info.image_format_properties2.2d.linear.g12x4_b12x4r12x4_2plane_422_unorm_3pack16
dEQP-VK.api.info.vulkan1p2.feature_bits_influence
dEQP-VK.binding_model.mutable_descriptor.multiple_arrays.constant_size.aliasing.update_copy.mutable_source.normal_source.pool_same_types.update_after_bind.index_constant.comp
dEQP-VK.binding_model.mutable_descriptor.multiple_arrays.constant_size.aliasing.update_write.no_source.no_source.pool_expand_types.pre_update.index_push_constant.comp
dEQP-VK.binding_model.mutable_descriptor.multiple_arrays.unbounded.aliasing.update_copy.mutable_source.host_only_source.pool_same_types.update_after_bind.index_constant.comp
dEQP-VK.binding_model.mutable_descriptor.multiple_arrays.unbounded.noaliasing.update_copy.mutable_source.normal_source.pool_same_types.pre_update.index_push_constant.comp
dEQP-VK.binding_model.mutable_descriptor.multiple_arrays.unbounded.noaliasing.update_copy.nonmutable_source.host_only_source.pool_expand_types.pre_update.index_push_constant.comp
dEQP-VK.glsl.texture_functions.query.texturesize.isampler3d_fragment
dEQP-VK.memory.requirements.core.image.regular_tiling_linear
dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_graphics
dEQP-VK.synchronization.timeline_semaphore.device_host.write_copy_buffer_read_ubo_compute.buffer_16384
dEQP-VK.synchronization.timeline_semaphore.device_host.write_copy_buffer_to_image_read_copy_image.image_128x128_r16g16b16a16_uint
dEQP-VK.synchronization.timeline_semaphore.device_host.write_copy_image_read_blit_image.image_64x64x8_r32_sfloat
dEQP-VK.synchronization.timeline_semaphore.device_host.write_copy_image_to_buffer_read_ssbo_vertex.buffer_262144
dEQP-VK.synchronization.timeline_semaphore.device_host.write_image_compute_indirect_read_image_vertex.image_128x128_r8_unorm
dEQP-VK.synchronization.timeline_semaphore.device_host.write_image_compute_read_image_geometry.image_128_r32_uint
dEQP-VK.synchronization.timeline_semaphore.device_host.write_image_vertex_read_copy_image.image_128x128_r16g16b16a16_uint
dEQP-VK.synchronization.timeline_semaphore.device_host.write_ssbo_vertex_read_ssbo_compute_indirect.buffer_262144
dEQP-VK.synchronization.timeline_semaphore.device_host.write_ssbo_vertex_read_ssbo_tess_control.buffer_262144
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_linear_linear_mipmap_linear_clamp
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_linear_linear_mipmap_nearest_clamp
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_linear_linear_mipmap_nearest_repeat
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_linear_nearest_mipmap_linear_clamp
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_linear_nearest_mipmap_linear_repeat
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_nearest_linear_mipmap_linear_repeat
# Can crash since host lvp can return VK_ERROR_OUT_OF_DEVICE_MEMORY during those tests
dEQP-VK.binding_model.mutable_descriptor.multiple_arrays_mixed.*
# Trying to allocate all the memory we can is not a great idea on shared runners.
dEQP-VK.api.device_init.create_instance_device_intentional_alloc_fail.*
# New timeouts in 1.4.1.1
dEQP-VK.synchronization.internally_synchronized_objects.pipeline_cache_compute
dEQP-VK.texture.explicit_lod.2d.sizes.128x128_nearest_linear_mipmap_nearest_clamp
# 60s timeout (flake), unknown when it appeard
dEQP-VK.ubo.random.16bit.all_per_block_buffers.8
dEQP-VK.spirv_assembly.instruction.graphics.8bit_storage.struct_mixed_types.storage_buffer_frag
# Timeout in venus-lavapipe-full
dEQP-VK.ray_query.acceleration_structures.dynamic_indexing.sparse_binding_structures.dynamic_indexing
dEQP-VK.ray_tracing_pipeline.acceleration_structures.dynamic_indexing.sparse_binding_structures.dynamic_indexing
dEQP-VK.ray_tracing_pipeline.acceleration_structures.dynamic_indexing.traditional_structures.dynamic_indexing
dEQP-VK.ray_tracing_pipeline.build.gpu.level_instances.triangles_65536_1_1
dEQP-VK.ray_tracing_pipeline.misc.cullmask_AABB_extrabits
dEQP-VK.ray_tracing_pipeline.misc.cullmask_tri
dEQP-VK.ray_tracing_pipeline.misc.recursiveTraces_tri_15
dEQP-VK.ray_tracing_pipeline.trace_rays_cmds_maintenance_1.indirect2_cpu.11_13_5
dEQP-VK.ray_tracing_pipeline.watertightness.closedFan2.1024
# New timeouts with VKCTS 1.4.4.0
dEQP-VK.pipeline.fast_linked_library.blend.dual_source.multi_attachments.b5g5r5a1_unorm_pack16
dEQP-VK.pipeline.fast_linked_library.blend.dual_source.multi_attachments.r5g5b5a1_unorm_pack16
dEQP-VK.pipeline.monolithic.blend.dual_source.multi_attachments.b4g4r4a4_unorm_pack16
dEQP-VK.pipeline.monolithic.blend.dual_source.multi_attachments.b5g5r5a1_unorm_pack16
dEQP-VK.pipeline.monolithic.blend.dual_source.multi_attachments.r32g32b32a32_sfloat
dEQP-VK.pipeline.pipeline_library.blend.dual_source.multi_attachments.a2b10g10r10_unorm_pack32
dEQP-VK.ray_tracing_pipeline.trace_rays_indirect2.indirect_gpu.partial_copy.submit_compute.47x19x4
# Skip broken tests:
# https://gerrit.khronos.org/c/vk-gl-cts/+/15969
# https://gerrit.khronos.org/c/vk-gl-cts/+/19422
# https://gerrit.khronos.org/c/vk-gl-cts/+/19625
dEQP-VK.image.swapchain_mutable.direct_drm.*
dEQP-VK.wsi.acquire_drm_display.*
dEQP-VK.wsi.direct_drm.*
# New timeouts since https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40211
dEQP-VK.api.external.fence.sync_fd.export_multiple_times_temporary
dEQP-VK.api.external.semaphore.sync_fd.export_multiple_times_temporary
# Skip flaky memory pressure related tests
dEQP-VK.memory.allocation.basic.percent_1.*
dEQP-VK.memory.allocation.random.*
+223
View File
@@ -0,0 +1,223 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
use std::collections::VecDeque;
use std::mem::size_of;
use mesa3d_util::AsBorrowedDescriptor;
use mesa3d_util::MesaError;
use mesa3d_util::MesaHandle;
use mesa3d_util::MesaResult;
use mesa3d_util::OwnedDescriptor;
use mesa3d_util::Reader;
use mesa3d_util::Tube;
use mesa3d_util::Writer;
use mesa3d_util::MESA_HANDLE_TYPE_SIGNAL_EVENT_FD;
use zerocopy::FromBytes;
use zerocopy::Immutable;
use zerocopy::IntoBytes;
use crate::protocols::kumquat_gpu_protocol::*;
const MAX_COMMAND_SIZE: usize = 4096;
pub struct KumquatStream {
stream: Tube,
write_buffer: [u8; MAX_COMMAND_SIZE],
read_buffer: [u8; MAX_COMMAND_SIZE],
}
impl KumquatStream {
pub fn new(stream: Tube) -> KumquatStream {
KumquatStream {
stream,
write_buffer: [0; MAX_COMMAND_SIZE],
read_buffer: [0; MAX_COMMAND_SIZE],
}
}
pub fn write<T: FromBytes + IntoBytes + Immutable>(
&mut self,
encode: KumquatGpuProtocolWrite<T>,
) -> MesaResult<()> {
let mut writer = Writer::new(&mut self.write_buffer);
let array: &[OwnedDescriptor] = match encode {
KumquatGpuProtocolWrite::Cmd(cmd) => {
writer.write_obj(cmd)?;
&[]
}
KumquatGpuProtocolWrite::CmdWithHandle(cmd, handle) => {
writer.write_obj(cmd)?;
&[handle.os_handle]
}
KumquatGpuProtocolWrite::CmdWithData(cmd, data) => {
writer.write_obj(cmd)?;
writer.write_all(&data)?;
&[]
}
};
let bytes_written = writer.bytes_written();
self.stream
.send(&self.write_buffer[0..bytes_written], array)?;
Ok(())
}
pub fn read(&mut self) -> MesaResult<Vec<KumquatGpuProtocol>> {
let mut vec: Vec<KumquatGpuProtocol> = Vec::new();
let (bytes_read, descriptor_vec) = self.stream.receive(&mut self.read_buffer)?;
let mut descriptors: VecDeque<OwnedDescriptor> = descriptor_vec.into();
if bytes_read == 0 {
vec.push(KumquatGpuProtocol::OkNoData);
return Ok(vec);
}
let mut reader = Reader::new(&self.read_buffer[0..bytes_read]);
while reader.available_bytes() != 0 {
let hdr = reader.peek_obj::<kumquat_gpu_protocol_ctrl_hdr>()?;
let protocol = match hdr.type_ {
KUMQUAT_GPU_PROTOCOL_GET_NUM_CAPSETS => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::GetNumCapsets
}
KUMQUAT_GPU_PROTOCOL_GET_CAPSET_INFO => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::GetCapsetInfo(hdr.payload)
}
KUMQUAT_GPU_PROTOCOL_GET_CAPSET => {
KumquatGpuProtocol::GetCapset(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_CTX_CREATE => {
KumquatGpuProtocol::CtxCreate(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_CTX_DESTROY => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::CtxDestroy(hdr.payload)
}
KUMQUAT_GPU_PROTOCOL_CTX_ATTACH_RESOURCE => {
KumquatGpuProtocol::CtxAttachResource(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_CTX_DETACH_RESOURCE => {
KumquatGpuProtocol::CtxDetachResource(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_3D => {
KumquatGpuProtocol::ResourceCreate3d(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_TRANSFER_TO_HOST_3D => {
let os_handle = descriptors.pop_front().ok_or(MesaError::Unsupported)?;
let resp: kumquat_gpu_protocol_transfer_host_3d = reader.read_obj()?;
let handle = MesaHandle {
os_handle,
handle_type: MESA_HANDLE_TYPE_SIGNAL_EVENT_FD,
};
KumquatGpuProtocol::TransferToHost3d(resp, handle)
}
KUMQUAT_GPU_PROTOCOL_TRANSFER_FROM_HOST_3D => {
let os_handle = descriptors.pop_front().ok_or(MesaError::Unsupported)?;
let resp: kumquat_gpu_protocol_transfer_host_3d = reader.read_obj()?;
let handle = MesaHandle {
os_handle,
handle_type: MESA_HANDLE_TYPE_SIGNAL_EVENT_FD,
};
KumquatGpuProtocol::TransferFromHost3d(resp, handle)
}
KUMQUAT_GPU_PROTOCOL_SUBMIT_3D => {
let cmd: kumquat_gpu_protocol_cmd_submit = reader.read_obj()?;
if reader.available_bytes() < cmd.size.try_into()? {
// Large command buffers should handled via shared memory.
return Err(MesaError::Unsupported);
} else if reader.available_bytes() != 0 {
let num_in_fences = cmd.num_in_fences as usize;
let cmd_size = cmd.size as usize;
let mut cmd_buf = vec![0; cmd_size];
let mut fence_ids: Vec<u64> = Vec::with_capacity(num_in_fences);
for _ in 0..num_in_fences {
match reader.read_obj::<u64>() {
Ok(fence_id) => {
fence_ids.push(fence_id);
}
Err(_) => return Err(MesaError::Unsupported),
}
}
reader.read_exact(&mut cmd_buf[..])?;
KumquatGpuProtocol::CmdSubmit3d(cmd, cmd_buf, fence_ids)
} else {
KumquatGpuProtocol::CmdSubmit3d(cmd, Vec::new(), Vec::new())
}
}
KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_BLOB => {
KumquatGpuProtocol::ResourceCreateBlob(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_SNAPSHOT_SAVE => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::SnapshotSave
}
KUMQUAT_GPU_PROTOCOL_SNAPSHOT_RESTORE => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::SnapshotRestore
}
KUMQUAT_GPU_PROTOCOL_RESP_NUM_CAPSETS => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::RespNumCapsets(hdr.payload)
}
KUMQUAT_GPU_PROTOCOL_RESP_CAPSET_INFO => {
KumquatGpuProtocol::RespCapsetInfo(reader.read_obj()?)
}
KUMQUAT_GPU_PROTOCOL_RESP_CAPSET => {
let len: usize = hdr.payload.try_into()?;
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
let mut capset: Vec<u8> = vec![0; len];
reader.read_exact(&mut capset)?;
KumquatGpuProtocol::RespCapset(capset)
}
KUMQUAT_GPU_PROTOCOL_RESP_CONTEXT_CREATE => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::RespContextCreate(hdr.payload)
}
KUMQUAT_GPU_PROTOCOL_RESP_RESOURCE_CREATE => {
let os_handle = descriptors.pop_front().ok_or(MesaError::Unsupported)?;
let resp: kumquat_gpu_protocol_resp_resource_create = reader.read_obj()?;
let handle = MesaHandle {
os_handle,
handle_type: resp.handle_type,
};
KumquatGpuProtocol::RespResourceCreate(resp, handle)
}
KUMQUAT_GPU_PROTOCOL_RESP_CMD_SUBMIT_3D => {
let os_handle = descriptors.pop_front().ok_or(MesaError::Unsupported)?;
let resp: kumquat_gpu_protocol_resp_cmd_submit_3d = reader.read_obj()?;
let handle = MesaHandle {
os_handle,
handle_type: resp.handle_type,
};
KumquatGpuProtocol::RespCmdSubmit3d(resp.fence_id, handle)
}
KUMQUAT_GPU_PROTOCOL_RESP_OK_SNAPSHOT => {
reader.consume(size_of::<kumquat_gpu_protocol_ctrl_hdr>());
KumquatGpuProtocol::RespOkSnapshot
}
_ => {
return Err(MesaError::Unsupported);
}
};
vec.push(protocol);
}
Ok(vec)
}
pub fn as_borrowed_descriptor(&self) -> &OwnedDescriptor {
self.stream.as_borrowed_descriptor()
}
}
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
pub mod kumquat_stream;
pub use kumquat_stream::KumquatStream;
+5
View File
@@ -0,0 +1,5 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
pub mod ipc;
pub mod protocols;
+12
View File
@@ -0,0 +1,12 @@
# Copyright © 2024 Google
# SPDX-License-Identifier: MIT
libmesa_protocols = static_library(
'mesa3d_protocols',
'lib.rs',
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
rust_args : rust_global_args,
link_with: [libmesa_rust_util],
dependencies: dep_mesa3d_util
)
@@ -0,0 +1,270 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
//! Protocol based on ${crosvm_src}/devices/src/virtio/gpu/protocol.rs
use mesa3d_util::MesaHandle;
use zerocopy::FromBytes;
use zerocopy::Immutable;
use zerocopy::IntoBytes;
/// A unique identifier for a device.
#[derive(
Copy,
Clone,
Debug,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
FromBytes,
IntoBytes,
Immutable,
)]
#[repr(C)]
pub struct DeviceId {
pub device_uuid: [u8; 16],
pub driver_uuid: [u8; 16],
}
/// Memory index and physical device id of the associated VkDeviceMemory.
#[derive(
Copy,
Clone,
Debug,
Default,
PartialEq,
Eq,
PartialOrd,
Ord,
Hash,
FromBytes,
IntoBytes,
Immutable,
)]
#[repr(C)]
pub struct VulkanInfo {
pub memory_idx: u32,
pub device_id: DeviceId,
}
/* 2d commands */
pub const KUMQUAT_GPU_PROTOCOL_RESOURCE_UNREF: u32 = 0x100;
pub const KUMQUAT_GPU_PROTOCOL_GET_NUM_CAPSETS: u32 = 0x101;
pub const KUMQUAT_GPU_PROTOCOL_GET_CAPSET_INFO: u32 = 0x102;
pub const KUMQUAT_GPU_PROTOCOL_GET_CAPSET: u32 = 0x103;
pub const KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_BLOB: u32 = 0x104;
/* 3d commands */
pub const KUMQUAT_GPU_PROTOCOL_CTX_CREATE: u32 = 0x200;
pub const KUMQUAT_GPU_PROTOCOL_CTX_DESTROY: u32 = 0x201;
pub const KUMQUAT_GPU_PROTOCOL_CTX_ATTACH_RESOURCE: u32 = 0x202;
pub const KUMQUAT_GPU_PROTOCOL_CTX_DETACH_RESOURCE: u32 = 0x203;
pub const KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_3D: u32 = 0x204;
pub const KUMQUAT_GPU_PROTOCOL_TRANSFER_TO_HOST_3D: u32 = 0x205;
pub const KUMQUAT_GPU_PROTOCOL_TRANSFER_FROM_HOST_3D: u32 = 0x206;
pub const KUMQUAT_GPU_PROTOCOL_SUBMIT_3D: u32 = 0x207;
pub const KUMQUAT_GPU_PROTOCOL_RESOURCE_MAP_BLOB: u32 = 0x208;
pub const KUMQUAT_GPU_PROTOCOL_RESOURCE_UNMAP_BLOB: u32 = 0x209;
pub const KUMQUAT_GPU_PROTOCOL_SNAPSHOT_SAVE: u32 = 0x208;
pub const KUMQUAT_GPU_PROTOCOL_SNAPSHOT_RESTORE: u32 = 0x209;
/* success responses */
pub const KUMQUAT_GPU_PROTOCOL_RESP_NODATA: u32 = 0x3001;
pub const KUMQUAT_GPU_PROTOCOL_RESP_NUM_CAPSETS: u32 = 0x3002;
pub const KUMQUAT_GPU_PROTOCOL_RESP_CAPSET_INFO: u32 = 0x3003;
pub const KUMQUAT_GPU_PROTOCOL_RESP_CAPSET: u32 = 0x3004;
pub const KUMQUAT_GPU_PROTOCOL_RESP_CONTEXT_CREATE: u32 = 0x3005;
pub const KUMQUAT_GPU_PROTOCOL_RESP_RESOURCE_CREATE: u32 = 0x3006;
pub const KUMQUAT_GPU_PROTOCOL_RESP_CMD_SUBMIT_3D: u32 = 0x3007;
pub const KUMQUAT_GPU_PROTOCOL_RESP_OK_SNAPSHOT: u32 = 0x3008;
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_ctrl_hdr {
pub type_: u32,
pub payload: u32,
}
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_box {
pub x: u32,
pub y: u32,
pub z: u32,
pub w: u32,
pub h: u32,
pub d: u32,
}
/* KUMQUAT_GPU_PROTOCOL_TRANSFER_TO_HOST_3D, KUMQUAT_GPU_PROTOCOL_TRANSFER_FROM_HOST_3D */
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_transfer_host_3d {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub box_: kumquat_gpu_protocol_box,
pub offset: u64,
pub level: u32,
pub stride: u32,
pub layer_stride: u32,
pub ctx_id: u32,
pub resource_id: u32,
pub padding: u32,
}
/* KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_3D */
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_resource_create_3d {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub target: u32,
pub format: u32,
pub bind: u32,
pub width: u32,
pub height: u32,
pub depth: u32,
pub array_size: u32,
pub last_level: u32,
pub nr_samples: u32,
pub flags: u32,
pub size: u32,
pub stride: u32,
pub ctx_id: u32,
}
#[derive(Clone, Debug, Copy, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_ctx_create {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub nlen: u32,
pub context_init: u32,
pub debug_name: [u8; 64],
}
impl Default for kumquat_gpu_protocol_ctx_create {
fn default() -> Self {
// SAFETY: All zero pattern is safe for this particular struct
unsafe { ::std::mem::zeroed() }
}
}
/* KUMQUAT_GPU_PROTOCOL_CTX_ATTACH_RESOURCE, KUMQUAT_GPU_PROTOCOL_CTX_DETACH_RESOURCE */
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_ctx_resource {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub ctx_id: u32,
pub resource_id: u32,
}
/* KUMQUAT_GPU_PROTOCOL_SUBMIT_3D */
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_cmd_submit {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub ctx_id: u32,
pub pad: u32,
pub size: u32,
// The in-fence IDs are prepended to the cmd_buf and memory layout
// of the KUMQUAT_GPU_PROTOCOL_SUBMIT_3D buffer looks like this:
// _________________
// | CMD_SUBMIT_3D |
// -----------------
// | header |
// | in-fence IDs |
// | cmd_buf |
// -----------------
//
// This makes in-fence IDs naturally aligned to the sizeof(u64) inside
// of the virtio buffer.
pub num_in_fences: u32,
pub flags: u32,
pub ring_idx: u8,
pub padding: [u8; 3],
}
/* KUMQUAT_GPU_PROTOCOL_RESP_CAPSET_INFO */
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_resp_capset_info {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub capset_id: u32,
pub version: u32,
pub size: u32,
pub padding: u32,
}
/* KUMQUAT_GPU_PROTOCOL_GET_CAPSET */
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_get_capset {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub capset_id: u32,
pub capset_version: u32,
}
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_resource_create_blob {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub ctx_id: u32,
pub blob_mem: u32,
pub blob_flags: u32,
pub padding: u32,
pub blob_id: u64,
pub size: u64,
}
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_resp_resource_create {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub resource_id: u32,
pub handle_type: u32,
pub vulkan_info: VulkanInfo,
}
#[derive(Copy, Clone, Debug, Default, FromBytes, IntoBytes, Immutable)]
#[repr(C)]
pub struct kumquat_gpu_protocol_resp_cmd_submit_3d {
pub hdr: kumquat_gpu_protocol_ctrl_hdr,
pub fence_id: u64,
pub handle_type: u32,
pub padding: u32,
}
/// A virtio gpu command and associated metadata specific to each command.
#[derive(Debug)]
pub enum KumquatGpuProtocol {
OkNoData,
GetNumCapsets,
GetCapsetInfo(u32),
GetCapset(kumquat_gpu_protocol_get_capset),
CtxCreate(kumquat_gpu_protocol_ctx_create),
CtxDestroy(u32),
CtxAttachResource(kumquat_gpu_protocol_ctx_resource),
CtxDetachResource(kumquat_gpu_protocol_ctx_resource),
ResourceCreate3d(kumquat_gpu_protocol_resource_create_3d),
TransferToHost3d(kumquat_gpu_protocol_transfer_host_3d, MesaHandle),
TransferFromHost3d(kumquat_gpu_protocol_transfer_host_3d, MesaHandle),
CmdSubmit3d(kumquat_gpu_protocol_cmd_submit, Vec<u8>, Vec<u64>),
ResourceCreateBlob(kumquat_gpu_protocol_resource_create_blob),
SnapshotSave,
SnapshotRestore,
RespNumCapsets(u32),
RespCapsetInfo(kumquat_gpu_protocol_resp_capset_info),
RespCapset(Vec<u8>),
RespContextCreate(u32),
RespResourceCreate(kumquat_gpu_protocol_resp_resource_create, MesaHandle),
RespCmdSubmit3d(u64, MesaHandle),
RespOkSnapshot,
}
pub enum KumquatGpuProtocolWrite<T: IntoBytes + FromBytes + Immutable> {
Cmd(T),
CmdWithHandle(T, MesaHandle),
CmdWithData(T, Vec<u8>),
}
+4
View File
@@ -0,0 +1,4 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
pub mod kumquat_gpu_protocol;
+35
View File
@@ -0,0 +1,35 @@
# Copyright 2023 Google LLC
# SPDX-License-Identifier: MIT
inc_virtio_vdrm = include_directories('.')
libvdrm_c_args = [no_override_init_args, soong_compat_c_args]
if with_amdgpu_virtio
libvdrm_c_args += ['-DENABLE_DRM_AMDGPU']
endif
libvdrm = static_library(
'libvdrm',
[
'vdrm.c',
'vdrm.h',
'vdrm_virtgpu.c',
'vdrm_vpipe.c',
],
include_directories : [
inc_include,
inc_src,
inc_virtio,
inc_virtio_gpu,
],
c_args : libvdrm_c_args,
gnu_symbol_visibility: 'hidden',
dependencies: [
dep_libdrm,
dep_valgrind,
idep_mesautil,
],
link_with: [
_libmesa_util,
],
build_by_default: false,
)
+197
View File
@@ -0,0 +1,197 @@
/*
* Copyright © 2023 Google, Inc.
* SPDX-License-Identifier: MIT
*/
#include "util/u_math.h"
#include "util/perf/cpu_trace.h"
#include "vdrm.h"
struct vdrm_device * vdrm_virtgpu_connect(int fd, uint32_t context_type);
struct vdrm_device * vdrm_vpipe_connect(uint32_t context_type);
struct vdrm_device *
vdrm_device_connect(int fd, uint32_t context_type)
{
struct vdrm_device *vdev;
if (fd >= 0) {
vdev = vdrm_virtgpu_connect(fd, context_type);
} else {
vdev = vdrm_vpipe_connect(context_type);
}
if (!vdev)
return NULL;
simple_mtx_init(&vdev->rsp_lock, mtx_plain);
simple_mtx_init(&vdev->eb_lock, mtx_plain);
return vdev;
}
void
vdrm_device_close(struct vdrm_device *vdev)
{
vdev->funcs->close(vdev);
free(vdev);
}
uint32_t
vdrm_bo_create(struct vdrm_device *vdev, size_t size, uint32_t blob_flags,
uint64_t blob_id, struct vdrm_ccmd_req *req)
{
uint32_t handle;
simple_mtx_lock(&vdev->eb_lock);
/* flush any buffered cmds so they are seen by the host *prior* to
* the cmds associated with bo creation.
*/
vdev->funcs->flush_locked(vdev, NULL);
req->seqno = ++vdev->next_seqno;
handle = vdev->funcs->bo_create(vdev, size, blob_flags, blob_id, req);
simple_mtx_unlock(&vdev->eb_lock);
return handle;
}
void *
vdrm_alloc_rsp(struct vdrm_device *vdev, struct vdrm_ccmd_req *req, uint32_t sz)
{
unsigned off;
simple_mtx_lock(&vdev->rsp_lock);
sz = align(sz, 8);
if ((vdev->next_rsp_off + sz) >= vdev->rsp_mem_len)
vdev->next_rsp_off = 0;
off = vdev->next_rsp_off;
vdev->next_rsp_off += sz;
simple_mtx_unlock(&vdev->rsp_lock);
req->rsp_off = off;
struct vdrm_ccmd_rsp *rsp = (void *)&vdev->rsp_mem[off];
rsp->len = sz;
return rsp;
}
static int
enqueue_req(struct vdrm_device *vdev, struct vdrm_ccmd_req *req)
{
simple_mtx_assert_locked(&vdev->eb_lock);
req->seqno = ++vdev->next_seqno;
if ((vdev->reqbuf_len + req->len) > sizeof(vdev->reqbuf)) {
int ret = vdev->funcs->flush_locked(vdev, NULL);
if (ret)
return ret;
}
memcpy(&vdev->reqbuf[vdev->reqbuf_len], req, req->len);
vdev->reqbuf_len += req->len;
vdev->reqbuf_cnt++;
return 0;
}
int
vdrm_execbuf(struct vdrm_device *vdev, struct vdrm_execbuf_params *p)
{
int ret = 0;
MESA_TRACE_FUNC();
simple_mtx_lock(&vdev->eb_lock);
p->req->seqno = ++vdev->next_seqno;
ret = vdev->funcs->flush_locked(vdev, NULL);
if (ret)
goto out_unlock;
ret = vdev->funcs->execbuf_locked(vdev, p, p->req, p->req->len);
out_unlock:
simple_mtx_unlock(&vdev->eb_lock);
return ret;
}
/**
* Buffer/send a request cmd to host
*/
int
vdrm_send_req(struct vdrm_device *vdev, struct vdrm_ccmd_req *req, bool sync)
{
MESA_TRACE_FUNC();
uintptr_t fence = 0;
int ret = 0;
simple_mtx_lock(&vdev->eb_lock);
ret = enqueue_req(vdev, req);
if (ret || !sync)
goto out_unlock;
ret = vdev->funcs->flush_locked(vdev, &fence);
out_unlock:
simple_mtx_unlock(&vdev->eb_lock);
if (ret)
return ret;
if (sync) {
MESA_TRACE_SCOPE("vdrm_execbuf sync");
vdev->funcs->wait_fence(vdev, fence);
vdrm_host_sync(vdev, req);
}
return 0;
}
int
vdrm_flush(struct vdrm_device *vdev)
{
int ret = 0;
MESA_TRACE_FUNC();
simple_mtx_lock(&vdev->eb_lock);
ret = vdev->funcs->flush_locked(vdev, NULL);
simple_mtx_unlock(&vdev->eb_lock);
return ret;
}
/**
* Helper for fence/seqno comparisions which deals properly with rollover.
* Returns true if fence 'a' is before fence 'b'
*/
static bool
fence_before(uint32_t a, uint32_t b)
{
return (int32_t)(a - b) < 0;
}
/**
* Wait until host has processed the specified request.
*/
void
vdrm_host_sync(struct vdrm_device *vdev, const struct vdrm_ccmd_req *req)
{
while (fence_before(vdev->shmem->seqno, req->seqno))
sched_yield();
}
+170
View File
@@ -0,0 +1,170 @@
/*
* Copyright © 2023 Google, Inc.
* SPDX-License-Identifier: MIT
*/
/* A simple helper layer for virtgpu drm native context, which also
* abstracted the differences between vtest (communicating via socket
* with vtest server) vs virtgpu (communicating via drm/virtio driver
* in the guest).
*/
#ifndef __VDRM_H__
#define __VDRM_H__
#include <stdint.h>
#include "util/simple_mtx.h"
#include "virtio/virtio-gpu/drm_hw.h"
#ifdef __cplusplus
extern "C" {
#endif
struct vdrm_device;
struct vdrm_execbuf_params;
struct vdrm_device_funcs {
/* Note flush_locked and execbuf_locked are similar, and on top of virtgpu
* guest kernel driver are basically the same. But with vtest, only cmds
* that result in host kernel cmd submission can take and/or return fence
* and/or syncobj fd's.
*/
int (*execbuf_locked)(struct vdrm_device *vdev, struct vdrm_execbuf_params *p,
void *command, unsigned size);
int (*flush_locked)(struct vdrm_device *vdev, uintptr_t *fencep);
void (*wait_fence)(struct vdrm_device *vdev, uintptr_t fence);
uint32_t (*dmabuf_to_handle)(struct vdrm_device *vdev, int fd);
uint32_t (*handle_to_res_id)(struct vdrm_device *vdev, uint32_t handle);
uint32_t (*bo_create)(struct vdrm_device *vdev, size_t size, uint32_t blob_flags,
uint64_t blob_id, struct vdrm_ccmd_req *req);
int (*bo_wait)(struct vdrm_device *vdev, uint32_t handle);
void *(*bo_map)(struct vdrm_device *vdev, uint32_t handle, size_t size, void *placed_addr);
int (*bo_export_dmabuf)(struct vdrm_device *vdev, uint32_t handle);
void (*bo_close)(struct vdrm_device *vdev, uint32_t handle);
void (*close)(struct vdrm_device *vdev);
};
struct vdrm_device {
const struct vdrm_device_funcs *funcs;
bool supports_cross_device;
struct vdrm_shmem *shmem;
uint8_t *rsp_mem;
uint32_t rsp_mem_len;
uint32_t next_rsp_off;
simple_mtx_t rsp_lock;
simple_mtx_t eb_lock;
uint32_t next_seqno;
/*
* Buffering for requests to host:
*/
uint32_t reqbuf_len;
uint32_t reqbuf_cnt;
uint8_t reqbuf[0x4000];
/*
* struct virgl_renderer_capset_drm has a varying size and must be placed
* in the end of struct vdrm_device.
*/
struct virgl_renderer_capset_drm caps;
};
struct vdrm_device *vdrm_device_connect(int fd, uint32_t context_type);
void vdrm_device_close(struct vdrm_device *vdev);
void * vdrm_alloc_rsp(struct vdrm_device *vdev, struct vdrm_ccmd_req *req, uint32_t sz);
int vdrm_send_req(struct vdrm_device *vdev, struct vdrm_ccmd_req *req, bool sync);
int vdrm_flush(struct vdrm_device *vdev);
struct vdrm_execbuf_params {
int ring_idx;
struct vdrm_ccmd_req *req; /* Note, must be host kernel cmd submit */
uint32_t *handles;
uint32_t num_handles;
struct drm_virtgpu_execbuffer_syncobj *in_syncobjs;
struct drm_virtgpu_execbuffer_syncobj *out_syncobjs;
bool has_in_fence_fd : 1;
bool needs_out_fence_fd : 1;
int fence_fd; /* in/out fence */
uint32_t num_in_syncobjs;
uint32_t num_out_syncobjs;
};
/**
* Note, must be a host cmd submission, which specified in/out fence/syncobj
* can be passed to. In the vtest case, we can't get fences/syncobjs for
* other host cmds.
*/
int vdrm_execbuf(struct vdrm_device *vdev, struct vdrm_execbuf_params *p);
void vdrm_host_sync(struct vdrm_device *vdev, const struct vdrm_ccmd_req *req);
/**
* Import dmabuf fd returning a GEM handle
*/
static inline uint32_t
vdrm_dmabuf_to_handle(struct vdrm_device *vdev, int fd)
{
return vdev->funcs->dmabuf_to_handle(vdev, fd);
}
static inline uint32_t
vdrm_handle_to_res_id(struct vdrm_device *vdev, uint32_t handle)
{
return vdev->funcs->handle_to_res_id(vdev, handle);
}
uint32_t vdrm_bo_create(struct vdrm_device *vdev, size_t size,
uint32_t blob_flags, uint64_t blob_id,
struct vdrm_ccmd_req *req);
static inline int
vdrm_bo_wait(struct vdrm_device *vdev, uint32_t handle)
{
return vdev->funcs->bo_wait(vdev, handle);
}
static inline void *
vdrm_bo_map(struct vdrm_device *vdev, uint32_t handle, size_t size, void *placed_addr)
{
return vdev->funcs->bo_map(vdev, handle, size, placed_addr);
}
static inline int
vdrm_bo_export_dmabuf(struct vdrm_device *vdev, uint32_t handle)
{
return vdev->funcs->bo_export_dmabuf(vdev, handle);
}
static inline void
vdrm_bo_close(struct vdrm_device *vdev, uint32_t handle)
{
vdev->funcs->bo_close(vdev, handle);
}
/*
* Special interface for dealing with syncobjs when we don't have direct
* access to a rendernode:
*/
struct util_sync_provider;
struct util_sync_provider *vdrm_vpipe_get_sync(struct vdrm_device *vdrm);
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* __VDRM_H__ */
+420
View File
@@ -0,0 +1,420 @@
/*
* Copyright © 2023 Google, Inc.
* SPDX-License-Identifier: MIT
*/
#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
#include <xf86drm.h>
#include "vdrm.h"
#include "drm-uapi/virtgpu_drm.h"
#include "util/libsync.h"
#include "util/log.h"
#include "util/perf/cpu_trace.h"
#define SHMEM_SZ 0x4000
#define virtgpu_ioctl(fd, name, args...) ({ \
MESA_TRACE_SCOPE(#name); \
int ret = drmIoctl((fd), DRM_IOCTL_ ## name, (args)); \
ret; \
})
struct virtgpu_device {
struct vdrm_device base;
uint32_t shmem_handle;
int fd;
};
DEFINE_CAST(vdrm_device, virtgpu_device)
static int
virtgpu_execbuf_locked(struct vdrm_device *vdev, struct vdrm_execbuf_params *p,
void *command, unsigned size)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
simple_mtx_assert_locked(&vdev->eb_lock);
assert(size);
#define COND(bool, val) ((bool) ? (val) : 0)
struct drm_virtgpu_execbuffer eb = {
.flags = COND(p->needs_out_fence_fd, VIRTGPU_EXECBUF_FENCE_FD_OUT) |
COND(p->has_in_fence_fd, VIRTGPU_EXECBUF_FENCE_FD_IN) |
VIRTGPU_EXECBUF_RING_IDX,
.size = size,
.command = (uintptr_t)command,
.bo_handles = (uintptr_t)p->handles,
.num_bo_handles = p->num_handles,
.fence_fd = p->fence_fd,
.ring_idx = p->ring_idx,
.syncobj_stride = sizeof(struct drm_virtgpu_execbuffer_syncobj),
.num_in_syncobjs = p->num_in_syncobjs,
.num_out_syncobjs = p->num_out_syncobjs,
.in_syncobjs = (uintptr_t)p->in_syncobjs,
.out_syncobjs = (uintptr_t)p->out_syncobjs,
};
int ret = virtgpu_ioctl(vgdev->fd, VIRTGPU_EXECBUFFER, &eb);
if (ret) {
mesa_loge("EXECBUFFER failed: %s", strerror(errno));
return ret;
}
if (p->needs_out_fence_fd)
p->fence_fd = eb.fence_fd;
return 0;
}
static int
virtgpu_flush_locked(struct vdrm_device *vdev, uintptr_t *fencep)
{
int ret;
simple_mtx_assert_locked(&vdev->eb_lock);
if (!vdev->reqbuf_len)
return 0;
struct vdrm_execbuf_params p = {
.needs_out_fence_fd = !!fencep,
};
ret = virtgpu_execbuf_locked(vdev, &p, vdev->reqbuf, vdev->reqbuf_len);
if (ret)
return ret;
vdev->reqbuf_len = 0;
vdev->reqbuf_cnt = 0;
if (fencep)
*fencep = p.fence_fd;
return 0;
}
static void
virtgpu_wait_fence(struct vdrm_device *vdev, uintptr_t fence)
{
int fence_fd = fence;
sync_wait(fence_fd, -1);
close(fence_fd);
}
static void
gem_close(struct virtgpu_device *vgdev, uint32_t handle)
{
virtgpu_ioctl(vgdev->fd, GEM_CLOSE, &(struct drm_gem_close){
.handle = handle,
});
}
/**
* Note, does _not_ de-duplicate handles
*/
static uint32_t
virtgpu_dmabuf_to_handle(struct vdrm_device *vdev, int fd)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
uint32_t handle;
int ret;
ret = drmPrimeFDToHandle(vgdev->fd, fd, &handle);
if (ret) {
mesa_loge("dmabuf import failed: %s", strerror(errno));
return 0;
}
return handle;
}
static uint32_t
virtgpu_handle_to_res_id(struct vdrm_device *vdev, uint32_t handle)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
struct drm_virtgpu_resource_info args = {
.bo_handle = handle,
};
int ret;
ret = virtgpu_ioctl(vgdev->fd, VIRTGPU_RESOURCE_INFO, &args);
if (ret) {
mesa_loge("failed to get resource info: %s", strerror(errno));
return 0;
}
return args.res_handle;
}
static uint32_t
virtgpu_bo_create(struct vdrm_device *vdev, size_t size, uint32_t blob_flags,
uint64_t blob_id, struct vdrm_ccmd_req *req)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
struct drm_virtgpu_resource_create_blob args = {
.blob_mem = VIRTGPU_BLOB_MEM_HOST3D,
.blob_flags = blob_flags,
.size = size,
.cmd_size = req->len,
.cmd = (uintptr_t)req,
.blob_id = blob_id,
};
int ret;
simple_mtx_assert_locked(&vdev->eb_lock);
ret = virtgpu_ioctl(vgdev->fd, VIRTGPU_RESOURCE_CREATE_BLOB, &args);
if (ret) {
mesa_loge("buffer allocation failed: %s", strerror(errno));
return 0;
}
return args.bo_handle;
}
static int
map_handle(int fd, uint32_t handle, size_t size, void **map, void *placed_addr)
{
struct drm_virtgpu_map req = {
.handle = handle,
};
int ret;
ret = virtgpu_ioctl(fd, VIRTGPU_MAP, &req);
if (ret) {
mesa_loge("VIRTGPU_MAP failed: %s", strerror(errno));
return ret;
}
*map = mmap(placed_addr, size, PROT_READ | PROT_WRITE,
MAP_SHARED | (placed_addr != NULL ? MAP_FIXED : 0),
fd, req.offset);
if (*map == MAP_FAILED) {
mesa_loge("failed to map handle: %s", strerror(errno));
return -1;
}
return 0;
}
static int
virtgpu_bo_wait(struct vdrm_device *vdev, uint32_t handle)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
struct drm_virtgpu_3d_wait args = {
.handle = handle,
};
int ret;
/* Side note, this ioctl is defined as IO_WR but should be IO_W: */
ret = virtgpu_ioctl(vgdev->fd, VIRTGPU_WAIT, &args);
if (ret && errno == EBUSY)
return -EBUSY;
return 0;
}
static void *
virtgpu_bo_map(struct vdrm_device *vdev, uint32_t handle, size_t size, void *placed_addr)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
void *map;
int ret;
ret = map_handle(vgdev->fd, handle, size, &map, placed_addr);
if (ret)
return NULL;
return map;
}
static int
virtgpu_bo_export_dmabuf(struct vdrm_device *vdev, uint32_t handle)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
int ret, fd;
ret = drmPrimeHandleToFD(vgdev->fd, handle, DRM_CLOEXEC | DRM_RDWR, &fd);
if (ret) {
mesa_loge("dmabuf export failed: %s", strerror(errno));
return ret;
}
return fd;
}
static void
virtgpu_bo_close(struct vdrm_device *vdev, uint32_t handle)
{
/* Flush any buffered commands first, so the detach_resource doesn't
* overtake any buffered ccmd which references the resource:
*/
if (vdev->reqbuf_len) {
simple_mtx_lock(&vdev->eb_lock);
virtgpu_flush_locked(vdev, NULL);
simple_mtx_unlock(&vdev->eb_lock);
}
gem_close(to_virtgpu_device(vdev), handle);
}
static void
virtgpu_close(struct vdrm_device *vdev)
{
struct virtgpu_device *vgdev = to_virtgpu_device(vdev);
munmap(vdev->shmem, SHMEM_SZ);
gem_close(vgdev, vgdev->shmem_handle);
}
static const struct vdrm_device_funcs funcs = {
.flush_locked = virtgpu_flush_locked,
.wait_fence = virtgpu_wait_fence,
.execbuf_locked = virtgpu_execbuf_locked,
.dmabuf_to_handle = virtgpu_dmabuf_to_handle,
.handle_to_res_id = virtgpu_handle_to_res_id,
.bo_create = virtgpu_bo_create,
.bo_wait = virtgpu_bo_wait,
.bo_map = virtgpu_bo_map,
.bo_export_dmabuf = virtgpu_bo_export_dmabuf,
.bo_close = virtgpu_bo_close,
.close = virtgpu_close,
};
static int
get_capset(int fd, struct virgl_renderer_capset_drm *caps)
{
struct drm_virtgpu_get_caps args = {
.cap_set_id = VIRTGPU_DRM_CAPSET_DRM,
.cap_set_ver = 0,
.addr = (uintptr_t)caps,
.size = sizeof(*caps),
};
memset(caps, 0, sizeof(*caps));
return virtgpu_ioctl(fd, VIRTGPU_GET_CAPS, &args);
}
static int
set_context(int fd)
{
struct drm_virtgpu_context_set_param params[] = {
{ VIRTGPU_CONTEXT_PARAM_CAPSET_ID, VIRTGPU_DRM_CAPSET_DRM },
{ VIRTGPU_CONTEXT_PARAM_NUM_RINGS, 64 },
};
struct drm_virtgpu_context_init args = {
.num_params = ARRAY_SIZE(params),
.ctx_set_params = (uintptr_t)params,
};
return virtgpu_ioctl(fd, VIRTGPU_CONTEXT_INIT, &args);
}
static int
init_shmem(struct virtgpu_device *vgdev)
{
struct vdrm_device *vdev = &vgdev->base;
struct drm_virtgpu_resource_create_blob args = {
.blob_mem = VIRTGPU_BLOB_MEM_HOST3D,
.blob_flags = VIRTGPU_BLOB_FLAG_USE_MAPPABLE,
.size = SHMEM_SZ,
.blob_id = 0,
};
int ret;
ret = virtgpu_ioctl(vgdev->fd, VIRTGPU_RESOURCE_CREATE_BLOB, &args);
if (ret) {
mesa_logi("failed to allocate shmem buffer: %s", strerror(errno));
return ret;
}
vgdev->shmem_handle = args.bo_handle;
ret = map_handle(vgdev->fd, vgdev->shmem_handle, args.size, (void **)&vdev->shmem, NULL);
if (ret) {
gem_close(vgdev, vgdev->shmem_handle);
vgdev->shmem_handle = 0;
return ret;
}
uint32_t offset = vdev->shmem->rsp_mem_offset;
vdev->rsp_mem_len = args.size - offset;
vdev->rsp_mem = &((uint8_t *)vdev->shmem)[offset];
return 0;
}
static uint64_t
get_param(int fd, uint64_t param)
{
/* val must be zeroed because kernel only writes the lower 32 bits */
uint64_t val = 0;
struct drm_virtgpu_getparam args = {
.param = param,
.value = (uintptr_t)&val,
};
const int ret = virtgpu_ioctl(fd, VIRTGPU_GETPARAM, &args);
return ret ? 0 : val;
}
struct vdrm_device * vdrm_virtgpu_connect(int fd, uint32_t context_type);
struct vdrm_device *
vdrm_virtgpu_connect(int fd, uint32_t context_type)
{
struct virgl_renderer_capset_drm caps;
struct virtgpu_device *vgdev;
struct vdrm_device *vdev;
int ret;
ret = get_capset(fd, &caps);
if (ret) {
mesa_logi("could not get caps: %s", strerror(errno));
return NULL;
}
/* If the context type does not match, return silently. This does not
* indicate anything is wrong, just that we're trying to probe the wrong
* driver. If we logged here, we would spam for every vdrm driver.
*/
if (caps.context_type != context_type)
return NULL;
ret = set_context(fd);
if (ret) {
mesa_logi("Could not set context type: %s", strerror(errno));
return NULL;
}
vgdev = calloc(1, sizeof(*vgdev));
if (!vgdev)
return NULL;
vgdev->fd = fd;
ret = init_shmem(vgdev);
if (ret) {
free(vgdev);
return NULL;
}
vdev = &vgdev->base;
vdev->caps = caps;
vdev->funcs = &funcs;
/* Cross-device feature is optional. It enables sharing dma-bufs
* with other virtio devices, like virtio-wl or virtio-video used
* by ChromeOS VMs. Qemu doesn't support cross-device sharing.
*/
if (get_param(fd, VIRTGPU_PARAM_CROSS_DEVICE))
vdev->supports_cross_device = true;
return vdev;
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,49 @@
/* This file is generated by venus-protocol git-70991d4c. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_H
#define VN_PROTOCOL_DRIVER_H
#include "vn_protocol_driver_cs.h"
#include "vn_protocol_driver_defines.h"
#include "vn_protocol_driver_info.h"
#include "vn_protocol_driver_types.h"
#include "vn_protocol_driver_handles.h"
#include "vn_protocol_driver_structs.h"
#include "vn_protocol_driver_transport.h"
#include "vn_protocol_driver_instance.h"
#include "vn_protocol_driver_device.h"
#include "vn_protocol_driver_queue.h"
#include "vn_protocol_driver_fence.h"
#include "vn_protocol_driver_semaphore.h"
#include "vn_protocol_driver_event.h"
#include "vn_protocol_driver_device_memory.h"
#include "vn_protocol_driver_image.h"
#include "vn_protocol_driver_image_view.h"
#include "vn_protocol_driver_sampler.h"
#include "vn_protocol_driver_sampler_ycbcr_conversion.h"
#include "vn_protocol_driver_buffer.h"
#include "vn_protocol_driver_buffer_view.h"
#include "vn_protocol_driver_descriptor_pool.h"
#include "vn_protocol_driver_descriptor_set.h"
#include "vn_protocol_driver_descriptor_set_layout.h"
#include "vn_protocol_driver_descriptor_update_template.h"
#include "vn_protocol_driver_render_pass.h"
#include "vn_protocol_driver_framebuffer.h"
#include "vn_protocol_driver_query_pool.h"
#include "vn_protocol_driver_shader_module.h"
#include "vn_protocol_driver_pipeline.h"
#include "vn_protocol_driver_pipeline_layout.h"
#include "vn_protocol_driver_pipeline_cache.h"
#include "vn_protocol_driver_command_pool.h"
#include "vn_protocol_driver_command_buffer.h"
#include "vn_protocol_driver_private_data_slot.h"
#include "vn_protocol_driver_host_copy.h"
#include "vn_protocol_driver_acceleration_structure.h"
#include "vn_protocol_driver_descriptor_heap.h"
#endif /* VN_PROTOCOL_DRIVER_H */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,306 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_BUFFER_VIEW_H
#define VN_PROTOCOL_DRIVER_BUFFER_VIEW_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkBufferViewCreateInfo chain */
static inline size_t
vn_sizeof_VkBufferViewCreateInfo_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO:
if (!vn_cs_renderer_protocol_has_extension(471 /* VK_KHR_maintenance5 */))
break;
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkBufferViewCreateInfo_pnext(((const VkBufferUsageFlags2CreateInfo *)pnext)->pNext);
size += vn_sizeof_VkBufferUsageFlags2CreateInfo_self((const VkBufferUsageFlags2CreateInfo *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkBufferViewCreateInfo_self(const VkBufferViewCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkBuffer(&val->buffer);
size += vn_sizeof_VkFormat(&val->format);
size += vn_sizeof_VkDeviceSize(&val->offset);
size += vn_sizeof_VkDeviceSize(&val->range);
return size;
}
static inline size_t
vn_sizeof_VkBufferViewCreateInfo(const VkBufferViewCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkBufferViewCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkBufferViewCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkBufferViewCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO:
if (!vn_cs_renderer_protocol_has_extension(471 /* VK_KHR_maintenance5 */))
break;
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkBufferViewCreateInfo_pnext(enc, ((const VkBufferUsageFlags2CreateInfo *)pnext)->pNext);
vn_encode_VkBufferUsageFlags2CreateInfo_self(enc, (const VkBufferUsageFlags2CreateInfo *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkBufferViewCreateInfo_self(struct vn_cs_encoder *enc, const VkBufferViewCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkBuffer(enc, &val->buffer);
vn_encode_VkFormat(enc, &val->format);
vn_encode_VkDeviceSize(enc, &val->offset);
vn_encode_VkDeviceSize(enc, &val->range);
}
static inline void
vn_encode_VkBufferViewCreateInfo(struct vn_cs_encoder *enc, const VkBufferViewCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO });
vn_encode_VkBufferViewCreateInfo_pnext(enc, val->pNext);
vn_encode_VkBufferViewCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateBufferView_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkBufferViewCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pView);
if (pView)
cmd_size += vn_sizeof_VkBufferView(pView);
return cmd_size;
}
static inline void vn_encode_vkCreateBufferView(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateBufferView_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkBufferViewCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pView))
vn_encode_VkBufferView(enc, pView);
}
static inline size_t vn_sizeof_vkCreateBufferView_reply(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateBufferView_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pView);
if (pView)
cmd_size += vn_sizeof_VkBufferView(pView);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateBufferView_reply(struct vn_cs_decoder *dec, VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateBufferView_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkBufferView(dec, pView);
} else {
pView = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyBufferView_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkBufferView(&bufferView);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyBufferView(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyBufferView_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkBufferView(enc, &bufferView);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyBufferView_reply(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyBufferView_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip bufferView */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyBufferView_reply(struct vn_cs_decoder *dec, VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyBufferView_EXT);
/* skip device */
/* skip bufferView */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateBufferView(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateBufferView(device, pCreateInfo, pAllocator, pView);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateBufferView_reply(device, pCreateInfo, pAllocator, pView) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateBufferView(enc, cmd_flags, device, pCreateInfo, pAllocator, pView);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyBufferView(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyBufferView(device, bufferView, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyBufferView_reply(device, bufferView, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyBufferView(enc, cmd_flags, device, bufferView, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateBufferView(struct vn_ring *vn_ring, VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateBufferView(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pView, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateBufferView_reply(dec, device, pCreateInfo, pAllocator, pView);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateBufferView(struct vn_ring *vn_ring, VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateBufferView(vn_ring, 0, device, pCreateInfo, pAllocator, pView, &submit);
}
static inline void vn_async_vkDestroyBufferView(struct vn_ring *vn_ring, VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyBufferView(vn_ring, 0, device, bufferView, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_BUFFER_VIEW_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,435 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_COMMAND_POOL_H
#define VN_PROTOCOL_DRIVER_COMMAND_POOL_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkCommandPoolCreateInfo chain */
static inline size_t
vn_sizeof_VkCommandPoolCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkCommandPoolCreateInfo_self(const VkCommandPoolCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_uint32_t(&val->queueFamilyIndex);
return size;
}
static inline size_t
vn_sizeof_VkCommandPoolCreateInfo(const VkCommandPoolCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkCommandPoolCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkCommandPoolCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkCommandPoolCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkCommandPoolCreateInfo_self(struct vn_cs_encoder *enc, const VkCommandPoolCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_uint32_t(enc, &val->queueFamilyIndex);
}
static inline void
vn_encode_VkCommandPoolCreateInfo(struct vn_cs_encoder *enc, const VkCommandPoolCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO });
vn_encode_VkCommandPoolCreateInfo_pnext(enc, val->pNext);
vn_encode_VkCommandPoolCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateCommandPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkCommandPoolCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pCommandPool);
if (pCommandPool)
cmd_size += vn_sizeof_VkCommandPool(pCommandPool);
return cmd_size;
}
static inline void vn_encode_vkCreateCommandPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateCommandPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkCommandPoolCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pCommandPool))
vn_encode_VkCommandPool(enc, pCommandPool);
}
static inline size_t vn_sizeof_vkCreateCommandPool_reply(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateCommandPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pCommandPool);
if (pCommandPool)
cmd_size += vn_sizeof_VkCommandPool(pCommandPool);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateCommandPool_reply(struct vn_cs_decoder *dec, VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateCommandPool_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkCommandPool(dec, pCommandPool);
} else {
pCommandPool = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyCommandPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkCommandPool(&commandPool);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyCommandPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyCommandPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkCommandPool(enc, &commandPool);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyCommandPool_reply(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyCommandPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip commandPool */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyCommandPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyCommandPool_EXT);
/* skip device */
/* skip commandPool */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetCommandPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkCommandPool(&commandPool);
cmd_size += vn_sizeof_VkFlags(&flags);
return cmd_size;
}
static inline void vn_encode_vkResetCommandPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetCommandPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkCommandPool(enc, &commandPool);
vn_encode_VkFlags(enc, &flags);
}
static inline size_t vn_sizeof_vkResetCommandPool_reply(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetCommandPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip commandPool */
/* skip flags */
return cmd_size;
}
static inline VkResult vn_decode_vkResetCommandPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkResetCommandPool_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip commandPool */
/* skip flags */
return ret;
}
static inline size_t vn_sizeof_vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkTrimCommandPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkCommandPool(&commandPool);
cmd_size += vn_sizeof_VkFlags(&flags);
return cmd_size;
}
static inline void vn_encode_vkTrimCommandPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkTrimCommandPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkCommandPool(enc, &commandPool);
vn_encode_VkFlags(enc, &flags);
}
static inline size_t vn_sizeof_vkTrimCommandPool_reply(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkTrimCommandPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip commandPool */
/* skip flags */
return cmd_size;
}
static inline void vn_decode_vkTrimCommandPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkTrimCommandPool_EXT);
/* skip device */
/* skip commandPool */
/* skip flags */
}
static inline void vn_submit_vkCreateCommandPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateCommandPool_reply(device, pCreateInfo, pAllocator, pCommandPool) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateCommandPool(enc, cmd_flags, device, pCreateInfo, pAllocator, pCommandPool);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyCommandPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyCommandPool(device, commandPool, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyCommandPool_reply(device, commandPool, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyCommandPool(enc, cmd_flags, device, commandPool, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkResetCommandPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkResetCommandPool(device, commandPool, flags);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetCommandPool_reply(device, commandPool, flags) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkResetCommandPool(enc, cmd_flags, device, commandPool, flags);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkTrimCommandPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkTrimCommandPool(device, commandPool, flags);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkTrimCommandPool_reply(device, commandPool, flags) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkTrimCommandPool(enc, cmd_flags, device, commandPool, flags);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateCommandPool(struct vn_ring *vn_ring, VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateCommandPool(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pCommandPool, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateCommandPool_reply(dec, device, pCreateInfo, pAllocator, pCommandPool);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateCommandPool(struct vn_ring *vn_ring, VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateCommandPool(vn_ring, 0, device, pCreateInfo, pAllocator, pCommandPool, &submit);
}
static inline void vn_async_vkDestroyCommandPool(struct vn_ring *vn_ring, VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyCommandPool(vn_ring, 0, device, commandPool, pAllocator, &submit);
}
static inline VkResult vn_call_vkResetCommandPool(struct vn_ring *vn_ring, VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkResetCommandPool(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, commandPool, flags, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkResetCommandPool_reply(dec, device, commandPool, flags);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkResetCommandPool(struct vn_ring *vn_ring, VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags)
{
struct vn_ring_submit_command submit;
vn_submit_vkResetCommandPool(vn_ring, 0, device, commandPool, flags, &submit);
}
static inline void vn_async_vkTrimCommandPool(struct vn_ring *vn_ring, VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags)
{
struct vn_ring_submit_command submit;
vn_submit_vkTrimCommandPool(vn_ring, 0, device, commandPool, flags, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_COMMAND_POOL_H */
@@ -0,0 +1,46 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_CS_H
#define VN_PROTOCOL_DRIVER_CS_H
#include <assert.h>
/*
* These types/functions are expected
*
* struct vn_cs_encoder
* vn_cs_encoder_get_len
* vn_cs_encoder_reserve
* vn_cs_encoder_write
*
* struct vn_cs_decoder
* vn_cs_decoder_set_fatal
* vn_cs_decoder_read
* vn_cs_decoder_peek
*
* vn_cs_handle_load_id
* vn_cs_handle_store_id
*/
#include "vn_cs.h"
static inline void
vn_encode(struct vn_cs_encoder *enc, size_t size, const void *data, size_t data_size)
{
assert(size % 4 == 0);
/* TODO check if the generated code is optimal */
vn_cs_encoder_write(enc, size, data, data_size);
}
static inline void
vn_decode(struct vn_cs_decoder *dec, size_t size, void *data, size_t data_size)
{
assert(size % 4 == 0);
vn_cs_decoder_read(dec, size, data, data_size);
}
#endif /* VN_PROTOCOL_DRIVER_CS_H */
@@ -0,0 +1,608 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_DEFINES_H
#define VN_PROTOCOL_DRIVER_DEFINES_H
#include <stdlib.h>
#include <string.h>
#include <vulkan/vulkan.h>
#define VN_SUBMIT_LOCAL_CMD_SIZE 256
/* VkStructureType */
#define VK_STRUCTURE_TYPE_RING_CREATE_INFO_MESA ((VkStructureType)1000384000)
#define VK_STRUCTURE_TYPE_MEMORY_RESOURCE_PROPERTIES_MESA ((VkStructureType)1000384001)
#define VK_STRUCTURE_TYPE_IMPORT_MEMORY_RESOURCE_INFO_MESA ((VkStructureType)1000384002)
#define VK_STRUCTURE_TYPE_MEMORY_RESOURCE_ALLOCATION_SIZE_PROPERTIES_MESA ((VkStructureType)1000384003)
#define VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_RESOURCE_INFO_MESA ((VkStructureType)1000384004)
#define VK_STRUCTURE_TYPE_DEVICE_QUEUE_TIMELINE_INFO_MESA ((VkStructureType)1000384005)
#define VK_STRUCTURE_TYPE_RING_MONITOR_INFO_MESA ((VkStructureType)1000384006)
#define VK_STRUCTURE_TYPE_RING_PRIORITY_INFO_MESA ((VkStructureType)1000384007)
#define VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_MESA ((VkStructureType)1000384008)
#define VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_MESA ((VkStructureType)1000384009)
#define VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_MESA ((VkStructureType)1000384010)
typedef enum VkCommandTypeEXT {
VK_COMMAND_TYPE_vkCreateInstance_EXT = 0,
VK_COMMAND_TYPE_vkDestroyInstance_EXT = 1,
VK_COMMAND_TYPE_vkEnumeratePhysicalDevices_EXT = 2,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFeatures_EXT = 3,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFormatProperties_EXT = 4,
VK_COMMAND_TYPE_vkGetPhysicalDeviceImageFormatProperties_EXT = 5,
VK_COMMAND_TYPE_vkGetPhysicalDeviceProperties_EXT = 6,
VK_COMMAND_TYPE_vkGetPhysicalDeviceQueueFamilyProperties_EXT = 7,
VK_COMMAND_TYPE_vkGetPhysicalDeviceMemoryProperties_EXT = 8,
VK_COMMAND_TYPE_vkGetInstanceProcAddr_EXT = 9,
VK_COMMAND_TYPE_vkGetDeviceProcAddr_EXT = 10,
VK_COMMAND_TYPE_vkCreateDevice_EXT = 11,
VK_COMMAND_TYPE_vkDestroyDevice_EXT = 12,
VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT = 13,
VK_COMMAND_TYPE_vkEnumerateDeviceExtensionProperties_EXT = 14,
VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT = 15,
VK_COMMAND_TYPE_vkEnumerateDeviceLayerProperties_EXT = 16,
VK_COMMAND_TYPE_vkGetDeviceQueue_EXT = 17,
VK_COMMAND_TYPE_vkQueueSubmit_EXT = 18,
VK_COMMAND_TYPE_vkQueueWaitIdle_EXT = 19,
VK_COMMAND_TYPE_vkDeviceWaitIdle_EXT = 20,
VK_COMMAND_TYPE_vkAllocateMemory_EXT = 21,
VK_COMMAND_TYPE_vkFreeMemory_EXT = 22,
VK_COMMAND_TYPE_vkMapMemory_EXT = 23,
VK_COMMAND_TYPE_vkUnmapMemory_EXT = 24,
VK_COMMAND_TYPE_vkFlushMappedMemoryRanges_EXT = 25,
VK_COMMAND_TYPE_vkInvalidateMappedMemoryRanges_EXT = 26,
VK_COMMAND_TYPE_vkGetDeviceMemoryCommitment_EXT = 27,
VK_COMMAND_TYPE_vkBindBufferMemory_EXT = 28,
VK_COMMAND_TYPE_vkBindImageMemory_EXT = 29,
VK_COMMAND_TYPE_vkGetBufferMemoryRequirements_EXT = 30,
VK_COMMAND_TYPE_vkGetImageMemoryRequirements_EXT = 31,
VK_COMMAND_TYPE_vkGetImageSparseMemoryRequirements_EXT = 32,
VK_COMMAND_TYPE_vkGetPhysicalDeviceSparseImageFormatProperties_EXT = 33,
VK_COMMAND_TYPE_vkQueueBindSparse_EXT = 34,
VK_COMMAND_TYPE_vkCreateFence_EXT = 35,
VK_COMMAND_TYPE_vkDestroyFence_EXT = 36,
VK_COMMAND_TYPE_vkResetFences_EXT = 37,
VK_COMMAND_TYPE_vkGetFenceStatus_EXT = 38,
VK_COMMAND_TYPE_vkWaitForFences_EXT = 39,
VK_COMMAND_TYPE_vkCreateSemaphore_EXT = 40,
VK_COMMAND_TYPE_vkDestroySemaphore_EXT = 41,
VK_COMMAND_TYPE_vkCreateEvent_EXT = 42,
VK_COMMAND_TYPE_vkDestroyEvent_EXT = 43,
VK_COMMAND_TYPE_vkGetEventStatus_EXT = 44,
VK_COMMAND_TYPE_vkSetEvent_EXT = 45,
VK_COMMAND_TYPE_vkResetEvent_EXT = 46,
VK_COMMAND_TYPE_vkCreateQueryPool_EXT = 47,
VK_COMMAND_TYPE_vkDestroyQueryPool_EXT = 48,
VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT = 49,
VK_COMMAND_TYPE_vkCreateBuffer_EXT = 50,
VK_COMMAND_TYPE_vkDestroyBuffer_EXT = 51,
VK_COMMAND_TYPE_vkCreateBufferView_EXT = 52,
VK_COMMAND_TYPE_vkDestroyBufferView_EXT = 53,
VK_COMMAND_TYPE_vkCreateImage_EXT = 54,
VK_COMMAND_TYPE_vkDestroyImage_EXT = 55,
VK_COMMAND_TYPE_vkGetImageSubresourceLayout_EXT = 56,
VK_COMMAND_TYPE_vkCreateImageView_EXT = 57,
VK_COMMAND_TYPE_vkDestroyImageView_EXT = 58,
VK_COMMAND_TYPE_vkCreateShaderModule_EXT = 59,
VK_COMMAND_TYPE_vkDestroyShaderModule_EXT = 60,
VK_COMMAND_TYPE_vkCreatePipelineCache_EXT = 61,
VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT = 62,
VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT = 63,
VK_COMMAND_TYPE_vkMergePipelineCaches_EXT = 64,
VK_COMMAND_TYPE_vkCreateGraphicsPipelines_EXT = 65,
VK_COMMAND_TYPE_vkCreateComputePipelines_EXT = 66,
VK_COMMAND_TYPE_vkDestroyPipeline_EXT = 67,
VK_COMMAND_TYPE_vkCreatePipelineLayout_EXT = 68,
VK_COMMAND_TYPE_vkDestroyPipelineLayout_EXT = 69,
VK_COMMAND_TYPE_vkCreateSampler_EXT = 70,
VK_COMMAND_TYPE_vkDestroySampler_EXT = 71,
VK_COMMAND_TYPE_vkCreateDescriptorSetLayout_EXT = 72,
VK_COMMAND_TYPE_vkDestroyDescriptorSetLayout_EXT = 73,
VK_COMMAND_TYPE_vkCreateDescriptorPool_EXT = 74,
VK_COMMAND_TYPE_vkDestroyDescriptorPool_EXT = 75,
VK_COMMAND_TYPE_vkResetDescriptorPool_EXT = 76,
VK_COMMAND_TYPE_vkAllocateDescriptorSets_EXT = 77,
VK_COMMAND_TYPE_vkFreeDescriptorSets_EXT = 78,
VK_COMMAND_TYPE_vkUpdateDescriptorSets_EXT = 79,
VK_COMMAND_TYPE_vkCreateFramebuffer_EXT = 80,
VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT = 81,
VK_COMMAND_TYPE_vkCreateRenderPass_EXT = 82,
VK_COMMAND_TYPE_vkDestroyRenderPass_EXT = 83,
VK_COMMAND_TYPE_vkGetRenderAreaGranularity_EXT = 84,
VK_COMMAND_TYPE_vkCreateCommandPool_EXT = 85,
VK_COMMAND_TYPE_vkDestroyCommandPool_EXT = 86,
VK_COMMAND_TYPE_vkResetCommandPool_EXT = 87,
VK_COMMAND_TYPE_vkAllocateCommandBuffers_EXT = 88,
VK_COMMAND_TYPE_vkFreeCommandBuffers_EXT = 89,
VK_COMMAND_TYPE_vkBeginCommandBuffer_EXT = 90,
VK_COMMAND_TYPE_vkEndCommandBuffer_EXT = 91,
VK_COMMAND_TYPE_vkResetCommandBuffer_EXT = 92,
VK_COMMAND_TYPE_vkCmdBindPipeline_EXT = 93,
VK_COMMAND_TYPE_vkCmdSetViewport_EXT = 94,
VK_COMMAND_TYPE_vkCmdSetScissor_EXT = 95,
VK_COMMAND_TYPE_vkCmdSetLineWidth_EXT = 96,
VK_COMMAND_TYPE_vkCmdSetDepthBias_EXT = 97,
VK_COMMAND_TYPE_vkCmdSetBlendConstants_EXT = 98,
VK_COMMAND_TYPE_vkCmdSetDepthBounds_EXT = 99,
VK_COMMAND_TYPE_vkCmdSetStencilCompareMask_EXT = 100,
VK_COMMAND_TYPE_vkCmdSetStencilWriteMask_EXT = 101,
VK_COMMAND_TYPE_vkCmdSetStencilReference_EXT = 102,
VK_COMMAND_TYPE_vkCmdBindDescriptorSets_EXT = 103,
VK_COMMAND_TYPE_vkCmdBindIndexBuffer_EXT = 104,
VK_COMMAND_TYPE_vkCmdBindVertexBuffers_EXT = 105,
VK_COMMAND_TYPE_vkCmdDraw_EXT = 106,
VK_COMMAND_TYPE_vkCmdDrawIndexed_EXT = 107,
VK_COMMAND_TYPE_vkCmdDrawIndirect_EXT = 108,
VK_COMMAND_TYPE_vkCmdDrawIndexedIndirect_EXT = 109,
VK_COMMAND_TYPE_vkCmdDispatch_EXT = 110,
VK_COMMAND_TYPE_vkCmdDispatchIndirect_EXT = 111,
VK_COMMAND_TYPE_vkCmdCopyBuffer_EXT = 112,
VK_COMMAND_TYPE_vkCmdCopyImage_EXT = 113,
VK_COMMAND_TYPE_vkCmdBlitImage_EXT = 114,
VK_COMMAND_TYPE_vkCmdCopyBufferToImage_EXT = 115,
VK_COMMAND_TYPE_vkCmdCopyImageToBuffer_EXT = 116,
VK_COMMAND_TYPE_vkCmdUpdateBuffer_EXT = 117,
VK_COMMAND_TYPE_vkCmdFillBuffer_EXT = 118,
VK_COMMAND_TYPE_vkCmdClearColorImage_EXT = 119,
VK_COMMAND_TYPE_vkCmdClearDepthStencilImage_EXT = 120,
VK_COMMAND_TYPE_vkCmdClearAttachments_EXT = 121,
VK_COMMAND_TYPE_vkCmdResolveImage_EXT = 122,
VK_COMMAND_TYPE_vkCmdSetEvent_EXT = 123,
VK_COMMAND_TYPE_vkCmdResetEvent_EXT = 124,
VK_COMMAND_TYPE_vkCmdWaitEvents_EXT = 125,
VK_COMMAND_TYPE_vkCmdPipelineBarrier_EXT = 126,
VK_COMMAND_TYPE_vkCmdBeginQuery_EXT = 127,
VK_COMMAND_TYPE_vkCmdEndQuery_EXT = 128,
VK_COMMAND_TYPE_vkCmdResetQueryPool_EXT = 129,
VK_COMMAND_TYPE_vkCmdWriteTimestamp_EXT = 130,
VK_COMMAND_TYPE_vkCmdCopyQueryPoolResults_EXT = 131,
VK_COMMAND_TYPE_vkCmdPushConstants_EXT = 132,
VK_COMMAND_TYPE_vkCmdBeginRenderPass_EXT = 133,
VK_COMMAND_TYPE_vkCmdNextSubpass_EXT = 134,
VK_COMMAND_TYPE_vkCmdEndRenderPass_EXT = 135,
VK_COMMAND_TYPE_vkCmdExecuteCommands_EXT = 136,
VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT = 137,
VK_COMMAND_TYPE_vkBindBufferMemory2_EXT = 138,
VK_COMMAND_TYPE_vkBindBufferMemory2KHR_EXT = 138,
VK_COMMAND_TYPE_vkBindImageMemory2_EXT = 139,
VK_COMMAND_TYPE_vkBindImageMemory2KHR_EXT = 139,
VK_COMMAND_TYPE_vkGetDeviceGroupPeerMemoryFeatures_EXT = 140,
VK_COMMAND_TYPE_vkGetDeviceGroupPeerMemoryFeaturesKHR_EXT = 140,
VK_COMMAND_TYPE_vkCmdSetDeviceMask_EXT = 141,
VK_COMMAND_TYPE_vkCmdSetDeviceMaskKHR_EXT = 141,
VK_COMMAND_TYPE_vkCmdDispatchBase_EXT = 142,
VK_COMMAND_TYPE_vkCmdDispatchBaseKHR_EXT = 142,
VK_COMMAND_TYPE_vkEnumeratePhysicalDeviceGroups_EXT = 143,
VK_COMMAND_TYPE_vkEnumeratePhysicalDeviceGroupsKHR_EXT = 143,
VK_COMMAND_TYPE_vkGetImageMemoryRequirements2_EXT = 144,
VK_COMMAND_TYPE_vkGetImageMemoryRequirements2KHR_EXT = 144,
VK_COMMAND_TYPE_vkGetBufferMemoryRequirements2_EXT = 145,
VK_COMMAND_TYPE_vkGetBufferMemoryRequirements2KHR_EXT = 145,
VK_COMMAND_TYPE_vkGetImageSparseMemoryRequirements2_EXT = 146,
VK_COMMAND_TYPE_vkGetImageSparseMemoryRequirements2KHR_EXT = 146,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFeatures2_EXT = 147,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFeatures2KHR_EXT = 147,
VK_COMMAND_TYPE_vkGetPhysicalDeviceProperties2_EXT = 148,
VK_COMMAND_TYPE_vkGetPhysicalDeviceProperties2KHR_EXT = 148,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFormatProperties2_EXT = 149,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFormatProperties2KHR_EXT = 149,
VK_COMMAND_TYPE_vkGetPhysicalDeviceImageFormatProperties2_EXT = 150,
VK_COMMAND_TYPE_vkGetPhysicalDeviceImageFormatProperties2KHR_EXT = 150,
VK_COMMAND_TYPE_vkGetPhysicalDeviceQueueFamilyProperties2_EXT = 151,
VK_COMMAND_TYPE_vkGetPhysicalDeviceQueueFamilyProperties2KHR_EXT = 151,
VK_COMMAND_TYPE_vkGetPhysicalDeviceMemoryProperties2_EXT = 152,
VK_COMMAND_TYPE_vkGetPhysicalDeviceMemoryProperties2KHR_EXT = 152,
VK_COMMAND_TYPE_vkGetPhysicalDeviceSparseImageFormatProperties2_EXT = 153,
VK_COMMAND_TYPE_vkGetPhysicalDeviceSparseImageFormatProperties2KHR_EXT = 153,
VK_COMMAND_TYPE_vkTrimCommandPool_EXT = 154,
VK_COMMAND_TYPE_vkTrimCommandPoolKHR_EXT = 154,
VK_COMMAND_TYPE_vkGetDeviceQueue2_EXT = 155,
VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_EXT = 156,
VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversionKHR_EXT = 156,
VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT = 157,
VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversionKHR_EXT = 157,
VK_COMMAND_TYPE_vkCreateDescriptorUpdateTemplate_EXT = 158,
VK_COMMAND_TYPE_vkCreateDescriptorUpdateTemplateKHR_EXT = 158,
VK_COMMAND_TYPE_vkDestroyDescriptorUpdateTemplate_EXT = 159,
VK_COMMAND_TYPE_vkDestroyDescriptorUpdateTemplateKHR_EXT = 159,
VK_COMMAND_TYPE_vkUpdateDescriptorSetWithTemplate_EXT = 160,
VK_COMMAND_TYPE_vkUpdateDescriptorSetWithTemplateKHR_EXT = 160,
VK_COMMAND_TYPE_vkGetPhysicalDeviceExternalBufferProperties_EXT = 161,
VK_COMMAND_TYPE_vkGetPhysicalDeviceExternalBufferPropertiesKHR_EXT = 161,
VK_COMMAND_TYPE_vkGetPhysicalDeviceExternalFenceProperties_EXT = 162,
VK_COMMAND_TYPE_vkGetPhysicalDeviceExternalFencePropertiesKHR_EXT = 162,
VK_COMMAND_TYPE_vkGetPhysicalDeviceExternalSemaphoreProperties_EXT = 163,
VK_COMMAND_TYPE_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR_EXT = 163,
VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupport_EXT = 164,
VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupportKHR_EXT = 164,
VK_COMMAND_TYPE_vkCmdDrawIndirectCount_EXT = 165,
VK_COMMAND_TYPE_vkCmdDrawIndirectCountKHR_EXT = 165,
VK_COMMAND_TYPE_vkCmdDrawIndirectCountAMD_EXT = 165,
VK_COMMAND_TYPE_vkCmdDrawIndexedIndirectCount_EXT = 166,
VK_COMMAND_TYPE_vkCmdDrawIndexedIndirectCountKHR_EXT = 166,
VK_COMMAND_TYPE_vkCmdDrawIndexedIndirectCountAMD_EXT = 166,
VK_COMMAND_TYPE_vkCreateRenderPass2_EXT = 167,
VK_COMMAND_TYPE_vkCreateRenderPass2KHR_EXT = 167,
VK_COMMAND_TYPE_vkCmdBeginRenderPass2_EXT = 168,
VK_COMMAND_TYPE_vkCmdBeginRenderPass2KHR_EXT = 168,
VK_COMMAND_TYPE_vkCmdNextSubpass2_EXT = 169,
VK_COMMAND_TYPE_vkCmdNextSubpass2KHR_EXT = 169,
VK_COMMAND_TYPE_vkCmdEndRenderPass2_EXT = 170,
VK_COMMAND_TYPE_vkCmdEndRenderPass2KHR_EXT = 170,
VK_COMMAND_TYPE_vkResetQueryPool_EXT = 171,
VK_COMMAND_TYPE_vkResetQueryPoolEXT_EXT = 171,
VK_COMMAND_TYPE_vkGetSemaphoreCounterValue_EXT = 172,
VK_COMMAND_TYPE_vkGetSemaphoreCounterValueKHR_EXT = 172,
VK_COMMAND_TYPE_vkWaitSemaphores_EXT = 173,
VK_COMMAND_TYPE_vkWaitSemaphoresKHR_EXT = 173,
VK_COMMAND_TYPE_vkSignalSemaphore_EXT = 174,
VK_COMMAND_TYPE_vkSignalSemaphoreKHR_EXT = 174,
VK_COMMAND_TYPE_vkGetBufferDeviceAddress_EXT = 175,
VK_COMMAND_TYPE_vkGetBufferDeviceAddressKHR_EXT = 175,
VK_COMMAND_TYPE_vkGetBufferDeviceAddressEXT_EXT = 175,
VK_COMMAND_TYPE_vkGetBufferOpaqueCaptureAddress_EXT = 176,
VK_COMMAND_TYPE_vkGetBufferOpaqueCaptureAddressKHR_EXT = 176,
VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddress_EXT = 177,
VK_COMMAND_TYPE_vkGetDeviceMemoryOpaqueCaptureAddressKHR_EXT = 177,
VK_COMMAND_TYPE_vkSetReplyCommandStreamMESA_EXT = 178,
VK_COMMAND_TYPE_vkSeekReplyCommandStreamMESA_EXT = 179,
VK_COMMAND_TYPE_vkExecuteCommandStreamsMESA_EXT = 180,
VK_COMMAND_TYPE_vkCmdBindTransformFeedbackBuffersEXT_EXT = 181,
VK_COMMAND_TYPE_vkCmdBeginTransformFeedbackEXT_EXT = 182,
VK_COMMAND_TYPE_vkCmdEndTransformFeedbackEXT_EXT = 183,
VK_COMMAND_TYPE_vkCmdBeginQueryIndexedEXT_EXT = 184,
VK_COMMAND_TYPE_vkCmdEndQueryIndexedEXT_EXT = 185,
VK_COMMAND_TYPE_vkCmdDrawIndirectByteCountEXT_EXT = 186,
VK_COMMAND_TYPE_vkGetImageDrmFormatModifierPropertiesEXT_EXT = 187,
VK_COMMAND_TYPE_vkCreateRingMESA_EXT = 188,
VK_COMMAND_TYPE_vkDestroyRingMESA_EXT = 189,
VK_COMMAND_TYPE_vkNotifyRingMESA_EXT = 190,
VK_COMMAND_TYPE_vkWriteRingExtraMESA_EXT = 191,
VK_COMMAND_TYPE_vkGetMemoryResourcePropertiesMESA_EXT = 192,
VK_COMMAND_TYPE_vkGetMemoryFdKHR_EXT = 193,
VK_COMMAND_TYPE_vkGetMemoryFdPropertiesKHR_EXT = 194,
VK_COMMAND_TYPE_vkGetPhysicalDeviceToolProperties_EXT = 196,
VK_COMMAND_TYPE_vkGetPhysicalDeviceToolPropertiesEXT_EXT = 196,
VK_COMMAND_TYPE_vkCreatePrivateDataSlot_EXT = 197,
VK_COMMAND_TYPE_vkCreatePrivateDataSlotEXT_EXT = 197,
VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT = 198,
VK_COMMAND_TYPE_vkDestroyPrivateDataSlotEXT_EXT = 198,
VK_COMMAND_TYPE_vkSetPrivateData_EXT = 199,
VK_COMMAND_TYPE_vkSetPrivateDataEXT_EXT = 199,
VK_COMMAND_TYPE_vkGetPrivateData_EXT = 200,
VK_COMMAND_TYPE_vkGetPrivateDataEXT_EXT = 200,
VK_COMMAND_TYPE_vkCmdSetEvent2_EXT = 201,
VK_COMMAND_TYPE_vkCmdSetEvent2KHR_EXT = 201,
VK_COMMAND_TYPE_vkCmdResetEvent2_EXT = 202,
VK_COMMAND_TYPE_vkCmdResetEvent2KHR_EXT = 202,
VK_COMMAND_TYPE_vkCmdWaitEvents2_EXT = 203,
VK_COMMAND_TYPE_vkCmdWaitEvents2KHR_EXT = 203,
VK_COMMAND_TYPE_vkCmdPipelineBarrier2_EXT = 204,
VK_COMMAND_TYPE_vkCmdPipelineBarrier2KHR_EXT = 204,
VK_COMMAND_TYPE_vkCmdWriteTimestamp2_EXT = 205,
VK_COMMAND_TYPE_vkCmdWriteTimestamp2KHR_EXT = 205,
VK_COMMAND_TYPE_vkQueueSubmit2_EXT = 206,
VK_COMMAND_TYPE_vkQueueSubmit2KHR_EXT = 206,
VK_COMMAND_TYPE_vkCmdCopyBuffer2_EXT = 207,
VK_COMMAND_TYPE_vkCmdCopyBuffer2KHR_EXT = 207,
VK_COMMAND_TYPE_vkCmdCopyImage2_EXT = 208,
VK_COMMAND_TYPE_vkCmdCopyImage2KHR_EXT = 208,
VK_COMMAND_TYPE_vkCmdCopyBufferToImage2_EXT = 209,
VK_COMMAND_TYPE_vkCmdCopyBufferToImage2KHR_EXT = 209,
VK_COMMAND_TYPE_vkCmdCopyImageToBuffer2_EXT = 210,
VK_COMMAND_TYPE_vkCmdCopyImageToBuffer2KHR_EXT = 210,
VK_COMMAND_TYPE_vkCmdBlitImage2_EXT = 211,
VK_COMMAND_TYPE_vkCmdBlitImage2KHR_EXT = 211,
VK_COMMAND_TYPE_vkCmdResolveImage2_EXT = 212,
VK_COMMAND_TYPE_vkCmdResolveImage2KHR_EXT = 212,
VK_COMMAND_TYPE_vkCmdBeginRendering_EXT = 213,
VK_COMMAND_TYPE_vkCmdBeginRenderingKHR_EXT = 213,
VK_COMMAND_TYPE_vkCmdEndRendering_EXT = 214,
VK_COMMAND_TYPE_vkCmdEndRenderingKHR_EXT = 214,
VK_COMMAND_TYPE_vkCmdSetCullMode_EXT = 215,
VK_COMMAND_TYPE_vkCmdSetCullModeEXT_EXT = 215,
VK_COMMAND_TYPE_vkCmdSetFrontFace_EXT = 216,
VK_COMMAND_TYPE_vkCmdSetFrontFaceEXT_EXT = 216,
VK_COMMAND_TYPE_vkCmdSetPrimitiveTopology_EXT = 217,
VK_COMMAND_TYPE_vkCmdSetPrimitiveTopologyEXT_EXT = 217,
VK_COMMAND_TYPE_vkCmdSetViewportWithCount_EXT = 218,
VK_COMMAND_TYPE_vkCmdSetViewportWithCountEXT_EXT = 218,
VK_COMMAND_TYPE_vkCmdSetScissorWithCount_EXT = 219,
VK_COMMAND_TYPE_vkCmdSetScissorWithCountEXT_EXT = 219,
VK_COMMAND_TYPE_vkCmdBindVertexBuffers2_EXT = 220,
VK_COMMAND_TYPE_vkCmdBindVertexBuffers2EXT_EXT = 220,
VK_COMMAND_TYPE_vkCmdSetDepthTestEnable_EXT = 221,
VK_COMMAND_TYPE_vkCmdSetDepthTestEnableEXT_EXT = 221,
VK_COMMAND_TYPE_vkCmdSetDepthWriteEnable_EXT = 222,
VK_COMMAND_TYPE_vkCmdSetDepthWriteEnableEXT_EXT = 222,
VK_COMMAND_TYPE_vkCmdSetDepthCompareOp_EXT = 223,
VK_COMMAND_TYPE_vkCmdSetDepthCompareOpEXT_EXT = 223,
VK_COMMAND_TYPE_vkCmdSetDepthBoundsTestEnable_EXT = 224,
VK_COMMAND_TYPE_vkCmdSetDepthBoundsTestEnableEXT_EXT = 224,
VK_COMMAND_TYPE_vkCmdSetStencilTestEnable_EXT = 225,
VK_COMMAND_TYPE_vkCmdSetStencilTestEnableEXT_EXT = 225,
VK_COMMAND_TYPE_vkCmdSetStencilOp_EXT = 226,
VK_COMMAND_TYPE_vkCmdSetStencilOpEXT_EXT = 226,
VK_COMMAND_TYPE_vkCmdSetRasterizerDiscardEnable_EXT = 227,
VK_COMMAND_TYPE_vkCmdSetRasterizerDiscardEnableEXT_EXT = 227,
VK_COMMAND_TYPE_vkCmdSetDepthBiasEnable_EXT = 228,
VK_COMMAND_TYPE_vkCmdSetDepthBiasEnableEXT_EXT = 228,
VK_COMMAND_TYPE_vkCmdSetPrimitiveRestartEnable_EXT = 229,
VK_COMMAND_TYPE_vkCmdSetPrimitiveRestartEnableEXT_EXT = 229,
VK_COMMAND_TYPE_vkGetDeviceBufferMemoryRequirements_EXT = 230,
VK_COMMAND_TYPE_vkGetDeviceBufferMemoryRequirementsKHR_EXT = 230,
VK_COMMAND_TYPE_vkGetDeviceImageMemoryRequirements_EXT = 231,
VK_COMMAND_TYPE_vkGetDeviceImageMemoryRequirementsKHR_EXT = 231,
VK_COMMAND_TYPE_vkGetDeviceImageSparseMemoryRequirements_EXT = 232,
VK_COMMAND_TYPE_vkGetDeviceImageSparseMemoryRequirementsKHR_EXT = 232,
VK_COMMAND_TYPE_vkCmdSetPatchControlPointsEXT_EXT = 233,
VK_COMMAND_TYPE_vkCmdSetLogicOpEXT_EXT = 234,
VK_COMMAND_TYPE_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR_EXT = 235,
VK_COMMAND_TYPE_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT_EXT = 235,
VK_COMMAND_TYPE_vkGetCalibratedTimestampsKHR_EXT = 236,
VK_COMMAND_TYPE_vkGetCalibratedTimestampsEXT_EXT = 236,
VK_COMMAND_TYPE_vkCmdSetLineStipple_EXT = 237,
VK_COMMAND_TYPE_vkCmdSetLineStippleKHR_EXT = 237,
VK_COMMAND_TYPE_vkCmdSetLineStippleEXT_EXT = 237,
VK_COMMAND_TYPE_vkImportFenceFdKHR_EXT = 238,
VK_COMMAND_TYPE_vkGetFenceFdKHR_EXT = 239,
VK_COMMAND_TYPE_vkCmdBeginConditionalRenderingEXT_EXT = 240,
VK_COMMAND_TYPE_vkCmdEndConditionalRenderingEXT_EXT = 241,
VK_COMMAND_TYPE_vkImportSemaphoreFdKHR_EXT = 242,
VK_COMMAND_TYPE_vkGetSemaphoreFdKHR_EXT = 243,
VK_COMMAND_TYPE_vkResetFenceResourceMESA_EXT = 244,
VK_COMMAND_TYPE_vkWaitSemaphoreResourceMESA_EXT = 245,
VK_COMMAND_TYPE_vkImportSemaphoreResourceMESA_EXT = 246,
VK_COMMAND_TYPE_vkCmdDrawMultiEXT_EXT = 247,
VK_COMMAND_TYPE_vkCmdDrawMultiIndexedEXT_EXT = 248,
VK_COMMAND_TYPE_vkCmdPushDescriptorSet_EXT = 249,
VK_COMMAND_TYPE_vkCmdPushDescriptorSetKHR_EXT = 249,
VK_COMMAND_TYPE_vkCmdPushDescriptorSetWithTemplate_EXT = 250,
VK_COMMAND_TYPE_vkCmdPushDescriptorSetWithTemplateKHR_EXT = 250,
VK_COMMAND_TYPE_vkSubmitVirtqueueSeqnoMESA_EXT = 251,
VK_COMMAND_TYPE_vkWaitVirtqueueSeqnoMESA_EXT = 252,
VK_COMMAND_TYPE_vkWaitRingSeqnoMESA_EXT = 253,
VK_COMMAND_TYPE_vkCmdSetColorWriteEnableEXT_EXT = 254,
VK_COMMAND_TYPE_vkCmdSetVertexInputEXT_EXT = 255,
VK_COMMAND_TYPE_vkCmdSetTessellationDomainOriginEXT_EXT = 256,
VK_COMMAND_TYPE_vkCmdSetDepthClampEnableEXT_EXT = 257,
VK_COMMAND_TYPE_vkCmdSetPolygonModeEXT_EXT = 258,
VK_COMMAND_TYPE_vkCmdSetRasterizationSamplesEXT_EXT = 259,
VK_COMMAND_TYPE_vkCmdSetSampleMaskEXT_EXT = 260,
VK_COMMAND_TYPE_vkCmdSetAlphaToCoverageEnableEXT_EXT = 261,
VK_COMMAND_TYPE_vkCmdSetAlphaToOneEnableEXT_EXT = 262,
VK_COMMAND_TYPE_vkCmdSetLogicOpEnableEXT_EXT = 263,
VK_COMMAND_TYPE_vkCmdSetColorBlendEnableEXT_EXT = 264,
VK_COMMAND_TYPE_vkCmdSetColorBlendEquationEXT_EXT = 265,
VK_COMMAND_TYPE_vkCmdSetColorWriteMaskEXT_EXT = 266,
VK_COMMAND_TYPE_vkCmdSetRasterizationStreamEXT_EXT = 267,
VK_COMMAND_TYPE_vkCmdSetConservativeRasterizationModeEXT_EXT = 268,
VK_COMMAND_TYPE_vkCmdSetExtraPrimitiveOverestimationSizeEXT_EXT = 269,
VK_COMMAND_TYPE_vkCmdSetDepthClipEnableEXT_EXT = 270,
VK_COMMAND_TYPE_vkCmdSetSampleLocationsEnableEXT_EXT = 271,
VK_COMMAND_TYPE_vkCmdSetColorBlendAdvancedEXT_EXT = 272,
VK_COMMAND_TYPE_vkCmdSetProvokingVertexModeEXT_EXT = 273,
VK_COMMAND_TYPE_vkCmdSetLineRasterizationModeEXT_EXT = 274,
VK_COMMAND_TYPE_vkCmdSetLineStippleEnableEXT_EXT = 275,
VK_COMMAND_TYPE_vkCmdSetDepthClipNegativeOneToOneEXT_EXT = 276,
VK_COMMAND_TYPE_vkGetPhysicalDeviceFragmentShadingRatesKHR_EXT = 277,
VK_COMMAND_TYPE_vkCmdSetFragmentShadingRateKHR_EXT = 278,
VK_COMMAND_TYPE_vkCmdBindIndexBuffer2_EXT = 279,
VK_COMMAND_TYPE_vkCmdBindIndexBuffer2KHR_EXT = 279,
VK_COMMAND_TYPE_vkGetRenderingAreaGranularity_EXT = 280,
VK_COMMAND_TYPE_vkGetRenderingAreaGranularityKHR_EXT = 280,
VK_COMMAND_TYPE_vkGetDeviceImageSubresourceLayout_EXT = 281,
VK_COMMAND_TYPE_vkGetDeviceImageSubresourceLayoutKHR_EXT = 281,
VK_COMMAND_TYPE_vkGetImageSubresourceLayout2_EXT = 282,
VK_COMMAND_TYPE_vkGetImageSubresourceLayout2KHR_EXT = 282,
VK_COMMAND_TYPE_vkGetImageSubresourceLayout2EXT_EXT = 282,
VK_COMMAND_TYPE_vkCmdSetSampleLocationsEXT_EXT = 283,
VK_COMMAND_TYPE_vkGetPhysicalDeviceMultisamplePropertiesEXT_EXT = 284,
VK_COMMAND_TYPE_vkMapMemory2_EXT = 285,
VK_COMMAND_TYPE_vkMapMemory2KHR_EXT = 285,
VK_COMMAND_TYPE_vkUnmapMemory2_EXT = 286,
VK_COMMAND_TYPE_vkUnmapMemory2KHR_EXT = 286,
VK_COMMAND_TYPE_vkCmdSetRenderingAttachmentLocations_EXT = 287,
VK_COMMAND_TYPE_vkCmdSetRenderingAttachmentLocationsKHR_EXT = 287,
VK_COMMAND_TYPE_vkCmdSetRenderingInputAttachmentIndices_EXT = 288,
VK_COMMAND_TYPE_vkCmdSetRenderingInputAttachmentIndicesKHR_EXT = 288,
VK_COMMAND_TYPE_vkCmdBindDescriptorSets2_EXT = 289,
VK_COMMAND_TYPE_vkCmdBindDescriptorSets2KHR_EXT = 289,
VK_COMMAND_TYPE_vkCmdPushConstants2_EXT = 290,
VK_COMMAND_TYPE_vkCmdPushConstants2KHR_EXT = 290,
VK_COMMAND_TYPE_vkCmdPushDescriptorSet2_EXT = 291,
VK_COMMAND_TYPE_vkCmdPushDescriptorSet2KHR_EXT = 291,
VK_COMMAND_TYPE_vkCmdPushDescriptorSetWithTemplate2_EXT = 292,
VK_COMMAND_TYPE_vkCmdPushDescriptorSetWithTemplate2KHR_EXT = 292,
VK_COMMAND_TYPE_vkCopyMemoryToImage_EXT = 293,
VK_COMMAND_TYPE_vkCopyMemoryToImageEXT_EXT = 293,
VK_COMMAND_TYPE_vkCopyImageToMemory_EXT = 294,
VK_COMMAND_TYPE_vkCopyImageToMemoryEXT_EXT = 294,
VK_COMMAND_TYPE_vkCopyImageToImage_EXT = 295,
VK_COMMAND_TYPE_vkCopyImageToImageEXT_EXT = 295,
VK_COMMAND_TYPE_vkTransitionImageLayout_EXT = 296,
VK_COMMAND_TYPE_vkTransitionImageLayoutEXT_EXT = 296,
VK_COMMAND_TYPE_vkCopyImageToMemoryMESA_EXT = 297,
VK_COMMAND_TYPE_vkCopyMemoryToImageMESA_EXT = 298,
VK_COMMAND_TYPE_vkCreateDeferredOperationKHR_EXT = 299,
VK_COMMAND_TYPE_vkDestroyDeferredOperationKHR_EXT = 300,
VK_COMMAND_TYPE_vkGetDeferredOperationMaxConcurrencyKHR_EXT = 301,
VK_COMMAND_TYPE_vkGetDeferredOperationResultKHR_EXT = 302,
VK_COMMAND_TYPE_vkDeferredOperationJoinKHR_EXT = 303,
VK_COMMAND_TYPE_vkCreateAccelerationStructureKHR_EXT = 304,
VK_COMMAND_TYPE_vkDestroyAccelerationStructureKHR_EXT = 305,
VK_COMMAND_TYPE_vkCmdBuildAccelerationStructuresKHR_EXT = 306,
VK_COMMAND_TYPE_vkCmdBuildAccelerationStructuresIndirectKHR_EXT = 307,
VK_COMMAND_TYPE_vkBuildAccelerationStructuresKHR_EXT = 308,
VK_COMMAND_TYPE_vkCopyAccelerationStructureKHR_EXT = 309,
VK_COMMAND_TYPE_vkCopyAccelerationStructureToMemoryKHR_EXT = 310,
VK_COMMAND_TYPE_vkCopyMemoryToAccelerationStructureKHR_EXT = 311,
VK_COMMAND_TYPE_vkWriteAccelerationStructuresPropertiesKHR_EXT = 312,
VK_COMMAND_TYPE_vkCmdCopyAccelerationStructureKHR_EXT = 313,
VK_COMMAND_TYPE_vkCmdCopyAccelerationStructureToMemoryKHR_EXT = 314,
VK_COMMAND_TYPE_vkCmdCopyMemoryToAccelerationStructureKHR_EXT = 315,
VK_COMMAND_TYPE_vkGetAccelerationStructureDeviceAddressKHR_EXT = 316,
VK_COMMAND_TYPE_vkCmdWriteAccelerationStructuresPropertiesKHR_EXT = 317,
VK_COMMAND_TYPE_vkGetDeviceAccelerationStructureCompatibilityKHR_EXT = 318,
VK_COMMAND_TYPE_vkGetAccelerationStructureBuildSizesKHR_EXT = 319,
VK_COMMAND_TYPE_vkCmdTraceRaysKHR_EXT = 320,
VK_COMMAND_TYPE_vkCreateRayTracingPipelinesKHR_EXT = 321,
VK_COMMAND_TYPE_vkGetRayTracingShaderGroupHandlesKHR_EXT = 322,
VK_COMMAND_TYPE_vkGetRayTracingShaderGroupHandlesNV_EXT = 322,
VK_COMMAND_TYPE_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR_EXT = 323,
VK_COMMAND_TYPE_vkCmdTraceRaysIndirectKHR_EXT = 324,
VK_COMMAND_TYPE_vkGetRayTracingShaderGroupStackSizeKHR_EXT = 325,
VK_COMMAND_TYPE_vkCmdSetRayTracingPipelineStackSizeKHR_EXT = 326,
VK_COMMAND_TYPE_vkCmdTraceRaysIndirect2KHR_EXT = 327,
VK_COMMAND_TYPE_vkCmdSetDepthBias2EXT_EXT = 328,
VK_COMMAND_TYPE_vkCmdSetAttachmentFeedbackLoopEnableEXT_EXT = 329,
VK_COMMAND_TYPE_vkCmdSetDepthClampRangeEXT_EXT = 330,
VK_COMMAND_TYPE_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR_EXT = 331,
VK_COMMAND_TYPE_vkCmdDrawMeshTasksEXT_EXT = 332,
VK_COMMAND_TYPE_vkCmdDrawMeshTasksIndirectEXT_EXT = 333,
VK_COMMAND_TYPE_vkCmdDrawMeshTasksIndirectCountEXT_EXT = 334,
VK_COMMAND_TYPE_vkWriteSamplerDescriptorMESA_EXT = 335,
VK_COMMAND_TYPE_vkWriteResourceDescriptorMESA_EXT = 336,
VK_COMMAND_TYPE_vkWriteSamplerDescriptorsEXT_EXT = 337,
VK_COMMAND_TYPE_vkWriteResourceDescriptorsEXT_EXT = 338,
VK_COMMAND_TYPE_vkCmdBindSamplerHeapEXT_EXT = 339,
VK_COMMAND_TYPE_vkCmdBindResourceHeapEXT_EXT = 340,
VK_COMMAND_TYPE_vkCmdPushDataEXT_EXT = 341,
VK_COMMAND_TYPE_vkGetImageOpaqueCaptureDataEXT_EXT = 342,
VK_COMMAND_TYPE_vkGetPhysicalDeviceDescriptorSizeEXT_EXT = 343,
VK_COMMAND_TYPE_vkRegisterCustomBorderColorEXT_EXT = 344,
VK_COMMAND_TYPE_vkUnregisterCustomBorderColorEXT_EXT = 345,
} VkCommandTypeEXT;
typedef enum VkCommandFlagBitsEXT {
VK_COMMAND_GENERATE_REPLY_BIT_EXT = 0x00000001,
} VkCommandFlagBitsEXT;
typedef enum VkRingStatusFlagBitsMESA {
VK_RING_STATUS_NONE_MESA = 0,
VK_RING_STATUS_IDLE_BIT_MESA = 0x00000001,
VK_RING_STATUS_FATAL_BIT_MESA = 0x00000002,
VK_RING_STATUS_ALIVE_BIT_MESA = 0x00000004,
} VkRingStatusFlagBitsMESA;
typedef VkFlags VkCommandFlagsEXT;
typedef VkFlags VkCommandStreamExecutionFlagsMESA;
typedef VkFlags VkRingCreateFlagsMESA;
typedef VkFlags VkRingNotifyFlagsMESA;
typedef VkFlags VkRingStatusFlagsMESA;
typedef struct VkCommandStreamDescriptionMESA {
uint32_t resourceId;
size_t offset;
size_t size;
} VkCommandStreamDescriptionMESA;
typedef struct VkCommandStreamDependencyMESA {
uint32_t srcCommandStream;
uint32_t dstCommandStream;
} VkCommandStreamDependencyMESA;
typedef struct VkRingCreateInfoMESA {
VkStructureType sType;
const void* pNext;
VkRingCreateFlagsMESA flags;
uint32_t resourceId;
size_t offset;
size_t size;
uint64_t idleTimeout;
size_t headOffset;
size_t tailOffset;
size_t statusOffset;
size_t bufferOffset;
size_t bufferSize;
size_t extraOffset;
size_t extraSize;
} VkRingCreateInfoMESA;
typedef struct VkRingMonitorInfoMESA {
VkStructureType sType;
const void* pNext;
uint32_t maxReportingPeriodMicroseconds;
} VkRingMonitorInfoMESA;
typedef struct VkMemoryResourcePropertiesMESA {
VkStructureType sType;
void* pNext;
uint32_t memoryTypeBits;
} VkMemoryResourcePropertiesMESA;
typedef struct VkImportMemoryResourceInfoMESA {
VkStructureType sType;
const void* pNext;
uint32_t resourceId;
} VkImportMemoryResourceInfoMESA;
typedef struct VkMemoryResourceAllocationSizePropertiesMESA {
VkStructureType sType;
void* pNext;
uint64_t allocationSize;
} VkMemoryResourceAllocationSizePropertiesMESA;
typedef struct VkImportSemaphoreResourceInfoMESA {
VkStructureType sType;
const void* pNext;
VkSemaphore semaphore;
uint32_t resourceId;
} VkImportSemaphoreResourceInfoMESA;
typedef struct VkDeviceQueueTimelineInfoMESA {
VkStructureType sType;
const void* pNext;
uint32_t ringIdx;
} VkDeviceQueueTimelineInfoMESA;
typedef struct VkRingPriorityInfoMESA {
VkStructureType sType;
const void* pNext;
int32_t priority;
} VkRingPriorityInfoMESA;
typedef struct VkCopyImageToMemoryInfoMESA {
VkStructureType sType;
const void* pNext;
VkHostImageCopyFlags flags;
VkImage srcImage;
VkImageLayout srcImageLayout;
uint32_t memoryRowLength;
uint32_t memoryImageHeight;
VkImageSubresourceLayers imageSubresource;
VkOffset3D imageOffset;
VkExtent3D imageExtent;
} VkCopyImageToMemoryInfoMESA;
typedef struct VkMemoryToImageCopyMESA {
VkStructureType sType;
const void* pNext;
size_t dataSize;
const void* pData;
uint32_t memoryRowLength;
uint32_t memoryImageHeight;
VkImageSubresourceLayers imageSubresource;
VkOffset3D imageOffset;
VkExtent3D imageExtent;
} VkMemoryToImageCopyMESA;
typedef struct VkCopyMemoryToImageInfoMESA {
VkStructureType sType;
const void* pNext;
VkHostImageCopyFlags flags;
VkImage dstImage;
VkImageLayout dstImageLayout;
uint32_t regionCount;
const VkMemoryToImageCopyMESA* pRegions;
} VkCopyMemoryToImageInfoMESA;
#endif /* VN_PROTOCOL_DRIVER_DEFINES_H */
@@ -0,0 +1,979 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_HEAP_H
#define VN_PROTOCOL_DRIVER_DESCRIPTOR_HEAP_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/*
* These structs/unions/commands are not included
*
* vkWriteSamplerDescriptorsEXT
* vkWriteResourceDescriptorsEXT
*/
/* struct VkHostAddressRangeEXT */
static inline size_t
vn_sizeof_VkHostAddressRangeEXT(const VkHostAddressRangeEXT *val)
{
size_t size = 0;
size += vn_sizeof_size_t(&val->size);
if (val->address) {
size += vn_sizeof_array_size(val->size);
size += vn_sizeof_blob_array(val->address, val->size);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline void
vn_encode_VkHostAddressRangeEXT(struct vn_cs_encoder *enc, const VkHostAddressRangeEXT *val)
{
vn_encode_size_t(enc, &val->size);
if (val->address) {
vn_encode_array_size(enc, val->size);
vn_encode_blob_array(enc, val->address, val->size);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_decode_VkHostAddressRangeEXT(struct vn_cs_decoder *dec, VkHostAddressRangeEXT *val)
{
vn_decode_size_t(dec, &val->size);
if (vn_peek_array_size(dec)) {
const size_t array_size = vn_decode_array_size(dec, val->size);
vn_decode_blob_array(dec, val->address, array_size);
} else {
vn_decode_array_size_unchecked(dec);
val->address = NULL;
}
}
static inline size_t
vn_sizeof_VkHostAddressRangeEXT_partial(const VkHostAddressRangeEXT *val)
{
size_t size = 0;
size += vn_sizeof_size_t(&val->size);
size += vn_sizeof_simple_pointer(val->address); /* out */
return size;
}
static inline void
vn_encode_VkHostAddressRangeEXT_partial(struct vn_cs_encoder *enc, const VkHostAddressRangeEXT *val)
{
vn_encode_size_t(enc, &val->size);
vn_encode_array_size(enc, val->address ? val->size : 0); /* out */
}
/* struct VkImageDescriptorInfoEXT chain */
static inline size_t
vn_sizeof_VkImageDescriptorInfoEXT_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkImageDescriptorInfoEXT_self(const VkImageDescriptorInfoEXT *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_simple_pointer(val->pView);
if (val->pView)
size += vn_sizeof_VkImageViewCreateInfo(val->pView);
size += vn_sizeof_VkImageLayout(&val->layout);
return size;
}
static inline size_t
vn_sizeof_VkImageDescriptorInfoEXT(const VkImageDescriptorInfoEXT *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkImageDescriptorInfoEXT_pnext(val->pNext);
size += vn_sizeof_VkImageDescriptorInfoEXT_self(val);
return size;
}
static inline void
vn_encode_VkImageDescriptorInfoEXT_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkImageDescriptorInfoEXT_self(struct vn_cs_encoder *enc, const VkImageDescriptorInfoEXT *val)
{
/* skip val->{sType,pNext} */
if (vn_encode_simple_pointer(enc, val->pView))
vn_encode_VkImageViewCreateInfo(enc, val->pView);
vn_encode_VkImageLayout(enc, &val->layout);
}
static inline void
vn_encode_VkImageDescriptorInfoEXT(struct vn_cs_encoder *enc, const VkImageDescriptorInfoEXT *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_IMAGE_DESCRIPTOR_INFO_EXT);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_IMAGE_DESCRIPTOR_INFO_EXT });
vn_encode_VkImageDescriptorInfoEXT_pnext(enc, val->pNext);
vn_encode_VkImageDescriptorInfoEXT_self(enc, val);
}
/* struct VkTexelBufferDescriptorInfoEXT chain */
static inline size_t
vn_sizeof_VkTexelBufferDescriptorInfoEXT_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkTexelBufferDescriptorInfoEXT_self(const VkTexelBufferDescriptorInfoEXT *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFormat(&val->format);
size += vn_sizeof_VkDeviceAddressRangeEXT(&val->addressRange);
return size;
}
static inline size_t
vn_sizeof_VkTexelBufferDescriptorInfoEXT(const VkTexelBufferDescriptorInfoEXT *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkTexelBufferDescriptorInfoEXT_pnext(val->pNext);
size += vn_sizeof_VkTexelBufferDescriptorInfoEXT_self(val);
return size;
}
static inline void
vn_encode_VkTexelBufferDescriptorInfoEXT_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkTexelBufferDescriptorInfoEXT_self(struct vn_cs_encoder *enc, const VkTexelBufferDescriptorInfoEXT *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFormat(enc, &val->format);
vn_encode_VkDeviceAddressRangeEXT(enc, &val->addressRange);
}
static inline void
vn_encode_VkTexelBufferDescriptorInfoEXT(struct vn_cs_encoder *enc, const VkTexelBufferDescriptorInfoEXT *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_TEXEL_BUFFER_DESCRIPTOR_INFO_EXT);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_TEXEL_BUFFER_DESCRIPTOR_INFO_EXT });
vn_encode_VkTexelBufferDescriptorInfoEXT_pnext(enc, val->pNext);
vn_encode_VkTexelBufferDescriptorInfoEXT_self(enc, val);
}
/* struct VkTensorViewCreateInfoARM chain */
static inline size_t
vn_sizeof_VkTensorViewCreateInfoARM_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkTensorViewCreateInfoARM_self(const VkTensorViewCreateInfoARM *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags64(&val->flags);
size += vn_sizeof_VkTensorARM(&val->tensor);
size += vn_sizeof_VkFormat(&val->format);
return size;
}
static inline size_t
vn_sizeof_VkTensorViewCreateInfoARM(const VkTensorViewCreateInfoARM *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkTensorViewCreateInfoARM_pnext(val->pNext);
size += vn_sizeof_VkTensorViewCreateInfoARM_self(val);
return size;
}
static inline void
vn_encode_VkTensorViewCreateInfoARM_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkTensorViewCreateInfoARM_self(struct vn_cs_encoder *enc, const VkTensorViewCreateInfoARM *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags64(enc, &val->flags);
vn_encode_VkTensorARM(enc, &val->tensor);
vn_encode_VkFormat(enc, &val->format);
}
static inline void
vn_encode_VkTensorViewCreateInfoARM(struct vn_cs_encoder *enc, const VkTensorViewCreateInfoARM *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_TENSOR_VIEW_CREATE_INFO_ARM);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_TENSOR_VIEW_CREATE_INFO_ARM });
vn_encode_VkTensorViewCreateInfoARM_pnext(enc, val->pNext);
vn_encode_VkTensorViewCreateInfoARM_self(enc, val);
}
/* union VkResourceDescriptorDataEXT */
static inline size_t
vn_sizeof_VkResourceDescriptorDataEXT(const VkResourceDescriptorDataEXT *val, VkDescriptorType tag)
{
size_t size = vn_sizeof_VkDescriptorType(&tag);
switch (tag) {
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
size += vn_sizeof_simple_pointer(val->pImage);
if (val->pImage)
size += vn_sizeof_VkImageDescriptorInfoEXT(val->pImage);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
size += vn_sizeof_simple_pointer(val->pImage);
if (val->pImage)
size += vn_sizeof_VkImageDescriptorInfoEXT(val->pImage);
break;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
size += vn_sizeof_simple_pointer(val->pImage);
if (val->pImage)
size += vn_sizeof_VkImageDescriptorInfoEXT(val->pImage);
break;
case VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM:
size += vn_sizeof_simple_pointer(val->pImage);
if (val->pImage)
size += vn_sizeof_VkImageDescriptorInfoEXT(val->pImage);
break;
case VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM:
size += vn_sizeof_simple_pointer(val->pImage);
if (val->pImage)
size += vn_sizeof_VkImageDescriptorInfoEXT(val->pImage);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
size += vn_sizeof_simple_pointer(val->pTexelBuffer);
if (val->pTexelBuffer)
size += vn_sizeof_VkTexelBufferDescriptorInfoEXT(val->pTexelBuffer);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
size += vn_sizeof_simple_pointer(val->pTexelBuffer);
if (val->pTexelBuffer)
size += vn_sizeof_VkTexelBufferDescriptorInfoEXT(val->pTexelBuffer);
break;
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR:
size += vn_sizeof_simple_pointer(val->pAddressRange);
if (val->pAddressRange)
size += vn_sizeof_VkDeviceAddressRangeEXT(val->pAddressRange);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
size += vn_sizeof_simple_pointer(val->pAddressRange);
if (val->pAddressRange)
size += vn_sizeof_VkDeviceAddressRangeEXT(val->pAddressRange);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
size += vn_sizeof_simple_pointer(val->pAddressRange);
if (val->pAddressRange)
size += vn_sizeof_VkDeviceAddressRangeEXT(val->pAddressRange);
break;
case VK_DESCRIPTOR_TYPE_TENSOR_ARM:
size += vn_sizeof_simple_pointer(val->pTensorARM);
if (val->pTensorARM)
size += vn_sizeof_VkTensorViewCreateInfoARM(val->pTensorARM);
break;
default:
assert(false);
break;
}
return size;
}
static inline void
vn_encode_VkResourceDescriptorDataEXT(struct vn_cs_encoder *enc, const VkResourceDescriptorDataEXT *val, VkDescriptorType tag)
{
vn_encode_VkDescriptorType(enc, &tag);
switch (tag) {
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
if (vn_encode_simple_pointer(enc, val->pImage))
vn_encode_VkImageDescriptorInfoEXT(enc, val->pImage);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
if (vn_encode_simple_pointer(enc, val->pImage))
vn_encode_VkImageDescriptorInfoEXT(enc, val->pImage);
break;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
if (vn_encode_simple_pointer(enc, val->pImage))
vn_encode_VkImageDescriptorInfoEXT(enc, val->pImage);
break;
case VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM:
if (vn_encode_simple_pointer(enc, val->pImage))
vn_encode_VkImageDescriptorInfoEXT(enc, val->pImage);
break;
case VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM:
if (vn_encode_simple_pointer(enc, val->pImage))
vn_encode_VkImageDescriptorInfoEXT(enc, val->pImage);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
if (vn_encode_simple_pointer(enc, val->pTexelBuffer))
vn_encode_VkTexelBufferDescriptorInfoEXT(enc, val->pTexelBuffer);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
if (vn_encode_simple_pointer(enc, val->pTexelBuffer))
vn_encode_VkTexelBufferDescriptorInfoEXT(enc, val->pTexelBuffer);
break;
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR:
if (vn_encode_simple_pointer(enc, val->pAddressRange))
vn_encode_VkDeviceAddressRangeEXT(enc, val->pAddressRange);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
if (vn_encode_simple_pointer(enc, val->pAddressRange))
vn_encode_VkDeviceAddressRangeEXT(enc, val->pAddressRange);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
if (vn_encode_simple_pointer(enc, val->pAddressRange))
vn_encode_VkDeviceAddressRangeEXT(enc, val->pAddressRange);
break;
case VK_DESCRIPTOR_TYPE_TENSOR_ARM:
if (vn_encode_simple_pointer(enc, val->pTensorARM))
vn_encode_VkTensorViewCreateInfoARM(enc, val->pTensorARM);
break;
default:
assert(false);
break;
}
}
/* struct VkResourceDescriptorInfoEXT chain */
static inline size_t
vn_sizeof_VkResourceDescriptorInfoEXT_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkResourceDescriptorInfoEXT_self(const VkResourceDescriptorInfoEXT *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkDescriptorType(&val->type);
size += vn_sizeof_VkResourceDescriptorDataEXT(&val->data, val->type);
return size;
}
static inline size_t
vn_sizeof_VkResourceDescriptorInfoEXT(const VkResourceDescriptorInfoEXT *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkResourceDescriptorInfoEXT_pnext(val->pNext);
size += vn_sizeof_VkResourceDescriptorInfoEXT_self(val);
return size;
}
static inline void
vn_encode_VkResourceDescriptorInfoEXT_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkResourceDescriptorInfoEXT_self(struct vn_cs_encoder *enc, const VkResourceDescriptorInfoEXT *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkDescriptorType(enc, &val->type);
vn_encode_VkResourceDescriptorDataEXT(enc, &val->data, val->type);
}
static inline void
vn_encode_VkResourceDescriptorInfoEXT(struct vn_cs_encoder *enc, const VkResourceDescriptorInfoEXT *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_RESOURCE_DESCRIPTOR_INFO_EXT);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_RESOURCE_DESCRIPTOR_INFO_EXT });
vn_encode_VkResourceDescriptorInfoEXT_pnext(enc, val->pNext);
vn_encode_VkResourceDescriptorInfoEXT_self(enc, val);
}
static inline size_t vn_sizeof_vkRegisterCustomBorderColorEXT(VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkRegisterCustomBorderColorEXT_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pBorderColor);
if (pBorderColor)
cmd_size += vn_sizeof_VkSamplerCustomBorderColorCreateInfoEXT(pBorderColor);
cmd_size += vn_sizeof_VkBool32(&requestIndex);
cmd_size += vn_sizeof_simple_pointer(pIndex);
if (pIndex)
cmd_size += vn_sizeof_uint32_t(pIndex);
return cmd_size;
}
static inline void vn_encode_vkRegisterCustomBorderColorEXT(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkRegisterCustomBorderColorEXT_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pBorderColor))
vn_encode_VkSamplerCustomBorderColorCreateInfoEXT(enc, pBorderColor);
vn_encode_VkBool32(enc, &requestIndex);
if (vn_encode_simple_pointer(enc, pIndex))
vn_encode_uint32_t(enc, pIndex);
}
static inline size_t vn_sizeof_vkRegisterCustomBorderColorEXT_reply(VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkRegisterCustomBorderColorEXT_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pBorderColor */
/* skip requestIndex */
cmd_size += vn_sizeof_simple_pointer(pIndex);
if (pIndex)
cmd_size += vn_sizeof_uint32_t(pIndex);
return cmd_size;
}
static inline VkResult vn_decode_vkRegisterCustomBorderColorEXT_reply(struct vn_cs_decoder *dec, VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkRegisterCustomBorderColorEXT_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pBorderColor */
/* skip requestIndex */
if (vn_decode_simple_pointer(dec)) {
vn_decode_uint32_t(dec, pIndex);
} else {
pIndex = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkUnregisterCustomBorderColorEXT(VkDevice device, uint32_t index)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUnregisterCustomBorderColorEXT_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_uint32_t(&index);
return cmd_size;
}
static inline void vn_encode_vkUnregisterCustomBorderColorEXT(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t index)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUnregisterCustomBorderColorEXT_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_uint32_t(enc, &index);
}
static inline size_t vn_sizeof_vkUnregisterCustomBorderColorEXT_reply(VkDevice device, uint32_t index)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUnregisterCustomBorderColorEXT_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip index */
return cmd_size;
}
static inline void vn_decode_vkUnregisterCustomBorderColorEXT_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t index)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkUnregisterCustomBorderColorEXT_EXT);
/* skip device */
/* skip index */
}
static inline size_t vn_sizeof_vkGetImageOpaqueCaptureDataEXT(VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetImageOpaqueCaptureDataEXT_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_uint32_t(&imageCount);
if (pImages) {
cmd_size += vn_sizeof_array_size(imageCount);
for (uint32_t i = 0; i < imageCount; i++)
cmd_size += vn_sizeof_VkImage(&pImages[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
if (pDatas) {
cmd_size += vn_sizeof_array_size(imageCount);
for (uint32_t i = 0; i < imageCount; i++)
cmd_size += vn_sizeof_VkHostAddressRangeEXT_partial(&pDatas[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkGetImageOpaqueCaptureDataEXT(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetImageOpaqueCaptureDataEXT_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_uint32_t(enc, &imageCount);
if (pImages) {
vn_encode_array_size(enc, imageCount);
for (uint32_t i = 0; i < imageCount; i++)
vn_encode_VkImage(enc, &pImages[i]);
} else {
vn_encode_array_size(enc, 0);
}
if (pDatas) {
vn_encode_array_size(enc, imageCount);
for (uint32_t i = 0; i < imageCount; i++)
vn_encode_VkHostAddressRangeEXT_partial(enc, &pDatas[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkGetImageOpaqueCaptureDataEXT_reply(VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetImageOpaqueCaptureDataEXT_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip imageCount */
/* skip pImages */
if (pDatas) {
cmd_size += vn_sizeof_array_size(imageCount);
for (uint32_t i = 0; i < imageCount; i++)
cmd_size += vn_sizeof_VkHostAddressRangeEXT(&pDatas[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkGetImageOpaqueCaptureDataEXT_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetImageOpaqueCaptureDataEXT_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip imageCount */
/* skip pImages */
if (vn_peek_array_size(dec)) {
const uint32_t iter_count = vn_decode_array_size(dec, imageCount);
for (uint32_t i = 0; i < iter_count; i++)
vn_decode_VkHostAddressRangeEXT(dec, &pDatas[i]);
} else {
vn_decode_array_size_unchecked(dec);
pDatas = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkWriteSamplerDescriptorMESA(VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWriteSamplerDescriptorMESA_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pSampler);
if (pSampler)
cmd_size += vn_sizeof_VkSamplerCreateInfo(pSampler);
cmd_size += vn_sizeof_size_t(&dataSize);
cmd_size += vn_sizeof_simple_pointer(pData); /* out */
return cmd_size;
}
static inline void vn_encode_vkWriteSamplerDescriptorMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWriteSamplerDescriptorMESA_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pSampler))
vn_encode_VkSamplerCreateInfo(enc, pSampler);
vn_encode_size_t(enc, &dataSize);
vn_encode_array_size(enc, pData ? dataSize : 0); /* out */
}
static inline size_t vn_sizeof_vkWriteSamplerDescriptorMESA_reply(VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWriteSamplerDescriptorMESA_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pSampler */
/* skip dataSize */
if (pData) {
cmd_size += vn_sizeof_array_size(dataSize);
cmd_size += vn_sizeof_blob_array(pData, dataSize);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkWriteSamplerDescriptorMESA_reply(struct vn_cs_decoder *dec, VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkWriteSamplerDescriptorMESA_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pSampler */
/* skip dataSize */
if (vn_peek_array_size(dec)) {
const size_t array_size = vn_decode_array_size(dec, dataSize);
vn_decode_blob_array(dec, pData, array_size);
} else {
vn_decode_array_size_unchecked(dec);
pData = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkWriteResourceDescriptorMESA(VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWriteResourceDescriptorMESA_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pResource);
if (pResource)
cmd_size += vn_sizeof_VkResourceDescriptorInfoEXT(pResource);
cmd_size += vn_sizeof_size_t(&dataSize);
cmd_size += vn_sizeof_simple_pointer(pData); /* out */
return cmd_size;
}
static inline void vn_encode_vkWriteResourceDescriptorMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWriteResourceDescriptorMESA_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pResource))
vn_encode_VkResourceDescriptorInfoEXT(enc, pResource);
vn_encode_size_t(enc, &dataSize);
vn_encode_array_size(enc, pData ? dataSize : 0); /* out */
}
static inline size_t vn_sizeof_vkWriteResourceDescriptorMESA_reply(VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWriteResourceDescriptorMESA_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pResource */
/* skip dataSize */
if (pData) {
cmd_size += vn_sizeof_array_size(dataSize);
cmd_size += vn_sizeof_blob_array(pData, dataSize);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkWriteResourceDescriptorMESA_reply(struct vn_cs_decoder *dec, VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkWriteResourceDescriptorMESA_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pResource */
/* skip dataSize */
if (vn_peek_array_size(dec)) {
const size_t array_size = vn_decode_array_size(dec, dataSize);
vn_decode_blob_array(dec, pData, array_size);
} else {
vn_decode_array_size_unchecked(dec);
pData = NULL;
}
return ret;
}
static inline void vn_submit_vkRegisterCustomBorderColorEXT(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkRegisterCustomBorderColorEXT(device, pBorderColor, requestIndex, pIndex);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkRegisterCustomBorderColorEXT_reply(device, pBorderColor, requestIndex, pIndex) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkRegisterCustomBorderColorEXT(enc, cmd_flags, device, pBorderColor, requestIndex, pIndex);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkUnregisterCustomBorderColorEXT(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t index, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkUnregisterCustomBorderColorEXT(device, index);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkUnregisterCustomBorderColorEXT_reply(device, index) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkUnregisterCustomBorderColorEXT(enc, cmd_flags, device, index);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetImageOpaqueCaptureDataEXT(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetImageOpaqueCaptureDataEXT(device, imageCount, pImages, pDatas);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetImageOpaqueCaptureDataEXT_reply(device, imageCount, pImages, pDatas) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetImageOpaqueCaptureDataEXT(enc, cmd_flags, device, imageCount, pImages, pDatas);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkWriteSamplerDescriptorMESA(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkWriteSamplerDescriptorMESA(device, pSampler, dataSize, pData);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkWriteSamplerDescriptorMESA_reply(device, pSampler, dataSize, pData) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkWriteSamplerDescriptorMESA(enc, cmd_flags, device, pSampler, dataSize, pData);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkWriteResourceDescriptorMESA(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkWriteResourceDescriptorMESA(device, pResource, dataSize, pData);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkWriteResourceDescriptorMESA_reply(device, pResource, dataSize, pData) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkWriteResourceDescriptorMESA(enc, cmd_flags, device, pResource, dataSize, pData);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkRegisterCustomBorderColorEXT(struct vn_ring *vn_ring, VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkRegisterCustomBorderColorEXT(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pBorderColor, requestIndex, pIndex, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkRegisterCustomBorderColorEXT_reply(dec, device, pBorderColor, requestIndex, pIndex);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkRegisterCustomBorderColorEXT(struct vn_ring *vn_ring, VkDevice device, const VkSamplerCustomBorderColorCreateInfoEXT* pBorderColor, VkBool32 requestIndex, uint32_t* pIndex)
{
struct vn_ring_submit_command submit;
vn_submit_vkRegisterCustomBorderColorEXT(vn_ring, 0, device, pBorderColor, requestIndex, pIndex, &submit);
}
static inline void vn_async_vkUnregisterCustomBorderColorEXT(struct vn_ring *vn_ring, VkDevice device, uint32_t index)
{
struct vn_ring_submit_command submit;
vn_submit_vkUnregisterCustomBorderColorEXT(vn_ring, 0, device, index, &submit);
}
static inline VkResult vn_call_vkGetImageOpaqueCaptureDataEXT(struct vn_ring *vn_ring, VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetImageOpaqueCaptureDataEXT(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, imageCount, pImages, pDatas, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkGetImageOpaqueCaptureDataEXT_reply(dec, device, imageCount, pImages, pDatas);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkGetImageOpaqueCaptureDataEXT(struct vn_ring *vn_ring, VkDevice device, uint32_t imageCount, const VkImage* pImages, VkHostAddressRangeEXT* pDatas)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetImageOpaqueCaptureDataEXT(vn_ring, 0, device, imageCount, pImages, pDatas, &submit);
}
static inline VkResult vn_call_vkWriteSamplerDescriptorMESA(struct vn_ring *vn_ring, VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkWriteSamplerDescriptorMESA(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pSampler, dataSize, pData, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkWriteSamplerDescriptorMESA_reply(dec, device, pSampler, dataSize, pData);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkWriteSamplerDescriptorMESA(struct vn_ring *vn_ring, VkDevice device, const VkSamplerCreateInfo* pSampler, size_t dataSize, void* pData)
{
struct vn_ring_submit_command submit;
vn_submit_vkWriteSamplerDescriptorMESA(vn_ring, 0, device, pSampler, dataSize, pData, &submit);
}
static inline VkResult vn_call_vkWriteResourceDescriptorMESA(struct vn_ring *vn_ring, VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkWriteResourceDescriptorMESA(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pResource, dataSize, pData, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkWriteResourceDescriptorMESA_reply(dec, device, pResource, dataSize, pData);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkWriteResourceDescriptorMESA(struct vn_ring *vn_ring, VkDevice device, const VkResourceDescriptorInfoEXT* pResource, size_t dataSize, void* pData)
{
struct vn_ring_submit_command submit;
vn_submit_vkWriteResourceDescriptorMESA(vn_ring, 0, device, pResource, dataSize, pData, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_DESCRIPTOR_HEAP_H */
@@ -0,0 +1,500 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_POOL_H
#define VN_PROTOCOL_DRIVER_DESCRIPTOR_POOL_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkDescriptorPoolSize */
static inline size_t
vn_sizeof_VkDescriptorPoolSize(const VkDescriptorPoolSize *val)
{
size_t size = 0;
size += vn_sizeof_VkDescriptorType(&val->type);
size += vn_sizeof_uint32_t(&val->descriptorCount);
return size;
}
static inline void
vn_encode_VkDescriptorPoolSize(struct vn_cs_encoder *enc, const VkDescriptorPoolSize *val)
{
vn_encode_VkDescriptorType(enc, &val->type);
vn_encode_uint32_t(enc, &val->descriptorCount);
}
/* struct VkDescriptorPoolInlineUniformBlockCreateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorPoolInlineUniformBlockCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorPoolInlineUniformBlockCreateInfo_self(const VkDescriptorPoolInlineUniformBlockCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_uint32_t(&val->maxInlineUniformBlockBindings);
return size;
}
static inline size_t
vn_sizeof_VkDescriptorPoolInlineUniformBlockCreateInfo(const VkDescriptorPoolInlineUniformBlockCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorPoolInlineUniformBlockCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorPoolInlineUniformBlockCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorPoolInlineUniformBlockCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorPoolInlineUniformBlockCreateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorPoolInlineUniformBlockCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_uint32_t(enc, &val->maxInlineUniformBlockBindings);
}
static inline void
vn_encode_VkDescriptorPoolInlineUniformBlockCreateInfo(struct vn_cs_encoder *enc, const VkDescriptorPoolInlineUniformBlockCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO });
vn_encode_VkDescriptorPoolInlineUniformBlockCreateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorPoolInlineUniformBlockCreateInfo_self(enc, val);
}
/* struct VkDescriptorPoolCreateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorPoolCreateInfo_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO:
if (!vn_cs_renderer_protocol_has_extension(139 /* VK_EXT_inline_uniform_block */))
break;
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorPoolCreateInfo_pnext(((const VkDescriptorPoolInlineUniformBlockCreateInfo *)pnext)->pNext);
size += vn_sizeof_VkDescriptorPoolInlineUniformBlockCreateInfo_self((const VkDescriptorPoolInlineUniformBlockCreateInfo *)pnext);
return size;
case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT:
if (!vn_cs_renderer_protocol_has_extension(352 /* VK_VALVE_mutable_descriptor_type */) && !vn_cs_renderer_protocol_has_extension(495 /* VK_EXT_mutable_descriptor_type */))
break;
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorPoolCreateInfo_pnext(((const VkMutableDescriptorTypeCreateInfoEXT *)pnext)->pNext);
size += vn_sizeof_VkMutableDescriptorTypeCreateInfoEXT_self((const VkMutableDescriptorTypeCreateInfoEXT *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorPoolCreateInfo_self(const VkDescriptorPoolCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_uint32_t(&val->maxSets);
size += vn_sizeof_uint32_t(&val->poolSizeCount);
if (val->pPoolSizes) {
size += vn_sizeof_array_size(val->poolSizeCount);
for (uint32_t i = 0; i < val->poolSizeCount; i++)
size += vn_sizeof_VkDescriptorPoolSize(&val->pPoolSizes[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkDescriptorPoolCreateInfo(const VkDescriptorPoolCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorPoolCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorPoolCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorPoolCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO:
if (!vn_cs_renderer_protocol_has_extension(139 /* VK_EXT_inline_uniform_block */))
break;
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkDescriptorPoolCreateInfo_pnext(enc, ((const VkDescriptorPoolInlineUniformBlockCreateInfo *)pnext)->pNext);
vn_encode_VkDescriptorPoolInlineUniformBlockCreateInfo_self(enc, (const VkDescriptorPoolInlineUniformBlockCreateInfo *)pnext);
return;
case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT:
if (!vn_cs_renderer_protocol_has_extension(352 /* VK_VALVE_mutable_descriptor_type */) && !vn_cs_renderer_protocol_has_extension(495 /* VK_EXT_mutable_descriptor_type */))
break;
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkDescriptorPoolCreateInfo_pnext(enc, ((const VkMutableDescriptorTypeCreateInfoEXT *)pnext)->pNext);
vn_encode_VkMutableDescriptorTypeCreateInfoEXT_self(enc, (const VkMutableDescriptorTypeCreateInfoEXT *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorPoolCreateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorPoolCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_uint32_t(enc, &val->maxSets);
vn_encode_uint32_t(enc, &val->poolSizeCount);
if (val->pPoolSizes) {
vn_encode_array_size(enc, val->poolSizeCount);
for (uint32_t i = 0; i < val->poolSizeCount; i++)
vn_encode_VkDescriptorPoolSize(enc, &val->pPoolSizes[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkDescriptorPoolCreateInfo(struct vn_cs_encoder *enc, const VkDescriptorPoolCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO });
vn_encode_VkDescriptorPoolCreateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorPoolCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkDescriptorPoolCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pDescriptorPool);
if (pDescriptorPool)
cmd_size += vn_sizeof_VkDescriptorPool(pDescriptorPool);
return cmd_size;
}
static inline void vn_encode_vkCreateDescriptorPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkDescriptorPoolCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pDescriptorPool))
vn_encode_VkDescriptorPool(enc, pDescriptorPool);
}
static inline size_t vn_sizeof_vkCreateDescriptorPool_reply(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pDescriptorPool);
if (pDescriptorPool)
cmd_size += vn_sizeof_VkDescriptorPool(pDescriptorPool);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateDescriptorPool_reply(struct vn_cs_decoder *dec, VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateDescriptorPool_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkDescriptorPool(dec, pDescriptorPool);
} else {
pDescriptorPool = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkDescriptorPool(&descriptorPool);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyDescriptorPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkDescriptorPool(enc, &descriptorPool);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyDescriptorPool_reply(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip descriptorPool */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyDescriptorPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyDescriptorPool_EXT);
/* skip device */
/* skip descriptorPool */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetDescriptorPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkDescriptorPool(&descriptorPool);
cmd_size += vn_sizeof_VkFlags(&flags);
return cmd_size;
}
static inline void vn_encode_vkResetDescriptorPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetDescriptorPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkDescriptorPool(enc, &descriptorPool);
vn_encode_VkFlags(enc, &flags);
}
static inline size_t vn_sizeof_vkResetDescriptorPool_reply(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetDescriptorPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip descriptorPool */
/* skip flags */
return cmd_size;
}
static inline VkResult vn_decode_vkResetDescriptorPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkResetDescriptorPool_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip descriptorPool */
/* skip flags */
return ret;
}
static inline void vn_submit_vkCreateDescriptorPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateDescriptorPool_reply(device, pCreateInfo, pAllocator, pDescriptorPool) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateDescriptorPool(enc, cmd_flags, device, pCreateInfo, pAllocator, pDescriptorPool);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyDescriptorPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyDescriptorPool(device, descriptorPool, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyDescriptorPool_reply(device, descriptorPool, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyDescriptorPool(enc, cmd_flags, device, descriptorPool, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkResetDescriptorPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkResetDescriptorPool(device, descriptorPool, flags);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetDescriptorPool_reply(device, descriptorPool, flags) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkResetDescriptorPool(enc, cmd_flags, device, descriptorPool, flags);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateDescriptorPool(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateDescriptorPool(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pDescriptorPool, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateDescriptorPool_reply(dec, device, pCreateInfo, pAllocator, pDescriptorPool);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateDescriptorPool(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateDescriptorPool(vn_ring, 0, device, pCreateInfo, pAllocator, pDescriptorPool, &submit);
}
static inline void vn_async_vkDestroyDescriptorPool(struct vn_ring *vn_ring, VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyDescriptorPool(vn_ring, 0, device, descriptorPool, pAllocator, &submit);
}
static inline VkResult vn_call_vkResetDescriptorPool(struct vn_ring *vn_ring, VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkResetDescriptorPool(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, descriptorPool, flags, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkResetDescriptorPool_reply(dec, device, descriptorPool, flags);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkResetDescriptorPool(struct vn_ring *vn_ring, VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags)
{
struct vn_ring_submit_command submit;
vn_submit_vkResetDescriptorPool(vn_ring, 0, device, descriptorPool, flags, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_DESCRIPTOR_POOL_H */
@@ -0,0 +1,597 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_H
#define VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/*
* These structs/unions/commands are not included
*
* vkUpdateDescriptorSetWithTemplate
*/
/* struct VkDescriptorSetVariableDescriptorCountAllocateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountAllocateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountAllocateInfo_self(const VkDescriptorSetVariableDescriptorCountAllocateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_uint32_t(&val->descriptorSetCount);
if (val->pDescriptorCounts) {
size += vn_sizeof_array_size(val->descriptorSetCount);
size += vn_sizeof_uint32_t_array(val->pDescriptorCounts, val->descriptorSetCount);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountAllocateInfo(const VkDescriptorSetVariableDescriptorCountAllocateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountAllocateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountAllocateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountAllocateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountAllocateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorSetVariableDescriptorCountAllocateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_uint32_t(enc, &val->descriptorSetCount);
if (val->pDescriptorCounts) {
vn_encode_array_size(enc, val->descriptorSetCount);
vn_encode_uint32_t_array(enc, val->pDescriptorCounts, val->descriptorSetCount);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountAllocateInfo(struct vn_cs_encoder *enc, const VkDescriptorSetVariableDescriptorCountAllocateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO });
vn_encode_VkDescriptorSetVariableDescriptorCountAllocateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorSetVariableDescriptorCountAllocateInfo_self(enc, val);
}
/* struct VkDescriptorSetAllocateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorSetAllocateInfo_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO:
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorSetAllocateInfo_pnext(((const VkDescriptorSetVariableDescriptorCountAllocateInfo *)pnext)->pNext);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountAllocateInfo_self((const VkDescriptorSetVariableDescriptorCountAllocateInfo *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetAllocateInfo_self(const VkDescriptorSetAllocateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkDescriptorPool(&val->descriptorPool);
size += vn_sizeof_uint32_t(&val->descriptorSetCount);
if (val->pSetLayouts) {
size += vn_sizeof_array_size(val->descriptorSetCount);
for (uint32_t i = 0; i < val->descriptorSetCount; i++)
size += vn_sizeof_VkDescriptorSetLayout(&val->pSetLayouts[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetAllocateInfo(const VkDescriptorSetAllocateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetAllocateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorSetAllocateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorSetAllocateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO:
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkDescriptorSetAllocateInfo_pnext(enc, ((const VkDescriptorSetVariableDescriptorCountAllocateInfo *)pnext)->pNext);
vn_encode_VkDescriptorSetVariableDescriptorCountAllocateInfo_self(enc, (const VkDescriptorSetVariableDescriptorCountAllocateInfo *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorSetAllocateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorSetAllocateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkDescriptorPool(enc, &val->descriptorPool);
vn_encode_uint32_t(enc, &val->descriptorSetCount);
if (val->pSetLayouts) {
vn_encode_array_size(enc, val->descriptorSetCount);
for (uint32_t i = 0; i < val->descriptorSetCount; i++)
vn_encode_VkDescriptorSetLayout(enc, &val->pSetLayouts[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkDescriptorSetAllocateInfo(struct vn_cs_encoder *enc, const VkDescriptorSetAllocateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO });
vn_encode_VkDescriptorSetAllocateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorSetAllocateInfo_self(enc, val);
}
/* struct VkCopyDescriptorSet chain */
static inline size_t
vn_sizeof_VkCopyDescriptorSet_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkCopyDescriptorSet_self(const VkCopyDescriptorSet *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkDescriptorSet(&val->srcSet);
size += vn_sizeof_uint32_t(&val->srcBinding);
size += vn_sizeof_uint32_t(&val->srcArrayElement);
size += vn_sizeof_VkDescriptorSet(&val->dstSet);
size += vn_sizeof_uint32_t(&val->dstBinding);
size += vn_sizeof_uint32_t(&val->dstArrayElement);
size += vn_sizeof_uint32_t(&val->descriptorCount);
return size;
}
static inline size_t
vn_sizeof_VkCopyDescriptorSet(const VkCopyDescriptorSet *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkCopyDescriptorSet_pnext(val->pNext);
size += vn_sizeof_VkCopyDescriptorSet_self(val);
return size;
}
static inline void
vn_encode_VkCopyDescriptorSet_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkCopyDescriptorSet_self(struct vn_cs_encoder *enc, const VkCopyDescriptorSet *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkDescriptorSet(enc, &val->srcSet);
vn_encode_uint32_t(enc, &val->srcBinding);
vn_encode_uint32_t(enc, &val->srcArrayElement);
vn_encode_VkDescriptorSet(enc, &val->dstSet);
vn_encode_uint32_t(enc, &val->dstBinding);
vn_encode_uint32_t(enc, &val->dstArrayElement);
vn_encode_uint32_t(enc, &val->descriptorCount);
}
static inline void
vn_encode_VkCopyDescriptorSet(struct vn_cs_encoder *enc, const VkCopyDescriptorSet *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET });
vn_encode_VkCopyDescriptorSet_pnext(enc, val->pNext);
vn_encode_VkCopyDescriptorSet_self(enc, val);
}
static inline size_t vn_sizeof_vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateDescriptorSets_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pAllocateInfo);
if (pAllocateInfo)
cmd_size += vn_sizeof_VkDescriptorSetAllocateInfo(pAllocateInfo);
if (pDescriptorSets) {
cmd_size += vn_sizeof_array_size((pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0));
for (uint32_t i = 0; i < (pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0); i++)
cmd_size += vn_sizeof_VkDescriptorSet(&pDescriptorSets[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkAllocateDescriptorSets(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateDescriptorSets_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pAllocateInfo))
vn_encode_VkDescriptorSetAllocateInfo(enc, pAllocateInfo);
if (pDescriptorSets) {
vn_encode_array_size(enc, (pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0));
for (uint32_t i = 0; i < (pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0); i++)
vn_encode_VkDescriptorSet(enc, &pDescriptorSets[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkAllocateDescriptorSets_reply(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkAllocateDescriptorSets_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pAllocateInfo */
if (pDescriptorSets) {
cmd_size += vn_sizeof_array_size((pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0));
for (uint32_t i = 0; i < (pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0); i++)
cmd_size += vn_sizeof_VkDescriptorSet(&pDescriptorSets[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkAllocateDescriptorSets_reply(struct vn_cs_decoder *dec, VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkAllocateDescriptorSets_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pAllocateInfo */
if (vn_peek_array_size(dec)) {
const uint32_t iter_count = vn_decode_array_size(dec, (pAllocateInfo ? pAllocateInfo->descriptorSetCount : 0));
for (uint32_t i = 0; i < iter_count; i++)
vn_decode_VkDescriptorSet(dec, &pDescriptorSets[i]);
} else {
vn_decode_array_size_unchecked(dec);
pDescriptorSets = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFreeDescriptorSets_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkDescriptorPool(&descriptorPool);
cmd_size += vn_sizeof_uint32_t(&descriptorSetCount);
if (pDescriptorSets) {
cmd_size += vn_sizeof_array_size(descriptorSetCount);
for (uint32_t i = 0; i < descriptorSetCount; i++)
cmd_size += vn_sizeof_VkDescriptorSet(&pDescriptorSets[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkFreeDescriptorSets(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFreeDescriptorSets_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkDescriptorPool(enc, &descriptorPool);
vn_encode_uint32_t(enc, &descriptorSetCount);
if (pDescriptorSets) {
vn_encode_array_size(enc, descriptorSetCount);
for (uint32_t i = 0; i < descriptorSetCount; i++)
vn_encode_VkDescriptorSet(enc, &pDescriptorSets[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkFreeDescriptorSets_reply(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkFreeDescriptorSets_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip descriptorPool */
/* skip descriptorSetCount */
/* skip pDescriptorSets */
return cmd_size;
}
static inline VkResult vn_decode_vkFreeDescriptorSets_reply(struct vn_cs_decoder *dec, VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkFreeDescriptorSets_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip descriptorPool */
/* skip descriptorSetCount */
/* skip pDescriptorSets */
return ret;
}
static inline size_t vn_sizeof_vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUpdateDescriptorSets_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_uint32_t(&descriptorWriteCount);
if (pDescriptorWrites) {
cmd_size += vn_sizeof_array_size(descriptorWriteCount);
for (uint32_t i = 0; i < descriptorWriteCount; i++)
cmd_size += vn_sizeof_VkWriteDescriptorSet(&pDescriptorWrites[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
cmd_size += vn_sizeof_uint32_t(&descriptorCopyCount);
if (pDescriptorCopies) {
cmd_size += vn_sizeof_array_size(descriptorCopyCount);
for (uint32_t i = 0; i < descriptorCopyCount; i++)
cmd_size += vn_sizeof_VkCopyDescriptorSet(&pDescriptorCopies[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkUpdateDescriptorSets(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUpdateDescriptorSets_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_uint32_t(enc, &descriptorWriteCount);
if (pDescriptorWrites) {
vn_encode_array_size(enc, descriptorWriteCount);
for (uint32_t i = 0; i < descriptorWriteCount; i++)
vn_encode_VkWriteDescriptorSet(enc, &pDescriptorWrites[i]);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_uint32_t(enc, &descriptorCopyCount);
if (pDescriptorCopies) {
vn_encode_array_size(enc, descriptorCopyCount);
for (uint32_t i = 0; i < descriptorCopyCount; i++)
vn_encode_VkCopyDescriptorSet(enc, &pDescriptorCopies[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkUpdateDescriptorSets_reply(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkUpdateDescriptorSets_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip descriptorWriteCount */
/* skip pDescriptorWrites */
/* skip descriptorCopyCount */
/* skip pDescriptorCopies */
return cmd_size;
}
static inline void vn_decode_vkUpdateDescriptorSets_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkUpdateDescriptorSets_EXT);
/* skip device */
/* skip descriptorWriteCount */
/* skip pDescriptorWrites */
/* skip descriptorCopyCount */
/* skip pDescriptorCopies */
}
static inline void vn_submit_vkAllocateDescriptorSets(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkAllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkAllocateDescriptorSets_reply(device, pAllocateInfo, pDescriptorSets) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkAllocateDescriptorSets(enc, cmd_flags, device, pAllocateInfo, pDescriptorSets);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkFreeDescriptorSets(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkFreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkFreeDescriptorSets_reply(device, descriptorPool, descriptorSetCount, pDescriptorSets) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkFreeDescriptorSets(enc, cmd_flags, device, descriptorPool, descriptorSetCount, pDescriptorSets);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkUpdateDescriptorSets(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkUpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkUpdateDescriptorSets_reply(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkUpdateDescriptorSets(enc, cmd_flags, device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkAllocateDescriptorSets(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkAllocateDescriptorSets(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pAllocateInfo, pDescriptorSets, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkAllocateDescriptorSets_reply(dec, device, pAllocateInfo, pDescriptorSets);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkAllocateDescriptorSets(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets)
{
struct vn_ring_submit_command submit;
vn_submit_vkAllocateDescriptorSets(vn_ring, 0, device, pAllocateInfo, pDescriptorSets, &submit);
}
static inline VkResult vn_call_vkFreeDescriptorSets(struct vn_ring *vn_ring, VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkFreeDescriptorSets(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, descriptorPool, descriptorSetCount, pDescriptorSets, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkFreeDescriptorSets_reply(dec, device, descriptorPool, descriptorSetCount, pDescriptorSets);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkFreeDescriptorSets(struct vn_ring *vn_ring, VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets)
{
struct vn_ring_submit_command submit;
vn_submit_vkFreeDescriptorSets(vn_ring, 0, device, descriptorPool, descriptorSetCount, pDescriptorSets, &submit);
}
static inline void vn_async_vkUpdateDescriptorSets(struct vn_ring *vn_ring, VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies)
{
struct vn_ring_submit_command submit;
vn_submit_vkUpdateDescriptorSets(vn_ring, 0, device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_H */
@@ -0,0 +1,816 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_LAYOUT_H
#define VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_LAYOUT_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkDescriptorSetLayoutBinding */
static inline size_t
vn_sizeof_VkDescriptorSetLayoutBinding(const VkDescriptorSetLayoutBinding *val)
{
size_t size = 0;
size += vn_sizeof_uint32_t(&val->binding);
size += vn_sizeof_VkDescriptorType(&val->descriptorType);
size += vn_sizeof_uint32_t(&val->descriptorCount);
size += vn_sizeof_VkFlags(&val->stageFlags);
if (val->pImmutableSamplers) {
size += vn_sizeof_array_size(val->descriptorCount);
for (uint32_t i = 0; i < val->descriptorCount; i++)
size += vn_sizeof_VkSampler(&val->pImmutableSamplers[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline void
vn_encode_VkDescriptorSetLayoutBinding(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutBinding *val)
{
vn_encode_uint32_t(enc, &val->binding);
vn_encode_VkDescriptorType(enc, &val->descriptorType);
vn_encode_uint32_t(enc, &val->descriptorCount);
vn_encode_VkFlags(enc, &val->stageFlags);
if (val->pImmutableSamplers) {
vn_encode_array_size(enc, val->descriptorCount);
for (uint32_t i = 0; i < val->descriptorCount; i++)
vn_encode_VkSampler(enc, &val->pImmutableSamplers[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
/* struct VkDescriptorSetLayoutBindingFlagsCreateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutBindingFlagsCreateInfo_self(const VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_uint32_t(&val->bindingCount);
if (val->pBindingFlags) {
size += vn_sizeof_array_size(val->bindingCount);
for (uint32_t i = 0; i < val->bindingCount; i++)
size += vn_sizeof_VkFlags(&val->pBindingFlags[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutBindingFlagsCreateInfo(const VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorSetLayoutBindingFlagsCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_uint32_t(enc, &val->bindingCount);
if (val->pBindingFlags) {
vn_encode_array_size(enc, val->bindingCount);
for (uint32_t i = 0; i < val->bindingCount; i++)
vn_encode_VkFlags(enc, &val->pBindingFlags[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkDescriptorSetLayoutBindingFlagsCreateInfo(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutBindingFlagsCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO });
vn_encode_VkDescriptorSetLayoutBindingFlagsCreateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self(enc, val);
}
/* struct VkDescriptorSetLayoutCreateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorSetLayoutCreateInfo_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO:
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorSetLayoutCreateInfo_pnext(((const VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext)->pNext);
size += vn_sizeof_VkDescriptorSetLayoutBindingFlagsCreateInfo_self((const VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext);
return size;
case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT:
if (!vn_cs_renderer_protocol_has_extension(352 /* VK_VALVE_mutable_descriptor_type */) && !vn_cs_renderer_protocol_has_extension(495 /* VK_EXT_mutable_descriptor_type */))
break;
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorSetLayoutCreateInfo_pnext(((const VkMutableDescriptorTypeCreateInfoEXT *)pnext)->pNext);
size += vn_sizeof_VkMutableDescriptorTypeCreateInfoEXT_self((const VkMutableDescriptorTypeCreateInfoEXT *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutCreateInfo_self(const VkDescriptorSetLayoutCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_uint32_t(&val->bindingCount);
if (val->pBindings) {
size += vn_sizeof_array_size(val->bindingCount);
for (uint32_t i = 0; i < val->bindingCount; i++)
size += vn_sizeof_VkDescriptorSetLayoutBinding(&val->pBindings[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutCreateInfo(const VkDescriptorSetLayoutCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetLayoutCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorSetLayoutCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorSetLayoutCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO:
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkDescriptorSetLayoutCreateInfo_pnext(enc, ((const VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext)->pNext);
vn_encode_VkDescriptorSetLayoutBindingFlagsCreateInfo_self(enc, (const VkDescriptorSetLayoutBindingFlagsCreateInfo *)pnext);
return;
case VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT:
if (!vn_cs_renderer_protocol_has_extension(352 /* VK_VALVE_mutable_descriptor_type */) && !vn_cs_renderer_protocol_has_extension(495 /* VK_EXT_mutable_descriptor_type */))
break;
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkDescriptorSetLayoutCreateInfo_pnext(enc, ((const VkMutableDescriptorTypeCreateInfoEXT *)pnext)->pNext);
vn_encode_VkMutableDescriptorTypeCreateInfoEXT_self(enc, (const VkMutableDescriptorTypeCreateInfoEXT *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorSetLayoutCreateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_uint32_t(enc, &val->bindingCount);
if (val->pBindings) {
vn_encode_array_size(enc, val->bindingCount);
for (uint32_t i = 0; i < val->bindingCount; i++)
vn_encode_VkDescriptorSetLayoutBinding(enc, &val->pBindings[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkDescriptorSetLayoutCreateInfo(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO });
vn_encode_VkDescriptorSetLayoutCreateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorSetLayoutCreateInfo_self(enc, val);
}
/* struct VkDescriptorSetVariableDescriptorCountLayoutSupport chain */
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_uint32_t(&val->maxVariableDescriptorCount);
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport(const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(val->pNext);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(val);
return size;
}
static inline void
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(struct vn_cs_decoder *dec, const void *val)
{
/* no known/supported struct */
if (vn_decode_simple_pointer(dec))
assert(false);
}
static inline void
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(struct vn_cs_decoder *dec, VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
/* skip val->{sType,pNext} */
vn_decode_uint32_t(dec, &val->maxVariableDescriptorCount);
}
static inline void
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport(struct vn_cs_decoder *dec, VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
VkStructureType stype;
vn_decode_VkStructureType(dec, &stype);
assert(stype == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT);
assert(val->sType == stype);
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext(dec, val->pNext);
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(dec, val);
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial(const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
/* skip val->maxVariableDescriptorCount */
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_partial(const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial(val->pNext);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial(val);
return size;
}
static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial(struct vn_cs_encoder *enc, const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
/* skip val->{sType,pNext} */
/* skip val->maxVariableDescriptorCount */
}
static inline void
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_partial(struct vn_cs_encoder *enc, const VkDescriptorSetVariableDescriptorCountLayoutSupport *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT });
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_pnext_partial(enc, val->pNext);
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial(enc, val);
}
/* struct VkDescriptorSetLayoutSupport chain */
static inline size_t
vn_sizeof_VkDescriptorSetLayoutSupport_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT:
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorSetLayoutSupport_pnext(((const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext)->pNext);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_self((const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutSupport_self(const VkDescriptorSetLayoutSupport *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkBool32(&val->supported);
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutSupport(const VkDescriptorSetLayoutSupport *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetLayoutSupport_pnext(val->pNext);
size += vn_sizeof_VkDescriptorSetLayoutSupport_self(val);
return size;
}
static inline void
vn_decode_VkDescriptorSetLayoutSupport_pnext(struct vn_cs_decoder *dec, const void *val)
{
VkBaseOutStructure *pnext = (VkBaseOutStructure *)val;
VkStructureType stype;
if (!vn_decode_simple_pointer(dec))
return;
vn_decode_VkStructureType(dec, &stype);
while (true) {
assert(pnext);
if (pnext->sType == stype)
break;
pnext = pnext->pNext;
}
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT:
vn_decode_VkDescriptorSetLayoutSupport_pnext(dec, ((VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext)->pNext);
vn_decode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self(dec, (VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext);
break;
default:
assert(false);
break;
}
}
static inline void
vn_decode_VkDescriptorSetLayoutSupport_self(struct vn_cs_decoder *dec, VkDescriptorSetLayoutSupport *val)
{
/* skip val->{sType,pNext} */
vn_decode_VkBool32(dec, &val->supported);
}
static inline void
vn_decode_VkDescriptorSetLayoutSupport(struct vn_cs_decoder *dec, VkDescriptorSetLayoutSupport *val)
{
VkStructureType stype;
vn_decode_VkStructureType(dec, &stype);
assert(stype == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT);
assert(val->sType == stype);
vn_decode_VkDescriptorSetLayoutSupport_pnext(dec, val->pNext);
vn_decode_VkDescriptorSetLayoutSupport_self(dec, val);
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutSupport_pnext_partial(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT:
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkDescriptorSetLayoutSupport_pnext_partial(((const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext)->pNext);
size += vn_sizeof_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial((const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutSupport_self_partial(const VkDescriptorSetLayoutSupport *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
/* skip val->supported */
return size;
}
static inline size_t
vn_sizeof_VkDescriptorSetLayoutSupport_partial(const VkDescriptorSetLayoutSupport *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorSetLayoutSupport_pnext_partial(val->pNext);
size += vn_sizeof_VkDescriptorSetLayoutSupport_self_partial(val);
return size;
}
static inline void
vn_encode_VkDescriptorSetLayoutSupport_pnext_partial(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT:
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkDescriptorSetLayoutSupport_pnext_partial(enc, ((const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext)->pNext);
vn_encode_VkDescriptorSetVariableDescriptorCountLayoutSupport_self_partial(enc, (const VkDescriptorSetVariableDescriptorCountLayoutSupport *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorSetLayoutSupport_self_partial(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutSupport *val)
{
/* skip val->{sType,pNext} */
/* skip val->supported */
}
static inline void
vn_encode_VkDescriptorSetLayoutSupport_partial(struct vn_cs_encoder *enc, const VkDescriptorSetLayoutSupport *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT });
vn_encode_VkDescriptorSetLayoutSupport_pnext_partial(enc, val->pNext);
vn_encode_VkDescriptorSetLayoutSupport_self_partial(enc, val);
}
static inline size_t vn_sizeof_vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorSetLayout_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkDescriptorSetLayoutCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pSetLayout);
if (pSetLayout)
cmd_size += vn_sizeof_VkDescriptorSetLayout(pSetLayout);
return cmd_size;
}
static inline void vn_encode_vkCreateDescriptorSetLayout(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorSetLayout_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkDescriptorSetLayoutCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pSetLayout))
vn_encode_VkDescriptorSetLayout(enc, pSetLayout);
}
static inline size_t vn_sizeof_vkCreateDescriptorSetLayout_reply(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorSetLayout_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pSetLayout);
if (pSetLayout)
cmd_size += vn_sizeof_VkDescriptorSetLayout(pSetLayout);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateDescriptorSetLayout_reply(struct vn_cs_decoder *dec, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateDescriptorSetLayout_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkDescriptorSetLayout(dec, pSetLayout);
} else {
pSetLayout = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorSetLayout_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkDescriptorSetLayout(&descriptorSetLayout);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyDescriptorSetLayout(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorSetLayout_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkDescriptorSetLayout(enc, &descriptorSetLayout);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyDescriptorSetLayout_reply(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorSetLayout_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip descriptorSetLayout */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyDescriptorSetLayout_reply(struct vn_cs_decoder *dec, VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyDescriptorSetLayout_EXT);
/* skip device */
/* skip descriptorSetLayout */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupport_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkDescriptorSetLayoutCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pSupport);
if (pSupport)
cmd_size += vn_sizeof_VkDescriptorSetLayoutSupport_partial(pSupport);
return cmd_size;
}
static inline void vn_encode_vkGetDescriptorSetLayoutSupport(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupport_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkDescriptorSetLayoutCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pSupport))
vn_encode_VkDescriptorSetLayoutSupport_partial(enc, pSupport);
}
static inline size_t vn_sizeof_vkGetDescriptorSetLayoutSupport_reply(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupport_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip pCreateInfo */
cmd_size += vn_sizeof_simple_pointer(pSupport);
if (pSupport)
cmd_size += vn_sizeof_VkDescriptorSetLayoutSupport(pSupport);
return cmd_size;
}
static inline void vn_decode_vkGetDescriptorSetLayoutSupport_reply(struct vn_cs_decoder *dec, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetDescriptorSetLayoutSupport_EXT);
/* skip device */
/* skip pCreateInfo */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkDescriptorSetLayoutSupport(dec, pSupport);
} else {
pSupport = NULL;
}
}
static inline void vn_submit_vkCreateDescriptorSetLayout(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateDescriptorSetLayout_reply(device, pCreateInfo, pAllocator, pSetLayout) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateDescriptorSetLayout(enc, cmd_flags, device, pCreateInfo, pAllocator, pSetLayout);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyDescriptorSetLayout(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyDescriptorSetLayout_reply(device, descriptorSetLayout, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyDescriptorSetLayout(enc, cmd_flags, device, descriptorSetLayout, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetDescriptorSetLayoutSupport(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetDescriptorSetLayoutSupport(device, pCreateInfo, pSupport);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetDescriptorSetLayoutSupport_reply(device, pCreateInfo, pSupport) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetDescriptorSetLayoutSupport(enc, cmd_flags, device, pCreateInfo, pSupport);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateDescriptorSetLayout(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateDescriptorSetLayout(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pSetLayout, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateDescriptorSetLayout_reply(dec, device, pCreateInfo, pAllocator, pSetLayout);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateDescriptorSetLayout(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateDescriptorSetLayout(vn_ring, 0, device, pCreateInfo, pAllocator, pSetLayout, &submit);
}
static inline void vn_async_vkDestroyDescriptorSetLayout(struct vn_ring *vn_ring, VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyDescriptorSetLayout(vn_ring, 0, device, descriptorSetLayout, pAllocator, &submit);
}
static inline void vn_call_vkGetDescriptorSetLayoutSupport(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetDescriptorSetLayoutSupport(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pSupport, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
vn_decode_vkGetDescriptorSetLayoutSupport_reply(dec, device, pCreateInfo, pSupport);
vn_ring_free_command_reply(vn_ring, &submit);
}
}
static inline void vn_async_vkGetDescriptorSetLayoutSupport(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetDescriptorSetLayoutSupport(vn_ring, 0, device, pCreateInfo, pSupport, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_DESCRIPTOR_SET_LAYOUT_H */
@@ -0,0 +1,313 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_DESCRIPTOR_UPDATE_TEMPLATE_H
#define VN_PROTOCOL_DRIVER_DESCRIPTOR_UPDATE_TEMPLATE_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkDescriptorUpdateTemplateEntry */
static inline size_t
vn_sizeof_VkDescriptorUpdateTemplateEntry(const VkDescriptorUpdateTemplateEntry *val)
{
size_t size = 0;
size += vn_sizeof_uint32_t(&val->dstBinding);
size += vn_sizeof_uint32_t(&val->dstArrayElement);
size += vn_sizeof_uint32_t(&val->descriptorCount);
size += vn_sizeof_VkDescriptorType(&val->descriptorType);
size += vn_sizeof_size_t(&val->offset);
size += vn_sizeof_size_t(&val->stride);
return size;
}
static inline void
vn_encode_VkDescriptorUpdateTemplateEntry(struct vn_cs_encoder *enc, const VkDescriptorUpdateTemplateEntry *val)
{
vn_encode_uint32_t(enc, &val->dstBinding);
vn_encode_uint32_t(enc, &val->dstArrayElement);
vn_encode_uint32_t(enc, &val->descriptorCount);
vn_encode_VkDescriptorType(enc, &val->descriptorType);
vn_encode_size_t(enc, &val->offset);
vn_encode_size_t(enc, &val->stride);
}
/* struct VkDescriptorUpdateTemplateCreateInfo chain */
static inline size_t
vn_sizeof_VkDescriptorUpdateTemplateCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkDescriptorUpdateTemplateCreateInfo_self(const VkDescriptorUpdateTemplateCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_uint32_t(&val->descriptorUpdateEntryCount);
if (val->pDescriptorUpdateEntries) {
size += vn_sizeof_array_size(val->descriptorUpdateEntryCount);
for (uint32_t i = 0; i < val->descriptorUpdateEntryCount; i++)
size += vn_sizeof_VkDescriptorUpdateTemplateEntry(&val->pDescriptorUpdateEntries[i]);
} else {
size += vn_sizeof_array_size(0);
}
size += vn_sizeof_VkDescriptorUpdateTemplateType(&val->templateType);
size += vn_sizeof_VkDescriptorSetLayout(&val->descriptorSetLayout);
size += vn_sizeof_VkPipelineBindPoint(&val->pipelineBindPoint);
size += vn_sizeof_VkPipelineLayout(&val->pipelineLayout);
size += vn_sizeof_uint32_t(&val->set);
return size;
}
static inline size_t
vn_sizeof_VkDescriptorUpdateTemplateCreateInfo(const VkDescriptorUpdateTemplateCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkDescriptorUpdateTemplateCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkDescriptorUpdateTemplateCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkDescriptorUpdateTemplateCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkDescriptorUpdateTemplateCreateInfo_self(struct vn_cs_encoder *enc, const VkDescriptorUpdateTemplateCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_uint32_t(enc, &val->descriptorUpdateEntryCount);
if (val->pDescriptorUpdateEntries) {
vn_encode_array_size(enc, val->descriptorUpdateEntryCount);
for (uint32_t i = 0; i < val->descriptorUpdateEntryCount; i++)
vn_encode_VkDescriptorUpdateTemplateEntry(enc, &val->pDescriptorUpdateEntries[i]);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_VkDescriptorUpdateTemplateType(enc, &val->templateType);
vn_encode_VkDescriptorSetLayout(enc, &val->descriptorSetLayout);
vn_encode_VkPipelineBindPoint(enc, &val->pipelineBindPoint);
vn_encode_VkPipelineLayout(enc, &val->pipelineLayout);
vn_encode_uint32_t(enc, &val->set);
}
static inline void
vn_encode_VkDescriptorUpdateTemplateCreateInfo(struct vn_cs_encoder *enc, const VkDescriptorUpdateTemplateCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO });
vn_encode_VkDescriptorUpdateTemplateCreateInfo_pnext(enc, val->pNext);
vn_encode_VkDescriptorUpdateTemplateCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorUpdateTemplate_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkDescriptorUpdateTemplateCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pDescriptorUpdateTemplate);
if (pDescriptorUpdateTemplate)
cmd_size += vn_sizeof_VkDescriptorUpdateTemplate(pDescriptorUpdateTemplate);
return cmd_size;
}
static inline void vn_encode_vkCreateDescriptorUpdateTemplate(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorUpdateTemplate_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkDescriptorUpdateTemplateCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pDescriptorUpdateTemplate))
vn_encode_VkDescriptorUpdateTemplate(enc, pDescriptorUpdateTemplate);
}
static inline size_t vn_sizeof_vkCreateDescriptorUpdateTemplate_reply(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateDescriptorUpdateTemplate_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pDescriptorUpdateTemplate);
if (pDescriptorUpdateTemplate)
cmd_size += vn_sizeof_VkDescriptorUpdateTemplate(pDescriptorUpdateTemplate);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateDescriptorUpdateTemplate_reply(struct vn_cs_decoder *dec, VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateDescriptorUpdateTemplate_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkDescriptorUpdateTemplate(dec, pDescriptorUpdateTemplate);
} else {
pDescriptorUpdateTemplate = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorUpdateTemplate_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkDescriptorUpdateTemplate(&descriptorUpdateTemplate);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyDescriptorUpdateTemplate(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorUpdateTemplate_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkDescriptorUpdateTemplate(enc, &descriptorUpdateTemplate);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyDescriptorUpdateTemplate_reply(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyDescriptorUpdateTemplate_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip descriptorUpdateTemplate */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyDescriptorUpdateTemplate_reply(struct vn_cs_decoder *dec, VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyDescriptorUpdateTemplate_EXT);
/* skip device */
/* skip descriptorUpdateTemplate */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateDescriptorUpdateTemplate(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateDescriptorUpdateTemplate_reply(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateDescriptorUpdateTemplate(enc, cmd_flags, device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyDescriptorUpdateTemplate(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyDescriptorUpdateTemplate(device, descriptorUpdateTemplate, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyDescriptorUpdateTemplate_reply(device, descriptorUpdateTemplate, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyDescriptorUpdateTemplate(enc, cmd_flags, device, descriptorUpdateTemplate, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateDescriptorUpdateTemplate(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateDescriptorUpdateTemplate(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateDescriptorUpdateTemplate_reply(dec, device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateDescriptorUpdateTemplate(struct vn_ring *vn_ring, VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateDescriptorUpdateTemplate(vn_ring, 0, device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate, &submit);
}
static inline void vn_async_vkDestroyDescriptorUpdateTemplate(struct vn_ring *vn_ring, VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyDescriptorUpdateTemplate(vn_ring, 0, device, descriptorUpdateTemplate, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_DESCRIPTOR_UPDATE_TEMPLATE_H */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,540 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_EVENT_H
#define VN_PROTOCOL_DRIVER_EVENT_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkEventCreateInfo chain */
static inline size_t
vn_sizeof_VkEventCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkEventCreateInfo_self(const VkEventCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
return size;
}
static inline size_t
vn_sizeof_VkEventCreateInfo(const VkEventCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkEventCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkEventCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkEventCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkEventCreateInfo_self(struct vn_cs_encoder *enc, const VkEventCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
}
static inline void
vn_encode_VkEventCreateInfo(struct vn_cs_encoder *enc, const VkEventCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_EVENT_CREATE_INFO });
vn_encode_VkEventCreateInfo_pnext(enc, val->pNext);
vn_encode_VkEventCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateEvent(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateEvent_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkEventCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pEvent);
if (pEvent)
cmd_size += vn_sizeof_VkEvent(pEvent);
return cmd_size;
}
static inline void vn_encode_vkCreateEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateEvent_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkEventCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pEvent))
vn_encode_VkEvent(enc, pEvent);
}
static inline size_t vn_sizeof_vkCreateEvent_reply(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateEvent_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pEvent);
if (pEvent)
cmd_size += vn_sizeof_VkEvent(pEvent);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateEvent_reply(struct vn_cs_decoder *dec, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateEvent_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkEvent(dec, pEvent);
} else {
pEvent = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyEvent_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkEvent(&event);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyEvent_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkEvent(enc, &event);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyEvent_reply(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyEvent_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip event */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyEvent_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyEvent_EXT);
/* skip device */
/* skip event */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkGetEventStatus(VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetEventStatus_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkEvent(&event);
return cmd_size;
}
static inline void vn_encode_vkGetEventStatus(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetEventStatus_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkEvent(enc, &event);
}
static inline size_t vn_sizeof_vkGetEventStatus_reply(VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetEventStatus_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip event */
return cmd_size;
}
static inline VkResult vn_decode_vkGetEventStatus_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetEventStatus_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip event */
return ret;
}
static inline size_t vn_sizeof_vkSetEvent(VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetEvent_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkEvent(&event);
return cmd_size;
}
static inline void vn_encode_vkSetEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetEvent_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkEvent(enc, &event);
}
static inline size_t vn_sizeof_vkSetEvent_reply(VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetEvent_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip event */
return cmd_size;
}
static inline VkResult vn_decode_vkSetEvent_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkSetEvent_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip event */
return ret;
}
static inline size_t vn_sizeof_vkResetEvent(VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetEvent_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkEvent(&event);
return cmd_size;
}
static inline void vn_encode_vkResetEvent(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetEvent_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkEvent(enc, &event);
}
static inline size_t vn_sizeof_vkResetEvent_reply(VkDevice device, VkEvent event)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetEvent_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip event */
return cmd_size;
}
static inline VkResult vn_decode_vkResetEvent_reply(struct vn_cs_decoder *dec, VkDevice device, VkEvent event)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkResetEvent_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip event */
return ret;
}
static inline void vn_submit_vkCreateEvent(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateEvent(device, pCreateInfo, pAllocator, pEvent);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateEvent_reply(device, pCreateInfo, pAllocator, pEvent) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateEvent(enc, cmd_flags, device, pCreateInfo, pAllocator, pEvent);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyEvent(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyEvent(device, event, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyEvent_reply(device, event, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyEvent(enc, cmd_flags, device, event, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetEventStatus(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetEventStatus(device, event);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetEventStatus_reply(device, event) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetEventStatus(enc, cmd_flags, device, event);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkSetEvent(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkSetEvent(device, event);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkSetEvent_reply(device, event) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkSetEvent(enc, cmd_flags, device, event);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkResetEvent(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkEvent event, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkResetEvent(device, event);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetEvent_reply(device, event) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkResetEvent(enc, cmd_flags, device, event);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateEvent(struct vn_ring *vn_ring, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateEvent(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pEvent, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateEvent_reply(dec, device, pCreateInfo, pAllocator, pEvent);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateEvent(struct vn_ring *vn_ring, VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateEvent(vn_ring, 0, device, pCreateInfo, pAllocator, pEvent, &submit);
}
static inline void vn_async_vkDestroyEvent(struct vn_ring *vn_ring, VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyEvent(vn_ring, 0, device, event, pAllocator, &submit);
}
static inline VkResult vn_call_vkGetEventStatus(struct vn_ring *vn_ring, VkDevice device, VkEvent event)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetEventStatus(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkGetEventStatus_reply(dec, device, event);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkGetEventStatus(struct vn_ring *vn_ring, VkDevice device, VkEvent event)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetEventStatus(vn_ring, 0, device, event, &submit);
}
static inline VkResult vn_call_vkSetEvent(struct vn_ring *vn_ring, VkDevice device, VkEvent event)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkSetEvent(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkSetEvent_reply(dec, device, event);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkSetEvent(struct vn_ring *vn_ring, VkDevice device, VkEvent event)
{
struct vn_ring_submit_command submit;
vn_submit_vkSetEvent(vn_ring, 0, device, event, &submit);
}
static inline VkResult vn_call_vkResetEvent(struct vn_ring *vn_ring, VkDevice device, VkEvent event)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkResetEvent(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, event, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkResetEvent_reply(dec, device, event);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkResetEvent(struct vn_ring *vn_ring, VkDevice device, VkEvent event)
{
struct vn_ring_submit_command submit;
vn_submit_vkResetEvent(vn_ring, 0, device, event, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_EVENT_H */
@@ -0,0 +1,744 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_FENCE_H
#define VN_PROTOCOL_DRIVER_FENCE_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/*
* These structs/unions/commands are not included
*
* vkGetFenceFdKHR
* vkImportFenceFdKHR
*/
/* struct VkExportFenceCreateInfo chain */
static inline size_t
vn_sizeof_VkExportFenceCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkExportFenceCreateInfo_self(const VkExportFenceCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->handleTypes);
return size;
}
static inline size_t
vn_sizeof_VkExportFenceCreateInfo(const VkExportFenceCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkExportFenceCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkExportFenceCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkExportFenceCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkExportFenceCreateInfo_self(struct vn_cs_encoder *enc, const VkExportFenceCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->handleTypes);
}
static inline void
vn_encode_VkExportFenceCreateInfo(struct vn_cs_encoder *enc, const VkExportFenceCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO });
vn_encode_VkExportFenceCreateInfo_pnext(enc, val->pNext);
vn_encode_VkExportFenceCreateInfo_self(enc, val);
}
/* struct VkFenceCreateInfo chain */
static inline size_t
vn_sizeof_VkFenceCreateInfo_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO:
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkFenceCreateInfo_pnext(((const VkExportFenceCreateInfo *)pnext)->pNext);
size += vn_sizeof_VkExportFenceCreateInfo_self((const VkExportFenceCreateInfo *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkFenceCreateInfo_self(const VkFenceCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
return size;
}
static inline size_t
vn_sizeof_VkFenceCreateInfo(const VkFenceCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkFenceCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkFenceCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkFenceCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO:
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkFenceCreateInfo_pnext(enc, ((const VkExportFenceCreateInfo *)pnext)->pNext);
vn_encode_VkExportFenceCreateInfo_self(enc, (const VkExportFenceCreateInfo *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkFenceCreateInfo_self(struct vn_cs_encoder *enc, const VkFenceCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
}
static inline void
vn_encode_VkFenceCreateInfo(struct vn_cs_encoder *enc, const VkFenceCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_FENCE_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO });
vn_encode_VkFenceCreateInfo_pnext(enc, val->pNext);
vn_encode_VkFenceCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFence_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkFenceCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pFence);
if (pFence)
cmd_size += vn_sizeof_VkFence(pFence);
return cmd_size;
}
static inline void vn_encode_vkCreateFence(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFence_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkFenceCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pFence))
vn_encode_VkFence(enc, pFence);
}
static inline size_t vn_sizeof_vkCreateFence_reply(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFence_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pFence);
if (pFence)
cmd_size += vn_sizeof_VkFence(pFence);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateFence_reply(struct vn_cs_decoder *dec, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateFence_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkFence(dec, pFence);
} else {
pFence = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFence_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkFence(&fence);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyFence(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFence_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkFence(enc, &fence);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyFence_reply(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFence_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip fence */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyFence_reply(struct vn_cs_decoder *dec, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyFence_EXT);
/* skip device */
/* skip fence */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFences_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_uint32_t(&fenceCount);
if (pFences) {
cmd_size += vn_sizeof_array_size(fenceCount);
for (uint32_t i = 0; i < fenceCount; i++)
cmd_size += vn_sizeof_VkFence(&pFences[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkResetFences(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFences_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_uint32_t(enc, &fenceCount);
if (pFences) {
vn_encode_array_size(enc, fenceCount);
for (uint32_t i = 0; i < fenceCount; i++)
vn_encode_VkFence(enc, &pFences[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkResetFences_reply(VkDevice device, uint32_t fenceCount, const VkFence* pFences)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFences_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip fenceCount */
/* skip pFences */
return cmd_size;
}
static inline VkResult vn_decode_vkResetFences_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t fenceCount, const VkFence* pFences)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkResetFences_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip fenceCount */
/* skip pFences */
return ret;
}
static inline size_t vn_sizeof_vkGetFenceStatus(VkDevice device, VkFence fence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetFenceStatus_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkFence(&fence);
return cmd_size;
}
static inline void vn_encode_vkGetFenceStatus(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetFenceStatus_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkFence(enc, &fence);
}
static inline size_t vn_sizeof_vkGetFenceStatus_reply(VkDevice device, VkFence fence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetFenceStatus_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip fence */
return cmd_size;
}
static inline VkResult vn_decode_vkGetFenceStatus_reply(struct vn_cs_decoder *dec, VkDevice device, VkFence fence)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetFenceStatus_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip fence */
return ret;
}
static inline size_t vn_sizeof_vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitForFences_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_uint32_t(&fenceCount);
if (pFences) {
cmd_size += vn_sizeof_array_size(fenceCount);
for (uint32_t i = 0; i < fenceCount; i++)
cmd_size += vn_sizeof_VkFence(&pFences[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
cmd_size += vn_sizeof_VkBool32(&waitAll);
cmd_size += vn_sizeof_uint64_t(&timeout);
return cmd_size;
}
static inline void vn_encode_vkWaitForFences(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitForFences_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_uint32_t(enc, &fenceCount);
if (pFences) {
vn_encode_array_size(enc, fenceCount);
for (uint32_t i = 0; i < fenceCount; i++)
vn_encode_VkFence(enc, &pFences[i]);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_VkBool32(enc, &waitAll);
vn_encode_uint64_t(enc, &timeout);
}
static inline size_t vn_sizeof_vkWaitForFences_reply(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkWaitForFences_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip fenceCount */
/* skip pFences */
/* skip waitAll */
/* skip timeout */
return cmd_size;
}
static inline VkResult vn_decode_vkWaitForFences_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkWaitForFences_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip fenceCount */
/* skip pFences */
/* skip waitAll */
/* skip timeout */
return ret;
}
static inline size_t vn_sizeof_vkResetFenceResourceMESA(VkDevice device, VkFence fence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFenceResourceMESA_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkFence(&fence);
return cmd_size;
}
static inline void vn_encode_vkResetFenceResourceMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFenceResourceMESA_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkFence(enc, &fence);
}
static inline size_t vn_sizeof_vkResetFenceResourceMESA_reply(VkDevice device, VkFence fence)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetFenceResourceMESA_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip fence */
return cmd_size;
}
static inline void vn_decode_vkResetFenceResourceMESA_reply(struct vn_cs_decoder *dec, VkDevice device, VkFence fence)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkResetFenceResourceMESA_EXT);
/* skip device */
/* skip fence */
}
static inline void vn_submit_vkCreateFence(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateFence(device, pCreateInfo, pAllocator, pFence);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateFence_reply(device, pCreateInfo, pAllocator, pFence) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateFence(enc, cmd_flags, device, pCreateInfo, pAllocator, pFence);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyFence(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyFence(device, fence, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyFence_reply(device, fence, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyFence(enc, cmd_flags, device, fence, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkResetFences(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkResetFences(device, fenceCount, pFences);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetFences_reply(device, fenceCount, pFences) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkResetFences(enc, cmd_flags, device, fenceCount, pFences);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetFenceStatus(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetFenceStatus(device, fence);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetFenceStatus_reply(device, fence) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetFenceStatus(enc, cmd_flags, device, fence);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkWaitForFences(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkWaitForFences(device, fenceCount, pFences, waitAll, timeout);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkWaitForFences_reply(device, fenceCount, pFences, waitAll, timeout) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkWaitForFences(enc, cmd_flags, device, fenceCount, pFences, waitAll, timeout);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkResetFenceResourceMESA(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFence fence, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkResetFenceResourceMESA(device, fence);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetFenceResourceMESA_reply(device, fence) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkResetFenceResourceMESA(enc, cmd_flags, device, fence);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateFence(struct vn_ring *vn_ring, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateFence(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pFence, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateFence_reply(dec, device, pCreateInfo, pAllocator, pFence);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateFence(struct vn_ring *vn_ring, VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateFence(vn_ring, 0, device, pCreateInfo, pAllocator, pFence, &submit);
}
static inline void vn_async_vkDestroyFence(struct vn_ring *vn_ring, VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyFence(vn_ring, 0, device, fence, pAllocator, &submit);
}
static inline VkResult vn_call_vkResetFences(struct vn_ring *vn_ring, VkDevice device, uint32_t fenceCount, const VkFence* pFences)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkResetFences(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fenceCount, pFences, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkResetFences_reply(dec, device, fenceCount, pFences);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkResetFences(struct vn_ring *vn_ring, VkDevice device, uint32_t fenceCount, const VkFence* pFences)
{
struct vn_ring_submit_command submit;
vn_submit_vkResetFences(vn_ring, 0, device, fenceCount, pFences, &submit);
}
static inline VkResult vn_call_vkGetFenceStatus(struct vn_ring *vn_ring, VkDevice device, VkFence fence)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetFenceStatus(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fence, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkGetFenceStatus_reply(dec, device, fence);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkGetFenceStatus(struct vn_ring *vn_ring, VkDevice device, VkFence fence)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetFenceStatus(vn_ring, 0, device, fence, &submit);
}
static inline VkResult vn_call_vkWaitForFences(struct vn_ring *vn_ring, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkWaitForFences(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, fenceCount, pFences, waitAll, timeout, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkWaitForFences_reply(dec, device, fenceCount, pFences, waitAll, timeout);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkWaitForFences(struct vn_ring *vn_ring, VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout)
{
struct vn_ring_submit_command submit;
vn_submit_vkWaitForFences(vn_ring, 0, device, fenceCount, pFences, waitAll, timeout, &submit);
}
static inline void vn_async_vkResetFenceResourceMESA(struct vn_ring *vn_ring, VkDevice device, VkFence fence)
{
struct vn_ring_submit_command submit;
vn_submit_vkResetFenceResourceMESA(vn_ring, 0, device, fence, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_FENCE_H */
@@ -0,0 +1,460 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_FRAMEBUFFER_H
#define VN_PROTOCOL_DRIVER_FRAMEBUFFER_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkFramebufferAttachmentImageInfo chain */
static inline size_t
vn_sizeof_VkFramebufferAttachmentImageInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkFramebufferAttachmentImageInfo_self(const VkFramebufferAttachmentImageInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkFlags(&val->usage);
size += vn_sizeof_uint32_t(&val->width);
size += vn_sizeof_uint32_t(&val->height);
size += vn_sizeof_uint32_t(&val->layerCount);
size += vn_sizeof_uint32_t(&val->viewFormatCount);
if (val->pViewFormats) {
size += vn_sizeof_array_size(val->viewFormatCount);
size += vn_sizeof_VkFormat_array(val->pViewFormats, val->viewFormatCount);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkFramebufferAttachmentImageInfo(const VkFramebufferAttachmentImageInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkFramebufferAttachmentImageInfo_pnext(val->pNext);
size += vn_sizeof_VkFramebufferAttachmentImageInfo_self(val);
return size;
}
static inline void
vn_encode_VkFramebufferAttachmentImageInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkFramebufferAttachmentImageInfo_self(struct vn_cs_encoder *enc, const VkFramebufferAttachmentImageInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkFlags(enc, &val->usage);
vn_encode_uint32_t(enc, &val->width);
vn_encode_uint32_t(enc, &val->height);
vn_encode_uint32_t(enc, &val->layerCount);
vn_encode_uint32_t(enc, &val->viewFormatCount);
if (val->pViewFormats) {
vn_encode_array_size(enc, val->viewFormatCount);
vn_encode_VkFormat_array(enc, val->pViewFormats, val->viewFormatCount);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkFramebufferAttachmentImageInfo(struct vn_cs_encoder *enc, const VkFramebufferAttachmentImageInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO });
vn_encode_VkFramebufferAttachmentImageInfo_pnext(enc, val->pNext);
vn_encode_VkFramebufferAttachmentImageInfo_self(enc, val);
}
/* struct VkFramebufferAttachmentsCreateInfo chain */
static inline size_t
vn_sizeof_VkFramebufferAttachmentsCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkFramebufferAttachmentsCreateInfo_self(const VkFramebufferAttachmentsCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_uint32_t(&val->attachmentImageInfoCount);
if (val->pAttachmentImageInfos) {
size += vn_sizeof_array_size(val->attachmentImageInfoCount);
for (uint32_t i = 0; i < val->attachmentImageInfoCount; i++)
size += vn_sizeof_VkFramebufferAttachmentImageInfo(&val->pAttachmentImageInfos[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkFramebufferAttachmentsCreateInfo(const VkFramebufferAttachmentsCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkFramebufferAttachmentsCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkFramebufferAttachmentsCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkFramebufferAttachmentsCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkFramebufferAttachmentsCreateInfo_self(struct vn_cs_encoder *enc, const VkFramebufferAttachmentsCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_uint32_t(enc, &val->attachmentImageInfoCount);
if (val->pAttachmentImageInfos) {
vn_encode_array_size(enc, val->attachmentImageInfoCount);
for (uint32_t i = 0; i < val->attachmentImageInfoCount; i++)
vn_encode_VkFramebufferAttachmentImageInfo(enc, &val->pAttachmentImageInfos[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkFramebufferAttachmentsCreateInfo(struct vn_cs_encoder *enc, const VkFramebufferAttachmentsCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO });
vn_encode_VkFramebufferAttachmentsCreateInfo_pnext(enc, val->pNext);
vn_encode_VkFramebufferAttachmentsCreateInfo_self(enc, val);
}
/* struct VkFramebufferCreateInfo chain */
static inline size_t
vn_sizeof_VkFramebufferCreateInfo_pnext(const void *val)
{
const VkBaseInStructure *pnext = val;
size_t size = 0;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO:
size += vn_sizeof_simple_pointer(pnext);
size += vn_sizeof_VkStructureType(&pnext->sType);
size += vn_sizeof_VkFramebufferCreateInfo_pnext(((const VkFramebufferAttachmentsCreateInfo *)pnext)->pNext);
size += vn_sizeof_VkFramebufferAttachmentsCreateInfo_self((const VkFramebufferAttachmentsCreateInfo *)pnext);
return size;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkFramebufferCreateInfo_self(const VkFramebufferCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkRenderPass(&val->renderPass);
size += vn_sizeof_uint32_t(&val->attachmentCount);
if (!(val->flags & VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT)) {
size += vn_sizeof_array_size(val->attachmentCount);
for (uint32_t i = 0; i < val->attachmentCount; i++)
size += vn_sizeof_VkImageView(&val->pAttachments[i]);
} else {
size += vn_sizeof_array_size(0);
}
size += vn_sizeof_uint32_t(&val->width);
size += vn_sizeof_uint32_t(&val->height);
size += vn_sizeof_uint32_t(&val->layers);
return size;
}
static inline size_t
vn_sizeof_VkFramebufferCreateInfo(const VkFramebufferCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkFramebufferCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkFramebufferCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkFramebufferCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
const VkBaseInStructure *pnext = val;
while (pnext) {
switch ((int32_t)pnext->sType) {
case VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO:
vn_encode_simple_pointer(enc, pnext);
vn_encode_VkStructureType(enc, &pnext->sType);
vn_encode_VkFramebufferCreateInfo_pnext(enc, ((const VkFramebufferAttachmentsCreateInfo *)pnext)->pNext);
vn_encode_VkFramebufferAttachmentsCreateInfo_self(enc, (const VkFramebufferAttachmentsCreateInfo *)pnext);
return;
default:
/* ignore unknown/unsupported struct */
break;
}
pnext = pnext->pNext;
}
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkFramebufferCreateInfo_self(struct vn_cs_encoder *enc, const VkFramebufferCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkRenderPass(enc, &val->renderPass);
vn_encode_uint32_t(enc, &val->attachmentCount);
if (!(val->flags & VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT)) {
vn_encode_array_size(enc, val->attachmentCount);
for (uint32_t i = 0; i < val->attachmentCount; i++)
vn_encode_VkImageView(enc, &val->pAttachments[i]);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_uint32_t(enc, &val->width);
vn_encode_uint32_t(enc, &val->height);
vn_encode_uint32_t(enc, &val->layers);
}
static inline void
vn_encode_VkFramebufferCreateInfo(struct vn_cs_encoder *enc, const VkFramebufferCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO });
vn_encode_VkFramebufferCreateInfo_pnext(enc, val->pNext);
vn_encode_VkFramebufferCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFramebuffer_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkFramebufferCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pFramebuffer);
if (pFramebuffer)
cmd_size += vn_sizeof_VkFramebuffer(pFramebuffer);
return cmd_size;
}
static inline void vn_encode_vkCreateFramebuffer(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFramebuffer_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkFramebufferCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pFramebuffer))
vn_encode_VkFramebuffer(enc, pFramebuffer);
}
static inline size_t vn_sizeof_vkCreateFramebuffer_reply(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateFramebuffer_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pFramebuffer);
if (pFramebuffer)
cmd_size += vn_sizeof_VkFramebuffer(pFramebuffer);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateFramebuffer_reply(struct vn_cs_decoder *dec, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateFramebuffer_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkFramebuffer(dec, pFramebuffer);
} else {
pFramebuffer = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkFramebuffer(&framebuffer);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyFramebuffer(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkFramebuffer(enc, &framebuffer);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyFramebuffer_reply(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip framebuffer */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyFramebuffer_reply(struct vn_cs_decoder *dec, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyFramebuffer_EXT);
/* skip device */
/* skip framebuffer */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateFramebuffer(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateFramebuffer_reply(device, pCreateInfo, pAllocator, pFramebuffer) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateFramebuffer(enc, cmd_flags, device, pCreateInfo, pAllocator, pFramebuffer);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyFramebuffer(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyFramebuffer(device, framebuffer, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyFramebuffer_reply(device, framebuffer, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyFramebuffer(enc, cmd_flags, device, framebuffer, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateFramebuffer(struct vn_ring *vn_ring, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateFramebuffer(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pFramebuffer, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateFramebuffer_reply(dec, device, pCreateInfo, pAllocator, pFramebuffer);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateFramebuffer(struct vn_ring *vn_ring, VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateFramebuffer(vn_ring, 0, device, pCreateInfo, pAllocator, pFramebuffer, &submit);
}
static inline void vn_async_vkDestroyFramebuffer(struct vn_ring *vn_ring, VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyFramebuffer(vn_ring, 0, device, framebuffer, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_FRAMEBUFFER_H */
@@ -0,0 +1,726 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_HANDLES_H
#define VN_PROTOCOL_DRIVER_HANDLES_H
#include "vn_protocol_driver_types.h"
/* VK_DEFINE_HANDLE(VkInstance) */
static inline size_t
vn_sizeof_VkInstance(const VkInstance *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkInstance(struct vn_cs_encoder *enc, const VkInstance *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_INSTANCE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkInstance(struct vn_cs_decoder *dec, VkInstance *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_INSTANCE);
}
/* VK_DEFINE_HANDLE(VkPhysicalDevice) */
static inline size_t
vn_sizeof_VkPhysicalDevice(const VkPhysicalDevice *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkPhysicalDevice(struct vn_cs_encoder *enc, const VkPhysicalDevice *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_PHYSICAL_DEVICE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkPhysicalDevice(struct vn_cs_decoder *dec, VkPhysicalDevice *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_PHYSICAL_DEVICE);
}
/* VK_DEFINE_HANDLE(VkDevice) */
static inline size_t
vn_sizeof_VkDevice(const VkDevice *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDevice(struct vn_cs_encoder *enc, const VkDevice *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DEVICE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDevice(struct vn_cs_decoder *dec, VkDevice *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DEVICE);
}
/* VK_DEFINE_HANDLE(VkQueue) */
static inline size_t
vn_sizeof_VkQueue(const VkQueue *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkQueue(struct vn_cs_encoder *enc, const VkQueue *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_QUEUE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkQueue(struct vn_cs_decoder *dec, VkQueue *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_QUEUE);
}
/* VK_DEFINE_HANDLE(VkCommandBuffer) */
static inline size_t
vn_sizeof_VkCommandBuffer(const VkCommandBuffer *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkCommandBuffer(struct vn_cs_encoder *enc, const VkCommandBuffer *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_COMMAND_BUFFER);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkCommandBuffer(struct vn_cs_decoder *dec, VkCommandBuffer *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_COMMAND_BUFFER);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) */
static inline size_t
vn_sizeof_VkDeviceMemory(const VkDeviceMemory *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDeviceMemory(struct vn_cs_encoder *enc, const VkDeviceMemory *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DEVICE_MEMORY);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDeviceMemory(struct vn_cs_decoder *dec, VkDeviceMemory *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DEVICE_MEMORY);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) */
static inline size_t
vn_sizeof_VkCommandPool(const VkCommandPool *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkCommandPool(struct vn_cs_encoder *enc, const VkCommandPool *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_COMMAND_POOL);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkCommandPool(struct vn_cs_decoder *dec, VkCommandPool *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_COMMAND_POOL);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) */
static inline size_t
vn_sizeof_VkBuffer(const VkBuffer *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkBuffer(struct vn_cs_encoder *enc, const VkBuffer *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_BUFFER);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkBuffer(struct vn_cs_decoder *dec, VkBuffer *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_BUFFER);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) */
static inline size_t
vn_sizeof_VkBufferView(const VkBufferView *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkBufferView(struct vn_cs_encoder *enc, const VkBufferView *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_BUFFER_VIEW);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkBufferView(struct vn_cs_decoder *dec, VkBufferView *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_BUFFER_VIEW);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) */
static inline size_t
vn_sizeof_VkImage(const VkImage *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkImage(struct vn_cs_encoder *enc, const VkImage *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_IMAGE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkImage(struct vn_cs_decoder *dec, VkImage *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_IMAGE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) */
static inline size_t
vn_sizeof_VkImageView(const VkImageView *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkImageView(struct vn_cs_encoder *enc, const VkImageView *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_IMAGE_VIEW);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkImageView(struct vn_cs_decoder *dec, VkImageView *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_IMAGE_VIEW);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) */
static inline size_t
vn_sizeof_VkShaderModule(const VkShaderModule *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkShaderModule(struct vn_cs_encoder *enc, const VkShaderModule *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_SHADER_MODULE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkShaderModule(struct vn_cs_decoder *dec, VkShaderModule *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_SHADER_MODULE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) */
static inline size_t
vn_sizeof_VkPipeline(const VkPipeline *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkPipeline(struct vn_cs_encoder *enc, const VkPipeline *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_PIPELINE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkPipeline(struct vn_cs_decoder *dec, VkPipeline *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_PIPELINE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) */
static inline size_t
vn_sizeof_VkPipelineLayout(const VkPipelineLayout *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkPipelineLayout(struct vn_cs_encoder *enc, const VkPipelineLayout *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_PIPELINE_LAYOUT);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkPipelineLayout(struct vn_cs_decoder *dec, VkPipelineLayout *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_PIPELINE_LAYOUT);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) */
static inline size_t
vn_sizeof_VkSampler(const VkSampler *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkSampler(struct vn_cs_encoder *enc, const VkSampler *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_SAMPLER);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkSampler(struct vn_cs_decoder *dec, VkSampler *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_SAMPLER);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) */
static inline size_t
vn_sizeof_VkDescriptorSet(const VkDescriptorSet *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDescriptorSet(struct vn_cs_encoder *enc, const VkDescriptorSet *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DESCRIPTOR_SET);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDescriptorSet(struct vn_cs_decoder *dec, VkDescriptorSet *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DESCRIPTOR_SET);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) */
static inline size_t
vn_sizeof_VkDescriptorSetLayout(const VkDescriptorSetLayout *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDescriptorSetLayout(struct vn_cs_encoder *enc, const VkDescriptorSetLayout *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDescriptorSetLayout(struct vn_cs_decoder *dec, VkDescriptorSetLayout *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) */
static inline size_t
vn_sizeof_VkDescriptorPool(const VkDescriptorPool *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDescriptorPool(struct vn_cs_encoder *enc, const VkDescriptorPool *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DESCRIPTOR_POOL);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDescriptorPool(struct vn_cs_decoder *dec, VkDescriptorPool *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DESCRIPTOR_POOL);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) */
static inline size_t
vn_sizeof_VkFence(const VkFence *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkFence(struct vn_cs_encoder *enc, const VkFence *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_FENCE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkFence(struct vn_cs_decoder *dec, VkFence *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_FENCE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) */
static inline size_t
vn_sizeof_VkSemaphore(const VkSemaphore *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkSemaphore(struct vn_cs_encoder *enc, const VkSemaphore *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_SEMAPHORE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkSemaphore(struct vn_cs_decoder *dec, VkSemaphore *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_SEMAPHORE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) */
static inline size_t
vn_sizeof_VkEvent(const VkEvent *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkEvent(struct vn_cs_encoder *enc, const VkEvent *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_EVENT);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkEvent(struct vn_cs_decoder *dec, VkEvent *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_EVENT);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) */
static inline size_t
vn_sizeof_VkQueryPool(const VkQueryPool *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkQueryPool(struct vn_cs_encoder *enc, const VkQueryPool *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_QUERY_POOL);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkQueryPool(struct vn_cs_decoder *dec, VkQueryPool *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_QUERY_POOL);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) */
static inline size_t
vn_sizeof_VkFramebuffer(const VkFramebuffer *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkFramebuffer(struct vn_cs_encoder *enc, const VkFramebuffer *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_FRAMEBUFFER);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkFramebuffer(struct vn_cs_decoder *dec, VkFramebuffer *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_FRAMEBUFFER);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) */
static inline size_t
vn_sizeof_VkRenderPass(const VkRenderPass *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkRenderPass(struct vn_cs_encoder *enc, const VkRenderPass *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_RENDER_PASS);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkRenderPass(struct vn_cs_decoder *dec, VkRenderPass *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_RENDER_PASS);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) */
static inline size_t
vn_sizeof_VkPipelineCache(const VkPipelineCache *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkPipelineCache(struct vn_cs_encoder *enc, const VkPipelineCache *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_PIPELINE_CACHE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkPipelineCache(struct vn_cs_decoder *dec, VkPipelineCache *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_PIPELINE_CACHE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplate) */
static inline size_t
vn_sizeof_VkDescriptorUpdateTemplate(const VkDescriptorUpdateTemplate *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDescriptorUpdateTemplate(struct vn_cs_encoder *enc, const VkDescriptorUpdateTemplate *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDescriptorUpdateTemplate(struct vn_cs_decoder *dec, VkDescriptorUpdateTemplate *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion) */
static inline size_t
vn_sizeof_VkSamplerYcbcrConversion(const VkSamplerYcbcrConversion *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkSamplerYcbcrConversion(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversion *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkSamplerYcbcrConversion(struct vn_cs_decoder *dec, VkSamplerYcbcrConversion *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) */
static inline size_t
vn_sizeof_VkAccelerationStructureKHR(const VkAccelerationStructureKHR *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkAccelerationStructureKHR(struct vn_cs_encoder *enc, const VkAccelerationStructureKHR *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkAccelerationStructureKHR(struct vn_cs_decoder *dec, VkAccelerationStructureKHR *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeferredOperationKHR) */
static inline size_t
vn_sizeof_VkDeferredOperationKHR(const VkDeferredOperationKHR *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkDeferredOperationKHR(struct vn_cs_encoder *enc, const VkDeferredOperationKHR *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkDeferredOperationKHR(struct vn_cs_decoder *dec, VkDeferredOperationKHR *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPrivateDataSlot) */
static inline size_t
vn_sizeof_VkPrivateDataSlot(const VkPrivateDataSlot *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkPrivateDataSlot(struct vn_cs_encoder *enc, const VkPrivateDataSlot *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_PRIVATE_DATA_SLOT);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkPrivateDataSlot(struct vn_cs_decoder *dec, VkPrivateDataSlot *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_PRIVATE_DATA_SLOT);
}
/* VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkTensorARM) */
static inline size_t
vn_sizeof_VkTensorARM(const VkTensorARM *val)
{
return sizeof(uint64_t);
}
static inline void
vn_encode_VkTensorARM(struct vn_cs_encoder *enc, const VkTensorARM *val)
{
const uint64_t id = vn_cs_handle_load_id((const void **)val, VK_OBJECT_TYPE_TENSOR_ARM);
vn_encode_uint64_t(enc, &id);
}
static inline void
vn_decode_VkTensorARM(struct vn_cs_decoder *dec, VkTensorARM *val)
{
uint64_t id;
vn_decode_uint64_t(dec, &id);
vn_cs_handle_store_id((void **)val, id, VK_OBJECT_TYPE_TENSOR_ARM);
}
#endif /* VN_PROTOCOL_DRIVER_HANDLES_H */
@@ -0,0 +1,788 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_HOST_COPY_H
#define VN_PROTOCOL_DRIVER_HOST_COPY_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/*
* These structs/unions/commands are not included
*
* vkCopyMemoryToImage
* vkCopyImageToMemory
*/
/* struct VkCopyImageToImageInfo chain */
static inline size_t
vn_sizeof_VkCopyImageToImageInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkCopyImageToImageInfo_self(const VkCopyImageToImageInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkImage(&val->srcImage);
size += vn_sizeof_VkImageLayout(&val->srcImageLayout);
size += vn_sizeof_VkImage(&val->dstImage);
size += vn_sizeof_VkImageLayout(&val->dstImageLayout);
size += vn_sizeof_uint32_t(&val->regionCount);
if (val->pRegions) {
size += vn_sizeof_array_size(val->regionCount);
for (uint32_t i = 0; i < val->regionCount; i++)
size += vn_sizeof_VkImageCopy2(&val->pRegions[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkCopyImageToImageInfo(const VkCopyImageToImageInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkCopyImageToImageInfo_pnext(val->pNext);
size += vn_sizeof_VkCopyImageToImageInfo_self(val);
return size;
}
static inline void
vn_encode_VkCopyImageToImageInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkCopyImageToImageInfo_self(struct vn_cs_encoder *enc, const VkCopyImageToImageInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkImage(enc, &val->srcImage);
vn_encode_VkImageLayout(enc, &val->srcImageLayout);
vn_encode_VkImage(enc, &val->dstImage);
vn_encode_VkImageLayout(enc, &val->dstImageLayout);
vn_encode_uint32_t(enc, &val->regionCount);
if (val->pRegions) {
vn_encode_array_size(enc, val->regionCount);
for (uint32_t i = 0; i < val->regionCount; i++)
vn_encode_VkImageCopy2(enc, &val->pRegions[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkCopyImageToImageInfo(struct vn_cs_encoder *enc, const VkCopyImageToImageInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO });
vn_encode_VkCopyImageToImageInfo_pnext(enc, val->pNext);
vn_encode_VkCopyImageToImageInfo_self(enc, val);
}
/* struct VkHostImageLayoutTransitionInfo chain */
static inline size_t
vn_sizeof_VkHostImageLayoutTransitionInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkHostImageLayoutTransitionInfo_self(const VkHostImageLayoutTransitionInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkImage(&val->image);
size += vn_sizeof_VkImageLayout(&val->oldLayout);
size += vn_sizeof_VkImageLayout(&val->newLayout);
size += vn_sizeof_VkImageSubresourceRange(&val->subresourceRange);
return size;
}
static inline size_t
vn_sizeof_VkHostImageLayoutTransitionInfo(const VkHostImageLayoutTransitionInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkHostImageLayoutTransitionInfo_pnext(val->pNext);
size += vn_sizeof_VkHostImageLayoutTransitionInfo_self(val);
return size;
}
static inline void
vn_encode_VkHostImageLayoutTransitionInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkHostImageLayoutTransitionInfo_self(struct vn_cs_encoder *enc, const VkHostImageLayoutTransitionInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkImage(enc, &val->image);
vn_encode_VkImageLayout(enc, &val->oldLayout);
vn_encode_VkImageLayout(enc, &val->newLayout);
vn_encode_VkImageSubresourceRange(enc, &val->subresourceRange);
}
static inline void
vn_encode_VkHostImageLayoutTransitionInfo(struct vn_cs_encoder *enc, const VkHostImageLayoutTransitionInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO });
vn_encode_VkHostImageLayoutTransitionInfo_pnext(enc, val->pNext);
vn_encode_VkHostImageLayoutTransitionInfo_self(enc, val);
}
/* struct VkCopyImageToMemoryInfoMESA chain */
static inline size_t
vn_sizeof_VkCopyImageToMemoryInfoMESA_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkCopyImageToMemoryInfoMESA_self(const VkCopyImageToMemoryInfoMESA *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkImage(&val->srcImage);
size += vn_sizeof_VkImageLayout(&val->srcImageLayout);
size += vn_sizeof_uint32_t(&val->memoryRowLength);
size += vn_sizeof_uint32_t(&val->memoryImageHeight);
size += vn_sizeof_VkImageSubresourceLayers(&val->imageSubresource);
size += vn_sizeof_VkOffset3D(&val->imageOffset);
size += vn_sizeof_VkExtent3D(&val->imageExtent);
return size;
}
static inline size_t
vn_sizeof_VkCopyImageToMemoryInfoMESA(const VkCopyImageToMemoryInfoMESA *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkCopyImageToMemoryInfoMESA_pnext(val->pNext);
size += vn_sizeof_VkCopyImageToMemoryInfoMESA_self(val);
return size;
}
static inline void
vn_encode_VkCopyImageToMemoryInfoMESA_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkCopyImageToMemoryInfoMESA_self(struct vn_cs_encoder *enc, const VkCopyImageToMemoryInfoMESA *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkImage(enc, &val->srcImage);
vn_encode_VkImageLayout(enc, &val->srcImageLayout);
vn_encode_uint32_t(enc, &val->memoryRowLength);
vn_encode_uint32_t(enc, &val->memoryImageHeight);
vn_encode_VkImageSubresourceLayers(enc, &val->imageSubresource);
vn_encode_VkOffset3D(enc, &val->imageOffset);
vn_encode_VkExtent3D(enc, &val->imageExtent);
}
static inline void
vn_encode_VkCopyImageToMemoryInfoMESA(struct vn_cs_encoder *enc, const VkCopyImageToMemoryInfoMESA *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_MESA);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_MESA });
vn_encode_VkCopyImageToMemoryInfoMESA_pnext(enc, val->pNext);
vn_encode_VkCopyImageToMemoryInfoMESA_self(enc, val);
}
/* struct VkMemoryToImageCopyMESA chain */
static inline size_t
vn_sizeof_VkMemoryToImageCopyMESA_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkMemoryToImageCopyMESA_self(const VkMemoryToImageCopyMESA *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_size_t(&val->dataSize);
if (val->pData) {
size += vn_sizeof_array_size(val->dataSize);
size += vn_sizeof_blob_array(val->pData, val->dataSize);
} else {
size += vn_sizeof_array_size(0);
}
size += vn_sizeof_uint32_t(&val->memoryRowLength);
size += vn_sizeof_uint32_t(&val->memoryImageHeight);
size += vn_sizeof_VkImageSubresourceLayers(&val->imageSubresource);
size += vn_sizeof_VkOffset3D(&val->imageOffset);
size += vn_sizeof_VkExtent3D(&val->imageExtent);
return size;
}
static inline size_t
vn_sizeof_VkMemoryToImageCopyMESA(const VkMemoryToImageCopyMESA *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkMemoryToImageCopyMESA_pnext(val->pNext);
size += vn_sizeof_VkMemoryToImageCopyMESA_self(val);
return size;
}
static inline void
vn_encode_VkMemoryToImageCopyMESA_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkMemoryToImageCopyMESA_self(struct vn_cs_encoder *enc, const VkMemoryToImageCopyMESA *val)
{
/* skip val->{sType,pNext} */
vn_encode_size_t(enc, &val->dataSize);
if (val->pData) {
vn_encode_array_size(enc, val->dataSize);
vn_encode_blob_array(enc, val->pData, val->dataSize);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_uint32_t(enc, &val->memoryRowLength);
vn_encode_uint32_t(enc, &val->memoryImageHeight);
vn_encode_VkImageSubresourceLayers(enc, &val->imageSubresource);
vn_encode_VkOffset3D(enc, &val->imageOffset);
vn_encode_VkExtent3D(enc, &val->imageExtent);
}
static inline void
vn_encode_VkMemoryToImageCopyMESA(struct vn_cs_encoder *enc, const VkMemoryToImageCopyMESA *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_MESA);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_MESA });
vn_encode_VkMemoryToImageCopyMESA_pnext(enc, val->pNext);
vn_encode_VkMemoryToImageCopyMESA_self(enc, val);
}
/* struct VkCopyMemoryToImageInfoMESA chain */
static inline size_t
vn_sizeof_VkCopyMemoryToImageInfoMESA_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkCopyMemoryToImageInfoMESA_self(const VkCopyMemoryToImageInfoMESA *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkImage(&val->dstImage);
size += vn_sizeof_VkImageLayout(&val->dstImageLayout);
size += vn_sizeof_uint32_t(&val->regionCount);
if (val->pRegions) {
size += vn_sizeof_array_size(val->regionCount);
for (uint32_t i = 0; i < val->regionCount; i++)
size += vn_sizeof_VkMemoryToImageCopyMESA(&val->pRegions[i]);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkCopyMemoryToImageInfoMESA(const VkCopyMemoryToImageInfoMESA *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkCopyMemoryToImageInfoMESA_pnext(val->pNext);
size += vn_sizeof_VkCopyMemoryToImageInfoMESA_self(val);
return size;
}
static inline void
vn_encode_VkCopyMemoryToImageInfoMESA_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkCopyMemoryToImageInfoMESA_self(struct vn_cs_encoder *enc, const VkCopyMemoryToImageInfoMESA *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkImage(enc, &val->dstImage);
vn_encode_VkImageLayout(enc, &val->dstImageLayout);
vn_encode_uint32_t(enc, &val->regionCount);
if (val->pRegions) {
vn_encode_array_size(enc, val->regionCount);
for (uint32_t i = 0; i < val->regionCount; i++)
vn_encode_VkMemoryToImageCopyMESA(enc, &val->pRegions[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkCopyMemoryToImageInfoMESA(struct vn_cs_encoder *enc, const VkCopyMemoryToImageInfoMESA *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_MESA);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_MESA });
vn_encode_VkCopyMemoryToImageInfoMESA_pnext(enc, val->pNext);
vn_encode_VkCopyMemoryToImageInfoMESA_self(enc, val);
}
static inline size_t vn_sizeof_vkCopyImageToImage(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyImageToImage_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCopyImageToImageInfo);
if (pCopyImageToImageInfo)
cmd_size += vn_sizeof_VkCopyImageToImageInfo(pCopyImageToImageInfo);
return cmd_size;
}
static inline void vn_encode_vkCopyImageToImage(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyImageToImage_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCopyImageToImageInfo))
vn_encode_VkCopyImageToImageInfo(enc, pCopyImageToImageInfo);
}
static inline size_t vn_sizeof_vkCopyImageToImage_reply(VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyImageToImage_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCopyImageToImageInfo */
return cmd_size;
}
static inline VkResult vn_decode_vkCopyImageToImage_reply(struct vn_cs_decoder *dec, VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCopyImageToImage_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCopyImageToImageInfo */
return ret;
}
static inline size_t vn_sizeof_vkTransitionImageLayout(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkTransitionImageLayout_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_uint32_t(&transitionCount);
if (pTransitions) {
cmd_size += vn_sizeof_array_size(transitionCount);
for (uint32_t i = 0; i < transitionCount; i++)
cmd_size += vn_sizeof_VkHostImageLayoutTransitionInfo(&pTransitions[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkTransitionImageLayout(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkTransitionImageLayout_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_uint32_t(enc, &transitionCount);
if (pTransitions) {
vn_encode_array_size(enc, transitionCount);
for (uint32_t i = 0; i < transitionCount; i++)
vn_encode_VkHostImageLayoutTransitionInfo(enc, &pTransitions[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkTransitionImageLayout_reply(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkTransitionImageLayout_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip transitionCount */
/* skip pTransitions */
return cmd_size;
}
static inline VkResult vn_decode_vkTransitionImageLayout_reply(struct vn_cs_decoder *dec, VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkTransitionImageLayout_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip transitionCount */
/* skip pTransitions */
return ret;
}
static inline size_t vn_sizeof_vkCopyImageToMemoryMESA(VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyImageToMemoryMESA_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCopyImageToMemoryInfo);
if (pCopyImageToMemoryInfo)
cmd_size += vn_sizeof_VkCopyImageToMemoryInfoMESA(pCopyImageToMemoryInfo);
cmd_size += vn_sizeof_size_t(&dataSize);
cmd_size += vn_sizeof_simple_pointer(pData); /* out */
return cmd_size;
}
static inline void vn_encode_vkCopyImageToMemoryMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyImageToMemoryMESA_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCopyImageToMemoryInfo))
vn_encode_VkCopyImageToMemoryInfoMESA(enc, pCopyImageToMemoryInfo);
vn_encode_size_t(enc, &dataSize);
vn_encode_array_size(enc, pData ? dataSize : 0); /* out */
}
static inline size_t vn_sizeof_vkCopyImageToMemoryMESA_reply(VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyImageToMemoryMESA_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCopyImageToMemoryInfo */
/* skip dataSize */
if (pData) {
cmd_size += vn_sizeof_array_size(dataSize);
cmd_size += vn_sizeof_blob_array(pData, dataSize);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkCopyImageToMemoryMESA_reply(struct vn_cs_decoder *dec, VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCopyImageToMemoryMESA_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCopyImageToMemoryInfo */
/* skip dataSize */
if (vn_peek_array_size(dec)) {
const size_t array_size = vn_decode_array_size(dec, dataSize);
vn_decode_blob_array(dec, pData, array_size);
} else {
vn_decode_array_size_unchecked(dec);
pData = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkCopyMemoryToImageMESA(VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyMemoryToImageMESA_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCopyMemoryToImageInfo);
if (pCopyMemoryToImageInfo)
cmd_size += vn_sizeof_VkCopyMemoryToImageInfoMESA(pCopyMemoryToImageInfo);
return cmd_size;
}
static inline void vn_encode_vkCopyMemoryToImageMESA(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyMemoryToImageMESA_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCopyMemoryToImageInfo))
vn_encode_VkCopyMemoryToImageInfoMESA(enc, pCopyMemoryToImageInfo);
}
static inline size_t vn_sizeof_vkCopyMemoryToImageMESA_reply(VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCopyMemoryToImageMESA_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCopyMemoryToImageInfo */
return cmd_size;
}
static inline VkResult vn_decode_vkCopyMemoryToImageMESA_reply(struct vn_cs_decoder *dec, VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCopyMemoryToImageMESA_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCopyMemoryToImageInfo */
return ret;
}
static inline void vn_submit_vkCopyImageToImage(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCopyImageToImage(device, pCopyImageToImageInfo);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCopyImageToImage_reply(device, pCopyImageToImageInfo) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCopyImageToImage(enc, cmd_flags, device, pCopyImageToImageInfo);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkTransitionImageLayout(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkTransitionImageLayout(device, transitionCount, pTransitions);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkTransitionImageLayout_reply(device, transitionCount, pTransitions) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkTransitionImageLayout(enc, cmd_flags, device, transitionCount, pTransitions);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkCopyImageToMemoryMESA(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCopyImageToMemoryMESA(device, pCopyImageToMemoryInfo, dataSize, pData);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCopyImageToMemoryMESA_reply(device, pCopyImageToMemoryInfo, dataSize, pData) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCopyImageToMemoryMESA(enc, cmd_flags, device, pCopyImageToMemoryInfo, dataSize, pData);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkCopyMemoryToImageMESA(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCopyMemoryToImageMESA(device, pCopyMemoryToImageInfo);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCopyMemoryToImageMESA_reply(device, pCopyMemoryToImageInfo) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCopyMemoryToImageMESA(enc, cmd_flags, device, pCopyMemoryToImageInfo);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCopyImageToImage(struct vn_ring *vn_ring, VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCopyImageToImage(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCopyImageToImageInfo, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCopyImageToImage_reply(dec, device, pCopyImageToImageInfo);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCopyImageToImage(struct vn_ring *vn_ring, VkDevice device, const VkCopyImageToImageInfo* pCopyImageToImageInfo)
{
struct vn_ring_submit_command submit;
vn_submit_vkCopyImageToImage(vn_ring, 0, device, pCopyImageToImageInfo, &submit);
}
static inline VkResult vn_call_vkTransitionImageLayout(struct vn_ring *vn_ring, VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkTransitionImageLayout(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, transitionCount, pTransitions, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkTransitionImageLayout_reply(dec, device, transitionCount, pTransitions);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkTransitionImageLayout(struct vn_ring *vn_ring, VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfo* pTransitions)
{
struct vn_ring_submit_command submit;
vn_submit_vkTransitionImageLayout(vn_ring, 0, device, transitionCount, pTransitions, &submit);
}
static inline VkResult vn_call_vkCopyImageToMemoryMESA(struct vn_ring *vn_ring, VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCopyImageToMemoryMESA(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCopyImageToMemoryInfo, dataSize, pData, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCopyImageToMemoryMESA_reply(dec, device, pCopyImageToMemoryInfo, dataSize, pData);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCopyImageToMemoryMESA(struct vn_ring *vn_ring, VkDevice device, const VkCopyImageToMemoryInfoMESA* pCopyImageToMemoryInfo, size_t dataSize, void* pData)
{
struct vn_ring_submit_command submit;
vn_submit_vkCopyImageToMemoryMESA(vn_ring, 0, device, pCopyImageToMemoryInfo, dataSize, pData, &submit);
}
static inline VkResult vn_call_vkCopyMemoryToImageMESA(struct vn_ring *vn_ring, VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCopyMemoryToImageMESA(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCopyMemoryToImageInfo, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCopyMemoryToImageMESA_reply(dec, device, pCopyMemoryToImageInfo);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCopyMemoryToImageMESA(struct vn_ring *vn_ring, VkDevice device, const VkCopyMemoryToImageInfoMESA* pCopyMemoryToImageInfo)
{
struct vn_ring_submit_command submit;
vn_submit_vkCopyMemoryToImageMESA(vn_ring, 0, device, pCopyMemoryToImageInfo, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_HOST_COPY_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,208 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_IMAGE_VIEW_H
#define VN_PROTOCOL_DRIVER_IMAGE_VIEW_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
static inline size_t vn_sizeof_vkCreateImageView(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateImageView_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkImageViewCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pView);
if (pView)
cmd_size += vn_sizeof_VkImageView(pView);
return cmd_size;
}
static inline void vn_encode_vkCreateImageView(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateImageView_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkImageViewCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pView))
vn_encode_VkImageView(enc, pView);
}
static inline size_t vn_sizeof_vkCreateImageView_reply(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateImageView_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pView);
if (pView)
cmd_size += vn_sizeof_VkImageView(pView);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateImageView_reply(struct vn_cs_decoder *dec, VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateImageView_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkImageView(dec, pView);
} else {
pView = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyImageView_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkImageView(&imageView);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyImageView(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyImageView_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkImageView(enc, &imageView);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyImageView_reply(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyImageView_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip imageView */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyImageView_reply(struct vn_cs_decoder *dec, VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyImageView_EXT);
/* skip device */
/* skip imageView */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateImageView(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateImageView(device, pCreateInfo, pAllocator, pView);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateImageView_reply(device, pCreateInfo, pAllocator, pView) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateImageView(enc, cmd_flags, device, pCreateInfo, pAllocator, pView);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyImageView(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyImageView(device, imageView, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyImageView_reply(device, imageView, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyImageView(enc, cmd_flags, device, imageView, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateImageView(struct vn_ring *vn_ring, VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateImageView(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pView, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateImageView_reply(dec, device, pCreateInfo, pAllocator, pView);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateImageView(struct vn_ring *vn_ring, VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateImageView(vn_ring, 0, device, pCreateInfo, pAllocator, pView, &submit);
}
static inline void vn_async_vkDestroyImageView(struct vn_ring *vn_ring, VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyImageView(vn_ring, 0, device, imageView, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_IMAGE_VIEW_H */
@@ -0,0 +1,253 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_INFO_H
#define VN_PROTOCOL_DRIVER_INFO_H
#include "vn_protocol_driver_defines.h"
#define VN_INFO_EXTENSION_MAX_NUMBER (643)
struct vn_info_extension {
const char *name;
uint32_t number;
uint32_t spec_version;
};
/* sorted by extension names for bsearch */
static const uint32_t _vn_info_extension_count = 187;
static const struct vn_info_extension _vn_info_extensions[187] = {
{ "VK_ARM_rasterization_order_attachment_access", 343, 1 },
{ "VK_EXT_4444_formats", 341, 1 },
{ "VK_EXT_attachment_feedback_loop_dynamic_state", 525, 1 },
{ "VK_EXT_attachment_feedback_loop_layout", 340, 2 },
{ "VK_EXT_blend_operation_advanced", 149, 2 },
{ "VK_EXT_border_color_swizzle", 412, 1 },
{ "VK_EXT_buffer_device_address", 245, 2 },
{ "VK_EXT_calibrated_timestamps", 185, 2 },
{ "VK_EXT_color_write_enable", 382, 1 },
{ "VK_EXT_command_serialization", 384, 1 },
{ "VK_EXT_conditional_rendering", 82, 2 },
{ "VK_EXT_conservative_rasterization", 102, 1 },
{ "VK_EXT_custom_border_color", 288, 12 },
{ "VK_EXT_depth_bias_control", 284, 1 },
{ "VK_EXT_depth_clamp_control", 583, 1 },
{ "VK_EXT_depth_clamp_zero_one", 422, 1 },
{ "VK_EXT_depth_clip_control", 356, 1 },
{ "VK_EXT_depth_clip_enable", 103, 1 },
{ "VK_EXT_depth_range_unrestricted", 14, 1 },
{ "VK_EXT_descriptor_heap", 136, 1 },
{ "VK_EXT_descriptor_indexing", 162, 2 },
{ "VK_EXT_dynamic_rendering_unused_attachments", 500, 1 },
{ "VK_EXT_extended_dynamic_state", 268, 1 },
{ "VK_EXT_extended_dynamic_state2", 378, 1 },
{ "VK_EXT_extended_dynamic_state3", 456, 2 },
{ "VK_EXT_external_memory_acquire_unmodified", 454, 1 },
{ "VK_EXT_external_memory_dma_buf", 126, 1 },
{ "VK_EXT_filter_cubic", 171, 3 },
{ "VK_EXT_fragment_shader_interlock", 252, 1 },
{ "VK_EXT_global_priority", 175, 2 },
{ "VK_EXT_global_priority_query", 389, 1 },
{ "VK_EXT_graphics_pipeline_library", 321, 1 },
{ "VK_EXT_host_image_copy", 271, 1 },
{ "VK_EXT_host_query_reset", 262, 1 },
{ "VK_EXT_image_2d_view_of_3d", 394, 1 },
{ "VK_EXT_image_drm_format_modifier", 159, 2 },
{ "VK_EXT_image_robustness", 336, 1 },
{ "VK_EXT_image_sliced_view_of_3d", 419, 1 },
{ "VK_EXT_image_view_min_lod", 392, 1 },
{ "VK_EXT_index_type_uint8", 266, 1 },
{ "VK_EXT_inline_uniform_block", 139, 1 },
{ "VK_EXT_legacy_dithering", 466, 2 },
{ "VK_EXT_legacy_vertex_attributes", 496, 1 },
{ "VK_EXT_line_rasterization", 260, 1 },
{ "VK_EXT_load_store_op_none", 401, 1 },
{ "VK_EXT_memory_budget", 238, 1 },
{ "VK_EXT_mesh_shader", 329, 1 },
{ "VK_EXT_multi_draw", 393, 1 },
{ "VK_EXT_multisampled_render_to_single_sampled", 377, 1 },
{ "VK_EXT_mutable_descriptor_type", 495, 1 },
{ "VK_EXT_nested_command_buffer", 452, 1 },
{ "VK_EXT_non_seamless_cube_map", 423, 1 },
{ "VK_EXT_pci_bus_info", 213, 2 },
{ "VK_EXT_pipeline_creation_cache_control", 298, 3 },
{ "VK_EXT_pipeline_creation_feedback", 193, 1 },
{ "VK_EXT_pipeline_library_group_handles", 499, 1 },
{ "VK_EXT_pipeline_protected_access", 467, 1 },
{ "VK_EXT_pipeline_robustness", 69, 1 },
{ "VK_EXT_post_depth_coverage", 156, 1 },
{ "VK_EXT_primitive_topology_list_restart", 357, 1 },
{ "VK_EXT_primitives_generated_query", 383, 1 },
{ "VK_EXT_private_data", 296, 1 },
{ "VK_EXT_provoking_vertex", 255, 1 },
{ "VK_EXT_queue_family_foreign", 127, 1 },
{ "VK_EXT_rasterization_order_attachment_access", 464, 1 },
{ "VK_EXT_robustness2", 287, 1 },
{ "VK_EXT_sample_locations", 144, 1 },
{ "VK_EXT_sampler_filter_minmax", 131, 2 },
{ "VK_EXT_scalar_block_layout", 222, 1 },
{ "VK_EXT_separate_stencil_usage", 247, 1 },
{ "VK_EXT_shader_atomic_float", 261, 1 },
{ "VK_EXT_shader_atomic_float2", 274, 1 },
{ "VK_EXT_shader_demote_to_helper_invocation", 277, 1 },
{ "VK_EXT_shader_float8", 568, 1 },
{ "VK_EXT_shader_image_atomic_int64", 235, 1 },
{ "VK_EXT_shader_replicated_composites", 565, 1 },
{ "VK_EXT_shader_stencil_export", 141, 1 },
{ "VK_EXT_shader_subgroup_ballot", 65, 1 },
{ "VK_EXT_shader_subgroup_vote", 66, 1 },
{ "VK_EXT_shader_uniform_buffer_unsized_array", 643, 1 },
{ "VK_EXT_shader_viewport_index_layer", 163, 1 },
{ "VK_EXT_subgroup_size_control", 226, 2 },
{ "VK_EXT_texel_buffer_alignment", 282, 1 },
{ "VK_EXT_texture_compression_astc_hdr", 67, 1 },
{ "VK_EXT_tooling_info", 246, 1 },
{ "VK_EXT_transform_feedback", 29, 1 },
{ "VK_EXT_vertex_attribute_divisor", 191, 3 },
{ "VK_EXT_vertex_input_dynamic_state", 353, 2 },
{ "VK_EXT_ycbcr_2plane_444_formats", 331, 1 },
{ "VK_EXT_ycbcr_image_arrays", 253, 1 },
{ "VK_GOOGLE_decorate_string", 225, 1 },
{ "VK_GOOGLE_hlsl_functionality1", 224, 1 },
{ "VK_GOOGLE_user_type", 290, 1 },
{ "VK_IMG_filter_cubic", 16, 1 },
{ "VK_KHR_16bit_storage", 84, 1 },
{ "VK_KHR_8bit_storage", 178, 1 },
{ "VK_KHR_acceleration_structure", 151, 13 },
{ "VK_KHR_bind_memory2", 158, 1 },
{ "VK_KHR_buffer_device_address", 258, 1 },
{ "VK_KHR_calibrated_timestamps", 544, 1 },
{ "VK_KHR_compute_shader_derivatives", 512, 1 },
{ "VK_KHR_cooperative_matrix", 507, 2 },
{ "VK_KHR_copy_commands2", 338, 1 },
{ "VK_KHR_create_renderpass2", 110, 1 },
{ "VK_KHR_dedicated_allocation", 128, 3 },
{ "VK_KHR_deferred_host_operations", 269, 4 },
{ "VK_KHR_depth_clamp_zero_one", 605, 1 },
{ "VK_KHR_depth_stencil_resolve", 200, 1 },
{ "VK_KHR_descriptor_update_template", 86, 1 },
{ "VK_KHR_device_group", 61, 4 },
{ "VK_KHR_device_group_creation", 71, 1 },
{ "VK_KHR_draw_indirect_count", 170, 1 },
{ "VK_KHR_driver_properties", 197, 1 },
{ "VK_KHR_dynamic_rendering", 45, 1 },
{ "VK_KHR_dynamic_rendering_local_read", 233, 1 },
{ "VK_KHR_external_fence", 114, 1 },
{ "VK_KHR_external_fence_capabilities", 113, 1 },
{ "VK_KHR_external_fence_fd", 116, 1 },
{ "VK_KHR_external_memory", 73, 1 },
{ "VK_KHR_external_memory_capabilities", 72, 1 },
{ "VK_KHR_external_memory_fd", 75, 1 },
{ "VK_KHR_external_semaphore", 78, 1 },
{ "VK_KHR_external_semaphore_capabilities", 77, 1 },
{ "VK_KHR_external_semaphore_fd", 80, 1 },
{ "VK_KHR_format_feature_flags2", 361, 2 },
{ "VK_KHR_fragment_shader_barycentric", 323, 1 },
{ "VK_KHR_fragment_shading_rate", 227, 2 },
{ "VK_KHR_get_memory_requirements2", 147, 1 },
{ "VK_KHR_get_physical_device_properties2", 60, 2 },
{ "VK_KHR_global_priority", 189, 1 },
{ "VK_KHR_image_format_list", 148, 1 },
{ "VK_KHR_imageless_framebuffer", 109, 1 },
{ "VK_KHR_index_type_uint8", 534, 1 },
{ "VK_KHR_line_rasterization", 535, 1 },
{ "VK_KHR_load_store_op_none", 527, 1 },
{ "VK_KHR_maintenance1", 70, 2 },
{ "VK_KHR_maintenance2", 118, 1 },
{ "VK_KHR_maintenance3", 169, 1 },
{ "VK_KHR_maintenance4", 414, 2 },
{ "VK_KHR_maintenance5", 471, 1 },
{ "VK_KHR_maintenance6", 546, 1 },
{ "VK_KHR_maintenance7", 563, 1 },
{ "VK_KHR_map_memory2", 272, 1 },
{ "VK_KHR_multiview", 54, 1 },
{ "VK_KHR_pipeline_library", 291, 1 },
{ "VK_KHR_push_descriptor", 81, 2 },
{ "VK_KHR_ray_query", 349, 1 },
{ "VK_KHR_ray_tracing_maintenance1", 387, 1 },
{ "VK_KHR_ray_tracing_pipeline", 348, 1 },
{ "VK_KHR_ray_tracing_position_fetch", 482, 1 },
{ "VK_KHR_relaxed_block_layout", 145, 1 },
{ "VK_KHR_robustness2", 613, 1 },
{ "VK_KHR_sampler_mirror_clamp_to_edge", 15, 3 },
{ "VK_KHR_sampler_ycbcr_conversion", 157, 14 },
{ "VK_KHR_separate_depth_stencil_layouts", 242, 1 },
{ "VK_KHR_shader_atomic_int64", 181, 1 },
{ "VK_KHR_shader_bfloat16", 142, 1 },
{ "VK_KHR_shader_clock", 182, 1 },
{ "VK_KHR_shader_draw_parameters", 64, 1 },
{ "VK_KHR_shader_expect_assume", 545, 1 },
{ "VK_KHR_shader_float16_int8", 83, 1 },
{ "VK_KHR_shader_float_controls", 198, 4 },
{ "VK_KHR_shader_float_controls2", 529, 1 },
{ "VK_KHR_shader_fma", 580, 1 },
{ "VK_KHR_shader_integer_dot_product", 281, 1 },
{ "VK_KHR_shader_maximal_reconvergence", 435, 1 },
{ "VK_KHR_shader_non_semantic_info", 294, 1 },
{ "VK_KHR_shader_quad_control", 236, 1 },
{ "VK_KHR_shader_relaxed_extended_instruction", 559, 1 },
{ "VK_KHR_shader_subgroup_extended_types", 176, 1 },
{ "VK_KHR_shader_subgroup_rotate", 417, 2 },
{ "VK_KHR_shader_subgroup_uniform_control_flow", 324, 1 },
{ "VK_KHR_shader_terminate_invocation", 216, 1 },
{ "VK_KHR_shader_untyped_pointers", 388, 1 },
{ "VK_KHR_spirv_1_4", 237, 1 },
{ "VK_KHR_storage_buffer_storage_class", 132, 1 },
{ "VK_KHR_synchronization2", 315, 1 },
{ "VK_KHR_timeline_semaphore", 208, 2 },
{ "VK_KHR_uniform_buffer_standard_layout", 254, 1 },
{ "VK_KHR_variable_pointers", 121, 1 },
{ "VK_KHR_vertex_attribute_divisor", 526, 1 },
{ "VK_KHR_vulkan_memory_model", 212, 3 },
{ "VK_KHR_workgroup_memory_explicit_layout", 337, 1 },
{ "VK_KHR_zero_initialize_workgroup_memory", 326, 1 },
{ "VK_MESA_venus_protocol", 385, 4 },
{ "VK_NV_compute_shader_derivatives", 202, 1 },
{ "VK_VALVE_mutable_descriptor_type", 352, 1 },
};
static inline uint32_t
vn_info_wire_format_version(void)
{
return 1;
}
static inline uint32_t
vn_info_vk_xml_version(void)
{
return VK_MAKE_API_VERSION(0, 1, 4, 343);
}
static inline int
vn_info_extension_compare(const void *name, const void *ext)
{
return strcmp(name, ((const struct vn_info_extension *)ext)->name);
}
static inline int32_t
vn_info_extension_index(const char *name)
{
const struct vn_info_extension *ext = bsearch(name, _vn_info_extensions,
_vn_info_extension_count, sizeof(*_vn_info_extensions),
vn_info_extension_compare);
return ext ? ext - _vn_info_extensions : -1;
}
static inline const struct vn_info_extension *
vn_info_extension_get(int32_t index)
{
assert(index >= 0 && (uint32_t)index < _vn_info_extension_count);
return &_vn_info_extensions[index];
}
static inline bool
vn_info_extension_mask_test(const uint32_t *mask, uint32_t ext_number)
{
return mask[ext_number / 32] & (1 << (ext_number % 32));
}
#endif /* VN_PROTOCOL_DRIVER_INFO_H */
@@ -0,0 +1,758 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_INSTANCE_H
#define VN_PROTOCOL_DRIVER_INSTANCE_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/*
* These structs/unions/commands are not included
*
* vkGetInstanceProcAddr
*/
/* struct VkApplicationInfo chain */
static inline size_t
vn_sizeof_VkApplicationInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkApplicationInfo_self(const VkApplicationInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
if (val->pApplicationName) {
const size_t string_size = strlen(val->pApplicationName) + 1;
size += vn_sizeof_array_size(string_size);
size += vn_sizeof_char_array(val->pApplicationName, string_size);
} else {
size += vn_sizeof_array_size(0);
}
size += vn_sizeof_uint32_t(&val->applicationVersion);
if (val->pEngineName) {
const size_t string_size = strlen(val->pEngineName) + 1;
size += vn_sizeof_array_size(string_size);
size += vn_sizeof_char_array(val->pEngineName, string_size);
} else {
size += vn_sizeof_array_size(0);
}
size += vn_sizeof_uint32_t(&val->engineVersion);
size += vn_sizeof_uint32_t(&val->apiVersion);
return size;
}
static inline size_t
vn_sizeof_VkApplicationInfo(const VkApplicationInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkApplicationInfo_pnext(val->pNext);
size += vn_sizeof_VkApplicationInfo_self(val);
return size;
}
static inline void
vn_encode_VkApplicationInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkApplicationInfo_self(struct vn_cs_encoder *enc, const VkApplicationInfo *val)
{
/* skip val->{sType,pNext} */
if (val->pApplicationName) {
const size_t string_size = strlen(val->pApplicationName) + 1;
vn_encode_array_size(enc, string_size);
vn_encode_char_array(enc, val->pApplicationName, string_size);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_uint32_t(enc, &val->applicationVersion);
if (val->pEngineName) {
const size_t string_size = strlen(val->pEngineName) + 1;
vn_encode_array_size(enc, string_size);
vn_encode_char_array(enc, val->pEngineName, string_size);
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_uint32_t(enc, &val->engineVersion);
vn_encode_uint32_t(enc, &val->apiVersion);
}
static inline void
vn_encode_VkApplicationInfo(struct vn_cs_encoder *enc, const VkApplicationInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_APPLICATION_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_APPLICATION_INFO });
vn_encode_VkApplicationInfo_pnext(enc, val->pNext);
vn_encode_VkApplicationInfo_self(enc, val);
}
/* struct VkInstanceCreateInfo chain */
static inline size_t
vn_sizeof_VkInstanceCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkInstanceCreateInfo_self(const VkInstanceCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_simple_pointer(val->pApplicationInfo);
if (val->pApplicationInfo)
size += vn_sizeof_VkApplicationInfo(val->pApplicationInfo);
size += vn_sizeof_uint32_t(&val->enabledLayerCount);
if (val->ppEnabledLayerNames) {
size += vn_sizeof_array_size(val->enabledLayerCount);
for (uint32_t i = 0; i < val->enabledLayerCount; i++) {
const size_t string_size = strlen(val->ppEnabledLayerNames[i]) + 1;
size += vn_sizeof_array_size(string_size);
size += vn_sizeof_char_array(val->ppEnabledLayerNames[i], string_size);
}
} else {
size += vn_sizeof_array_size(0);
}
size += vn_sizeof_uint32_t(&val->enabledExtensionCount);
if (val->ppEnabledExtensionNames) {
size += vn_sizeof_array_size(val->enabledExtensionCount);
for (uint32_t i = 0; i < val->enabledExtensionCount; i++) {
const size_t string_size = strlen(val->ppEnabledExtensionNames[i]) + 1;
size += vn_sizeof_array_size(string_size);
size += vn_sizeof_char_array(val->ppEnabledExtensionNames[i], string_size);
}
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkInstanceCreateInfo(const VkInstanceCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkInstanceCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkInstanceCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkInstanceCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkInstanceCreateInfo_self(struct vn_cs_encoder *enc, const VkInstanceCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
if (vn_encode_simple_pointer(enc, val->pApplicationInfo))
vn_encode_VkApplicationInfo(enc, val->pApplicationInfo);
vn_encode_uint32_t(enc, &val->enabledLayerCount);
if (val->ppEnabledLayerNames) {
vn_encode_array_size(enc, val->enabledLayerCount);
for (uint32_t i = 0; i < val->enabledLayerCount; i++) {
const size_t string_size = strlen(val->ppEnabledLayerNames[i]) + 1;
vn_encode_array_size(enc, string_size);
vn_encode_char_array(enc, val->ppEnabledLayerNames[i], string_size);
}
} else {
vn_encode_array_size(enc, 0);
}
vn_encode_uint32_t(enc, &val->enabledExtensionCount);
if (val->ppEnabledExtensionNames) {
vn_encode_array_size(enc, val->enabledExtensionCount);
for (uint32_t i = 0; i < val->enabledExtensionCount; i++) {
const size_t string_size = strlen(val->ppEnabledExtensionNames[i]) + 1;
vn_encode_array_size(enc, string_size);
vn_encode_char_array(enc, val->ppEnabledExtensionNames[i], string_size);
}
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkInstanceCreateInfo(struct vn_cs_encoder *enc, const VkInstanceCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO });
vn_encode_VkInstanceCreateInfo_pnext(enc, val->pNext);
vn_encode_VkInstanceCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateInstance_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkInstanceCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pInstance);
if (pInstance)
cmd_size += vn_sizeof_VkInstance(pInstance);
return cmd_size;
}
static inline void vn_encode_vkCreateInstance(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateInstance_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkInstanceCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pInstance))
vn_encode_VkInstance(enc, pInstance);
}
static inline size_t vn_sizeof_vkCreateInstance_reply(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateInstance_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pInstance);
if (pInstance)
cmd_size += vn_sizeof_VkInstance(pInstance);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateInstance_reply(struct vn_cs_decoder *dec, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateInstance_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkInstance(dec, pInstance);
} else {
pInstance = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyInstance_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkInstance(&instance);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyInstance(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkInstance instance, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyInstance_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkInstance(enc, &instance);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyInstance_reply(VkInstance instance, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyInstance_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip instance */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyInstance_reply(struct vn_cs_decoder *dec, VkInstance instance, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyInstance_EXT);
/* skip instance */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkEnumerateInstanceVersion(uint32_t* pApiVersion)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_simple_pointer(pApiVersion); /* out */
return cmd_size;
}
static inline void vn_encode_vkEnumerateInstanceVersion(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, uint32_t* pApiVersion)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_simple_pointer(enc, pApiVersion); /* out */
}
static inline size_t vn_sizeof_vkEnumerateInstanceVersion_reply(uint32_t* pApiVersion)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
cmd_size += vn_sizeof_simple_pointer(pApiVersion);
if (pApiVersion)
cmd_size += vn_sizeof_uint32_t(pApiVersion);
return cmd_size;
}
static inline VkResult vn_decode_vkEnumerateInstanceVersion_reply(struct vn_cs_decoder *dec, uint32_t* pApiVersion)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkEnumerateInstanceVersion_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
if (vn_decode_simple_pointer(dec)) {
vn_decode_uint32_t(dec, pApiVersion);
} else {
pApiVersion = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_simple_pointer(pPropertyCount);
if (pPropertyCount)
cmd_size += vn_sizeof_uint32_t(pPropertyCount);
if (pProperties) {
cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++)
cmd_size += vn_sizeof_VkLayerProperties_partial(&pProperties[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkEnumerateInstanceLayerProperties(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
if (vn_encode_simple_pointer(enc, pPropertyCount))
vn_encode_uint32_t(enc, pPropertyCount);
if (pProperties) {
vn_encode_array_size(enc, (pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++)
vn_encode_VkLayerProperties_partial(enc, &pProperties[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkEnumerateInstanceLayerProperties_reply(uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
cmd_size += vn_sizeof_simple_pointer(pPropertyCount);
if (pPropertyCount)
cmd_size += vn_sizeof_uint32_t(pPropertyCount);
if (pProperties) {
cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++)
cmd_size += vn_sizeof_VkLayerProperties(&pProperties[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkEnumerateInstanceLayerProperties_reply(struct vn_cs_decoder *dec, uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkEnumerateInstanceLayerProperties_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
if (vn_decode_simple_pointer(dec)) {
vn_decode_uint32_t(dec, pPropertyCount);
} else {
pPropertyCount = NULL;
}
if (vn_peek_array_size(dec)) {
const uint32_t iter_count = vn_decode_array_size(dec, (pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < iter_count; i++)
vn_decode_VkLayerProperties(dec, &pProperties[i]);
} else {
vn_decode_array_size_unchecked(dec);
pProperties = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkEnumerateInstanceExtensionProperties(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
if (pLayerName) {
const size_t string_size = strlen(pLayerName) + 1;
cmd_size += vn_sizeof_array_size(string_size);
cmd_size += vn_sizeof_char_array(pLayerName, string_size);
} else {
cmd_size += vn_sizeof_array_size(0);
}
cmd_size += vn_sizeof_simple_pointer(pPropertyCount);
if (pPropertyCount)
cmd_size += vn_sizeof_uint32_t(pPropertyCount);
if (pProperties) {
cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++)
cmd_size += vn_sizeof_VkExtensionProperties_partial(&pProperties[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkEnumerateInstanceExtensionProperties(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
if (pLayerName) {
const size_t string_size = strlen(pLayerName) + 1;
vn_encode_array_size(enc, string_size);
vn_encode_char_array(enc, pLayerName, string_size);
} else {
vn_encode_array_size(enc, 0);
}
if (vn_encode_simple_pointer(enc, pPropertyCount))
vn_encode_uint32_t(enc, pPropertyCount);
if (pProperties) {
vn_encode_array_size(enc, (pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++)
vn_encode_VkExtensionProperties_partial(enc, &pProperties[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkEnumerateInstanceExtensionProperties_reply(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip pLayerName */
cmd_size += vn_sizeof_simple_pointer(pPropertyCount);
if (pPropertyCount)
cmd_size += vn_sizeof_uint32_t(pPropertyCount);
if (pProperties) {
cmd_size += vn_sizeof_array_size((pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < (pPropertyCount ? *pPropertyCount : 0); i++)
cmd_size += vn_sizeof_VkExtensionProperties(&pProperties[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkEnumerateInstanceExtensionProperties_reply(struct vn_cs_decoder *dec, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkEnumerateInstanceExtensionProperties_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip pLayerName */
if (vn_decode_simple_pointer(dec)) {
vn_decode_uint32_t(dec, pPropertyCount);
} else {
pPropertyCount = NULL;
}
if (vn_peek_array_size(dec)) {
const uint32_t iter_count = vn_decode_array_size(dec, (pPropertyCount ? *pPropertyCount : 0));
for (uint32_t i = 0; i < iter_count; i++)
vn_decode_VkExtensionProperties(dec, &pProperties[i]);
} else {
vn_decode_array_size_unchecked(dec);
pProperties = NULL;
}
return ret;
}
static inline void vn_submit_vkCreateInstance(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateInstance(pCreateInfo, pAllocator, pInstance);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateInstance_reply(pCreateInfo, pAllocator, pInstance) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateInstance(enc, cmd_flags, pCreateInfo, pAllocator, pInstance);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyInstance(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkInstance instance, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyInstance(instance, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyInstance_reply(instance, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyInstance(enc, cmd_flags, instance, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkEnumerateInstanceVersion(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, uint32_t* pApiVersion, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkEnumerateInstanceVersion(pApiVersion);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkEnumerateInstanceVersion_reply(pApiVersion) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkEnumerateInstanceVersion(enc, cmd_flags, pApiVersion);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkEnumerateInstanceLayerProperties(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, uint32_t* pPropertyCount, VkLayerProperties* pProperties, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkEnumerateInstanceLayerProperties(pPropertyCount, pProperties);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkEnumerateInstanceLayerProperties_reply(pPropertyCount, pProperties) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkEnumerateInstanceLayerProperties(enc, cmd_flags, pPropertyCount, pProperties);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkEnumerateInstanceExtensionProperties(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkEnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkEnumerateInstanceExtensionProperties_reply(pLayerName, pPropertyCount, pProperties) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkEnumerateInstanceExtensionProperties(enc, cmd_flags, pLayerName, pPropertyCount, pProperties);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateInstance(struct vn_ring *vn_ring, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateInstance(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pCreateInfo, pAllocator, pInstance, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateInstance_reply(dec, pCreateInfo, pAllocator, pInstance);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateInstance(struct vn_ring *vn_ring, const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateInstance(vn_ring, 0, pCreateInfo, pAllocator, pInstance, &submit);
}
static inline void vn_async_vkDestroyInstance(struct vn_ring *vn_ring, VkInstance instance, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyInstance(vn_ring, 0, instance, pAllocator, &submit);
}
static inline VkResult vn_call_vkEnumerateInstanceVersion(struct vn_ring *vn_ring, uint32_t* pApiVersion)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkEnumerateInstanceVersion(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pApiVersion, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkEnumerateInstanceVersion_reply(dec, pApiVersion);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkEnumerateInstanceVersion(struct vn_ring *vn_ring, uint32_t* pApiVersion)
{
struct vn_ring_submit_command submit;
vn_submit_vkEnumerateInstanceVersion(vn_ring, 0, pApiVersion, &submit);
}
static inline VkResult vn_call_vkEnumerateInstanceLayerProperties(struct vn_ring *vn_ring, uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkEnumerateInstanceLayerProperties(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pPropertyCount, pProperties, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkEnumerateInstanceLayerProperties_reply(dec, pPropertyCount, pProperties);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkEnumerateInstanceLayerProperties(struct vn_ring *vn_ring, uint32_t* pPropertyCount, VkLayerProperties* pProperties)
{
struct vn_ring_submit_command submit;
vn_submit_vkEnumerateInstanceLayerProperties(vn_ring, 0, pPropertyCount, pProperties, &submit);
}
static inline VkResult vn_call_vkEnumerateInstanceExtensionProperties(struct vn_ring *vn_ring, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkEnumerateInstanceExtensionProperties(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, pLayerName, pPropertyCount, pProperties, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkEnumerateInstanceExtensionProperties_reply(dec, pLayerName, pPropertyCount, pProperties);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkEnumerateInstanceExtensionProperties(struct vn_ring *vn_ring, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties)
{
struct vn_ring_submit_command submit;
vn_submit_vkEnumerateInstanceExtensionProperties(vn_ring, 0, pLayerName, pPropertyCount, pProperties, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_INSTANCE_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,509 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H
#define VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkPipelineCacheCreateInfo chain */
static inline size_t
vn_sizeof_VkPipelineCacheCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkPipelineCacheCreateInfo_self(const VkPipelineCacheCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_size_t(&val->initialDataSize);
if (val->pInitialData) {
size += vn_sizeof_array_size(val->initialDataSize);
size += vn_sizeof_blob_array(val->pInitialData, val->initialDataSize);
} else {
size += vn_sizeof_array_size(0);
}
return size;
}
static inline size_t
vn_sizeof_VkPipelineCacheCreateInfo(const VkPipelineCacheCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkPipelineCacheCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkPipelineCacheCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkPipelineCacheCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkPipelineCacheCreateInfo_self(struct vn_cs_encoder *enc, const VkPipelineCacheCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_size_t(enc, &val->initialDataSize);
if (val->pInitialData) {
vn_encode_array_size(enc, val->initialDataSize);
vn_encode_blob_array(enc, val->pInitialData, val->initialDataSize);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline void
vn_encode_VkPipelineCacheCreateInfo(struct vn_cs_encoder *enc, const VkPipelineCacheCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO });
vn_encode_VkPipelineCacheCreateInfo_pnext(enc, val->pNext);
vn_encode_VkPipelineCacheCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineCache_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkPipelineCacheCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pPipelineCache);
if (pPipelineCache)
cmd_size += vn_sizeof_VkPipelineCache(pPipelineCache);
return cmd_size;
}
static inline void vn_encode_vkCreatePipelineCache(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineCache_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkPipelineCacheCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pPipelineCache))
vn_encode_VkPipelineCache(enc, pPipelineCache);
}
static inline size_t vn_sizeof_vkCreatePipelineCache_reply(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineCache_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pPipelineCache);
if (pPipelineCache)
cmd_size += vn_sizeof_VkPipelineCache(pPipelineCache);
return cmd_size;
}
static inline VkResult vn_decode_vkCreatePipelineCache_reply(struct vn_cs_decoder *dec, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreatePipelineCache_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkPipelineCache(dec, pPipelineCache);
} else {
pPipelineCache = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkPipelineCache(&pipelineCache);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyPipelineCache(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkPipelineCache(enc, &pipelineCache);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyPipelineCache_reply(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip pipelineCache */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyPipelineCache_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyPipelineCache_EXT);
/* skip device */
/* skip pipelineCache */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkPipelineCache(&pipelineCache);
cmd_size += vn_sizeof_simple_pointer(pDataSize);
if (pDataSize)
cmd_size += vn_sizeof_size_t(pDataSize);
cmd_size += vn_sizeof_simple_pointer(pData); /* out */
return cmd_size;
}
static inline void vn_encode_vkGetPipelineCacheData(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkPipelineCache(enc, &pipelineCache);
if (vn_encode_simple_pointer(enc, pDataSize))
vn_encode_size_t(enc, pDataSize);
vn_encode_array_size(enc, pData ? (pDataSize ? *pDataSize : 0) : 0); /* out */
}
static inline size_t vn_sizeof_vkGetPipelineCacheData_reply(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pipelineCache */
cmd_size += vn_sizeof_simple_pointer(pDataSize);
if (pDataSize)
cmd_size += vn_sizeof_size_t(pDataSize);
if (pData) {
cmd_size += vn_sizeof_array_size((pDataSize ? *pDataSize : 0));
cmd_size += vn_sizeof_blob_array(pData, (pDataSize ? *pDataSize : 0));
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline VkResult vn_decode_vkGetPipelineCacheData_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetPipelineCacheData_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pipelineCache */
if (vn_decode_simple_pointer(dec)) {
vn_decode_size_t(dec, pDataSize);
} else {
pDataSize = NULL;
}
if (vn_peek_array_size(dec)) {
const size_t array_size = vn_decode_array_size(dec, (pDataSize ? *pDataSize : 0));
vn_decode_blob_array(dec, pData, array_size);
} else {
vn_decode_array_size_unchecked(dec);
pData = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkMergePipelineCaches_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkPipelineCache(&dstCache);
cmd_size += vn_sizeof_uint32_t(&srcCacheCount);
if (pSrcCaches) {
cmd_size += vn_sizeof_array_size(srcCacheCount);
for (uint32_t i = 0; i < srcCacheCount; i++)
cmd_size += vn_sizeof_VkPipelineCache(&pSrcCaches[i]);
} else {
cmd_size += vn_sizeof_array_size(0);
}
return cmd_size;
}
static inline void vn_encode_vkMergePipelineCaches(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkMergePipelineCaches_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkPipelineCache(enc, &dstCache);
vn_encode_uint32_t(enc, &srcCacheCount);
if (pSrcCaches) {
vn_encode_array_size(enc, srcCacheCount);
for (uint32_t i = 0; i < srcCacheCount; i++)
vn_encode_VkPipelineCache(enc, &pSrcCaches[i]);
} else {
vn_encode_array_size(enc, 0);
}
}
static inline size_t vn_sizeof_vkMergePipelineCaches_reply(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkMergePipelineCaches_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip dstCache */
/* skip srcCacheCount */
/* skip pSrcCaches */
return cmd_size;
}
static inline VkResult vn_decode_vkMergePipelineCaches_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkMergePipelineCaches_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip dstCache */
/* skip srcCacheCount */
/* skip pSrcCaches */
return ret;
}
static inline void vn_submit_vkCreatePipelineCache(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreatePipelineCache_reply(device, pCreateInfo, pAllocator, pPipelineCache) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreatePipelineCache(enc, cmd_flags, device, pCreateInfo, pAllocator, pPipelineCache);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyPipelineCache(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyPipelineCache(device, pipelineCache, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyPipelineCache_reply(device, pipelineCache, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyPipelineCache(enc, cmd_flags, device, pipelineCache, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetPipelineCacheData(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetPipelineCacheData(device, pipelineCache, pDataSize, pData);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetPipelineCacheData_reply(device, pipelineCache, pDataSize, pData) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetPipelineCacheData(enc, cmd_flags, device, pipelineCache, pDataSize, pData);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkMergePipelineCaches(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkMergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkMergePipelineCaches_reply(device, dstCache, srcCacheCount, pSrcCaches) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkMergePipelineCaches(enc, cmd_flags, device, dstCache, srcCacheCount, pSrcCaches);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreatePipelineCache(struct vn_ring *vn_ring, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreatePipelineCache(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pPipelineCache, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreatePipelineCache_reply(dec, device, pCreateInfo, pAllocator, pPipelineCache);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreatePipelineCache(struct vn_ring *vn_ring, VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreatePipelineCache(vn_ring, 0, device, pCreateInfo, pAllocator, pPipelineCache, &submit);
}
static inline void vn_async_vkDestroyPipelineCache(struct vn_ring *vn_ring, VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyPipelineCache(vn_ring, 0, device, pipelineCache, pAllocator, &submit);
}
static inline VkResult vn_call_vkGetPipelineCacheData(struct vn_ring *vn_ring, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetPipelineCacheData(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pipelineCache, pDataSize, pData, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkGetPipelineCacheData_reply(dec, device, pipelineCache, pDataSize, pData);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkGetPipelineCacheData(struct vn_ring *vn_ring, VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetPipelineCacheData(vn_ring, 0, device, pipelineCache, pDataSize, pData, &submit);
}
static inline VkResult vn_call_vkMergePipelineCaches(struct vn_ring *vn_ring, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkMergePipelineCaches(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, dstCache, srcCacheCount, pSrcCaches, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkMergePipelineCaches_reply(dec, device, dstCache, srcCacheCount, pSrcCaches);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkMergePipelineCaches(struct vn_ring *vn_ring, VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches)
{
struct vn_ring_submit_command submit;
vn_submit_vkMergePipelineCaches(vn_ring, 0, device, dstCache, srcCacheCount, pSrcCaches, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_PIPELINE_CACHE_H */
@@ -0,0 +1,208 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_PIPELINE_LAYOUT_H
#define VN_PROTOCOL_DRIVER_PIPELINE_LAYOUT_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
static inline size_t vn_sizeof_vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineLayout_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkPipelineLayoutCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pPipelineLayout);
if (pPipelineLayout)
cmd_size += vn_sizeof_VkPipelineLayout(pPipelineLayout);
return cmd_size;
}
static inline void vn_encode_vkCreatePipelineLayout(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineLayout_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkPipelineLayoutCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pPipelineLayout))
vn_encode_VkPipelineLayout(enc, pPipelineLayout);
}
static inline size_t vn_sizeof_vkCreatePipelineLayout_reply(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePipelineLayout_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pPipelineLayout);
if (pPipelineLayout)
cmd_size += vn_sizeof_VkPipelineLayout(pPipelineLayout);
return cmd_size;
}
static inline VkResult vn_decode_vkCreatePipelineLayout_reply(struct vn_cs_decoder *dec, VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreatePipelineLayout_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkPipelineLayout(dec, pPipelineLayout);
} else {
pPipelineLayout = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineLayout_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkPipelineLayout(&pipelineLayout);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyPipelineLayout(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineLayout_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkPipelineLayout(enc, &pipelineLayout);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyPipelineLayout_reply(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPipelineLayout_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip pipelineLayout */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyPipelineLayout_reply(struct vn_cs_decoder *dec, VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyPipelineLayout_EXT);
/* skip device */
/* skip pipelineLayout */
/* skip pAllocator */
}
static inline void vn_submit_vkCreatePipelineLayout(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreatePipelineLayout_reply(device, pCreateInfo, pAllocator, pPipelineLayout) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreatePipelineLayout(enc, cmd_flags, device, pCreateInfo, pAllocator, pPipelineLayout);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyPipelineLayout(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyPipelineLayout(device, pipelineLayout, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyPipelineLayout_reply(device, pipelineLayout, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyPipelineLayout(enc, cmd_flags, device, pipelineLayout, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreatePipelineLayout(struct vn_ring *vn_ring, VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreatePipelineLayout(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pPipelineLayout, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreatePipelineLayout_reply(dec, device, pCreateInfo, pAllocator, pPipelineLayout);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreatePipelineLayout(struct vn_ring *vn_ring, VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreatePipelineLayout(vn_ring, 0, device, pCreateInfo, pAllocator, pPipelineLayout, &submit);
}
static inline void vn_async_vkDestroyPipelineLayout(struct vn_ring *vn_ring, VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyPipelineLayout(vn_ring, 0, device, pipelineLayout, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_PIPELINE_LAYOUT_H */
@@ -0,0 +1,468 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_PRIVATE_DATA_SLOT_H
#define VN_PROTOCOL_DRIVER_PRIVATE_DATA_SLOT_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkPrivateDataSlotCreateInfo chain */
static inline size_t
vn_sizeof_VkPrivateDataSlotCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkPrivateDataSlotCreateInfo_self(const VkPrivateDataSlotCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
return size;
}
static inline size_t
vn_sizeof_VkPrivateDataSlotCreateInfo(const VkPrivateDataSlotCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkPrivateDataSlotCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkPrivateDataSlotCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkPrivateDataSlotCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkPrivateDataSlotCreateInfo_self(struct vn_cs_encoder *enc, const VkPrivateDataSlotCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
}
static inline void
vn_encode_VkPrivateDataSlotCreateInfo(struct vn_cs_encoder *enc, const VkPrivateDataSlotCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO });
vn_encode_VkPrivateDataSlotCreateInfo_pnext(enc, val->pNext);
vn_encode_VkPrivateDataSlotCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreatePrivateDataSlot(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePrivateDataSlot_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkPrivateDataSlotCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pPrivateDataSlot);
if (pPrivateDataSlot)
cmd_size += vn_sizeof_VkPrivateDataSlot(pPrivateDataSlot);
return cmd_size;
}
static inline void vn_encode_vkCreatePrivateDataSlot(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePrivateDataSlot_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkPrivateDataSlotCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pPrivateDataSlot))
vn_encode_VkPrivateDataSlot(enc, pPrivateDataSlot);
}
static inline size_t vn_sizeof_vkCreatePrivateDataSlot_reply(VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreatePrivateDataSlot_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pPrivateDataSlot);
if (pPrivateDataSlot)
cmd_size += vn_sizeof_VkPrivateDataSlot(pPrivateDataSlot);
return cmd_size;
}
static inline VkResult vn_decode_vkCreatePrivateDataSlot_reply(struct vn_cs_decoder *dec, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreatePrivateDataSlot_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkPrivateDataSlot(dec, pPrivateDataSlot);
} else {
pPrivateDataSlot = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkPrivateDataSlot(&privateDataSlot);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyPrivateDataSlot(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkPrivateDataSlot(enc, &privateDataSlot);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyPrivateDataSlot_reply(VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip privateDataSlot */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyPrivateDataSlot_reply(struct vn_cs_decoder *dec, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyPrivateDataSlot_EXT);
/* skip device */
/* skip privateDataSlot */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetPrivateData_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkObjectType(&objectType);
cmd_size += vn_sizeof_uint64_t(&objectHandle);
cmd_size += vn_sizeof_VkPrivateDataSlot(&privateDataSlot);
cmd_size += vn_sizeof_uint64_t(&data);
return cmd_size;
}
static inline void vn_encode_vkSetPrivateData(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetPrivateData_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkObjectType(enc, &objectType);
vn_encode_uint64_t(enc, &objectHandle);
vn_encode_VkPrivateDataSlot(enc, &privateDataSlot);
vn_encode_uint64_t(enc, &data);
}
static inline size_t vn_sizeof_vkSetPrivateData_reply(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkSetPrivateData_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip objectType */
/* skip objectHandle */
/* skip privateDataSlot */
/* skip data */
return cmd_size;
}
static inline VkResult vn_decode_vkSetPrivateData_reply(struct vn_cs_decoder *dec, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkSetPrivateData_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip objectType */
/* skip objectHandle */
/* skip privateDataSlot */
/* skip data */
return ret;
}
static inline size_t vn_sizeof_vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPrivateData_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkObjectType(&objectType);
cmd_size += vn_sizeof_uint64_t(&objectHandle);
cmd_size += vn_sizeof_VkPrivateDataSlot(&privateDataSlot);
cmd_size += vn_sizeof_simple_pointer(pData); /* out */
return cmd_size;
}
static inline void vn_encode_vkGetPrivateData(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPrivateData_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkObjectType(enc, &objectType);
vn_encode_uint64_t(enc, &objectHandle);
vn_encode_VkPrivateDataSlot(enc, &privateDataSlot);
vn_encode_simple_pointer(enc, pData); /* out */
}
static inline size_t vn_sizeof_vkGetPrivateData_reply(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetPrivateData_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip objectType */
/* skip objectHandle */
/* skip privateDataSlot */
cmd_size += vn_sizeof_simple_pointer(pData);
if (pData)
cmd_size += vn_sizeof_uint64_t(pData);
return cmd_size;
}
static inline void vn_decode_vkGetPrivateData_reply(struct vn_cs_decoder *dec, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetPrivateData_EXT);
/* skip device */
/* skip objectType */
/* skip objectHandle */
/* skip privateDataSlot */
if (vn_decode_simple_pointer(dec)) {
vn_decode_uint64_t(dec, pData);
} else {
pData = NULL;
}
}
static inline void vn_submit_vkCreatePrivateDataSlot(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreatePrivateDataSlot(device, pCreateInfo, pAllocator, pPrivateDataSlot);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreatePrivateDataSlot_reply(device, pCreateInfo, pAllocator, pPrivateDataSlot) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreatePrivateDataSlot(enc, cmd_flags, device, pCreateInfo, pAllocator, pPrivateDataSlot);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyPrivateDataSlot(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyPrivateDataSlot(device, privateDataSlot, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyPrivateDataSlot_reply(device, privateDataSlot, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyPrivateDataSlot(enc, cmd_flags, device, privateDataSlot, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkSetPrivateData(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkSetPrivateData(device, objectType, objectHandle, privateDataSlot, data);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkSetPrivateData_reply(device, objectType, objectHandle, privateDataSlot, data) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkSetPrivateData(enc, cmd_flags, device, objectType, objectHandle, privateDataSlot, data);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetPrivateData(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetPrivateData(device, objectType, objectHandle, privateDataSlot, pData);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetPrivateData_reply(device, objectType, objectHandle, privateDataSlot, pData) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetPrivateData(enc, cmd_flags, device, objectType, objectHandle, privateDataSlot, pData);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreatePrivateDataSlot(struct vn_ring *vn_ring, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreatePrivateDataSlot(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pPrivateDataSlot, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreatePrivateDataSlot_reply(dec, device, pCreateInfo, pAllocator, pPrivateDataSlot);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreatePrivateDataSlot(struct vn_ring *vn_ring, VkDevice device, const VkPrivateDataSlotCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlot* pPrivateDataSlot)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreatePrivateDataSlot(vn_ring, 0, device, pCreateInfo, pAllocator, pPrivateDataSlot, &submit);
}
static inline void vn_async_vkDestroyPrivateDataSlot(struct vn_ring *vn_ring, VkDevice device, VkPrivateDataSlot privateDataSlot, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyPrivateDataSlot(vn_ring, 0, device, privateDataSlot, pAllocator, &submit);
}
static inline VkResult vn_call_vkSetPrivateData(struct vn_ring *vn_ring, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkSetPrivateData(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, objectType, objectHandle, privateDataSlot, data, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkSetPrivateData_reply(dec, device, objectType, objectHandle, privateDataSlot, data);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkSetPrivateData(struct vn_ring *vn_ring, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t data)
{
struct vn_ring_submit_command submit;
vn_submit_vkSetPrivateData(vn_ring, 0, device, objectType, objectHandle, privateDataSlot, data, &submit);
}
static inline void vn_call_vkGetPrivateData(struct vn_ring *vn_ring, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetPrivateData(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, objectType, objectHandle, privateDataSlot, pData, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
vn_decode_vkGetPrivateData_reply(dec, device, objectType, objectHandle, privateDataSlot, pData);
vn_ring_free_command_reply(vn_ring, &submit);
}
}
static inline void vn_async_vkGetPrivateData(struct vn_ring *vn_ring, VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlot privateDataSlot, uint64_t* pData)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetPrivateData(vn_ring, 0, device, objectType, objectHandle, privateDataSlot, pData, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_PRIVATE_DATA_SLOT_H */
@@ -0,0 +1,474 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_QUERY_POOL_H
#define VN_PROTOCOL_DRIVER_QUERY_POOL_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkQueryPoolCreateInfo chain */
static inline size_t
vn_sizeof_VkQueryPoolCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkQueryPoolCreateInfo_self(const VkQueryPoolCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFlags(&val->flags);
size += vn_sizeof_VkQueryType(&val->queryType);
size += vn_sizeof_uint32_t(&val->queryCount);
size += vn_sizeof_VkFlags(&val->pipelineStatistics);
return size;
}
static inline size_t
vn_sizeof_VkQueryPoolCreateInfo(const VkQueryPoolCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkQueryPoolCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkQueryPoolCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkQueryPoolCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkQueryPoolCreateInfo_self(struct vn_cs_encoder *enc, const VkQueryPoolCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFlags(enc, &val->flags);
vn_encode_VkQueryType(enc, &val->queryType);
vn_encode_uint32_t(enc, &val->queryCount);
vn_encode_VkFlags(enc, &val->pipelineStatistics);
}
static inline void
vn_encode_VkQueryPoolCreateInfo(struct vn_cs_encoder *enc, const VkQueryPoolCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO });
vn_encode_VkQueryPoolCreateInfo_pnext(enc, val->pNext);
vn_encode_VkQueryPoolCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateQueryPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkQueryPoolCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pQueryPool);
if (pQueryPool)
cmd_size += vn_sizeof_VkQueryPool(pQueryPool);
return cmd_size;
}
static inline void vn_encode_vkCreateQueryPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateQueryPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkQueryPoolCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pQueryPool))
vn_encode_VkQueryPool(enc, pQueryPool);
}
static inline size_t vn_sizeof_vkCreateQueryPool_reply(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateQueryPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pQueryPool);
if (pQueryPool)
cmd_size += vn_sizeof_VkQueryPool(pQueryPool);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateQueryPool_reply(struct vn_cs_decoder *dec, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateQueryPool_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkQueryPool(dec, pQueryPool);
} else {
pQueryPool = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyQueryPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkQueryPool(&queryPool);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyQueryPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyQueryPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkQueryPool(enc, &queryPool);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyQueryPool_reply(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyQueryPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip queryPool */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyQueryPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyQueryPool_EXT);
/* skip device */
/* skip queryPool */
/* skip pAllocator */
}
static inline size_t vn_sizeof_vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkQueryPool(&queryPool);
cmd_size += vn_sizeof_uint32_t(&firstQuery);
cmd_size += vn_sizeof_uint32_t(&queryCount);
cmd_size += vn_sizeof_size_t(&dataSize);
cmd_size += vn_sizeof_simple_pointer(pData); /* out */
cmd_size += vn_sizeof_VkDeviceSize(&stride);
cmd_size += vn_sizeof_VkFlags(&flags);
return cmd_size;
}
static inline void vn_encode_vkGetQueryPoolResults(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkQueryPool(enc, &queryPool);
vn_encode_uint32_t(enc, &firstQuery);
vn_encode_uint32_t(enc, &queryCount);
vn_encode_size_t(enc, &dataSize);
vn_encode_array_size(enc, pData ? dataSize : 0); /* out */
vn_encode_VkDeviceSize(enc, &stride);
vn_encode_VkFlags(enc, &flags);
}
static inline size_t vn_sizeof_vkGetQueryPoolResults_reply(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip queryPool */
/* skip firstQuery */
/* skip queryCount */
/* skip dataSize */
if (pData) {
cmd_size += vn_sizeof_array_size(dataSize);
cmd_size += vn_sizeof_blob_array(pData, dataSize);
} else {
cmd_size += vn_sizeof_array_size(0);
}
/* skip stride */
/* skip flags */
return cmd_size;
}
static inline VkResult vn_decode_vkGetQueryPoolResults_reply(struct vn_cs_decoder *dec, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkGetQueryPoolResults_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip queryPool */
/* skip firstQuery */
/* skip queryCount */
/* skip dataSize */
if (vn_peek_array_size(dec)) {
const size_t array_size = vn_decode_array_size(dec, dataSize);
vn_decode_blob_array(dec, pData, array_size);
} else {
vn_decode_array_size_unchecked(dec);
pData = NULL;
}
/* skip stride */
/* skip flags */
return ret;
}
static inline size_t vn_sizeof_vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetQueryPool_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkQueryPool(&queryPool);
cmd_size += vn_sizeof_uint32_t(&firstQuery);
cmd_size += vn_sizeof_uint32_t(&queryCount);
return cmd_size;
}
static inline void vn_encode_vkResetQueryPool(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetQueryPool_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkQueryPool(enc, &queryPool);
vn_encode_uint32_t(enc, &firstQuery);
vn_encode_uint32_t(enc, &queryCount);
}
static inline size_t vn_sizeof_vkResetQueryPool_reply(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkResetQueryPool_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip queryPool */
/* skip firstQuery */
/* skip queryCount */
return cmd_size;
}
static inline void vn_decode_vkResetQueryPool_reply(struct vn_cs_decoder *dec, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkResetQueryPool_EXT);
/* skip device */
/* skip queryPool */
/* skip firstQuery */
/* skip queryCount */
}
static inline void vn_submit_vkCreateQueryPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateQueryPool_reply(device, pCreateInfo, pAllocator, pQueryPool) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateQueryPool(enc, cmd_flags, device, pCreateInfo, pAllocator, pQueryPool);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyQueryPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyQueryPool(device, queryPool, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyQueryPool_reply(device, queryPool, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyQueryPool(enc, cmd_flags, device, queryPool, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkGetQueryPoolResults(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkGetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkGetQueryPoolResults_reply(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkGetQueryPoolResults(enc, cmd_flags, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkResetQueryPool(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkResetQueryPool(device, queryPool, firstQuery, queryCount);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkResetQueryPool_reply(device, queryPool, firstQuery, queryCount) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkResetQueryPool(enc, cmd_flags, device, queryPool, firstQuery, queryCount);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateQueryPool(struct vn_ring *vn_ring, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateQueryPool(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pQueryPool, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateQueryPool_reply(dec, device, pCreateInfo, pAllocator, pQueryPool);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateQueryPool(struct vn_ring *vn_ring, VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateQueryPool(vn_ring, 0, device, pCreateInfo, pAllocator, pQueryPool, &submit);
}
static inline void vn_async_vkDestroyQueryPool(struct vn_ring *vn_ring, VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyQueryPool(vn_ring, 0, device, queryPool, pAllocator, &submit);
}
static inline VkResult vn_call_vkGetQueryPoolResults(struct vn_ring *vn_ring, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkGetQueryPoolResults(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkGetQueryPoolResults_reply(dec, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkGetQueryPoolResults(struct vn_ring *vn_ring, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{
struct vn_ring_submit_command submit;
vn_submit_vkGetQueryPoolResults(vn_ring, 0, device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags, &submit);
}
static inline void vn_async_vkResetQueryPool(struct vn_ring *vn_ring, VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount)
{
struct vn_ring_submit_command submit;
vn_submit_vkResetQueryPool(vn_ring, 0, device, queryPool, firstQuery, queryCount, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_QUERY_POOL_H */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,208 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_SAMPLER_H
#define VN_PROTOCOL_DRIVER_SAMPLER_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
static inline size_t vn_sizeof_vkCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSampler_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkSamplerCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pSampler);
if (pSampler)
cmd_size += vn_sizeof_VkSampler(pSampler);
return cmd_size;
}
static inline void vn_encode_vkCreateSampler(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSampler_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkSamplerCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pSampler))
vn_encode_VkSampler(enc, pSampler);
}
static inline size_t vn_sizeof_vkCreateSampler_reply(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSampler_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pSampler);
if (pSampler)
cmd_size += vn_sizeof_VkSampler(pSampler);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateSampler_reply(struct vn_cs_decoder *dec, VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateSampler_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkSampler(dec, pSampler);
} else {
pSampler = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySampler_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkSampler(&sampler);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroySampler(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySampler_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkSampler(enc, &sampler);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroySampler_reply(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySampler_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip sampler */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroySampler_reply(struct vn_cs_decoder *dec, VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroySampler_EXT);
/* skip device */
/* skip sampler */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateSampler(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateSampler(device, pCreateInfo, pAllocator, pSampler);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateSampler_reply(device, pCreateInfo, pAllocator, pSampler) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateSampler(enc, cmd_flags, device, pCreateInfo, pAllocator, pSampler);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroySampler(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroySampler(device, sampler, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroySampler_reply(device, sampler, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroySampler(enc, cmd_flags, device, sampler, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateSampler(struct vn_ring *vn_ring, VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateSampler(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pSampler, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateSampler_reply(dec, device, pCreateInfo, pAllocator, pSampler);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateSampler(struct vn_ring *vn_ring, VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateSampler(vn_ring, 0, device, pCreateInfo, pAllocator, pSampler, &submit);
}
static inline void vn_async_vkDestroySampler(struct vn_ring *vn_ring, VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroySampler(vn_ring, 0, device, sampler, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_SAMPLER_H */
@@ -0,0 +1,275 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H
#define VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
/* struct VkSamplerYcbcrConversionCreateInfo chain */
static inline size_t
vn_sizeof_VkSamplerYcbcrConversionCreateInfo_pnext(const void *val)
{
/* no known/supported struct */
return vn_sizeof_simple_pointer(NULL);
}
static inline size_t
vn_sizeof_VkSamplerYcbcrConversionCreateInfo_self(const VkSamplerYcbcrConversionCreateInfo *val)
{
size_t size = 0;
/* skip val->{sType,pNext} */
size += vn_sizeof_VkFormat(&val->format);
size += vn_sizeof_VkSamplerYcbcrModelConversion(&val->ycbcrModel);
size += vn_sizeof_VkSamplerYcbcrRange(&val->ycbcrRange);
size += vn_sizeof_VkComponentMapping(&val->components);
size += vn_sizeof_VkChromaLocation(&val->xChromaOffset);
size += vn_sizeof_VkChromaLocation(&val->yChromaOffset);
size += vn_sizeof_VkFilter(&val->chromaFilter);
size += vn_sizeof_VkBool32(&val->forceExplicitReconstruction);
return size;
}
static inline size_t
vn_sizeof_VkSamplerYcbcrConversionCreateInfo(const VkSamplerYcbcrConversionCreateInfo *val)
{
size_t size = 0;
size += vn_sizeof_VkStructureType(&val->sType);
size += vn_sizeof_VkSamplerYcbcrConversionCreateInfo_pnext(val->pNext);
size += vn_sizeof_VkSamplerYcbcrConversionCreateInfo_self(val);
return size;
}
static inline void
vn_encode_VkSamplerYcbcrConversionCreateInfo_pnext(struct vn_cs_encoder *enc, const void *val)
{
/* no known/supported struct */
vn_encode_simple_pointer(enc, NULL);
}
static inline void
vn_encode_VkSamplerYcbcrConversionCreateInfo_self(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversionCreateInfo *val)
{
/* skip val->{sType,pNext} */
vn_encode_VkFormat(enc, &val->format);
vn_encode_VkSamplerYcbcrModelConversion(enc, &val->ycbcrModel);
vn_encode_VkSamplerYcbcrRange(enc, &val->ycbcrRange);
vn_encode_VkComponentMapping(enc, &val->components);
vn_encode_VkChromaLocation(enc, &val->xChromaOffset);
vn_encode_VkChromaLocation(enc, &val->yChromaOffset);
vn_encode_VkFilter(enc, &val->chromaFilter);
vn_encode_VkBool32(enc, &val->forceExplicitReconstruction);
}
static inline void
vn_encode_VkSamplerYcbcrConversionCreateInfo(struct vn_cs_encoder *enc, const VkSamplerYcbcrConversionCreateInfo *val)
{
assert(val->sType == VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO);
vn_encode_VkStructureType(enc, &(VkStructureType){ VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO });
vn_encode_VkSamplerYcbcrConversionCreateInfo_pnext(enc, val->pNext);
vn_encode_VkSamplerYcbcrConversionCreateInfo_self(enc, val);
}
static inline size_t vn_sizeof_vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkSamplerYcbcrConversionCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pYcbcrConversion);
if (pYcbcrConversion)
cmd_size += vn_sizeof_VkSamplerYcbcrConversion(pYcbcrConversion);
return cmd_size;
}
static inline void vn_encode_vkCreateSamplerYcbcrConversion(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkSamplerYcbcrConversionCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pYcbcrConversion))
vn_encode_VkSamplerYcbcrConversion(enc, pYcbcrConversion);
}
static inline size_t vn_sizeof_vkCreateSamplerYcbcrConversion_reply(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pYcbcrConversion);
if (pYcbcrConversion)
cmd_size += vn_sizeof_VkSamplerYcbcrConversion(pYcbcrConversion);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateSamplerYcbcrConversion_reply(struct vn_cs_decoder *dec, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateSamplerYcbcrConversion_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkSamplerYcbcrConversion(dec, pYcbcrConversion);
} else {
pYcbcrConversion = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkSamplerYcbcrConversion(&ycbcrConversion);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroySamplerYcbcrConversion(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkSamplerYcbcrConversion(enc, &ycbcrConversion);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroySamplerYcbcrConversion_reply(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip ycbcrConversion */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroySamplerYcbcrConversion_reply(struct vn_cs_decoder *dec, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroySamplerYcbcrConversion_EXT);
/* skip device */
/* skip ycbcrConversion */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateSamplerYcbcrConversion(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateSamplerYcbcrConversion_reply(device, pCreateInfo, pAllocator, pYcbcrConversion) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateSamplerYcbcrConversion(enc, cmd_flags, device, pCreateInfo, pAllocator, pYcbcrConversion);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroySamplerYcbcrConversion(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroySamplerYcbcrConversion_reply(device, ycbcrConversion, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroySamplerYcbcrConversion(enc, cmd_flags, device, ycbcrConversion, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateSamplerYcbcrConversion(struct vn_ring *vn_ring, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateSamplerYcbcrConversion(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pYcbcrConversion, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateSamplerYcbcrConversion_reply(dec, device, pCreateInfo, pAllocator, pYcbcrConversion);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateSamplerYcbcrConversion(struct vn_ring *vn_ring, VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateSamplerYcbcrConversion(vn_ring, 0, device, pCreateInfo, pAllocator, pYcbcrConversion, &submit);
}
static inline void vn_async_vkDestroySamplerYcbcrConversion(struct vn_ring *vn_ring, VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroySamplerYcbcrConversion(vn_ring, 0, device, ycbcrConversion, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_SAMPLER_YCBCR_CONVERSION_H */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,208 @@
/* This file is generated by venus-protocol. See vn_protocol_driver.h. */
/*
* Copyright 2020 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_PROTOCOL_DRIVER_SHADER_MODULE_H
#define VN_PROTOCOL_DRIVER_SHADER_MODULE_H
#include "vn_ring.h"
#include "vn_protocol_driver_structs.h"
static inline size_t vn_sizeof_vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateShaderModule_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_simple_pointer(pCreateInfo);
if (pCreateInfo)
cmd_size += vn_sizeof_VkShaderModuleCreateInfo(pCreateInfo);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
cmd_size += vn_sizeof_simple_pointer(pShaderModule);
if (pShaderModule)
cmd_size += vn_sizeof_VkShaderModule(pShaderModule);
return cmd_size;
}
static inline void vn_encode_vkCreateShaderModule(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateShaderModule_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
if (vn_encode_simple_pointer(enc, pCreateInfo))
vn_encode_VkShaderModuleCreateInfo(enc, pCreateInfo);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
if (vn_encode_simple_pointer(enc, pShaderModule))
vn_encode_VkShaderModule(enc, pShaderModule);
}
static inline size_t vn_sizeof_vkCreateShaderModule_reply(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkCreateShaderModule_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
VkResult ret;
cmd_size += vn_sizeof_VkResult(&ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
cmd_size += vn_sizeof_simple_pointer(pShaderModule);
if (pShaderModule)
cmd_size += vn_sizeof_VkShaderModule(pShaderModule);
return cmd_size;
}
static inline VkResult vn_decode_vkCreateShaderModule_reply(struct vn_cs_decoder *dec, VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkCreateShaderModule_EXT);
VkResult ret;
vn_decode_VkResult(dec, &ret);
/* skip device */
/* skip pCreateInfo */
/* skip pAllocator */
if (vn_decode_simple_pointer(dec)) {
vn_decode_VkShaderModule(dec, pShaderModule);
} else {
pShaderModule = NULL;
}
return ret;
}
static inline size_t vn_sizeof_vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyShaderModule_EXT;
const VkFlags cmd_flags = 0;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type) + vn_sizeof_VkFlags(&cmd_flags);
cmd_size += vn_sizeof_VkDevice(&device);
cmd_size += vn_sizeof_VkShaderModule(&shaderModule);
cmd_size += vn_sizeof_simple_pointer(pAllocator);
if (pAllocator)
assert(false);
return cmd_size;
}
static inline void vn_encode_vkDestroyShaderModule(struct vn_cs_encoder *enc, VkCommandFlagsEXT cmd_flags, VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyShaderModule_EXT;
vn_encode_VkCommandTypeEXT(enc, &cmd_type);
vn_encode_VkFlags(enc, &cmd_flags);
vn_encode_VkDevice(enc, &device);
vn_encode_VkShaderModule(enc, &shaderModule);
if (vn_encode_simple_pointer(enc, pAllocator))
assert(false);
}
static inline size_t vn_sizeof_vkDestroyShaderModule_reply(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
{
const VkCommandTypeEXT cmd_type = VK_COMMAND_TYPE_vkDestroyShaderModule_EXT;
size_t cmd_size = vn_sizeof_VkCommandTypeEXT(&cmd_type);
/* skip device */
/* skip shaderModule */
/* skip pAllocator */
return cmd_size;
}
static inline void vn_decode_vkDestroyShaderModule_reply(struct vn_cs_decoder *dec, VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
{
VkCommandTypeEXT command_type;
vn_decode_VkCommandTypeEXT(dec, &command_type);
assert(command_type == VK_COMMAND_TYPE_vkDestroyShaderModule_EXT);
/* skip device */
/* skip shaderModule */
/* skip pAllocator */
}
static inline void vn_submit_vkCreateShaderModule(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkCreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkCreateShaderModule_reply(device, pCreateInfo, pAllocator, pShaderModule) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkCreateShaderModule(enc, cmd_flags, device, pCreateInfo, pAllocator, pShaderModule);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline void vn_submit_vkDestroyShaderModule(struct vn_ring *vn_ring, VkCommandFlagsEXT cmd_flags, VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator, struct vn_ring_submit_command *submit)
{
uint8_t local_cmd_data[VN_SUBMIT_LOCAL_CMD_SIZE];
void *cmd_data = local_cmd_data;
size_t cmd_size = vn_sizeof_vkDestroyShaderModule(device, shaderModule, pAllocator);
if (cmd_size > sizeof(local_cmd_data)) {
cmd_data = malloc(cmd_size);
if (!cmd_data)
cmd_size = 0;
}
const size_t reply_size = cmd_flags & VK_COMMAND_GENERATE_REPLY_BIT_EXT ? vn_sizeof_vkDestroyShaderModule_reply(device, shaderModule, pAllocator) : 0;
struct vn_cs_encoder *enc = vn_ring_submit_command_init(vn_ring, submit, cmd_data, cmd_size, reply_size);
if (cmd_size) {
vn_encode_vkDestroyShaderModule(enc, cmd_flags, device, shaderModule, pAllocator);
vn_ring_submit_command(vn_ring, submit);
if (cmd_data != local_cmd_data)
free(cmd_data);
}
}
static inline VkResult vn_call_vkCreateShaderModule(struct vn_ring *vn_ring, VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
VN_TRACE_FUNC();
struct vn_ring_submit_command submit;
vn_submit_vkCreateShaderModule(vn_ring, VK_COMMAND_GENERATE_REPLY_BIT_EXT, device, pCreateInfo, pAllocator, pShaderModule, &submit);
struct vn_cs_decoder *dec = vn_ring_get_command_reply(vn_ring, &submit);
if (dec) {
const VkResult ret = vn_decode_vkCreateShaderModule_reply(dec, device, pCreateInfo, pAllocator, pShaderModule);
vn_ring_free_command_reply(vn_ring, &submit);
return ret;
} else {
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
static inline void vn_async_vkCreateShaderModule(struct vn_ring *vn_ring, VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule)
{
struct vn_ring_submit_command submit;
vn_submit_vkCreateShaderModule(vn_ring, 0, device, pCreateInfo, pAllocator, pShaderModule, &submit);
}
static inline void vn_async_vkDestroyShaderModule(struct vn_ring *vn_ring, VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator)
{
struct vn_ring_submit_command submit;
vn_submit_vkDestroyShaderModule(vn_ring, 0, device, shaderModule, pAllocator, &submit);
}
#endif /* VN_PROTOCOL_DRIVER_SHADER_MODULE_H */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+174
View File
@@ -0,0 +1,174 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
use std::ffi::c_void;
use mesa3d_protocols::protocols::kumquat_gpu_protocol::VulkanInfo;
pub const VIRTGPU_KUMQUAT_PARAM_3D_FEATURES: u64 = 1;
pub const VIRTGPU_KUMQUAT_PARAM_CAPSET_QUERY_FIX: u64 = 2;
pub const VIRTGPU_KUMQUAT_PARAM_RESOURCE_BLOB: u64 = 3;
pub const VIRTGPU_KUMQUAT_PARAM_HOST_VISIBLE: u64 = 4;
pub const VIRTGPU_KUMQUAT_PARAM_CROSS_DEVICE: u64 = 5;
pub const VIRTGPU_KUMQUAT_PARAM_CONTEXT_INIT: u64 = 6;
pub const VIRTGPU_KUMQUAT_PARAM_SUPPORTED_CAPSET_IDS: u64 = 7;
pub const VIRTGPU_KUMQUAT_PARAM_EXPLICIT_DEBUG_NAME: u64 = 8;
pub const VIRTGPU_KUMQUAT_PARAM_FENCE_PASSING: u64 = 9;
pub const VIRTGPU_KUMQUAT_EXECBUF_FENCE_FD_IN: u32 = 0x01;
pub const VIRTGPU_KUMQUAT_EXECBUF_FENCE_FD_OUT: u32 = 0x02;
pub const VIRTGPU_KUMQUAT_EXECBUF_RING_IDX: u32 = 0x04;
pub const VIRTGPU_KUMQUAT_EXECBUF_SHAREABLE_IN: u32 = 0x08;
pub const VIRTGPU_KUMQUAT_EXECBUF_SHAREABLE_OUT: u32 = 0x10;
pub const VIRTGPU_KUMQUAT_CONTEXT_PARAM_CAPSET_ID: u64 = 0x01;
pub const VIRTGPU_KUMQUAT_CONTEXT_PARAM_NUM_RINGS: u64 = 0x02;
pub const VIRTGPU_KUMQUAT_CONTEXT_PARAM_POLL_RING_MASK: u64 = 0x03;
pub const VIRTGPU_KUMQUAT_EMULATED_EXPORT: u32 = 0x01;
pub const VIRTGPU_KUMQUAT_PAGE_SIZE: usize = 4096;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuParam {
pub param: u64,
pub value: u64,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuGetCaps {
pub cap_set_id: u32,
pub cap_set_ver: u32,
pub addr: u64,
pub size: u32,
pub pad: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuContextInit {
pub num_params: u32,
pub pad: u32,
pub ctx_set_params: u64,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceCreate3D {
pub target: u32,
pub format: u32,
pub bind: u32,
pub width: u32,
pub height: u32,
pub depth: u32,
pub array_size: u32,
pub last_level: u32,
pub nr_samples: u32,
pub flags: u32,
pub bo_handle: u32,
pub res_handle: u32,
pub size: u32,
pub stride: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuBox {
pub x: u32,
pub y: u32,
pub z: u32,
pub w: u32,
pub h: u32,
pub d: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuTransfer {
pub bo_handle: u32,
pub _box: VirtGpuBox,
pub level: u32,
pub offset: u64,
pub stride: u32,
pub layer_stride: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceCreateBlob {
pub blob_mem: u32,
pub blob_flags: u32,
pub bo_handle: u32,
pub res_handle: u32,
pub size: u64,
pub pad: u32,
pub cmd_size: u32,
pub cmd: u64,
pub blob_id: u64,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceUnref {
pub bo_handle: u32,
pub pad: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuExecBuffer {
pub flags: u32,
pub size: u32,
pub command: u64,
pub bo_handles: u64,
pub num_bo_handles: u32,
pub fence_handle: i64,
pub ring_idx: u32,
pub syncobj_stride: u32,
pub num_in_syncobjs: u32,
pub num_out_syncobjs: u32,
pub in_syncobjs: u64,
pub out_syncobjs: u64,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuWait {
pub bo_handle: u32,
pub flags: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceMap {
pub bo_handle: u32,
pub ptr: *mut c_void,
pub size: u64,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceExport {
pub bo_handle: u32,
pub flags: u32,
pub os_handle: i64,
pub handle_type: u32,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceImport {
pub os_handle: i64,
pub handle_type: u32,
pub bo_handle: u32,
pub res_handle: u32,
pub size: u64,
}
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct VirtGpuResourceInfo {
pub bo_handle: u32,
pub vulkan_info: VulkanInfo,
}
+7
View File
@@ -0,0 +1,7 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
pub mod defines;
mod virtgpu_kumquat;
pub use virtgpu_kumquat::VirtGpuKumquat;
+12
View File
@@ -0,0 +1,12 @@
# Copyright © 2025 Google
# SPDX-License-Identifier: MIT
libvirtgpu_kumquat = static_library(
'virtgpu_kumquat',
'lib.rs',
gnu_symbol_visibility : 'hidden',
rust_abi : 'rust',
rust_args : rust_global_args,
link_with: [libmesa_protocols, libmesa_rust_util],
dependencies: [dep_mesa3d_util]
)
@@ -0,0 +1,683 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
use std::cmp::min;
use std::collections::BTreeMap as Map;
use std::path::PathBuf;
use std::slice::from_raw_parts_mut;
use mesa3d_protocols::ipc::KumquatStream;
use mesa3d_protocols::protocols::kumquat_gpu_protocol::*;
use mesa3d_util::Event;
use mesa3d_util::IntoRawDescriptor;
use mesa3d_util::MemoryMapping;
use mesa3d_util::MesaError;
use mesa3d_util::MesaHandle;
use mesa3d_util::MesaMapping;
use mesa3d_util::MesaResult;
use mesa3d_util::OwnedDescriptor;
use mesa3d_util::RawDescriptor;
use mesa3d_util::Reader;
use mesa3d_util::SharedMemory;
use mesa3d_util::Tube;
use mesa3d_util::TubeType;
use mesa3d_util::Writer;
use mesa3d_util::MESA_HANDLE_TYPE_MEM_OPAQUE_FD;
use mesa3d_util::MESA_MAP_ACCESS_RW;
use mesa3d_util::MESA_MAP_CACHE_CACHED;
use crate::defines::*;
// HACK: Should be part of protocol.
const RUTABAGA_FLAG_FENCE: u32 = 1 << 0;
const RUTABAGA_FLAG_INFO_RING_IDX: u32 = 1 << 1;
const RUTABAGA_FLAG_FENCE_HOST_SHAREABLE: u32 = 1 << 2;
pub struct VirtGpuResource {
resource_id: u32,
size: usize,
handle: MesaHandle,
attached_fences: Vec<MesaHandle>,
vulkan_info: VulkanInfo,
system_mapping: Option<MemoryMapping>,
}
impl VirtGpuResource {
pub fn new(
resource_id: u32,
size: usize,
handle: MesaHandle,
vulkan_info: VulkanInfo,
) -> VirtGpuResource {
VirtGpuResource {
resource_id,
size,
handle,
attached_fences: Vec::new(),
vulkan_info,
system_mapping: None,
}
}
}
pub struct VirtGpuKumquat {
context_id: u32,
id_allocator: u32,
capset_mask: u64,
stream: KumquatStream,
capsets: Map<u32, Vec<u8>>,
resources: Map<u32, VirtGpuResource>,
}
impl VirtGpuKumquat {
pub fn new(gpu_socket: &str) -> MesaResult<VirtGpuKumquat> {
let path = PathBuf::from(gpu_socket);
let connection = Tube::new(path, TubeType::Packet)?;
let mut stream = KumquatStream::new(connection);
let get_num_capsets = kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_GET_NUM_CAPSETS,
..Default::default()
};
stream.write(KumquatGpuProtocolWrite::Cmd(get_num_capsets))?;
let mut protocols = stream.read()?;
let num_capsets = match protocols.remove(0) {
KumquatGpuProtocol::RespNumCapsets(num) => num,
_ => return Err(MesaError::Unsupported),
};
let mut capset_mask = 0;
let mut capsets: Map<u32, Vec<u8>> = Default::default();
for capset_index in 0..num_capsets {
let get_capset_info = kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_GET_CAPSET_INFO,
payload: capset_index,
};
stream.write(KumquatGpuProtocolWrite::Cmd(get_capset_info))?;
protocols = stream.read()?;
let resp_capset_info = match protocols.remove(0) {
KumquatGpuProtocol::RespCapsetInfo(info) => info,
_ => return Err(MesaError::Unsupported),
};
let get_capset = kumquat_gpu_protocol_get_capset {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_GET_CAPSET,
..Default::default()
},
capset_id: resp_capset_info.capset_id,
capset_version: resp_capset_info.version,
};
stream.write(KumquatGpuProtocolWrite::Cmd(get_capset))?;
protocols = stream.read()?;
let capset = match protocols.remove(0) {
KumquatGpuProtocol::RespCapset(capset) => capset,
_ => return Err(MesaError::Unsupported),
};
capset_mask |= 1u64 << resp_capset_info.capset_id;
capsets.insert(resp_capset_info.capset_id, capset);
}
Ok(VirtGpuKumquat {
context_id: 0,
id_allocator: 0,
capset_mask,
stream,
capsets,
resources: Default::default(),
})
}
pub fn allocate_id(&mut self) -> u32 {
self.id_allocator += 1;
self.id_allocator
}
pub fn get_param(&self, getparam: &mut VirtGpuParam) -> MesaResult<()> {
getparam.value = match getparam.param {
VIRTGPU_KUMQUAT_PARAM_3D_FEATURES => (self.capset_mask != 0) as u64,
VIRTGPU_KUMQUAT_PARAM_CAPSET_QUERY_FIX..=VIRTGPU_KUMQUAT_PARAM_CONTEXT_INIT => 1,
VIRTGPU_KUMQUAT_PARAM_SUPPORTED_CAPSET_IDS => self.capset_mask,
VIRTGPU_KUMQUAT_PARAM_EXPLICIT_DEBUG_NAME => 0,
VIRTGPU_KUMQUAT_PARAM_FENCE_PASSING => 1,
_ => return Err(MesaError::Unsupported),
};
Ok(())
}
pub fn get_caps(&self, capset_id: u32, slice: &mut [u8]) -> MesaResult<()> {
let caps = self.capsets.get(&capset_id).ok_or(MesaError::Unsupported)?;
let length = min(slice.len(), caps.len());
slice[0..length].copy_from_slice(&caps[0..length]);
Ok(())
}
pub fn context_create(&mut self, capset_id: u64, name: &str) -> MesaResult<u32> {
let mut debug_name = [0u8; 64];
debug_name
.iter_mut()
.zip(name.bytes())
.for_each(|(dst, src)| *dst = src);
let context_create = kumquat_gpu_protocol_ctx_create {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_CTX_CREATE,
..Default::default()
},
nlen: 0,
context_init: capset_id.try_into()?,
debug_name,
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(context_create))?;
let mut protocols = self.stream.read()?;
self.context_id = match protocols.remove(0) {
KumquatGpuProtocol::RespContextCreate(ctx_id) => ctx_id,
_ => return Err(MesaError::Unsupported),
};
Ok(self.context_id)
}
pub fn resource_create_3d(
&mut self,
create_3d: &mut VirtGpuResourceCreate3D,
) -> MesaResult<()> {
let resource_create_3d = kumquat_gpu_protocol_resource_create_3d {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_3D,
..Default::default()
},
target: create_3d.target,
format: create_3d.format,
bind: create_3d.bind,
width: create_3d.width,
height: create_3d.height,
depth: create_3d.depth,
array_size: create_3d.array_size,
last_level: create_3d.last_level,
nr_samples: create_3d.nr_samples,
flags: create_3d.flags,
size: create_3d.size,
stride: create_3d.stride,
ctx_id: self.context_id,
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(resource_create_3d))?;
let mut protocols = self.stream.read()?;
let resource = match protocols.remove(0) {
KumquatGpuProtocol::RespResourceCreate(resp, handle) => {
let size: usize = create_3d.size.try_into()?;
VirtGpuResource::new(resp.resource_id, size, handle, resp.vulkan_info)
}
_ => return Err(MesaError::Unsupported),
};
create_3d.res_handle = resource.resource_id;
create_3d.bo_handle = self.allocate_id();
self.resources.insert(create_3d.bo_handle, resource);
Ok(())
}
pub fn resource_create_blob(
&mut self,
create_blob: &mut VirtGpuResourceCreateBlob,
blob_cmd: &[u8],
) -> MesaResult<()> {
if !blob_cmd.is_empty() {
let submit_command = kumquat_gpu_protocol_cmd_submit {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_SUBMIT_3D,
..Default::default()
},
ctx_id: self.context_id,
pad: 0,
size: blob_cmd.len().try_into()?,
num_in_fences: 0,
flags: 0,
ring_idx: 0,
padding: Default::default(),
};
let mut data: Vec<u8> = vec![0; blob_cmd.len()];
data.copy_from_slice(blob_cmd);
self.stream
.write(KumquatGpuProtocolWrite::CmdWithData(submit_command, data))?;
}
let resource_create_blob = kumquat_gpu_protocol_resource_create_blob {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_RESOURCE_CREATE_BLOB,
..Default::default()
},
ctx_id: self.context_id,
blob_mem: create_blob.blob_mem,
blob_flags: create_blob.blob_flags,
padding: 0,
blob_id: create_blob.blob_id,
size: create_blob.size,
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(resource_create_blob))?;
let mut protocols = self.stream.read()?;
let resource = match protocols.remove(0) {
KumquatGpuProtocol::RespResourceCreate(resp, handle) => {
let size: usize = create_blob.size.try_into()?;
VirtGpuResource::new(resp.resource_id, size, handle, resp.vulkan_info)
}
_ => {
return Err(MesaError::Unsupported);
}
};
create_blob.res_handle = resource.resource_id;
create_blob.bo_handle = self.allocate_id();
self.resources.insert(create_blob.bo_handle, resource);
Ok(())
}
pub fn resource_unref(&mut self, bo_handle: u32) -> MesaResult<()> {
let resource = self
.resources
.remove(&bo_handle)
.ok_or(MesaError::Unsupported)?;
let detach_resource = kumquat_gpu_protocol_ctx_resource {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_CTX_DETACH_RESOURCE,
..Default::default()
},
ctx_id: self.context_id,
resource_id: resource.resource_id,
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(detach_resource))?;
Ok(())
}
pub fn map(&mut self, bo_handle: u32) -> MesaResult<MesaMapping> {
let resource = self
.resources
.get_mut(&bo_handle)
.ok_or(MesaError::Unsupported)?;
if let Some(ref system_mapping) = resource.system_mapping {
let mesa_mapping = system_mapping.as_mesa_mapping();
Ok(mesa_mapping)
} else {
let clone = resource.handle.try_clone()?;
let mapping = MemoryMapping::from_safe_descriptor(
clone.os_handle,
resource.size,
MESA_MAP_CACHE_CACHED | MESA_MAP_ACCESS_RW,
)?;
let mesa_mapping = mapping.as_mesa_mapping();
resource.system_mapping = Some(mapping);
Ok(mesa_mapping)
}
}
pub fn unmap(&mut self, bo_handle: u32) -> MesaResult<()> {
let resource = self
.resources
.get_mut(&bo_handle)
.ok_or(MesaError::Unsupported)?;
resource.system_mapping = None;
Ok(())
}
pub fn transfer_to_host(&mut self, transfer: &VirtGpuTransfer) -> MesaResult<()> {
let resource = self
.resources
.get_mut(&transfer.bo_handle)
.ok_or(MesaError::Unsupported)?;
let event = Event::new()?;
let emulated_fence: MesaHandle = event.into();
resource.attached_fences.push(emulated_fence.try_clone()?);
let transfer_to_host = kumquat_gpu_protocol_transfer_host_3d {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_TRANSFER_TO_HOST_3D,
..Default::default()
},
box_: kumquat_gpu_protocol_box {
x: transfer._box.x,
y: transfer._box.y,
z: transfer._box.z,
w: transfer._box.w,
h: transfer._box.h,
d: transfer._box.d,
},
offset: transfer.offset,
level: transfer.level,
stride: transfer.stride,
layer_stride: transfer.layer_stride,
ctx_id: self.context_id,
resource_id: resource.resource_id,
padding: 0,
};
self.stream.write(KumquatGpuProtocolWrite::CmdWithHandle(
transfer_to_host,
emulated_fence,
))?;
Ok(())
}
pub fn transfer_from_host(&mut self, transfer: &VirtGpuTransfer) -> MesaResult<()> {
let resource = self
.resources
.get_mut(&transfer.bo_handle)
.ok_or(MesaError::Unsupported)?;
let event = Event::new()?;
let emulated_fence: MesaHandle = event.into();
resource.attached_fences.push(emulated_fence.try_clone()?);
let transfer_from_host = kumquat_gpu_protocol_transfer_host_3d {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_TRANSFER_FROM_HOST_3D,
..Default::default()
},
box_: kumquat_gpu_protocol_box {
x: transfer._box.x,
y: transfer._box.y,
z: transfer._box.z,
w: transfer._box.w,
h: transfer._box.h,
d: transfer._box.d,
},
offset: transfer.offset,
level: transfer.level,
stride: transfer.stride,
layer_stride: transfer.layer_stride,
ctx_id: self.context_id,
resource_id: resource.resource_id,
padding: 0,
};
self.stream.write(KumquatGpuProtocolWrite::CmdWithHandle(
transfer_from_host,
emulated_fence,
))?;
Ok(())
}
pub fn submit_command(
&mut self,
flags: u32,
bo_handles: &[u32],
cmd: &[u8],
ring_idx: u32,
in_fences: &[u64],
raw_descriptor: &mut RawDescriptor,
) -> MesaResult<()> {
let mut fence_opt: Option<MesaHandle> = None;
let mut data: Vec<u8> = vec![0; cmd.len()];
let mut host_flags = 0;
if flags & VIRTGPU_KUMQUAT_EXECBUF_RING_IDX != 0 {
host_flags = RUTABAGA_FLAG_INFO_RING_IDX;
}
let need_fence =
!bo_handles.is_empty() || (flags & VIRTGPU_KUMQUAT_EXECBUF_FENCE_FD_OUT) != 0;
let actual_fence = (flags & VIRTGPU_KUMQUAT_EXECBUF_SHAREABLE_OUT) != 0
&& (flags & VIRTGPU_KUMQUAT_EXECBUF_FENCE_FD_OUT) != 0;
// Should copy from in-fences when gfxstream supports it.
data.copy_from_slice(cmd);
if actual_fence {
host_flags |= RUTABAGA_FLAG_FENCE_HOST_SHAREABLE;
host_flags |= RUTABAGA_FLAG_FENCE;
} else if need_fence {
host_flags |= RUTABAGA_FLAG_FENCE;
}
let submit_command = kumquat_gpu_protocol_cmd_submit {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_SUBMIT_3D,
..Default::default()
},
ctx_id: self.context_id,
pad: 0,
size: cmd.len().try_into()?,
num_in_fences: in_fences.len().try_into()?,
flags: host_flags,
ring_idx: ring_idx.try_into()?,
padding: Default::default(),
};
if need_fence {
self.stream
.write(KumquatGpuProtocolWrite::CmdWithData(submit_command, data))?;
let mut protocols = self.stream.read()?;
let fence = match protocols.remove(0) {
KumquatGpuProtocol::RespCmdSubmit3d(_fence_id, handle) => handle,
_ => {
return Err(MesaError::Unsupported);
}
};
for handle in bo_handles {
// We could support implicit sync with real fences, but the need does not exist.
if actual_fence {
return Err(MesaError::Unsupported);
}
let resource = self
.resources
.get_mut(handle)
.ok_or(MesaError::Unsupported)?;
resource.attached_fences.push(fence.try_clone()?);
}
fence_opt = Some(fence);
} else {
self.stream
.write(KumquatGpuProtocolWrite::CmdWithData(submit_command, data))?;
}
if flags & VIRTGPU_KUMQUAT_EXECBUF_FENCE_FD_OUT != 0 {
*raw_descriptor = fence_opt
.ok_or(MesaError::WithContext("no fence found"))?
.os_handle
.into_raw_descriptor();
}
Ok(())
}
pub fn wait(&mut self, bo_handle: u32) -> MesaResult<()> {
let resource = self
.resources
.get_mut(&bo_handle)
.ok_or(MesaError::Unsupported)?;
let new_fences: Vec<MesaHandle> = std::mem::take(&mut resource.attached_fences);
for fence in new_fences {
let mut event: Event = fence.try_into()?;
event.wait()?;
}
Ok(())
}
pub fn resource_export(&mut self, bo_handle: u32, flags: u32) -> MesaResult<MesaHandle> {
let resource = self
.resources
.get_mut(&bo_handle)
.ok_or(MesaError::Unsupported)?;
if flags & VIRTGPU_KUMQUAT_EMULATED_EXPORT != 0 {
let descriptor: OwnedDescriptor =
SharedMemory::new("virtgpu_export", VIRTGPU_KUMQUAT_PAGE_SIZE as u64)?.into();
let clone = descriptor.try_clone()?;
// Creating the mapping closes the cloned descriptor.
let mapping = MemoryMapping::from_safe_descriptor(
clone,
VIRTGPU_KUMQUAT_PAGE_SIZE,
MESA_MAP_CACHE_CACHED | MESA_MAP_ACCESS_RW,
)?;
let mesa_mapping = mapping.as_mesa_mapping();
let slice: &mut [u8] = unsafe {
from_raw_parts_mut(mesa_mapping.ptr as *mut u8, VIRTGPU_KUMQUAT_PAGE_SIZE)
};
let mut writer = Writer::new(slice);
writer.write_obj(resource.resource_id)?;
// Opaque to users of this API, shared memory internally
Ok(MesaHandle {
os_handle: descriptor,
handle_type: MESA_HANDLE_TYPE_MEM_OPAQUE_FD,
})
} else {
let clone = resource.handle.try_clone()?;
Ok(clone)
}
}
pub fn resource_import(
&mut self,
handle: MesaHandle,
bo_handle: &mut u32,
resource_handle: &mut u32,
size: &mut u64,
) -> MesaResult<()> {
let clone = handle.try_clone()?;
let mapping = MemoryMapping::from_safe_descriptor(
clone.os_handle,
VIRTGPU_KUMQUAT_PAGE_SIZE,
MESA_MAP_CACHE_CACHED | MESA_MAP_ACCESS_RW,
)?;
let mesa_mapping = mapping.as_mesa_mapping();
let slice: &mut [u8] =
unsafe { from_raw_parts_mut(mesa_mapping.ptr as *mut u8, VIRTGPU_KUMQUAT_PAGE_SIZE) };
let mut reader = Reader::new(slice);
*resource_handle = reader.read_obj()?;
let attach_resource = kumquat_gpu_protocol_ctx_resource {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_CTX_ATTACH_RESOURCE,
..Default::default()
},
ctx_id: self.context_id,
resource_id: *resource_handle,
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(attach_resource))?;
let resource = VirtGpuResource::new(
*resource_handle,
VIRTGPU_KUMQUAT_PAGE_SIZE,
handle,
Default::default(),
);
*bo_handle = self.allocate_id();
// Should ask the server about the size long-term.
*size = VIRTGPU_KUMQUAT_PAGE_SIZE as u64;
self.resources.insert(*bo_handle, resource);
Ok(())
}
pub fn resource_info(&self, bo_handle: u32) -> MesaResult<VulkanInfo> {
let resource = self
.resources
.get(&bo_handle)
.ok_or(MesaError::Unsupported)?;
Ok(resource.vulkan_info)
}
pub fn snapshot(&mut self) -> MesaResult<()> {
let snapshot_save = kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_SNAPSHOT_SAVE,
..Default::default()
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(snapshot_save))?;
let mut protocols = self.stream.read()?;
match protocols.remove(0) {
KumquatGpuProtocol::RespOkSnapshot => Ok(()),
_ => Err(MesaError::Unsupported),
}
}
pub fn restore(&mut self) -> MesaResult<()> {
let snapshot_restore = kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_SNAPSHOT_RESTORE,
..Default::default()
};
self.stream
.write(KumquatGpuProtocolWrite::Cmd(snapshot_restore))?;
let mut protocols = self.stream.read()?;
match protocols.remove(0) {
KumquatGpuProtocol::RespOkSnapshot => Ok(()),
_ => Err(MesaError::Unsupported),
}
}
}
impl Drop for VirtGpuKumquat {
fn drop(&mut self) {
if self.context_id != 0 {
for (_, resource) in self.resources.iter() {
let detach_resource = kumquat_gpu_protocol_ctx_resource {
hdr: kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_CTX_DETACH_RESOURCE,
..Default::default()
},
ctx_id: self.context_id,
resource_id: resource.resource_id,
};
let _ = self
.stream
.write(KumquatGpuProtocolWrite::Cmd(detach_resource));
}
self.resources.clear();
let context_destroy = kumquat_gpu_protocol_ctrl_hdr {
type_: KUMQUAT_GPU_PROTOCOL_CTX_DESTROY,
payload: self.context_id,
};
let _ = self
.stream
.write(KumquatGpuProtocolWrite::Cmd(context_destroy));
}
}
}
@@ -0,0 +1,14 @@
# Copyright 2025 Google
# SPDX license identifier: MIT
BasedOnStyle: LLVM
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
BreakBeforeBraces: Linux
ColumnLimit: 100
IndentWidth: 4
TabWidth: 4
UseTab: Never
Cpp11BracedListStyle: false
IndentCaseLabels: false
@@ -0,0 +1,285 @@
/*
* Copyright 2025 Google
* SPDX License identifier: MIT
*/
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#ifndef VIRTGPU_KUMQUAT_FFI_H
#define VIRTGPU_KUMQUAT_FFI_H
#ifdef __cplusplus
extern "C" {
#endif
struct virtgpu_kumquat;
struct drm_kumquat_map {
uint32_t bo_handle;
// out
void *ptr;
uint64_t size;
};
#define VIRTGPU_KUMQUAT_EXECBUF_SYNCOBJ_RESET 0x01
#define VIRTGPU_KUMQUAT_EXECBUF_SYNCOBJ_FLAGS (VIRTGPU_KUMQUAT_EXECBUF_SYNCOBJ_RESET | 0)
struct drm_kumquat_execbuffer_syncobj {
uint32_t handle;
uint32_t flags;
uint64_t point;
};
#define VIRTGPU_KUMQUAT_EXECBUF_FENCE_HANDLE_IN 0x01
#define VIRTGPU_KUMQUAT_EXECBUF_FENCE_HANDLE_OUT 0x02
#define VIRTGPU_KUMQUAT_EXECBUF_RING_IDX 0x04
#define VIRTGPU_KUMQUAT_EXECBUF_SHAREABLE_IN 0x08
#define VIRTGPU_KUMQUAT_EXECBUF_SHAREABLE_OUT 0x10
#define VIRTGPU_KUMQUAT_EXECBUF_FLAGS \
(VIRTGPU_EXECBUF_FENCE_HANDLE_IN | VIRTGPU_EXECBUF_FENCE_HANDLE_OUT | \
VIRTGPU_EXECBUF_RING_IDX | VIRTGPU_EXECBUF_SHAREABLE_IN | VIRTGPU_EXECBUF_SHAREABLE_OUT | 0)
/* fence_fd is modified on success if VIRTGPU_KUMQUAT_EXECBUF_FENCE_HANDLE_OUT flag is set. */
struct drm_kumquat_execbuffer {
uint32_t flags;
uint32_t size;
uint64_t command; /* void* */
uint64_t bo_handles;
uint32_t num_bo_handles;
int64_t fence_handle; /* in/out fence fd (see VIRTGPU_KUMQUAT_EXECBUF_FENCE_HANDLE_IN/OUT) */
uint32_t ring_idx; /* command ring index (see VIRTGPU_KUMQUAT_EXECBUF_RING_IDX) */
uint32_t syncobj_stride; /* size of @drm_kumquat_execbuffer_syncobj */
uint32_t num_in_syncobjs;
uint32_t num_out_syncobjs;
uint64_t in_syncobjs;
uint64_t out_syncobjs;
};
#define VIRTGPU_KUMQUAT_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
#define VIRTGPU_KUMQUAT_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
#define VIRTGPU_KUMQUAT_PARAM_RESOURCE_BLOB 3 /* DRM_VIRTGPU_RESOURCE_CREATE_BLOB */
#define VIRTGPU_KUMQUAT_PARAM_HOST_VISIBLE 4 /* Host blob resources are mappable */
#define VIRTGPU_KUMQUAT_PARAM_CROSS_DEVICE 5 /* Cross virtio-device resource sharing */
#define VIRTGPU_KUMQUAT_PARAM_CONTEXT_INIT 6 /* DRM_VIRTGPU_KUMQUAT_CONTEXT_INIT */
#define VIRTGPU_KUMQUAT_PARAM_SUPPORTED_CAPSET_IDs 7 /* Bitmask of supported capability set ids */
#define VIRTGPU_KUMQUAT_PARAM_EXPLICIT_DEBUG_NAME 8 /* Ability to set debug name from userspace */
#define VIRTGPU_KUMQUAT_PARAM_FENCE_PASSING 9 /* Host shareable fences */
#define VIRTGPU_KUMQUAT_PARAM_CREATE_GUEST_HANDLE 10
struct drm_kumquat_getparam {
uint64_t param;
uint64_t value;
};
struct drm_kumquat_resource_create_3d {
uint32_t target;
uint32_t format;
uint32_t bind;
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t array_size;
uint32_t last_level;
uint32_t nr_samples;
uint32_t flags;
uint32_t bo_handle;
uint32_t res_handle;
uint32_t size;
uint32_t stride;
};
struct drm_kumquat_vk_device_id {
uint8_t device_uuid[16];
uint8_t driver_uuid[16];
};
struct drm_kumquat_vk_info {
uint32_t memory_idx;
struct drm_kumquat_vk_device_id device_id;
};
struct drm_kumquat_resource_info {
uint32_t bo_handle;
struct drm_kumquat_vk_info vulkan_info;
};
struct drm_kumquat_3d_box {
uint32_t x;
uint32_t y;
uint32_t z;
uint32_t w;
uint32_t h;
uint32_t d;
};
struct drm_kumquat_transfer_to_host {
uint32_t bo_handle;
struct drm_kumquat_3d_box box;
uint32_t level;
uint32_t offset;
uint32_t stride;
uint32_t layer_stride;
};
struct drm_kumquat_transfer_from_host {
uint32_t bo_handle;
struct drm_kumquat_3d_box box;
uint32_t level;
uint32_t offset;
uint32_t stride;
uint32_t layer_stride;
};
struct drm_kumquat_wait {
uint32_t handle; /* 0 is an invalid handle */
uint32_t flags;
};
struct drm_kumquat_get_caps {
uint32_t cap_set_id;
uint32_t cap_set_ver;
uint64_t addr;
uint32_t size;
uint32_t pad;
};
struct drm_kumquat_resource_create_blob {
#define VIRTGPU_KUMQUAT_MEM_GUEST 0x0001
#define VIRTGPU_KUMQUAT_MEM_HOST3D 0x0002
#define VIRTGPU_KUMQUAT_MEM_HOST3D_GUEST 0x0003
#define VIRTGPU_KUMQUAT_FLAG_USE_MAPPABLE 0x0001
#define VIRTGPU_KUMQUAT_FLAG_USE_SHAREABLE 0x0002
#define VIRTGPU_KUMQUAT_FLAG_USE_CROSS_DEVICE 0x0004
/* zero is invalid blob_mem */
uint32_t blob_mem;
uint32_t blob_flags;
uint32_t bo_handle;
uint32_t res_handle;
uint64_t size;
/*
* for 3D contexts with VIRTGPU_KUMQUAT_MEM_HOST3D_GUEST and
* VIRTGPU_KUMQUAT_MEM_HOST3D otherwise, must be zero.
*/
uint32_t pad;
uint32_t cmd_size;
uint64_t cmd;
uint64_t blob_id;
};
struct drm_kumquat_resource_unref {
uint32_t bo_handle;
uint32_t pad;
};
#define VIRTGPU_KUMQUAT_CONTEXT_PARAM_CAPSET_ID 0x0001
#define VIRTGPU_KUMQUAT_CONTEXT_PARAM_NUM_RINGS 0x0002
#define VIRTGPU_KUMQUAT_CONTEXT_PARAM_POLL_RINGS_MASK 0x0003
#define VIRTGPU_KUMQUAT_CONTEXT_PARAM_DEBUG_NAME 0x0004
struct drm_kumquat_context_set_param {
uint64_t param;
uint64_t value;
};
struct drm_kumquat_context_init {
uint32_t num_params;
uint32_t pad;
/* pointer to drm_kumquat_context_set_param array */
uint64_t ctx_set_params;
};
/*
* Without VIRTGPU_KUMQUAT_EMULATED_EXPORT, the server side descriptor will
* be provided.
*
* With VIRTGPU_KUMQUAT_EMULATED_EXPORT, a shared memory descriptor embedded
* with resource will be provided.
*/
#define VIRTGPU_KUMQUAT_EMULATED_EXPORT 0x0001
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_MEM_OPAQUE_FD 0x1
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_MEM_DMABUF 0x2
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_MEM_OPAQUE_WIN32 0x3
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_MEM_SHM 0x4
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_MEM_ZIRCON 0x5
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_SIGNAL_OPAQUE_FD 0x10
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_SIGNAL_SYNC_FD 0x0x20
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_SIGNAL_OPAQUE_WIN32 0x30
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_SIGNAL_ZIRCON 0x40
#define VIRTGPU_KUMQUAT_HANDLE_TYPE_SIGNAL_EVENT_FD 0x50
struct drm_kumquat_resource_export {
uint32_t bo_handle;
uint32_t flags;
int64_t os_handle;
uint32_t handle_type;
};
struct drm_kumquat_resource_import {
int64_t os_handle;
uint32_t handle_type;
uint32_t bo_handle;
uint32_t res_handle;
uint64_t size;
};
int32_t virtgpu_kumquat_init(struct virtgpu_kumquat **ptr, const char *gpu_socket);
int32_t virtgpu_kumquat_finish(struct virtgpu_kumquat **ptr);
int32_t virtgpu_kumquat_get_param(struct virtgpu_kumquat *ptr, struct drm_kumquat_getparam *cmd);
int32_t virtgpu_kumquat_get_caps(struct virtgpu_kumquat *ptr, struct drm_kumquat_get_caps *cmd);
int32_t virtgpu_kumquat_context_init(struct virtgpu_kumquat *ptr,
struct drm_kumquat_context_init *cmd);
int32_t virtgpu_kumquat_resource_create_3d(struct virtgpu_kumquat *ptr,
struct drm_kumquat_resource_create_3d *cmd);
int32_t virtgpu_kumquat_resource_create_blob(struct virtgpu_kumquat *ptr,
struct drm_kumquat_resource_create_blob *cmd);
int32_t virtgpu_kumquat_resource_unref(struct virtgpu_kumquat *ptr,
struct drm_kumquat_resource_unref *cmd);
int32_t virtgpu_kumquat_resource_map(struct virtgpu_kumquat *ptr, struct drm_kumquat_map *cmd);
int32_t virtgpu_kumquat_resource_unmap(struct virtgpu_kumquat *ptr, uint32_t bo_handle);
int32_t virtgpu_kumquat_transfer_to_host(struct virtgpu_kumquat *ptr,
struct drm_kumquat_transfer_to_host *cmd);
int32_t virtgpu_kumquat_transfer_from_host(struct virtgpu_kumquat *ptr,
struct drm_kumquat_transfer_from_host *cmd);
int32_t virtgpu_kumquat_execbuffer(struct virtgpu_kumquat *ptr, struct drm_kumquat_execbuffer *cmd);
int32_t virtgpu_kumquat_wait(struct virtgpu_kumquat *ptr, struct drm_kumquat_wait *cmd);
// The following commands are more emulated than the rest.
int32_t virtgpu_kumquat_resource_export(struct virtgpu_kumquat *ptr,
struct drm_kumquat_resource_export *cmd);
int32_t virtgpu_kumquat_resource_import(struct virtgpu_kumquat *ptr,
struct drm_kumquat_resource_import *cmd);
int32_t virtgpu_kumquat_resource_info(struct virtgpu_kumquat *ptr,
struct drm_kumquat_resource_info *cmd);
int32_t virtgpu_kumquat_snapshot_save(struct virtgpu_kumquat *ptr);
int32_t virtgpu_kumquat_snapshot_restore(struct virtgpu_kumquat *ptr);
#ifdef __cplusplus
}
#endif
#endif
+503
View File
@@ -0,0 +1,503 @@
// Copyright 2025 Google
// SPDX-License-Identifier: MIT
use std::ffi::c_char;
use std::ffi::c_void;
use std::ffi::CStr;
use std::panic::catch_unwind;
use std::panic::AssertUnwindSafe;
use std::ptr::null_mut;
use std::slice::from_raw_parts;
use std::slice::from_raw_parts_mut;
use std::sync::Mutex;
use libc::EINVAL;
use libc::ESRCH;
use log::error;
use mesa3d_util::FromRawDescriptor;
use mesa3d_util::IntoRawDescriptor;
use mesa3d_util::MesaHandle;
use mesa3d_util::MesaResult;
use mesa3d_util::OwnedDescriptor;
use mesa3d_util::RawDescriptor;
use mesa3d_util::DEFAULT_RAW_DESCRIPTOR;
use virtgpu_kumquat::defines::*;
use virtgpu_kumquat::VirtGpuKumquat;
const NO_ERROR: i32 = 0;
fn return_result<T>(result: MesaResult<T>) -> i32 {
if let Err(e) = result {
error!("An error occurred: {}", e);
-EINVAL
} else {
NO_ERROR
}
}
macro_rules! return_on_error {
($result:expr) => {
match $result {
Ok(t) => t,
Err(e) => {
error!("An error occurred: {}", e);
return -EINVAL;
}
}
};
}
#[expect(non_camel_case_types)]
type virtgpu_kumquat_ffi = Mutex<VirtGpuKumquat>;
// The following structs (in define.rs) must be ABI-compatible with FFI header
// (virtgpu_kumquat_ffi.h).
#[expect(non_camel_case_types)]
type drm_kumquat_getparam = VirtGpuParam;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_unref = VirtGpuResourceUnref;
#[expect(non_camel_case_types)]
type drm_kumquat_get_caps = VirtGpuGetCaps;
#[expect(non_camel_case_types)]
type drm_kumquat_context_init = VirtGpuContextInit;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_create_3d = VirtGpuResourceCreate3D;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_create_blob = VirtGpuResourceCreateBlob;
#[expect(non_camel_case_types)]
type drm_kumquat_transfer_to_host = VirtGpuTransfer;
#[expect(non_camel_case_types)]
type drm_kumquat_transfer_from_host = VirtGpuTransfer;
#[expect(non_camel_case_types)]
type drm_kumquat_execbuffer = VirtGpuExecBuffer;
#[expect(non_camel_case_types)]
type drm_kumquat_wait = VirtGpuWait;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_map = VirtGpuResourceMap;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_export = VirtGpuResourceExport;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_import = VirtGpuResourceImport;
#[expect(non_camel_case_types)]
type drm_kumquat_resource_info = VirtGpuResourceInfo;
// SAFETY:
// The `ptr` must be a valid pointer to a `*mut virtgpu_kumquat_ffi`.
// If `gpu_socket` is `Some`, `gpu_socket` must be a valid, null-terminated C string.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_init(
ptr: &mut *mut virtgpu_kumquat_ffi,
gpu_socket: Option<&c_char>,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let gpu_socket_str = match gpu_socket {
Some(value) => {
// SAFETY:
// The API user must pass in a valid C-string.
let c_str_slice = unsafe { CStr::from_ptr(value) };
let result = c_str_slice.to_str();
return_on_error!(result)
}
None => "/tmp/kumquat-gpu-0",
};
let result = VirtGpuKumquat::new(gpu_socket_str);
let kmqt = return_on_error!(result);
*ptr = Box::into_raw(Box::new(Mutex::new(kmqt))) as _;
NO_ERROR
}))
.unwrap_or(-ESRCH)
}
#[no_mangle]
pub extern "C" fn virtgpu_kumquat_finish(ptr: &mut *mut virtgpu_kumquat_ffi) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
// SAFETY:
// The pointer `*ptr` must have been previously allocated by `virtgpu_kumquat_init`,
// which uses `Box::into_raw`, and must not have been freed yet.
let _ = unsafe { Box::from_raw(*ptr) };
*ptr = null_mut();
NO_ERROR
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// The `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` struct initialized
// by `virtgpu_kumquat_init`.
// The `cmd` pointer must be valid for writes.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_get_param(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_getparam,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().get_param(cmd);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`. `cmd` must be a valid pointer to a
// `drm_kumquat_get_caps` struct. `cmd.addr` must be a valid pointer to a
// buffer of at least `cmd.size` bytes, or null if `cmd.size` is 0. The
// buffer must be valid for writes.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_get_caps(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &drm_kumquat_get_caps,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let caps_slice = if cmd.size != 0 {
// SAFETY:
// The caller must ensure that `cmd.addr` points to a valid, mutable
// memory block of at least `cmd.size` bytes.
unsafe { from_raw_parts_mut(cmd.addr as *mut u8, cmd.size as usize) }
} else {
&mut []
};
let result = ptr.get_mut().unwrap().get_caps(cmd.cap_set_id, caps_slice);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`. `cmd` must be a valid pointer to a
// `drm_kumquat_context_init` struct. `cmd.ctx_set_params` must be a valid
// pointer to an array of `VirtGpuParam` of size `cmd.num_params`, or null
// if `cmd.num_params` is 0.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_context_init(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &drm_kumquat_context_init,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let context_params: &[VirtGpuParam] = if cmd.num_params != 0 {
// SAFETY:
// The caller must ensure that `cmd.ctx_set_params` points to a
// valid memory block of at least `cmd.num_params` `VirtGpuParam`s.
unsafe {
from_raw_parts(
cmd.ctx_set_params as *const VirtGpuParam,
cmd.num_params as usize,
)
}
} else {
&[]
};
let mut capset_id: u64 = 0;
for param in context_params {
#[expect(clippy::single_match)]
match param.param {
VIRTGPU_KUMQUAT_CONTEXT_PARAM_CAPSET_ID => {
capset_id = param.value;
}
_ => (),
}
}
let result = ptr.get_mut().unwrap().context_create(capset_id, "");
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_resource_create_3d` struct.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_resource_create_3d(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_create_3d,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().resource_create_3d(cmd);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_resource_create_blob` struct.
// `cmd.cmd` must be a valid pointer to a buffer of at least `cmd.cmd_size` bytes,
// or null if `cmd.cmd_size` is 0.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_resource_create_blob(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_create_blob,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let blob_cmd = if cmd.cmd_size != 0 {
// SAFETY:
// The caller must ensure that `cmd.cmd` points to a valid memory
// block of at least `cmd.cmd_size` bytes.
unsafe { from_raw_parts(cmd.cmd as *const u8, cmd.cmd_size as usize) }
} else {
&[]
};
let result = ptr.get_mut().unwrap().resource_create_blob(cmd, blob_cmd);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_resource_unref` struct.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_resource_unref(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_unref,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().resource_unref(cmd.bo_handle);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_resource_map` struct and be valid for writes.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_resource_map(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_map,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().map(cmd.bo_handle);
let internal_map = return_on_error!(result);
cmd.ptr = internal_map.ptr as *mut c_void;
cmd.size = internal_map.size;
NO_ERROR
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `bo_handle` must be a valid resource handle that has been previously mapped.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_resource_unmap(
ptr: &mut virtgpu_kumquat_ffi,
bo_handle: u32,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().unmap(bo_handle);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_transfer_to_host` struct.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_transfer_to_host(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_transfer_to_host,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().transfer_to_host(cmd);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_transfer_from_host` struct.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_transfer_from_host(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_transfer_from_host,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().transfer_from_host(cmd);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_execbuffer` struct.
// If `cmd.num_bo_handles` is not 0, `cmd.bo_handles` must point to a valid
// array of `u32` of at least `cmd.num_bo_handles` elements.
// If `cmd.size` is not 0, `cmd.command` must point to a valid buffer of at
// least `cmd.size` bytes.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_execbuffer(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_execbuffer,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let bo_handles = if cmd.num_bo_handles != 0 {
// SAFETY:
// The API user must pass in a valid array of bo_handles with correct size.
unsafe { from_raw_parts(cmd.bo_handles as *const u32, cmd.num_bo_handles as usize) }
} else {
&[]
};
let cmd_buf = if cmd.size != 0 {
// SAFETY:
// The API user must pass in a valid command buffer with correct size.
unsafe { from_raw_parts(cmd.command as *const u8, cmd.size as usize) }
} else {
&[]
};
// TODO
let in_fences: &[u64] = &[0; 0];
let mut descriptor: RawDescriptor = DEFAULT_RAW_DESCRIPTOR;
let result = ptr.get_mut().unwrap().submit_command(
cmd.flags,
bo_handles,
cmd_buf,
cmd.ring_idx,
in_fences,
&mut descriptor,
);
cmd.fence_handle = descriptor as i64;
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_wait` struct.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_wait(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_wait,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().wait(cmd.bo_handle);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
#[no_mangle]
pub extern "C" fn virtgpu_kumquat_resource_export(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_export,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr
.get_mut()
.unwrap()
.resource_export(cmd.bo_handle, cmd.flags);
let hnd = return_on_error!(result);
cmd.handle_type = hnd.handle_type;
cmd.os_handle = hnd.os_handle.into_raw_descriptor() as i64;
NO_ERROR
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
// `cmd` must be a valid pointer to a `drm_kumquat_resource_import` struct.
// `cmd.os_handle` must be a valid OS handle, and ownership is transferred to this function.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_resource_import(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_import,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let handle = MesaHandle {
// SAFETY:
// The API user must transfer ownership of a valid OS handle.
os_handle: unsafe {
OwnedDescriptor::from_raw_descriptor(cmd.os_handle.into_raw_descriptor())
},
handle_type: cmd.handle_type,
};
let result = ptr.get_mut().unwrap().resource_import(
handle,
&mut cmd.bo_handle,
&mut cmd.res_handle,
&mut cmd.size,
);
return_result(result)
}))
.unwrap_or(-ESRCH)
}
#[no_mangle]
pub extern "C" fn virtgpu_kumquat_resource_info(
ptr: &mut virtgpu_kumquat_ffi,
cmd: &mut drm_kumquat_resource_info,
) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().resource_info(cmd.bo_handle);
let info = return_on_error!(result);
cmd.vulkan_info = info;
NO_ERROR
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_snapshot_save(ptr: &mut virtgpu_kumquat_ffi) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().snapshot();
return_result(result)
}))
.unwrap_or(-ESRCH)
}
// SAFETY:
// `ptr` must be a valid pointer to a `virtgpu_kumquat_ffi` obtained from
// `virtgpu_kumquat_init`.
#[no_mangle]
pub unsafe extern "C" fn virtgpu_kumquat_snapshot_restore(ptr: &mut virtgpu_kumquat_ffi) -> i32 {
catch_unwind(AssertUnwindSafe(|| {
let result = ptr.get_mut().unwrap().restore();
return_result(result)
}))
.unwrap_or(-ESRCH)
}
@@ -0,0 +1,39 @@
# Copyright © 2025 Google
# SPDX-License-Identifier: MIT
inc_virtgpu_kumquat_ffi = include_directories('include')
dep_rust_log = dependency('rust-log',
version: '>= 0.4.22',
fallback: ['log-0.4-rs', 'dep_log'],
required: true,
)
dep_rust_libc = dependency('rust-libc',
version: '>= 0.2.168',
fallback: ['libc-0.2-rs', 'dep_libc'],
required: true,
)
virtgpu_kumquat_ffi_args = [
# we want unsafe blocks inside unsafe functions
'-Dunsafe_op_in_unsafe_fn',
]
libvirtgpu_kumquat_ffi = static_library(
'virtgpu_kumquat_ffi',
'lib.rs',
gnu_symbol_visibility : 'hidden',
rust_abi : 'c',
rust_args : [
rust_global_args,
virtgpu_kumquat_ffi_args,
],
link_with: [libmesa_protocols, libmesa_rust_util, libvirtgpu_kumquat],
dependencies: [dep_mesa3d_util, dep_rust_log, dep_rust_libc]
)
dep_virtgpu_kumquat_ffi = declare_dependency(
include_directories : [inc_virtgpu_kumquat_ffi],
link_with : [libvirtgpu_kumquat_ffi]
)
+137
View File
@@ -0,0 +1,137 @@
/*
* Copyright 2022 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef DRM_HW_H_
#define DRM_HW_H_
#ifdef ENABLE_DRM_AMDGPU
#include <amdgpu.h>
#endif
/**
* When adding new caps to the end of the capset struct, a value of
* zero should be the fallback. Ie. a newer guest on an older host
* will see a zero value.
*
* For boolean caps, use 1/~0 for true/false
*/
#define VIRTGPU_CAP_BOOL_UNSUPPORTED_BY_HOST 0
#define VIRTGPU_CAP_BOOL_FALSE ~0
#define VIRTGPU_CAP_BOOL_TRUE 1
struct virgl_renderer_capset_drm {
uint32_t wire_format_version;
/* Underlying drm device version: */
uint32_t version_major;
uint32_t version_minor;
uint32_t version_patchlevel;
#define VIRTGPU_DRM_CONTEXT_MSM 1
#define VIRTGPU_DRM_CONTEXT_AMDGPU 2
#define VIRTGPU_DRM_CONTEXT_I915 3
uint32_t context_type;
uint32_t pad;
union {
struct {
uint32_t has_cached_coherent;
uint32_t priorities;
uint64_t va_start;
uint64_t va_size;
uint32_t gpu_id;
uint32_t gmem_size;
uint64_t gmem_base;
uint64_t chip_id;
uint32_t max_freq;
uint32_t highest_bank_bit;
uint64_t ubwc_swizzle;
uint64_t macrotile_mode;
uint32_t has_raytracing; /* VIRTGPU_CAP_BOOL_x */
uint32_t has_preemption; /* VIRTGPU_CAP_BOOL_x */
uint64_t uche_trap_base;
} msm; /* context_type == VIRTGPU_DRM_CONTEXT_MSM */
struct {
uint32_t address32_hi;
uint32_t has_vm_always_valid : 1;
uint32_t __pad : 31;
#ifdef ENABLE_DRM_AMDGPU
struct amdgpu_buffer_size_alignments alignments;
struct amdgpu_gpu_info gpu_info;
#endif
char marketing_name[128];
} amdgpu; /* context_type == VIRTGPU_DRM_CONTEXT_AMDGPU */
struct {
uint32_t pci_bus;
uint32_t pci_dev;
uint32_t pci_func;
uint32_t pci_revision_id;
uint32_t pci_domain;
uint32_t pci_device_id;
} intel; /* context_type == VIRTGPU_DRM_CONTEXT_I915 */
} u;
};
/**
* Defines the layout of shmem buffer used for host->guest communication.
*/
struct vdrm_shmem {
/**
* The sequence # of last cmd processed by the host
*/
uint32_t seqno;
/**
* Offset to the start of rsp memory region in the shmem buffer. This
* is set by the host when the shmem buffer is allocated, to allow for
* extending the shmem buffer with new fields. The size of the rsp
* memory region is the size of the shmem buffer (controlled by the
* guest) minus rsp_mem_offset.
*
* The guest should use the vdrm_shmem_has_field() macro to determine
* if the host supports a given field, ie. to handle compatibility of
* newer guest vs older host.
*
* Making the guest userspace responsible for backwards compatibility
* simplifies the host VMM.
*/
uint32_t rsp_mem_offset;
#define vdrm_shmem_has_field(shmem, field) ({ \
struct vdrm_shmem *_shmem = &(shmem)->base; \
(_shmem->rsp_mem_offset > offsetof(__typeof__(*(shmem)), field)); \
})
};
/**
* A Guest -> Host request header.
*/
struct vdrm_ccmd_req {
uint32_t cmd;
uint32_t len;
uint32_t seqno;
/* Offset into shmem ctrl buffer to write response. The host ensures
* that it doesn't write outside the bounds of the ctrl buffer, but
* otherwise it is up to the guest to manage allocation of where responses
* should be written in the ctrl buf.
*
* Only applicable for cmds that have a response message.
*/
uint32_t rsp_off;
};
/**
* A Guest <- Host response header.
*/
struct vdrm_ccmd_rsp {
uint32_t len;
};
#define DEFINE_CAST(parent, child) \
static inline struct child *to_##child(const struct parent *x) \
{ \
return (struct child *)x; \
}
#endif /* DRM_HW_H_ */
+74
View File
@@ -0,0 +1,74 @@
/*
* Copyright 2020 Chromium
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VENUS_HW_H
#define VENUS_HW_H
#include <stdint.h>
struct virgl_renderer_capset_venus {
uint32_t wire_format_version;
uint32_t vk_xml_version;
uint32_t vk_ext_command_serialization_spec_version;
uint32_t vk_mesa_venus_protocol_spec_version;
/* This flag indicates render server config, and will be needed until drm
* virtio-gpu blob mem gets fixed to attach_resource before resource_map.
*/
uint32_t supports_blob_id_0;
/* Extension number N, where N is defined by the Vulkan spec, corresponds
* to bit [N / 32] & (1 << N % 32). The below mask1 covers the first 1023
* Vulkan extensions (numbered from 1 to 1023).
*
* Bit (mask1[0] & 0x1) is used for backward compatibility purpose. When
* that bit is set, the extension mask(s) are valid. Otherwise, all the
* extensions are assumed to be supported by the renderer side protocol.
*/
uint32_t vk_extension_mask1[32];
/* The single-threaded renderer cannot afford potential blocking calls. It
* also leads to GPU lost if the wait depends on a following command. This
* capset allows such blocking calls to passthrough from the clients, and
* shifts the responsibilities to the client drivers.
*/
uint32_t allow_vk_wait_syncs;
/* This flag indicates that the renderer supports multiple fencing
* timelines. The client driver is expected to associate each VkQueue with
* one of these timelines at queue creation by binding it with an unused
* ring_idx. Queues created without a ring_idx binding are associated to a
* shared legacy timeline. The special ring_idx==0 is reserved for CPU
* fences that are signaled by the renderer immediately upon consumption of
* the associated renderer submission.
*/
uint32_t supports_multiple_timelines;
/* This flag indicates to the guest that hypervisor does not support memory
* pages injections and blob allocations must be done by guest from the
* dedicated heap (Host visible memory).
*/
uint32_t use_guest_vram;
};
#endif /* VENUS_HW_H */
+878
View File
@@ -0,0 +1,878 @@
/*
* Copyright 2014, 2015 Red Hat.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VIRGL_HW_H
#define VIRGL_HW_H
#include <stdint.h>
struct virgl_box {
uint32_t x, y, z;
uint32_t w, h, d;
};
/* formats known by the HW device - based on gallium subset */
enum virgl_formats {
VIRGL_FORMAT_NONE = 0,
VIRGL_FORMAT_B8G8R8A8_UNORM = 1,
VIRGL_FORMAT_B8G8R8X8_UNORM = 2,
VIRGL_FORMAT_A8R8G8B8_UNORM = 3,
VIRGL_FORMAT_X8R8G8B8_UNORM = 4,
VIRGL_FORMAT_B5G5R5A1_UNORM = 5,
VIRGL_FORMAT_B4G4R4A4_UNORM = 6,
VIRGL_FORMAT_B5G6R5_UNORM = 7,
VIRGL_FORMAT_R10G10B10A2_UNORM = 8,
VIRGL_FORMAT_L8_UNORM = 9, /**< ubyte luminance */
VIRGL_FORMAT_A8_UNORM = 10, /**< ubyte alpha */
VIRGL_FORMAT_I8_UNORM = 11,
VIRGL_FORMAT_L8A8_UNORM = 12, /**< ubyte alpha, luminance */
VIRGL_FORMAT_L16_UNORM = 13, /**< ushort luminance */
VIRGL_FORMAT_UYVY = 14,
VIRGL_FORMAT_YUYV = 15,
VIRGL_FORMAT_Z16_UNORM = 16,
VIRGL_FORMAT_Z32_UNORM = 17,
VIRGL_FORMAT_Z32_FLOAT = 18,
VIRGL_FORMAT_Z24_UNORM_S8_UINT = 19,
VIRGL_FORMAT_S8_UINT_Z24_UNORM = 20,
VIRGL_FORMAT_Z24X8_UNORM = 21,
VIRGL_FORMAT_X8Z24_UNORM = 22,
VIRGL_FORMAT_S8_UINT = 23, /**< ubyte stencil */
VIRGL_FORMAT_R64_FLOAT = 24,
VIRGL_FORMAT_R64G64_FLOAT = 25,
VIRGL_FORMAT_R64G64B64_FLOAT = 26,
VIRGL_FORMAT_R64G64B64A64_FLOAT = 27,
VIRGL_FORMAT_R32_FLOAT = 28,
VIRGL_FORMAT_R32G32_FLOAT = 29,
VIRGL_FORMAT_R32G32B32_FLOAT = 30,
VIRGL_FORMAT_R32G32B32A32_FLOAT = 31,
VIRGL_FORMAT_R32_UNORM = 32,
VIRGL_FORMAT_R32G32_UNORM = 33,
VIRGL_FORMAT_R32G32B32_UNORM = 34,
VIRGL_FORMAT_R32G32B32A32_UNORM = 35,
VIRGL_FORMAT_R32_USCALED = 36,
VIRGL_FORMAT_R32G32_USCALED = 37,
VIRGL_FORMAT_R32G32B32_USCALED = 38,
VIRGL_FORMAT_R32G32B32A32_USCALED = 39,
VIRGL_FORMAT_R32_SNORM = 40,
VIRGL_FORMAT_R32G32_SNORM = 41,
VIRGL_FORMAT_R32G32B32_SNORM = 42,
VIRGL_FORMAT_R32G32B32A32_SNORM = 43,
VIRGL_FORMAT_R32_SSCALED = 44,
VIRGL_FORMAT_R32G32_SSCALED = 45,
VIRGL_FORMAT_R32G32B32_SSCALED = 46,
VIRGL_FORMAT_R32G32B32A32_SSCALED = 47,
VIRGL_FORMAT_R16_UNORM = 48,
VIRGL_FORMAT_R16G16_UNORM = 49,
VIRGL_FORMAT_R16G16B16_UNORM = 50,
VIRGL_FORMAT_R16G16B16A16_UNORM = 51,
VIRGL_FORMAT_R16_USCALED = 52,
VIRGL_FORMAT_R16G16_USCALED = 53,
VIRGL_FORMAT_R16G16B16_USCALED = 54,
VIRGL_FORMAT_R16G16B16A16_USCALED = 55,
VIRGL_FORMAT_R16_SNORM = 56,
VIRGL_FORMAT_R16G16_SNORM = 57,
VIRGL_FORMAT_R16G16B16_SNORM = 58,
VIRGL_FORMAT_R16G16B16A16_SNORM = 59,
VIRGL_FORMAT_R16_SSCALED = 60,
VIRGL_FORMAT_R16G16_SSCALED = 61,
VIRGL_FORMAT_R16G16B16_SSCALED = 62,
VIRGL_FORMAT_R16G16B16A16_SSCALED = 63,
VIRGL_FORMAT_R8_UNORM = 64,
VIRGL_FORMAT_R8G8_UNORM = 65,
VIRGL_FORMAT_R8G8B8_UNORM = 66,
VIRGL_FORMAT_R8G8B8A8_UNORM = 67,
VIRGL_FORMAT_X8B8G8R8_UNORM = 68,
VIRGL_FORMAT_R8_USCALED = 69,
VIRGL_FORMAT_R8G8_USCALED = 70,
VIRGL_FORMAT_R8G8B8_USCALED = 71,
VIRGL_FORMAT_R8G8B8A8_USCALED = 72,
VIRGL_FORMAT_R8_SNORM = 74,
VIRGL_FORMAT_R8G8_SNORM = 75,
VIRGL_FORMAT_R8G8B8_SNORM = 76,
VIRGL_FORMAT_R8G8B8A8_SNORM = 77,
VIRGL_FORMAT_R8_SSCALED = 82,
VIRGL_FORMAT_R8G8_SSCALED = 83,
VIRGL_FORMAT_R8G8B8_SSCALED = 84,
VIRGL_FORMAT_R8G8B8A8_SSCALED = 85,
VIRGL_FORMAT_R32_FIXED = 87,
VIRGL_FORMAT_R32G32_FIXED = 88,
VIRGL_FORMAT_R32G32B32_FIXED = 89,
VIRGL_FORMAT_R32G32B32A32_FIXED = 90,
VIRGL_FORMAT_R16_FLOAT = 91,
VIRGL_FORMAT_R16G16_FLOAT = 92,
VIRGL_FORMAT_R16G16B16_FLOAT = 93,
VIRGL_FORMAT_R16G16B16A16_FLOAT = 94,
VIRGL_FORMAT_L8_SRGB = 95,
VIRGL_FORMAT_L8A8_SRGB = 96,
VIRGL_FORMAT_R8G8B8_SRGB = 97,
VIRGL_FORMAT_A8B8G8R8_SRGB = 98,
VIRGL_FORMAT_X8B8G8R8_SRGB = 99,
VIRGL_FORMAT_B8G8R8A8_SRGB = 100,
VIRGL_FORMAT_B8G8R8X8_SRGB = 101,
VIRGL_FORMAT_A8R8G8B8_SRGB = 102,
VIRGL_FORMAT_X8R8G8B8_SRGB = 103,
VIRGL_FORMAT_R8G8B8A8_SRGB = 104,
/* compressed formats */
VIRGL_FORMAT_DXT1_RGB = 105,
VIRGL_FORMAT_DXT1_RGBA = 106,
VIRGL_FORMAT_DXT3_RGBA = 107,
VIRGL_FORMAT_DXT5_RGBA = 108,
/* sRGB, compressed */
VIRGL_FORMAT_DXT1_SRGB = 109,
VIRGL_FORMAT_DXT1_SRGBA = 110,
VIRGL_FORMAT_DXT3_SRGBA = 111,
VIRGL_FORMAT_DXT5_SRGBA = 112,
/* rgtc compressed */
VIRGL_FORMAT_RGTC1_UNORM = 113,
VIRGL_FORMAT_RGTC1_SNORM = 114,
VIRGL_FORMAT_RGTC2_UNORM = 115,
VIRGL_FORMAT_RGTC2_SNORM = 116,
VIRGL_FORMAT_R8G8_B8G8_UNORM = 117,
VIRGL_FORMAT_G8R8_G8B8_UNORM = 118,
VIRGL_FORMAT_R8SG8SB8UX8U_NORM = 119,
VIRGL_FORMAT_R5SG5SB6U_NORM = 120,
VIRGL_FORMAT_A8B8G8R8_UNORM = 121,
VIRGL_FORMAT_B5G5R5X1_UNORM = 122,
VIRGL_FORMAT_R10G10B10A2_USCALED = 123,
VIRGL_FORMAT_R11G11B10_FLOAT = 124,
VIRGL_FORMAT_R9G9B9E5_FLOAT = 125,
VIRGL_FORMAT_Z32_FLOAT_S8X24_UINT = 126,
VIRGL_FORMAT_R1_UNORM = 127,
VIRGL_FORMAT_R10G10B10X2_USCALED = 128,
VIRGL_FORMAT_R10G10B10X2_SNORM = 129,
VIRGL_FORMAT_L4A4_UNORM = 130,
VIRGL_FORMAT_B10G10R10A2_UNORM = 131,
VIRGL_FORMAT_R10SG10SB10SA2U_NORM = 132,
VIRGL_FORMAT_R8G8Bx_SNORM = 133,
VIRGL_FORMAT_R8G8B8X8_UNORM = 134,
VIRGL_FORMAT_B4G4R4X4_UNORM = 135,
VIRGL_FORMAT_X24S8_UINT = 136,
VIRGL_FORMAT_S8X24_UINT = 137,
VIRGL_FORMAT_X32_S8X24_UINT = 138,
VIRGL_FORMAT_B2G3R3_UNORM = 139,
VIRGL_FORMAT_L16A16_UNORM = 140,
VIRGL_FORMAT_A16_UNORM = 141,
VIRGL_FORMAT_I16_UNORM = 142,
VIRGL_FORMAT_LATC1_UNORM = 143,
VIRGL_FORMAT_LATC1_SNORM = 144,
VIRGL_FORMAT_LATC2_UNORM = 145,
VIRGL_FORMAT_LATC2_SNORM = 146,
VIRGL_FORMAT_A8_SNORM = 147,
VIRGL_FORMAT_L8_SNORM = 148,
VIRGL_FORMAT_L8A8_SNORM = 149,
VIRGL_FORMAT_I8_SNORM = 150,
VIRGL_FORMAT_A16_SNORM = 151,
VIRGL_FORMAT_L16_SNORM = 152,
VIRGL_FORMAT_L16A16_SNORM = 153,
VIRGL_FORMAT_I16_SNORM = 154,
VIRGL_FORMAT_A16_FLOAT = 155,
VIRGL_FORMAT_L16_FLOAT = 156,
VIRGL_FORMAT_L16A16_FLOAT = 157,
VIRGL_FORMAT_I16_FLOAT = 158,
VIRGL_FORMAT_A32_FLOAT = 159,
VIRGL_FORMAT_L32_FLOAT = 160,
VIRGL_FORMAT_L32A32_FLOAT = 161,
VIRGL_FORMAT_I32_FLOAT = 162,
VIRGL_FORMAT_YV12 = 163,
VIRGL_FORMAT_YV16 = 164,
VIRGL_FORMAT_IYUV = 165, /**< aka I420 */
VIRGL_FORMAT_NV12 = 166,
VIRGL_FORMAT_NV21 = 167,
VIRGL_FORMAT_A4R4_UNORM = 168,
VIRGL_FORMAT_R4A4_UNORM = 169,
VIRGL_FORMAT_R8A8_UNORM = 170,
VIRGL_FORMAT_A8R8_UNORM = 171,
VIRGL_FORMAT_R10G10B10A2_SSCALED = 172,
VIRGL_FORMAT_R10G10B10A2_SNORM = 173,
VIRGL_FORMAT_B10G10R10A2_USCALED = 174,
VIRGL_FORMAT_B10G10R10A2_SSCALED = 175,
VIRGL_FORMAT_B10G10R10A2_SNORM = 176,
VIRGL_FORMAT_R8_UINT = 177,
VIRGL_FORMAT_R8G8_UINT = 178,
VIRGL_FORMAT_R8G8B8_UINT = 179,
VIRGL_FORMAT_R8G8B8A8_UINT = 180,
VIRGL_FORMAT_R8_SINT = 181,
VIRGL_FORMAT_R8G8_SINT = 182,
VIRGL_FORMAT_R8G8B8_SINT = 183,
VIRGL_FORMAT_R8G8B8A8_SINT = 184,
VIRGL_FORMAT_R16_UINT = 185,
VIRGL_FORMAT_R16G16_UINT = 186,
VIRGL_FORMAT_R16G16B16_UINT = 187,
VIRGL_FORMAT_R16G16B16A16_UINT = 188,
VIRGL_FORMAT_R16_SINT = 189,
VIRGL_FORMAT_R16G16_SINT = 190,
VIRGL_FORMAT_R16G16B16_SINT = 191,
VIRGL_FORMAT_R16G16B16A16_SINT = 192,
VIRGL_FORMAT_R32_UINT = 193,
VIRGL_FORMAT_R32G32_UINT = 194,
VIRGL_FORMAT_R32G32B32_UINT = 195,
VIRGL_FORMAT_R32G32B32A32_UINT = 196,
VIRGL_FORMAT_R32_SINT = 197,
VIRGL_FORMAT_R32G32_SINT = 198,
VIRGL_FORMAT_R32G32B32_SINT = 199,
VIRGL_FORMAT_R32G32B32A32_SINT = 200,
VIRGL_FORMAT_A8_UINT = 201,
VIRGL_FORMAT_I8_UINT = 202,
VIRGL_FORMAT_L8_UINT = 203,
VIRGL_FORMAT_L8A8_UINT = 204,
VIRGL_FORMAT_A8_SINT = 205,
VIRGL_FORMAT_I8_SINT = 206,
VIRGL_FORMAT_L8_SINT = 207,
VIRGL_FORMAT_L8A8_SINT = 208,
VIRGL_FORMAT_A16_UINT = 209,
VIRGL_FORMAT_I16_UINT = 210,
VIRGL_FORMAT_L16_UINT = 211,
VIRGL_FORMAT_L16A16_UINT = 212,
VIRGL_FORMAT_A16_SINT = 213,
VIRGL_FORMAT_I16_SINT = 214,
VIRGL_FORMAT_L16_SINT = 215,
VIRGL_FORMAT_L16A16_SINT = 216,
VIRGL_FORMAT_A32_UINT = 217,
VIRGL_FORMAT_I32_UINT = 218,
VIRGL_FORMAT_L32_UINT = 219,
VIRGL_FORMAT_L32A32_UINT = 220,
VIRGL_FORMAT_A32_SINT = 221,
VIRGL_FORMAT_I32_SINT = 222,
VIRGL_FORMAT_L32_SINT = 223,
VIRGL_FORMAT_L32A32_SINT = 224,
VIRGL_FORMAT_B10G10R10A2_UINT = 225,
VIRGL_FORMAT_ETC1_RGB8 = 226,
VIRGL_FORMAT_R8G8_R8B8_UNORM = 227,
VIRGL_FORMAT_G8R8_B8R8_UNORM = 228,
VIRGL_FORMAT_R8G8B8X8_SNORM = 229,
VIRGL_FORMAT_R8G8B8X8_SRGB = 230,
VIRGL_FORMAT_R8G8B8X8_UINT = 231,
VIRGL_FORMAT_R8G8B8X8_SINT = 232,
VIRGL_FORMAT_B10G10R10X2_UNORM = 233,
VIRGL_FORMAT_R16G16B16X16_UNORM = 234,
VIRGL_FORMAT_R16G16B16X16_SNORM = 235,
VIRGL_FORMAT_R16G16B16X16_FLOAT = 236,
VIRGL_FORMAT_R16G16B16X16_UINT = 237,
VIRGL_FORMAT_R16G16B16X16_SINT = 238,
VIRGL_FORMAT_R32G32B32X32_FLOAT = 239,
VIRGL_FORMAT_R32G32B32X32_UINT = 240,
VIRGL_FORMAT_R32G32B32X32_SINT = 241,
VIRGL_FORMAT_R8A8_SNORM = 242,
VIRGL_FORMAT_R16A16_UNORM = 243,
VIRGL_FORMAT_R16A16_SNORM = 244,
VIRGL_FORMAT_R16A16_FLOAT = 245,
VIRGL_FORMAT_R32A32_FLOAT = 246,
VIRGL_FORMAT_R8A8_UINT = 247,
VIRGL_FORMAT_R8A8_SINT = 248,
VIRGL_FORMAT_R16A16_UINT = 249,
VIRGL_FORMAT_R16A16_SINT = 250,
VIRGL_FORMAT_R32A32_UINT = 251,
VIRGL_FORMAT_R32A32_SINT = 252,
VIRGL_FORMAT_R10G10B10A2_UINT = 253,
VIRGL_FORMAT_B5G6R5_SRGB = 254,
VIRGL_FORMAT_BPTC_RGBA_UNORM = 255,
VIRGL_FORMAT_BPTC_SRGBA = 256,
VIRGL_FORMAT_BPTC_RGB_FLOAT = 257,
VIRGL_FORMAT_BPTC_RGB_UFLOAT = 258,
/*VIRGL_FORMAT_A8L8_UNORM = 259, Removed and no user */
/*VIRGL_FORMAT_A8L8_SNORM = 260, Removed and no user */
/*VIRGL_FORMAT_A8L8_SRGB = 261, Removed and no user */
/*VIRGL_FORMAT_A16L16_UNORM = 262, Removed and no user */
VIRGL_FORMAT_G8R8_UNORM = 263,
VIRGL_FORMAT_G8R8_SNORM = 264,
VIRGL_FORMAT_G16R16_UNORM = 265,
VIRGL_FORMAT_G16R16_SNORM = 266,
VIRGL_FORMAT_A8B8G8R8_SNORM = 267,
VIRGL_FORMAT_X8B8G8R8_SNORM = 268,
/* etc2 compressed */
VIRGL_FORMAT_ETC2_RGB8 = 269,
VIRGL_FORMAT_ETC2_SRGB8 = 270,
VIRGL_FORMAT_ETC2_RGB8A1 = 271,
VIRGL_FORMAT_ETC2_SRGB8A1 = 272,
VIRGL_FORMAT_ETC2_RGBA8 = 273,
VIRGL_FORMAT_ETC2_SRGBA8 = 274,
VIRGL_FORMAT_ETC2_R11_UNORM = 275,
VIRGL_FORMAT_ETC2_R11_SNORM = 276,
VIRGL_FORMAT_ETC2_RG11_UNORM = 277,
VIRGL_FORMAT_ETC2_RG11_SNORM = 278,
/* astc compressed */
VIRGL_FORMAT_ASTC_4x4 = 279,
VIRGL_FORMAT_ASTC_5x4 = 280,
VIRGL_FORMAT_ASTC_5x5 = 281,
VIRGL_FORMAT_ASTC_6x5 = 282,
VIRGL_FORMAT_ASTC_6x6 = 283,
VIRGL_FORMAT_ASTC_8x5 = 284,
VIRGL_FORMAT_ASTC_8x6 = 285,
VIRGL_FORMAT_ASTC_8x8 = 286,
VIRGL_FORMAT_ASTC_10x5 = 287,
VIRGL_FORMAT_ASTC_10x6 = 288,
VIRGL_FORMAT_ASTC_10x8 = 289,
VIRGL_FORMAT_ASTC_10x10 = 290,
VIRGL_FORMAT_ASTC_12x10 = 291,
VIRGL_FORMAT_ASTC_12x12 = 292,
VIRGL_FORMAT_ASTC_4x4_SRGB = 293,
VIRGL_FORMAT_ASTC_5x4_SRGB = 294,
VIRGL_FORMAT_ASTC_5x5_SRGB = 295,
VIRGL_FORMAT_ASTC_6x5_SRGB = 296,
VIRGL_FORMAT_ASTC_6x6_SRGB = 297,
VIRGL_FORMAT_ASTC_8x5_SRGB = 298,
VIRGL_FORMAT_ASTC_8x6_SRGB = 299,
VIRGL_FORMAT_ASTC_8x8_SRGB = 300,
VIRGL_FORMAT_ASTC_10x5_SRGB = 301,
VIRGL_FORMAT_ASTC_10x6_SRGB = 302,
VIRGL_FORMAT_ASTC_10x8_SRGB = 303,
VIRGL_FORMAT_ASTC_10x10_SRGB = 304,
VIRGL_FORMAT_ASTC_12x10_SRGB = 305,
VIRGL_FORMAT_ASTC_12x12_SRGB = 306,
VIRGL_FORMAT_R10G10B10X2_UNORM = 308,
VIRGL_FORMAT_A4B4G4R4_UNORM = 311,
VIRGL_FORMAT_R8_SRGB = 312,
VIRGL_FORMAT_R8G8_SRGB = 313,
VIRGL_FORMAT_P010 = 314,
VIRGL_FORMAT_P012 = 315,
VIRGL_FORMAT_P016 = 316,
VIRGL_FORMAT_B8G8R8_UNORM = 317,
VIRGL_FORMAT_R3G3B2_UNORM = 318,
VIRGL_FORMAT_R4G4B4A4_UNORM = 319,
VIRGL_FORMAT_R5G5B5A1_UNORM = 320,
VIRGL_FORMAT_R5G6B5_UNORM = 321,
VIRGL_FORMAT_Y8_400_UNORM = 322,
VIRGL_FORMAT_Y8_U8_V8_444_UNORM = 323,
VIRGL_FORMAT_Y8_U8_V8_422_UNORM = 324,
VIRGL_FORMAT_NV16 = 325, /* aka Y8_U8V8_422_UNORM */
VIRGL_FORMAT_Y8_UNORM = 326,
VIRGL_FORMAT_YVYU = 327,
VIRGL_FORMAT_Z16_UNORM_S8_UINT = 328,
VIRGL_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8 = 329,
VIRGL_FORMAT_A1B5G5R5_UINT = 330,
VIRGL_FORMAT_A1B5G5R5_UNORM = 331,
VIRGL_FORMAT_A1R5G5B5_UINT = 332,
VIRGL_FORMAT_A1R5G5B5_UNORM = 333,
VIRGL_FORMAT_A2B10G10R10_UINT = 334,
VIRGL_FORMAT_A2B10G10R10_UNORM = 335,
VIRGL_FORMAT_A2R10G10B10_UINT = 336,
VIRGL_FORMAT_A2R10G10B10_UNORM = 337,
VIRGL_FORMAT_A4B4G4R4_UINT = 338,
VIRGL_FORMAT_A4R4G4B4_UINT = 339,
VIRGL_FORMAT_A4R4G4B4_UNORM = 340,
VIRGL_FORMAT_A8B8G8R8_SINT = 341,
VIRGL_FORMAT_A8B8G8R8_SSCALED = 342,
VIRGL_FORMAT_A8B8G8R8_UINT = 343,
VIRGL_FORMAT_A8B8G8R8_USCALED = 344,
VIRGL_FORMAT_A8R8G8B8_SINT = 345,
VIRGL_FORMAT_A8R8G8B8_SNORM = 346,
VIRGL_FORMAT_A8R8G8B8_UINT = 347,
VIRGL_FORMAT_ASTC_3x3x3 = 348,
VIRGL_FORMAT_ASTC_3x3x3_SRGB = 349,
VIRGL_FORMAT_ASTC_4x3x3 = 350,
VIRGL_FORMAT_ASTC_4x3x3_SRGB = 351,
VIRGL_FORMAT_ASTC_4x4x3 = 352,
VIRGL_FORMAT_ASTC_4x4x3_SRGB = 353,
VIRGL_FORMAT_ASTC_4x4x4 = 354,
VIRGL_FORMAT_ASTC_4x4x4_SRGB = 355,
VIRGL_FORMAT_ASTC_5x4x4 = 356,
VIRGL_FORMAT_ASTC_5x4x4_SRGB = 357,
VIRGL_FORMAT_ASTC_5x5x4 = 358,
VIRGL_FORMAT_ASTC_5x5x4_SRGB = 359,
VIRGL_FORMAT_ASTC_5x5x5 = 360,
VIRGL_FORMAT_ASTC_5x5x5_SRGB = 361,
VIRGL_FORMAT_ASTC_6x5x5 = 362,
VIRGL_FORMAT_ASTC_6x5x5_SRGB = 363,
VIRGL_FORMAT_ASTC_6x6x5 = 364,
VIRGL_FORMAT_ASTC_6x6x5_SRGB = 365,
VIRGL_FORMAT_ASTC_6x6x6 = 366,
VIRGL_FORMAT_ASTC_6x6x6_SRGB = 367,
VIRGL_FORMAT_ATC_RGB = 368,
VIRGL_FORMAT_ATC_RGBA_EXPLICIT = 369,
VIRGL_FORMAT_ATC_RGBA_INTERPOLATED = 370,
VIRGL_FORMAT_AYUV = 371,
VIRGL_FORMAT_B10G10R10A2_SINT = 372,
VIRGL_FORMAT_B10G10R10X2_SINT = 373,
VIRGL_FORMAT_B10G10R10X2_SNORM = 374,
VIRGL_FORMAT_B2G3R3_UINT = 375,
VIRGL_FORMAT_B4G4R4A4_UINT = 376,
VIRGL_FORMAT_B5G5R5A1_UINT = 377,
VIRGL_FORMAT_B5G6R5_UINT = 378,
VIRGL_FORMAT_B8G8R8A8_SINT = 379,
VIRGL_FORMAT_B8G8R8A8_SNORM = 380,
VIRGL_FORMAT_B8G8R8A8_SSCALED = 381,
VIRGL_FORMAT_B8G8R8A8_UINT = 382,
VIRGL_FORMAT_B8G8R8A8_USCALED = 383,
VIRGL_FORMAT_B8G8_R8G8_UNORM = 384,
VIRGL_FORMAT_B8G8R8_SINT = 385,
VIRGL_FORMAT_B8G8R8_SNORM = 386,
VIRGL_FORMAT_B8G8R8_SRGB = 387,
VIRGL_FORMAT_B8G8R8_SSCALED = 388,
VIRGL_FORMAT_B8G8R8_UINT = 389,
VIRGL_FORMAT_B8G8R8_USCALED = 390,
VIRGL_FORMAT_B8G8R8X8_SINT = 391,
VIRGL_FORMAT_B8G8R8X8_SNORM = 392,
VIRGL_FORMAT_B8G8R8X8_UINT = 393,
VIRGL_FORMAT_B8R8_G8R8_UNORM = 394,
VIRGL_FORMAT_FXT1_RGB = 395,
VIRGL_FORMAT_FXT1_RGBA = 396,
VIRGL_FORMAT_G16R16_SINT = 397,
VIRGL_FORMAT_G8B8_G8R8_UNORM = 398,
VIRGL_FORMAT_G8_B8_R8_420_UNORM = 399,
VIRGL_FORMAT_G8_B8R8_420_UNORM = 400,
VIRGL_FORMAT_G8R8_SINT = 401,
VIRGL_FORMAT_P030 = 402,
VIRGL_FORMAT_R10G10B10A2_SINT = 403,
VIRGL_FORMAT_R10G10B10X2_SINT = 404,
VIRGL_FORMAT_R3G3B2_UINT = 405,
VIRGL_FORMAT_R4G4B4A4_UINT = 406,
VIRGL_FORMAT_R4G4B4X4_UNORM = 407,
VIRGL_FORMAT_R5G5B5A1_UINT = 408,
VIRGL_FORMAT_R5G5B5X1_UNORM = 409,
VIRGL_FORMAT_R5G6B5_SRGB = 410,
VIRGL_FORMAT_R5G6B5_UINT = 411,
VIRGL_FORMAT_R64G64B64A64_SINT = 412,
VIRGL_FORMAT_R64G64B64A64_UINT = 413,
VIRGL_FORMAT_R64G64B64_SINT = 414,
VIRGL_FORMAT_R64G64B64_UINT = 415,
VIRGL_FORMAT_R64G64_SINT = 416,
VIRGL_FORMAT_R64G64_UINT = 417,
VIRGL_FORMAT_R64_SINT = 418,
VIRGL_FORMAT_R64_UINT = 419, /**< raw doubles (ARB_vertex_attrib_64bit) */
VIRGL_FORMAT_R8_B8_G8_420_UNORM = 420,
VIRGL_FORMAT_R8_B8G8_420_UNORM = 421,
VIRGL_FORMAT_R8B8_R8G8_UNORM = 422,
VIRGL_FORMAT_R8_G8_B8_420_UNORM = 423,
VIRGL_FORMAT_R8_G8B8_420_UNORM = 424,
VIRGL_FORMAT_R8_G8_B8_UNORM = 425,
VIRGL_FORMAT_VYUY = 426,
VIRGL_FORMAT_X1B5G5R5_UNORM = 427,
VIRGL_FORMAT_X1R5G5B5_UNORM = 428,
VIRGL_FORMAT_XYUV = 429,
VIRGL_FORMAT_X8B8G8R8_SINT = 430,
VIRGL_FORMAT_X8R8G8B8_SINT = 431,
VIRGL_FORMAT_X8R8G8B8_SNORM = 432,
VIRGL_FORMAT_Y16_U16_V16_420_UNORM = 433,
VIRGL_FORMAT_Y16_U16_V16_422_UNORM = 434,
VIRGL_FORMAT_Y16_U16V16_422_UNORM = 435,
VIRGL_FORMAT_Y16_U16_V16_444_UNORM = 436,
VIRGL_FORMAT_Y210 = 437,
VIRGL_FORMAT_Y212 = 438,
VIRGL_FORMAT_Y216 = 439,
VIRGL_FORMAT_Y410 = 440,
VIRGL_FORMAT_Y412 = 441,
VIRGL_FORMAT_Y416 = 442,
VIRGL_FORMAT_NV15 = 443,
VIRGL_FORMAT_NV20 = 444,
VIRGL_FORMAT_Y8_U8_V8_440_UNORM = 445,
VIRGL_FORMAT_R10_G10B10_420_UNORM = 446,
VIRGL_FORMAT_R10_G10B10_422_UNORM = 447,
VIRGL_FORMAT_X6G10_X6B10X6R10_420_UNORM = 448,
VIRGL_FORMAT_X4G12_X4B12X4R12_420_UNORM = 449,
VIRGL_FORMAT_X6R10_UNORM = 450,
VIRGL_FORMAT_X6R10X6G10_UNORM = 451,
VIRGL_FORMAT_X4R12_UNORM = 452,
VIRGL_FORMAT_X4R12X4G12_UNORM = 453,
VIRGL_FORMAT_R8_G8B8_422_UNORM = 454,
VIRGL_FORMAT_R8_B8G8_422_UNORM = 455,
VIRGL_FORMAT_G8_B8R8_422_UNORM = 456,
VIRGL_FORMAT_ASTC_4x4_FLOAT = 457,
VIRGL_FORMAT_ASTC_5x4_FLOAT = 458,
VIRGL_FORMAT_ASTC_5x5_FLOAT = 459,
VIRGL_FORMAT_ASTC_6x5_FLOAT = 460,
VIRGL_FORMAT_ASTC_6x6_FLOAT = 461,
VIRGL_FORMAT_ASTC_8x5_FLOAT = 462,
VIRGL_FORMAT_ASTC_8x6_FLOAT = 463,
VIRGL_FORMAT_ASTC_8x8_FLOAT = 464,
VIRGL_FORMAT_ASTC_10x5_FLOAT = 465,
VIRGL_FORMAT_ASTC_10x6_FLOAT = 466,
VIRGL_FORMAT_ASTC_10x8_FLOAT = 467,
VIRGL_FORMAT_ASTC_10x10_FLOAT = 468,
VIRGL_FORMAT_ASTC_12x10_FLOAT = 469,
VIRGL_FORMAT_ASTC_12x12_FLOAT = 470,
VIRGL_FORMAT_Y8U8V8_420_UNORM_PACKED = 471,
VIRGL_FORMAT_Y10U10V10_420_UNORM_PACKED = 472,
VIRGL_FORMAT_R8G8B8_420_UNORM_PACKED = 473,
VIRGL_FORMAT_R10G10B10_420_UNORM_PACKED = 474,
VIRGL_FORMAT_Y10X6_U10X6_V10X6_420_UNORM = 475,
VIRGL_FORMAT_Y10X6_U10X6_V10X6_422_UNORM = 476,
VIRGL_FORMAT_Y10X6_U10X6_V10X6_444_UNORM = 477,
VIRGL_FORMAT_Y12X4_U12X4_V12X4_420_UNORM = 478,
VIRGL_FORMAT_Y12X4_U12X4_V12X4_422_UNORM = 479,
VIRGL_FORMAT_Y12X4_U12X4_V12X4_444_UNORM = 480,
VIRGL_FORMAT_MAX /* = PIPE_FORMAT_COUNT */,
/* Below formats must not be used in the guest. */
VIRGL_FORMAT_B8G8R8X8_UNORM_EMULATED,
VIRGL_FORMAT_B8G8R8A8_UNORM_EMULATED,
VIRGL_FORMAT_MAX_EXTENDED
};
/* These are used by the capability_bits field in virgl_caps_v2. */
#define VIRGL_CAP_NONE 0u
#define VIRGL_CAP_TGSI_INVARIANT (1u << 0)
#define VIRGL_CAP_TEXTURE_VIEW (1u << 1)
#define VIRGL_CAP_SET_MIN_SAMPLES (1u << 2)
#define VIRGL_CAP_COPY_IMAGE (1u << 3)
#define VIRGL_CAP_TGSI_PRECISE (1u << 4)
#define VIRGL_CAP_TXQS (1u << 5)
#define VIRGL_CAP_MEMORY_BARRIER (1u << 6)
#define VIRGL_CAP_COMPUTE_SHADER (1u << 7)
#define VIRGL_CAP_FB_NO_ATTACH (1u << 8)
#define VIRGL_CAP_ROBUST_BUFFER_ACCESS (1u << 9)
#define VIRGL_CAP_TGSI_FBFETCH (1u << 10)
#define VIRGL_CAP_SHADER_CLOCK (1u << 11)
#define VIRGL_CAP_TEXTURE_BARRIER (1u << 12)
#define VIRGL_CAP_TGSI_COMPONENTS (1u << 13)
#define VIRGL_CAP_GUEST_MAY_INIT_LOG (1u << 14)
#define VIRGL_CAP_SRGB_WRITE_CONTROL (1u << 15)
#define VIRGL_CAP_QBO (1u << 16)
#define VIRGL_CAP_TRANSFER (1u << 17)
#define VIRGL_CAP_FBO_MIXED_COLOR_FORMATS (1u << 18)
#define VIRGL_CAP_HOST_IS_GLES (1u << 19)
#define VIRGL_CAP_BIND_COMMAND_ARGS (1u << 20)
#define VIRGL_CAP_MULTI_DRAW_INDIRECT (1u << 21)
#define VIRGL_CAP_INDIRECT_PARAMS (1u << 22)
#define VIRGL_CAP_TRANSFORM_FEEDBACK3 (1u << 23)
#define VIRGL_CAP_3D_ASTC (1u << 24)
#define VIRGL_CAP_INDIRECT_INPUT_ADDR (1u << 25)
#define VIRGL_CAP_COPY_TRANSFER (1u << 26)
#define VIRGL_CAP_CLIP_HALFZ (1u << 27)
#define VIRGL_CAP_APP_TWEAK_SUPPORT (1u << 28)
#define VIRGL_CAP_BGRA_SRGB_IS_EMULATED (1u << 29)
#define VIRGL_CAP_CLEAR_TEXTURE (1u << 30)
#define VIRGL_CAP_ARB_BUFFER_STORAGE (1u << 31)
// Legacy alias
#define VIRGL_CAP_FAKE_FP64 VIRGL_CAP_HOST_IS_GLES
/* These are used by the capability_bits_v2 field in virgl_caps_v2. */
#define VIRGL_CAP_V2_BLEND_EQUATION (1u << 0)
#define VIRGL_CAP_V2_UNTYPED_RESOURCE (1u << 1)
#define VIRGL_CAP_V2_VIDEO_MEMORY (1u << 2)
#define VIRGL_CAP_V2_MEMINFO (1u << 3)
#define VIRGL_CAP_V2_STRING_MARKER (1u << 4)
#define VIRGL_CAP_V2_DIFFERENT_GPU (1u << 5)
#define VIRGL_CAP_V2_IMPLICIT_MSAA (1u << 6)
#define VIRGL_CAP_V2_COPY_TRANSFER_BOTH_DIRECTIONS (1u << 7)
#define VIRGL_CAP_V2_SCANOUT_USES_GBM (1u << 8)
#define VIRGL_CAP_V2_SSO (1u << 9)
#define VIRGL_CAP_V2_TEXTURE_SHADOW_LOD (1u << 10)
#define VIRGL_CAP_V2_VS_VERTEX_LAYER (1u << 11)
#define VIRGL_CAP_V2_VS_VIEWPORT_INDEX (1u << 12)
#define VIRGL_CAP_V2_PIPELINE_STATISTICS_QUERY (1u << 13)
#define VIRGL_CAP_V2_DRAW_PARAMETERS (1u << 14)
#define VIRGL_CAP_V2_GROUP_VOTE (1u << 15)
#define VIRGL_CAP_V2_MIRROR_CLAMP_TO_EDGE (1u << 16)
#define VIRGL_CAP_V2_MIRROR_CLAMP (1u << 17)
#define VIRGL_CAP_V2_RESOURCE_LAYOUT (1u << 18)
/* virgl bind flags - these are compatible with mesa 10.5 gallium.
* but are fixed, no other should be passed to virgl either.
*/
#define VIRGL_BIND_DEPTH_STENCIL (1u << 0)
#define VIRGL_BIND_RENDER_TARGET (1u << 1)
#define VIRGL_BIND_SAMPLER_VIEW (1u << 3)
#define VIRGL_BIND_VERTEX_BUFFER (1u << 4)
#define VIRGL_BIND_INDEX_BUFFER (1u << 5)
#define VIRGL_BIND_CONSTANT_BUFFER (1u << 6)
#define VIRGL_BIND_DISPLAY_TARGET (1u << 7)
#define VIRGL_BIND_COMMAND_ARGS (1u << 8)
#define VIRGL_BIND_STREAM_OUTPUT (1u << 11)
#define VIRGL_BIND_SHADER_BUFFER (1u << 14)
#define VIRGL_BIND_QUERY_BUFFER (1u << 15)
#define VIRGL_BIND_CURSOR (1u << 16)
#define VIRGL_BIND_CUSTOM (1u << 17)
#define VIRGL_BIND_SCANOUT (1u << 18)
/* Used for buffers that are backed by guest storage and
* are only read by the host.
*/
#define VIRGL_BIND_STAGING (1u << 19)
#define VIRGL_BIND_SHARED (1u << 20)
#define VIRGL_BIND_PREFER_EMULATED_BGRA (1u << 21) /* non-functional */
#define VIRGL_BIND_LINEAR (1u << 22)
#define VIRGL_BIND_SHARED_SUBFLAGS (0xffu << 24)
#define VIRGL_BIND_MINIGBM_CAMERA_WRITE (1u << 24)
#define VIRGL_BIND_MINIGBM_CAMERA_READ (1u << 25)
#define VIRGL_BIND_MINIGBM_HW_VIDEO_DECODER (1u << 26)
#define VIRGL_BIND_MINIGBM_HW_VIDEO_ENCODER (1u << 27)
#define VIRGL_BIND_MINIGBM_SW_READ_OFTEN (1u << 28)
#define VIRGL_BIND_MINIGBM_SW_READ_RARELY (1u << 29)
#define VIRGL_BIND_MINIGBM_SW_WRITE_OFTEN (1u << 30)
#define VIRGL_BIND_MINIGBM_SW_WRITE_RARELY (1u << 31)
#define VIRGL_BIND_MINIGBM_PROTECTED (0xfu << 28) // Mutually exclusive with SW_ flags
struct virgl_caps_bool_set1 {
unsigned indep_blend_enable:1;
unsigned indep_blend_func:1;
unsigned cube_map_array:1;
unsigned shader_stencil_export:1;
unsigned conditional_render:1;
unsigned start_instance:1;
unsigned primitive_restart:1;
unsigned blend_eq_sep:1;
unsigned instanceid:1;
unsigned vertex_element_instance_divisor:1;
unsigned seamless_cube_map:1;
unsigned occlusion_query:1;
unsigned timer_query:1;
unsigned streamout_pause_resume:1;
unsigned texture_multisample:1;
unsigned fragment_coord_conventions:1;
unsigned depth_clip_disable:1;
unsigned seamless_cube_map_per_texture:1;
unsigned ubo:1;
unsigned color_clamping:1; /* not in GL 3.1 core profile */
unsigned poly_stipple:1; /* not in GL 3.1 core profile */
unsigned mirror_clamp:1;
unsigned texture_query_lod:1;
unsigned has_fp64:1;
unsigned has_tessellation_shaders:1;
unsigned has_indirect_draw:1;
unsigned has_sample_shading:1;
unsigned has_cull:1;
unsigned conditional_render_inverted:1;
unsigned derivative_control:1;
unsigned polygon_offset_clamp:1;
unsigned transform_feedback_overflow_query:1;
/* DO NOT ADD ANYMORE MEMBERS - need to add another 32-bit to v2 caps */
};
/* endless expansion capabilites - current gallium has 252 formats */
struct virgl_supported_format_mask {
uint32_t bitmask[16];
};
/* capabilities set 2 - version 1 - 32-bit and float values */
struct virgl_caps_v1 {
uint32_t max_version;
struct virgl_supported_format_mask sampler;
struct virgl_supported_format_mask render;
struct virgl_supported_format_mask depthstencil;
struct virgl_supported_format_mask vertexbuffer;
struct virgl_caps_bool_set1 bset;
uint32_t glsl_level;
uint32_t max_texture_array_layers;
uint32_t max_streamout_buffers;
uint32_t max_dual_source_render_targets;
uint32_t max_render_targets;
uint32_t max_samples;
uint32_t prim_mask;
uint32_t max_tbo_size;
uint32_t max_uniform_blocks;
uint32_t max_viewports;
uint32_t max_texture_gather_components;
};
struct virgl_video_caps {
uint32_t profile:8;
uint32_t entrypoint:8;
uint32_t max_level:8;
uint32_t stacked_frames:8;
uint32_t max_width:16;
uint32_t max_height:16;
uint32_t prefered_format:16;
uint32_t max_macroblocks:16;
uint32_t npot_texture:1;
uint32_t supports_progressive:1;
uint32_t supports_interlaced:1;
uint32_t prefers_interlaced:1;
uint32_t max_temporal_layers:8;
uint32_t reserved:20;
};
/*
* This struct should be growable when used in capset 2,
* so we shouldn't have to add a v3 ever.
*/
struct virgl_caps_v2 {
struct virgl_caps_v1 v1;
float min_aliased_point_size;
float max_aliased_point_size;
float min_smooth_point_size;
float max_smooth_point_size;
float min_aliased_line_width;
float max_aliased_line_width;
float min_smooth_line_width;
float max_smooth_line_width;
float max_texture_lod_bias;
uint32_t max_geom_output_vertices;
uint32_t max_geom_total_output_components;
uint32_t max_vertex_outputs;
uint32_t max_vertex_attribs;
uint32_t max_shader_patch_varyings;
int32_t min_texel_offset;
int32_t max_texel_offset;
int32_t min_texture_gather_offset;
int32_t max_texture_gather_offset;
uint32_t texture_buffer_offset_alignment;
uint32_t uniform_buffer_offset_alignment;
uint32_t shader_buffer_offset_alignment;
uint32_t capability_bits;
uint32_t sample_locations[8];
uint32_t max_vertex_attrib_stride;
uint32_t max_shader_buffer_frag_compute;
uint32_t max_shader_buffer_other_stages;
uint32_t max_shader_image_frag_compute;
uint32_t max_shader_image_other_stages;
uint32_t max_image_samples;
uint32_t max_compute_work_group_invocations;
uint32_t max_compute_shared_memory_size;
uint32_t max_compute_grid_size[3];
uint32_t max_compute_block_size[3];
uint32_t max_texture_2d_size;
uint32_t max_texture_3d_size;
uint32_t max_texture_cube_size;
uint32_t max_combined_shader_buffers;
uint32_t max_atomic_counters[6];
uint32_t max_atomic_counter_buffers[6];
uint32_t max_combined_atomic_counters;
uint32_t max_combined_atomic_counter_buffers;
uint32_t host_feature_check_version;
struct virgl_supported_format_mask supported_readback_formats;
struct virgl_supported_format_mask scanout;
uint32_t capability_bits_v2;
uint32_t max_video_memory;
char renderer[64];
float max_anisotropy;
// NOTE: this informs guest-side pipe_shader_caps.max_texture_samplers,
// **NOT** GL_MAX_TEXTURE_IMAGE_UNITS!!!
// Guest-side driver has always used it as such.
uint32_t max_texture_samplers;
struct virgl_supported_format_mask supported_multisample_formats;
uint32_t max_const_buffer_size[6]; // MESA_SHADER_STAGES
uint32_t num_video_caps;
struct virgl_video_caps video_caps[32];
uint32_t max_uniform_block_size;
uint32_t max_tcs_outputs;
uint32_t max_tes_outputs;
uint32_t max_shader_storage_blocks[6]; // MESA_SHADER_STAGES
};
union virgl_caps {
uint32_t max_version;
struct virgl_caps_v1 v1;
struct virgl_caps_v2 v2;
};
enum virgl_errors {
VIRGL_ERROR_NONE,
VIRGL_ERROR_UNKNOWN,
VIRGL_ERROR_UNKNOWN_RESOURCE_FORMAT,
};
enum virgl_ctx_errors {
VIRGL_ERROR_CTX_NONE,
VIRGL_ERROR_CTX_UNKNOWN,
VIRGL_ERROR_CTX_ILLEGAL_SHADER,
VIRGL_ERROR_CTX_ILLEGAL_HANDLE,
VIRGL_ERROR_CTX_ILLEGAL_RESOURCE,
VIRGL_ERROR_CTX_ILLEGAL_SURFACE,
VIRGL_ERROR_CTX_ILLEGAL_VERTEX_FORMAT,
VIRGL_ERROR_CTX_ILLEGAL_CMD_BUFFER,
VIRGL_ERROR_CTX_GLES_HAVE_TES_BUT_MISS_TCS,
VIRGL_ERROR_GL_ANY_SAMPLES_PASSED,
VIRGL_ERROR_CTX_ILLEGAL_FORMAT,
VIRGL_ERROR_CTX_ILLEGAL_SAMPLER_VIEW_TARGET,
VIRGL_ERROR_CTX_TRANSFER_IOV_BOUNDS,
VIRGL_ERROR_CTX_ILLEGAL_DUAL_SRC_BLEND,
VIRGL_ERROR_CTX_UNSUPPORTED_FUNCTION,
VIRGL_ERROR_CTX_ILLEGAL_PROGRAM_PIPELINE,
VIRGL_ERROR_CTX_TOO_MANY_VERTEX_ATTRIBUTES,
VIRGL_ERROR_CTX_UNSUPPORTED_TEX_WRAP,
VIRGL_ERROR_CTX_CUBE_MAP_FACE_OUT_OF_RANGE,
VIRGL_ERROR_CTX_BLIT_AREA_OUT_OF_RANGE,
VIRGL_ERROR_CTX_SSBO_BINDING_RANGE,
VIRGL_ERROR_CTX_RESOURCE_OUT_OF_RANGE,
};
enum virgl_statistics_query_index {
VIRGL_STAT_QUERY_IA_VERTICES = 0,
VIRGL_STAT_QUERY_IA_PRIMITIVES = 1,
VIRGL_STAT_QUERY_VS_INVOCATIONS = 2,
VIRGL_STAT_QUERY_GS_INVOCATIONS = 3,
VIRGL_STAT_QUERY_GS_PRIMITIVES = 4,
VIRGL_STAT_QUERY_C_INVOCATIONS = 5,
VIRGL_STAT_QUERY_C_PRIMITIVES = 6,
VIRGL_STAT_QUERY_PS_INVOCATIONS = 7,
VIRGL_STAT_QUERY_HS_INVOCATIONS = 8,
VIRGL_STAT_QUERY_DS_INVOCATIONS = 9,
VIRGL_STAT_QUERY_CS_INVOCATIONS = 10,
};
/**
* Flags for the driver about resource behaviour:
*/
#define VIRGL_RESOURCE_Y_0_TOP (1 << 0)
#define VIRGL_RESOURCE_FLAG_MAP_PERSISTENT (1 << 1)
#define VIRGL_RESOURCE_FLAG_MAP_COHERENT (1 << 2)
#endif
+802
View File
@@ -0,0 +1,802 @@
/*
* Copyright 2014, 2015 Red Hat.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VIRGL_PROTOCOL_H
#define VIRGL_PROTOCOL_H
#include <stdint.h>
#define VIRGL_QUERY_STATE_NEW 0
#define VIRGL_QUERY_STATE_DONE 1
#define VIRGL_QUERY_STATE_WAIT_HOST 2
struct virgl_host_query_state {
uint32_t query_state;
uint32_t result_size;
uint64_t result;
};
struct virgl_memory_info
{
uint32_t total_device_memory; /**< size of device memory, e.g. VRAM */
uint32_t avail_device_memory; /**< free device memory at the moment */
uint32_t total_staging_memory; /**< size of staging memory, e.g. GART */
uint32_t avail_staging_memory; /**< free staging memory at the moment */
uint32_t device_memory_evicted; /**< size of memory evicted (monotonic counter) */
uint32_t nr_device_memory_evictions; /**< # of evictions (monotonic counter) */
};
#define VIRGL_RESOURCE_MAX_PLANES 4
struct virgl_resource_layout
{
uint64_t modifier;
uint32_t num_planes;
uint32_t reserved1;
struct {
uint64_t offset;
uint32_t stride;
uint32_t size;
} planes[VIRGL_RESOURCE_MAX_PLANES];
};
enum virgl_object_type {
VIRGL_OBJECT_NULL,
VIRGL_OBJECT_BLEND,
VIRGL_OBJECT_RASTERIZER,
VIRGL_OBJECT_DSA,
VIRGL_OBJECT_SHADER,
VIRGL_OBJECT_VERTEX_ELEMENTS,
VIRGL_OBJECT_SAMPLER_VIEW,
VIRGL_OBJECT_SAMPLER_STATE,
VIRGL_OBJECT_SURFACE,
VIRGL_OBJECT_QUERY,
VIRGL_OBJECT_STREAMOUT_TARGET,
VIRGL_OBJECT_MSAA_SURFACE,
VIRGL_MAX_OBJECTS,
};
/* context cmds to be encoded in the command stream */
enum virgl_context_cmd {
VIRGL_CCMD_NOP = 0,
VIRGL_CCMD_CREATE_OBJECT = 1,
VIRGL_CCMD_BIND_OBJECT,
VIRGL_CCMD_DESTROY_OBJECT,
VIRGL_CCMD_SET_VIEWPORT_STATE,
VIRGL_CCMD_SET_FRAMEBUFFER_STATE,
VIRGL_CCMD_SET_VERTEX_BUFFERS,
VIRGL_CCMD_CLEAR,
VIRGL_CCMD_DRAW_VBO,
VIRGL_CCMD_RESOURCE_INLINE_WRITE,
VIRGL_CCMD_SET_SAMPLER_VIEWS,
VIRGL_CCMD_SET_INDEX_BUFFER,
VIRGL_CCMD_SET_CONSTANT_BUFFER,
VIRGL_CCMD_SET_STENCIL_REF,
VIRGL_CCMD_SET_BLEND_COLOR,
VIRGL_CCMD_SET_SCISSOR_STATE,
VIRGL_CCMD_BLIT,
VIRGL_CCMD_RESOURCE_COPY_REGION,
VIRGL_CCMD_BIND_SAMPLER_STATES,
VIRGL_CCMD_BEGIN_QUERY,
VIRGL_CCMD_END_QUERY,
VIRGL_CCMD_GET_QUERY_RESULT,
VIRGL_CCMD_SET_POLYGON_STIPPLE,
VIRGL_CCMD_SET_CLIP_STATE,
VIRGL_CCMD_SET_SAMPLE_MASK,
VIRGL_CCMD_SET_STREAMOUT_TARGETS,
VIRGL_CCMD_SET_RENDER_CONDITION,
VIRGL_CCMD_SET_UNIFORM_BUFFER,
VIRGL_CCMD_SET_SUB_CTX,
VIRGL_CCMD_CREATE_SUB_CTX,
VIRGL_CCMD_DESTROY_SUB_CTX,
VIRGL_CCMD_BIND_SHADER,
VIRGL_CCMD_SET_TESS_STATE,
VIRGL_CCMD_SET_MIN_SAMPLES,
VIRGL_CCMD_SET_SHADER_BUFFERS,
VIRGL_CCMD_SET_SHADER_IMAGES,
VIRGL_CCMD_MEMORY_BARRIER,
VIRGL_CCMD_LAUNCH_GRID,
VIRGL_CCMD_SET_FRAMEBUFFER_STATE_NO_ATTACH,
VIRGL_CCMD_TEXTURE_BARRIER,
VIRGL_CCMD_SET_ATOMIC_BUFFERS,
VIRGL_CCMD_SET_DEBUG_FLAGS,
VIRGL_CCMD_GET_QUERY_RESULT_QBO,
VIRGL_CCMD_TRANSFER3D,
VIRGL_CCMD_END_TRANSFERS,
VIRGL_CCMD_COPY_TRANSFER3D,
VIRGL_CCMD_SET_TWEAKS,
VIRGL_CCMD_CLEAR_TEXTURE,
VIRGL_CCMD_PIPE_RESOURCE_CREATE,
VIRGL_CCMD_PIPE_RESOURCE_SET_TYPE,
VIRGL_CCMD_GET_MEMORY_INFO,
VIRGL_CCMD_EMIT_STRING_MARKER,
VIRGL_CCMD_LINK_SHADER,
/* video codec */
VIRGL_CCMD_CREATE_VIDEO_CODEC,
VIRGL_CCMD_DESTROY_VIDEO_CODEC,
VIRGL_CCMD_CREATE_VIDEO_BUFFER,
VIRGL_CCMD_DESTROY_VIDEO_BUFFER,
VIRGL_CCMD_BEGIN_FRAME,
VIRGL_CCMD_DECODE_MACROBLOCK,
VIRGL_CCMD_DECODE_BITSTREAM,
VIRGL_CCMD_ENCODE_BITSTREAM,
VIRGL_CCMD_END_FRAME,
VIRGL_CCMD_CLEAR_SURFACE,
VIRGL_CCMD_GET_PIPE_RESOURCE_LAYOUT,
VIRGL_MAX_COMMANDS
};
enum virgl_shader_stage {
VIRGL_SHADER_VERTEX,
VIRGL_SHADER_FRAGMENT,
VIRGL_SHADER_GEOMETRY,
VIRGL_SHADER_TESS_CTRL,
VIRGL_SHADER_TESS_EVAL,
VIRGL_SHADER_COMPUTE,
};
/*
8-bit cmd headers
8-bit object type
16-bit length
*/
#define VIRGL_CMD0(cmd, obj, len) ((cmd) | ((obj) << 8) | ((len) << 16))
#define VIRGL_CMD0_MAX_DWORDS (((1ULL << 16) - 1) / 4) * 4
/* hw specification */
#define VIRGL_MAX_COLOR_BUFS 8
#define VIRGL_MAX_CLIP_PLANES 8
#define VIRGL_OBJ_CREATE_HEADER 0
#define VIRGL_OBJ_CREATE_HANDLE 1
#define VIRGL_OBJ_BIND_HEADER 0
#define VIRGL_OBJ_BIND_HANDLE 1
#define VIRGL_OBJ_DESTROY_HANDLE 1
/* some of these defines are a specification - not used in the code */
/* bit offsets for blend state object */
#define VIRGL_OBJ_BLEND_SIZE (VIRGL_MAX_COLOR_BUFS + 3)
#define VIRGL_OBJ_BLEND_HANDLE 1
#define VIRGL_OBJ_BLEND_S0 2
#define VIRGL_OBJ_BLEND_S0_INDEPENDENT_BLEND_ENABLE(x) ((x) & 0x1 << 0)
#define VIRGL_OBJ_BLEND_S0_LOGICOP_ENABLE(x) (((x) & 0x1) << 1)
#define VIRGL_OBJ_BLEND_S0_DITHER(x) (((x) & 0x1) << 2)
#define VIRGL_OBJ_BLEND_S0_ALPHA_TO_COVERAGE(x) (((x) & 0x1) << 3)
#define VIRGL_OBJ_BLEND_S0_ALPHA_TO_ONE(x) (((x) & 0x1) << 4)
#define VIRGL_OBJ_BLEND_S1 3
#define VIRGL_OBJ_BLEND_S1_LOGICOP_FUNC(x) (((x) & 0xf) << 0)
/* repeated once per number of cbufs */
#define VIRGL_OBJ_BLEND_S2(cbuf) (4 + (cbuf))
#define VIRGL_OBJ_BLEND_S2_RT_BLEND_ENABLE(x) (((x) & 0x1) << 0)
#define VIRGL_OBJ_BLEND_S2_RT_RGB_FUNC(x) (((x) & 0x7) << 1)
#define VIRGL_OBJ_BLEND_S2_RT_RGB_SRC_FACTOR(x) (((x) & 0x1f) << 4)
#define VIRGL_OBJ_BLEND_S2_RT_RGB_DST_FACTOR(x) (((x) & 0x1f) << 9)
#define VIRGL_OBJ_BLEND_S2_RT_ALPHA_FUNC(x) (((x) & 0x7) << 14)
#define VIRGL_OBJ_BLEND_S2_RT_ALPHA_SRC_FACTOR(x) (((x) & 0x1f) << 17)
#define VIRGL_OBJ_BLEND_S2_RT_ALPHA_DST_FACTOR(x) (((x) & 0x1f) << 22)
#define VIRGL_OBJ_BLEND_S2_RT_COLORMASK(x) (((x) & 0xf) << 27)
/* bit offsets for DSA state */
#define VIRGL_OBJ_DSA_SIZE 5
#define VIRGL_OBJ_DSA_HANDLE 1
#define VIRGL_OBJ_DSA_S0 2
#define VIRGL_OBJ_DSA_S0_DEPTH_ENABLE(x) (((x) & 0x1) << 0)
#define VIRGL_OBJ_DSA_S0_DEPTH_WRITEMASK(x) (((x) & 0x1) << 1)
#define VIRGL_OBJ_DSA_S0_DEPTH_FUNC(x) (((x) & 0x7) << 2)
#define VIRGL_OBJ_DSA_S0_ALPHA_ENABLED(x) (((x) & 0x1) << 8)
#define VIRGL_OBJ_DSA_S0_ALPHA_FUNC(x) (((x) & 0x7) << 9)
#define VIRGL_OBJ_DSA_S1 3
#define VIRGL_OBJ_DSA_S2 4
#define VIRGL_OBJ_DSA_S1_STENCIL_ENABLED(x) (((x) & 0x1) << 0)
#define VIRGL_OBJ_DSA_S1_STENCIL_FUNC(x) (((x) & 0x7) << 1)
#define VIRGL_OBJ_DSA_S1_STENCIL_FAIL_OP(x) (((x) & 0x7) << 4)
#define VIRGL_OBJ_DSA_S1_STENCIL_ZPASS_OP(x) (((x) & 0x7) << 7)
#define VIRGL_OBJ_DSA_S1_STENCIL_ZFAIL_OP(x) (((x) & 0x7) << 10)
#define VIRGL_OBJ_DSA_S1_STENCIL_VALUEMASK(x) (((x) & 0xff) << 13)
#define VIRGL_OBJ_DSA_S1_STENCIL_WRITEMASK(x) (((x) & 0xff) << 21)
#define VIRGL_OBJ_DSA_ALPHA_REF 5
/* offsets for rasterizer state */
#define VIRGL_OBJ_RS_SIZE 9
#define VIRGL_OBJ_RS_HANDLE 1
#define VIRGL_OBJ_RS_S0 2
#define VIRGL_OBJ_RS_S0_FLATSHADE(x) (((x) & 0x1) << 0)
#define VIRGL_OBJ_RS_S0_DEPTH_CLIP(x) (((x) & 0x1) << 1)
#define VIRGL_OBJ_RS_S0_CLIP_HALFZ(x) (((x) & 0x1) << 2)
#define VIRGL_OBJ_RS_S0_RASTERIZER_DISCARD(x) (((x) & 0x1) << 3)
#define VIRGL_OBJ_RS_S0_FLATSHADE_FIRST(x) (((x) & 0x1) << 4)
#define VIRGL_OBJ_RS_S0_LIGHT_TWOSIZE(x) (((x) & 0x1) << 5)
#define VIRGL_OBJ_RS_S0_SPRITE_COORD_MODE(x) (((x) & 0x1) << 6)
#define VIRGL_OBJ_RS_S0_POINT_QUAD_RASTERIZATION(x) (((x) & 0x1) << 7)
#define VIRGL_OBJ_RS_S0_CULL_FACE(x) (((x) & 0x3) << 8)
#define VIRGL_OBJ_RS_S0_FILL_FRONT(x) (((x) & 0x3) << 10)
#define VIRGL_OBJ_RS_S0_FILL_BACK(x) (((x) & 0x3) << 12)
#define VIRGL_OBJ_RS_S0_SCISSOR(x) (((x) & 0x1) << 14)
#define VIRGL_OBJ_RS_S0_FRONT_CCW(x) (((x) & 0x1) << 15)
#define VIRGL_OBJ_RS_S0_CLAMP_VERTEX_COLOR(x) (((x) & 0x1) << 16)
#define VIRGL_OBJ_RS_S0_CLAMP_FRAGMENT_COLOR(x) (((x) & 0x1) << 17)
#define VIRGL_OBJ_RS_S0_OFFSET_LINE(x) (((x) & 0x1) << 18)
#define VIRGL_OBJ_RS_S0_OFFSET_POINT(x) (((x) & 0x1) << 19)
#define VIRGL_OBJ_RS_S0_OFFSET_TRI(x) (((x) & 0x1) << 20)
#define VIRGL_OBJ_RS_S0_POLY_SMOOTH(x) (((x) & 0x1) << 21)
#define VIRGL_OBJ_RS_S0_POLY_STIPPLE_ENABLE(x) (((x) & 0x1) << 22)
#define VIRGL_OBJ_RS_S0_POINT_SMOOTH(x) (((x) & 0x1) << 23)
#define VIRGL_OBJ_RS_S0_POINT_SIZE_PER_VERTEX(x) (((x) & 0x1) << 24)
#define VIRGL_OBJ_RS_S0_MULTISAMPLE(x) (((x) & 0x1) << 25)
#define VIRGL_OBJ_RS_S0_LINE_SMOOTH(x) (((x) & 0x1) << 26)
#define VIRGL_OBJ_RS_S0_LINE_STIPPLE_ENABLE(x) (((x) & 0x1) << 27)
#define VIRGL_OBJ_RS_S0_LINE_LAST_PIXEL(x) (((x) & 0x1) << 28)
#define VIRGL_OBJ_RS_S0_HALF_PIXEL_CENTER(x) (((x) & 0x1) << 29)
#define VIRGL_OBJ_RS_S0_BOTTOM_EDGE_RULE(x) (((x) & 0x1) << 30)
#define VIRGL_OBJ_RS_S0_FORCE_PERSAMPLE_INTERP(x) (((x) & 0x1u) << 31)
#define VIRGL_OBJ_RS_POINT_SIZE 3
#define VIRGL_OBJ_RS_SPRITE_COORD_ENABLE 4
#define VIRGL_OBJ_RS_S3 5
#define VIRGL_OBJ_RS_S3_LINE_STIPPLE_PATTERN(x) (((x) & 0xffff) << 0)
#define VIRGL_OBJ_RS_S3_LINE_STIPPLE_FACTOR(x) (((x) & 0xff) << 16)
#define VIRGL_OBJ_RS_S3_CLIP_PLANE_ENABLE(x) (((x) & 0xff) << 24)
#define VIRGL_OBJ_RS_LINE_WIDTH 6
#define VIRGL_OBJ_RS_OFFSET_UNITS 7
#define VIRGL_OBJ_RS_OFFSET_SCALE 8
#define VIRGL_OBJ_RS_OFFSET_CLAMP 9
#define VIRGL_OBJ_CLEAR_SIZE 8
#define VIRGL_OBJ_CLEAR_BUFFERS 1
#define VIRGL_OBJ_CLEAR_COLOR_0 2 /* color is 4 * u32/f32/i32 */
#define VIRGL_OBJ_CLEAR_COLOR_1 3
#define VIRGL_OBJ_CLEAR_COLOR_2 4
#define VIRGL_OBJ_CLEAR_COLOR_3 5
#define VIRGL_OBJ_CLEAR_DEPTH_0 6 /* depth is a double precision float */
#define VIRGL_OBJ_CLEAR_DEPTH_1 7
#define VIRGL_OBJ_CLEAR_STENCIL 8
/* shader object */
#define VIRGL_OBJ_SHADER_HDR_SIZE(nso) (5 + ((nso) ? (2 * nso) + 4 : 0))
#define VIRGL_OBJ_SHADER_HANDLE 1
#define VIRGL_OBJ_SHADER_TYPE 2
#define VIRGL_OBJ_SHADER_OFFSET 3
#define VIRGL_OBJ_SHADER_OFFSET_VAL(x) (((x) & 0x7fffffff) << 0)
/* start contains full length in VAL - also implies continuations */
/* continuation contains offset in VAL */
#define VIRGL_OBJ_SHADER_OFFSET_CONT (0x1u << 31)
#define VIRGL_OBJ_SHADER_NUM_TOKENS 4
#define VIRGL_OBJ_SHADER_SO_NUM_OUTPUTS 5
#define VIRGL_OBJ_SHADER_SO_STRIDE(x) (6 + (x))
#define VIRGL_OBJ_SHADER_SO_OUTPUT0(x) (10 + (x * 2))
#define VIRGL_OBJ_SHADER_SO_OUTPUT_REGISTER_INDEX(x) (((x) & 0xff) << 0)
#define VIRGL_OBJ_SHADER_SO_OUTPUT_START_COMPONENT(x) (((x) & 0x3) << 8)
#define VIRGL_OBJ_SHADER_SO_OUTPUT_NUM_COMPONENTS(x) (((x) & 0x7) << 10)
#define VIRGL_OBJ_SHADER_SO_OUTPUT_BUFFER(x) (((x) & 0x7) << 13)
#define VIRGL_OBJ_SHADER_SO_OUTPUT_DST_OFFSET(x) (((x) & 0xffff) << 16)
#define VIRGL_OBJ_SHADER_SO_OUTPUT0_SO(x) (11 + (x * 2))
#define VIRGL_OBJ_SHADER_SO_OUTPUT_STREAM(x) (((x) & 0x03) << 0)
/* viewport state */
#define VIRGL_SET_VIEWPORT_STATE_SIZE(num_viewports) ((6 * num_viewports) + 1)
#define VIRGL_SET_VIEWPORT_START_SLOT 1
#define VIRGL_SET_VIEWPORT_STATE_SCALE_0(x) (2 + (x * 6))
#define VIRGL_SET_VIEWPORT_STATE_SCALE_1(x) (3 + (x * 6))
#define VIRGL_SET_VIEWPORT_STATE_SCALE_2(x) (4 + (x * 6))
#define VIRGL_SET_VIEWPORT_STATE_TRANSLATE_0(x) (5 + (x * 6))
#define VIRGL_SET_VIEWPORT_STATE_TRANSLATE_1(x) (6 + (x * 6))
#define VIRGL_SET_VIEWPORT_STATE_TRANSLATE_2(x) (7 + (x * 6))
/* framebuffer state */
#define VIRGL_SET_FRAMEBUFFER_STATE_SIZE(nr_cbufs) (nr_cbufs + 2)
#define VIRGL_SET_FRAMEBUFFER_STATE_NR_CBUFS 1
#define VIRGL_SET_FRAMEBUFFER_STATE_NR_ZSURF_HANDLE 2
#define VIRGL_SET_FRAMEBUFFER_STATE_CBUF_HANDLE(x) ((x) + 3)
/* vertex elements object */
#define VIRGL_OBJ_VERTEX_ELEMENTS_SIZE(num_elements) (((num_elements) * 4) + 1)
#define VIRGL_OBJ_VERTEX_ELEMENTS_HANDLE 1
#define VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_OFFSET(x) (((x) * 4) + 2) /* repeated per VE */
#define VIRGL_OBJ_VERTEX_ELEMENTS_V0_INSTANCE_DIVISOR(x) (((x) * 4) + 3)
#define VIRGL_OBJ_VERTEX_ELEMENTS_V0_VERTEX_BUFFER_INDEX(x) (((x) * 4) + 4)
#define VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_FORMAT(x) (((x) * 4) + 5)
/* vertex buffers */
#define VIRGL_SET_VERTEX_BUFFERS_SIZE(num_buffers) ((num_buffers) * 3)
#define VIRGL_SET_VERTEX_BUFFER_STRIDE(x) (((x) * 3) + 1)
#define VIRGL_SET_VERTEX_BUFFER_OFFSET(x) (((x) * 3) + 2)
#define VIRGL_SET_VERTEX_BUFFER_HANDLE(x) (((x) * 3) + 3)
/* index buffer */
#define VIRGL_SET_INDEX_BUFFER_SIZE(ib) (((ib) ? 2 : 0) + 1)
#define VIRGL_SET_INDEX_BUFFER_HANDLE 1
#define VIRGL_SET_INDEX_BUFFER_INDEX_SIZE 2 /* only if sending an IB handle */
#define VIRGL_SET_INDEX_BUFFER_OFFSET 3 /* only if sending an IB handle */
/* constant buffer */
#define VIRGL_SET_CONSTANT_BUFFER_SHADER_TYPE 1
#define VIRGL_SET_CONSTANT_BUFFER_INDEX 2
#define VIRGL_SET_CONSTANT_BUFFER_DATA_START 3
#define VIRGL_SET_UNIFORM_BUFFER_SIZE 5
#define VIRGL_SET_UNIFORM_BUFFER_SHADER_TYPE 1
#define VIRGL_SET_UNIFORM_BUFFER_INDEX 2
#define VIRGL_SET_UNIFORM_BUFFER_OFFSET 3
#define VIRGL_SET_UNIFORM_BUFFER_LENGTH 4
#define VIRGL_SET_UNIFORM_BUFFER_RES_HANDLE 5
/* draw VBO */
#define VIRGL_DRAW_VBO_SIZE 12
#define VIRGL_DRAW_VBO_SIZE_TESS 14
#define VIRGL_DRAW_VBO_SIZE_INDIRECT 20
#define VIRGL_DRAW_VBO_START 1
#define VIRGL_DRAW_VBO_COUNT 2
#define VIRGL_DRAW_VBO_MODE 3
#define VIRGL_DRAW_VBO_INDEXED 4
#define VIRGL_DRAW_VBO_INSTANCE_COUNT 5
#define VIRGL_DRAW_VBO_INDEX_BIAS 6
#define VIRGL_DRAW_VBO_START_INSTANCE 7
#define VIRGL_DRAW_VBO_PRIMITIVE_RESTART 8
#define VIRGL_DRAW_VBO_RESTART_INDEX 9
#define VIRGL_DRAW_VBO_MIN_INDEX 10
#define VIRGL_DRAW_VBO_MAX_INDEX 11
#define VIRGL_DRAW_VBO_COUNT_FROM_SO 12
/* tess packet */
#define VIRGL_DRAW_VBO_VERTICES_PER_PATCH 13
#define VIRGL_DRAW_VBO_DRAWID 14
/* indirect packet */
#define VIRGL_DRAW_VBO_INDIRECT_HANDLE 15
#define VIRGL_DRAW_VBO_INDIRECT_OFFSET 16
#define VIRGL_DRAW_VBO_INDIRECT_STRIDE 17
#define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT 18
#define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT_OFFSET 19
#define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT_HANDLE 20
/* create surface */
#define VIRGL_OBJ_SURFACE_SIZE 5
#define VIRGL_OBJ_SURFACE_HANDLE 1
#define VIRGL_OBJ_SURFACE_RES_HANDLE 2
#define VIRGL_OBJ_SURFACE_FORMAT 3
#define VIRGL_OBJ_SURFACE_BUFFER_FIRST_ELEMENT 4
#define VIRGL_OBJ_SURFACE_BUFFER_LAST_ELEMENT 5
#define VIRGL_OBJ_SURFACE_TEXTURE_LEVEL 4
#define VIRGL_OBJ_SURFACE_TEXTURE_LAYERS 5
/* create surface with implicit MSAA support (for EXT_multisample_render_to_texture) */
#define VIRGL_OBJ_MSAA_SURFACE_SIZE (VIRGL_OBJ_SURFACE_SIZE + 1)
#define VIRGL_OBJ_SURFACE_SAMPLE_COUNT 6
/* create streamout target */
#define VIRGL_OBJ_STREAMOUT_SIZE 4
#define VIRGL_OBJ_STREAMOUT_HANDLE 1
#define VIRGL_OBJ_STREAMOUT_RES_HANDLE 2
#define VIRGL_OBJ_STREAMOUT_BUFFER_OFFSET 3
#define VIRGL_OBJ_STREAMOUT_BUFFER_SIZE 4
/* sampler state */
#define VIRGL_OBJ_SAMPLER_STATE_SIZE 9
#define VIRGL_OBJ_SAMPLER_STATE_HANDLE 1
#define VIRGL_OBJ_SAMPLER_STATE_S0 2
#define VIRGL_OBJ_SAMPLE_STATE_S0_WRAP_S(x) (((x) & 0x7) << 0)
#define VIRGL_OBJ_SAMPLE_STATE_S0_WRAP_T(x) (((x) & 0x7) << 3)
#define VIRGL_OBJ_SAMPLE_STATE_S0_WRAP_R(x) (((x) & 0x7) << 6)
#define VIRGL_OBJ_SAMPLE_STATE_S0_MIN_IMG_FILTER(x) (((x) & 0x1) << 9) /* Used to be 2 bits wide */
#define VIRGL_OBJ_SAMPLE_STATE_S0_MIN_MIP_FILTER(x) (((x) & 0x3) << 11)
#define VIRGL_OBJ_SAMPLE_STATE_S0_MAG_IMG_FILTER(x) (((x) & 0x1) << 13) /* Used to be 2 bits wide */
#define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_MODE(x) (((x) & 0x1) << 15)
#define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_FUNC(x) (((x) & 0x7) << 16)
#define VIRGL_OBJ_SAMPLE_STATE_S0_SEAMLESS_CUBE_MAP(x) (((x) & 0x1) << 19)
#define VIRGL_OBJ_SAMPLE_STATE_S0_MAX_ANISOTROPY(x) (((x & 0x1f)) << 20) /* Used to be 6 bits wide */
#define VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS 3
#define VIRGL_OBJ_SAMPLER_STATE_MIN_LOD 4
#define VIRGL_OBJ_SAMPLER_STATE_MAX_LOD 5
#define VIRGL_OBJ_SAMPLER_STATE_BORDER_COLOR(x) ((x) + 6) /* 6 - 9 */
/* sampler view */
#define VIRGL_OBJ_SAMPLER_VIEW_SIZE 6
#define VIRGL_OBJ_SAMPLER_VIEW_HANDLE 1
#define VIRGL_OBJ_SAMPLER_VIEW_RES_HANDLE 2
#define VIRGL_OBJ_SAMPLER_VIEW_FORMAT 3
#define VIRGL_OBJ_SAMPLER_VIEW_BUFFER_FIRST_ELEMENT 4
#define VIRGL_OBJ_SAMPLER_VIEW_BUFFER_LAST_ELEMENT 5
#define VIRGL_OBJ_SAMPLER_VIEW_TEXTURE_LAYER 4
#define VIRGL_OBJ_SAMPLER_VIEW_TEXTURE_LEVEL 5
#define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE 6
#define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_R(x) (((x) & 0x7) << 0)
#define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_G(x) (((x) & 0x7) << 3)
#define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_B(x) (((x) & 0x7) << 6)
#define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_A(x) (((x) & 0x7) << 9)
/* set sampler views */
#define VIRGL_SET_SAMPLER_VIEWS_SIZE(num_views) ((num_views) + 2)
#define VIRGL_SET_SAMPLER_VIEWS_SHADER_TYPE 1
#define VIRGL_SET_SAMPLER_VIEWS_START_SLOT 2
#define VIRGL_SET_SAMPLER_VIEWS_V0_HANDLE 3
/* bind sampler states */
#define VIRGL_BIND_SAMPLER_STATES(num_states) ((num_states) + 2)
#define VIRGL_BIND_SAMPLER_STATES_SHADER_TYPE 1
#define VIRGL_BIND_SAMPLER_STATES_START_SLOT 2
#define VIRGL_BIND_SAMPLER_STATES_S0_HANDLE 3
/* set stencil reference */
#define VIRGL_SET_STENCIL_REF_SIZE 1
#define VIRGL_SET_STENCIL_REF 1
#define VIRGL_STENCIL_REF_VAL(f, s) ((f & 0xff) | (((s & 0xff) << 8)))
/* set blend color */
#define VIRGL_SET_BLEND_COLOR_SIZE 4
#define VIRGL_SET_BLEND_COLOR(x) ((x) + 1)
/* set scissor state */
#define VIRGL_SET_SCISSOR_STATE_SIZE(x) (1 + 2 * x)
#define VIRGL_SET_SCISSOR_START_SLOT 1
#define VIRGL_SET_SCISSOR_MINX_MINY(x) (2 + (x * 2))
#define VIRGL_SET_SCISSOR_MAXX_MAXY(x) (3 + (x * 2))
/* resource copy region */
#define VIRGL_CMD_RESOURCE_COPY_REGION_SIZE 13
#define VIRGL_CMD_RCR_DST_RES_HANDLE 1
#define VIRGL_CMD_RCR_DST_LEVEL 2
#define VIRGL_CMD_RCR_DST_X 3
#define VIRGL_CMD_RCR_DST_Y 4
#define VIRGL_CMD_RCR_DST_Z 5
#define VIRGL_CMD_RCR_SRC_RES_HANDLE 6
#define VIRGL_CMD_RCR_SRC_LEVEL 7
#define VIRGL_CMD_RCR_SRC_X 8
#define VIRGL_CMD_RCR_SRC_Y 9
#define VIRGL_CMD_RCR_SRC_Z 10
#define VIRGL_CMD_RCR_SRC_W 11
#define VIRGL_CMD_RCR_SRC_H 12
#define VIRGL_CMD_RCR_SRC_D 13
/* blit */
#define VIRGL_CMD_BLIT_SIZE 21
#define VIRGL_CMD_BLIT_S0 1
#define VIRGL_CMD_BLIT_S0_MASK(x) (((x) & 0xff) << 0)
#define VIRGL_CMD_BLIT_S0_FILTER(x) (((x) & 0x3) << 8)
#define VIRGL_CMD_BLIT_S0_SCISSOR_ENABLE(x) (((x) & 0x1) << 10)
#define VIRGL_CMD_BLIT_S0_RENDER_CONDITION_ENABLE(x) (((x) & 0x1) << 11)
#define VIRGL_CMD_BLIT_S0_ALPHA_BLEND(x) (((x) & 0x1) << 12)
#define VIRGL_CMD_BLIT_SCISSOR_MINX_MINY 2
#define VIRGL_CMD_BLIT_SCISSOR_MAXX_MAXY 3
#define VIRGL_CMD_BLIT_DST_RES_HANDLE 4
#define VIRGL_CMD_BLIT_DST_LEVEL 5
#define VIRGL_CMD_BLIT_DST_FORMAT 6
#define VIRGL_CMD_BLIT_DST_X 7
#define VIRGL_CMD_BLIT_DST_Y 8
#define VIRGL_CMD_BLIT_DST_Z 9
#define VIRGL_CMD_BLIT_DST_W 10
#define VIRGL_CMD_BLIT_DST_H 11
#define VIRGL_CMD_BLIT_DST_D 12
#define VIRGL_CMD_BLIT_SRC_RES_HANDLE 13
#define VIRGL_CMD_BLIT_SRC_LEVEL 14
#define VIRGL_CMD_BLIT_SRC_FORMAT 15
#define VIRGL_CMD_BLIT_SRC_X 16
#define VIRGL_CMD_BLIT_SRC_Y 17
#define VIRGL_CMD_BLIT_SRC_Z 18
#define VIRGL_CMD_BLIT_SRC_W 19
#define VIRGL_CMD_BLIT_SRC_H 20
#define VIRGL_CMD_BLIT_SRC_D 21
/* query object */
#define VIRGL_OBJ_QUERY_SIZE 4
#define VIRGL_OBJ_QUERY_HANDLE 1
#define VIRGL_OBJ_QUERY_TYPE_INDEX 2
#define VIRGL_OBJ_QUERY_TYPE(x) (x & 0xffff)
#define VIRGL_OBJ_QUERY_INDEX(x) ((x & 0xffff) << 16)
#define VIRGL_OBJ_QUERY_OFFSET 3
#define VIRGL_OBJ_QUERY_RES_HANDLE 4
#define VIRGL_QUERY_BEGIN_HANDLE 1
#define VIRGL_QUERY_END_HANDLE 1
#define VIRGL_QUERY_RESULT_SIZE 2
#define VIRGL_QUERY_RESULT_HANDLE 1
#define VIRGL_QUERY_RESULT_WAIT 2
/* render condition */
#define VIRGL_RENDER_CONDITION_SIZE 3
#define VIRGL_RENDER_CONDITION_HANDLE 1
#define VIRGL_RENDER_CONDITION_CONDITION 2
#define VIRGL_RENDER_CONDITION_MODE 3
/* resource inline write */
#define VIRGL_RESOURCE_IW_RES_HANDLE 1
#define VIRGL_RESOURCE_IW_LEVEL 2
#define VIRGL_RESOURCE_IW_USAGE 3
#define VIRGL_RESOURCE_IW_STRIDE 4
#define VIRGL_RESOURCE_IW_LAYER_STRIDE 5
#define VIRGL_RESOURCE_IW_X 6
#define VIRGL_RESOURCE_IW_Y 7
#define VIRGL_RESOURCE_IW_Z 8
#define VIRGL_RESOURCE_IW_W 9
#define VIRGL_RESOURCE_IW_H 10
#define VIRGL_RESOURCE_IW_D 11
#define VIRGL_RESOURCE_IW_DATA_START 12
/* set streamout targets */
#define VIRGL_SET_STREAMOUT_TARGETS_APPEND_BITMASK 1
#define VIRGL_SET_STREAMOUT_TARGETS_H0 2
/* set sample mask */
#define VIRGL_SET_SAMPLE_MASK_SIZE 1
#define VIRGL_SET_SAMPLE_MASK_MASK 1
/* set clip state */
#define VIRGL_SET_CLIP_STATE_SIZE 32
#define VIRGL_SET_CLIP_STATE_C0 1
/* polygon stipple */
#define VIRGL_POLYGON_STIPPLE_SIZE 32
#define VIRGL_POLYGON_STIPPLE_P0 1
#define VIRGL_BIND_SHADER_SIZE 2
#define VIRGL_BIND_SHADER_HANDLE 1
#define VIRGL_BIND_SHADER_TYPE 2
/* tess state */
#define VIRGL_TESS_STATE_SIZE 6
/* set min samples */
#define VIRGL_SET_MIN_SAMPLES_SIZE 1
#define VIRGL_SET_MIN_SAMPLES_MASK 1
/* set shader buffers */
#define VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE 3
#define VIRGL_SET_SHADER_BUFFER_SIZE(x) (VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE * (x)) + 2
#define VIRGL_SET_SHADER_BUFFER_SHADER_TYPE 1
#define VIRGL_SET_SHADER_BUFFER_START_SLOT 2
#define VIRGL_SET_SHADER_BUFFER_OFFSET(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 3)
#define VIRGL_SET_SHADER_BUFFER_LENGTH(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 4)
#define VIRGL_SET_SHADER_BUFFER_RES_HANDLE(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 5)
/* set shader images */
#define VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE 5
#define VIRGL_SET_SHADER_IMAGE_SIZE(x) (VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE * (x)) + 2
#define VIRGL_SET_SHADER_IMAGE_SHADER_TYPE 1
#define VIRGL_SET_SHADER_IMAGE_START_SLOT 2
#define VIRGL_SET_SHADER_IMAGE_FORMAT(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 3)
#define VIRGL_SET_SHADER_IMAGE_ACCESS(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 4)
#define VIRGL_SET_SHADER_IMAGE_LAYER_OFFSET(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 5)
#define VIRGL_SET_SHADER_IMAGE_LEVEL_SIZE(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 6)
#define VIRGL_SET_SHADER_IMAGE_RES_HANDLE(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 7)
/* memory barrier */
#define VIRGL_MEMORY_BARRIER_SIZE 1
#define VIRGL_MEMORY_BARRIER_FLAGS 1
/* launch grid */
#define VIRGL_LAUNCH_GRID_SIZE 8
#define VIRGL_LAUNCH_BLOCK_X 1
#define VIRGL_LAUNCH_BLOCK_Y 2
#define VIRGL_LAUNCH_BLOCK_Z 3
#define VIRGL_LAUNCH_GRID_X 4
#define VIRGL_LAUNCH_GRID_Y 5
#define VIRGL_LAUNCH_GRID_Z 6
#define VIRGL_LAUNCH_INDIRECT_HANDLE 7
#define VIRGL_LAUNCH_INDIRECT_OFFSET 8
/* framebuffer state no attachment */
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_SIZE 2
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_WIDTH_HEIGHT 1
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_WIDTH(x) (x & 0xffff)
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_HEIGHT(x) ((x >> 16) & 0xffff)
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_LAYERS_SAMPLES 2
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_LAYERS(x) (x & 0xffff)
#define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_SAMPLES(x) ((x >> 16) & 0xff)
/* texture barrier */
#define VIRGL_TEXTURE_BARRIER_SIZE 1
#define VIRGL_TEXTURE_BARRIER_FLAGS 1
/* hw atomics */
#define VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE 3
#define VIRGL_SET_ATOMIC_BUFFER_SIZE(x) (VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE * (x)) + 1
#define VIRGL_SET_ATOMIC_BUFFER_START_SLOT 1
#define VIRGL_SET_ATOMIC_BUFFER_OFFSET(x) ((x) * VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE + 2)
#define VIRGL_SET_ATOMIC_BUFFER_LENGTH(x) ((x) * VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE + 3)
#define VIRGL_SET_ATOMIC_BUFFER_RES_HANDLE(x) ((x) * VIRGL_SET_ATOMIC_BUFFER_ELEMENT_SIZE + 4)
/* set debug flags */
#define VIRGL_SET_DEBUG_FLAGS_MIN_SIZE 2
#define VIRGL_SET_DEBUG_FLAGSTRING_OFFSET 1
/* query buffer object */
#define VIRGL_QUERY_RESULT_QBO_SIZE 6
#define VIRGL_QUERY_RESULT_QBO_HANDLE 1
#define VIRGL_QUERY_RESULT_QBO_QBO_HANDLE 2
#define VIRGL_QUERY_RESULT_QBO_WAIT 3
#define VIRGL_QUERY_RESULT_QBO_RESULT_TYPE 4
#define VIRGL_QUERY_RESULT_QBO_OFFSET 5
#define VIRGL_QUERY_RESULT_QBO_INDEX 6
#define VIRGL_TRANSFER_TO_HOST 1
#define VIRGL_TRANSFER_FROM_HOST 2
/* Transfer */
#define VIRGL_TRANSFER3D_SIZE 13
/* The first 11 dwords are the same as VIRGL_RESOURCE_IW_* */
#define VIRGL_TRANSFER3D_DATA_OFFSET 12
#define VIRGL_TRANSFER3D_DIRECTION 13
/* Copy transfer to host and from host*/
#define VIRGL_COPY_TRANSFER3D_SIZE 14
/* The first 11 dwords are the same as VIRGL_RESOURCE_IW_* */
#define VIRGL_COPY_TRANSFER3D_SRC_RES_HANDLE 12
#define VIRGL_COPY_TRANSFER3D_SRC_RES_OFFSET 13
#define VIRGL_COPY_TRANSFER3D_FLAGS 14
#define VIRGL_COPY_TRANSFER3D_FLAGS_SYNCHRONIZED (1 << 0)
/* 1 << 1 means transfer from host.
0 << 1 means transfer to host.*/
#define VIRGL_COPY_TRANSFER3D_FLAGS_READ_FROM_HOST (1 << 1)
/* set tweak flags */
#define VIRGL_SET_TWEAKS_SIZE 2
#define VIRGL_SET_TWEAKS_ID 1
#define VIRGL_SET_TWEAKS_VALUE 2
enum vrend_tweak_type {
virgl_tweak_gles_brga_emulate,
virgl_tweak_gles_brga_apply_dest_swizzle,
virgl_tweak_gles_tf3_samples_passes_multiplier,
virgl_tweak_undefined
};
/* Clear texture */
#define VIRGL_CLEAR_TEXTURE_SIZE 12
#define VIRGL_TEXTURE_HANDLE 1
#define VIRGL_TEXTURE_LEVEL 2
#define VIRGL_TEXTURE_SRC_X 3
#define VIRGL_TEXTURE_SRC_Y 4
#define VIRGL_TEXTURE_SRC_Z 5
#define VIRGL_TEXTURE_SRC_W 6
#define VIRGL_TEXTURE_SRC_H 7
#define VIRGL_TEXTURE_SRC_D 8
#define VIRGL_TEXTURE_ARRAY_A 9
#define VIRGL_TEXTURE_ARRAY_B 10
#define VIRGL_TEXTURE_ARRAY_C 11
#define VIRGL_TEXTURE_ARRAY_D 12
/* virgl create */
#define VIRGL_PIPE_RES_CREATE_SIZE 11
#define VIRGL_PIPE_RES_CREATE_TARGET 1
#define VIRGL_PIPE_RES_CREATE_FORMAT 2
#define VIRGL_PIPE_RES_CREATE_BIND 3
#define VIRGL_PIPE_RES_CREATE_WIDTH 4
#define VIRGL_PIPE_RES_CREATE_HEIGHT 5
#define VIRGL_PIPE_RES_CREATE_DEPTH 6
#define VIRGL_PIPE_RES_CREATE_ARRAY_SIZE 7
#define VIRGL_PIPE_RES_CREATE_LAST_LEVEL 8
#define VIRGL_PIPE_RES_CREATE_NR_SAMPLES 9
#define VIRGL_PIPE_RES_CREATE_FLAGS 10
#define VIRGL_PIPE_RES_CREATE_BLOB_ID 11
/* VIRGL_CCMD_PIPE_RESOURCE_SET_TYPE */
#define VIRGL_PIPE_RES_SET_TYPE_SIZE(nplanes) (8 + (nplanes) * 2)
#define VIRGL_PIPE_RES_SET_TYPE_RES_HANDLE 1
#define VIRGL_PIPE_RES_SET_TYPE_FORMAT 2
#define VIRGL_PIPE_RES_SET_TYPE_BIND 3
#define VIRGL_PIPE_RES_SET_TYPE_WIDTH 4
#define VIRGL_PIPE_RES_SET_TYPE_HEIGHT 5
#define VIRGL_PIPE_RES_SET_TYPE_USAGE 6
#define VIRGL_PIPE_RES_SET_TYPE_MODIFIER_LO 7
#define VIRGL_PIPE_RES_SET_TYPE_MODIFIER_HI 8
#define VIRGL_PIPE_RES_SET_TYPE_PLANE_STRIDE(plane) (9 + (plane) * 2)
#define VIRGL_PIPE_RES_SET_TYPE_PLANE_OFFSET(plane) (10 + (plane) * 2)
/* send string marker */
#define VIRGL_SEND_STRING_MARKER_MIN_SIZE 2
#define VIRGL_SEND_STRING_MARKER_STRING_SIZE 1
#define VIRGL_SEND_STRING_MARKER_OFFSET 2
/* link shader program */
#define VIRGL_LINK_SHADER_SIZE 6
#define VIRGL_LINK_SHADER_VERTEX_HANDLE 1
#define VIRGL_LINK_SHADER_FRAGMENT_HANDLE 2
#define VIRGL_LINK_SHADER_GEOMETRY_HANDLE 3
#define VIRGL_LINK_SHADER_TESS_CTRL_HANDLE 4
#define VIRGL_LINK_SHADER_TESS_EVAL_HANDLE 5
#define VIRGL_LINK_SHADER_COMPUTE_HANDLE 6
/* VIRGL_CCMD_CREATE_VIDEO_CODEC */
#define VIRGL_CREATE_VIDEO_CODEC_MIN_SIZE 7
#define VIRGL_CREATE_VIDEO_CODEC_HANDLE 1
#define VIRGL_CREATE_VIDEO_CODEC_PROFILE 2
#define VIRGL_CREATE_VIDEO_CODEC_ENTRYPOINT 3
#define VIRGL_CREATE_VIDEO_CODEC_CHROMA_FMT 4
#define VIRGL_CREATE_VIDEO_CODEC_LEVEL 5
#define VIRGL_CREATE_VIDEO_CODEC_WIDTH 6
#define VIRGL_CREATE_VIDEO_CODEC_HEIGHT 7
#define VIRGL_CREATE_VIDEO_CODEC_MAX_REF 8
/* VIRGL_CCMD_DESTROY_VIDEO_CODEC */
#define VIRGL_DESTROY_VIDEO_CODEC_MIN_SIZE 1
#define VIRGL_DESTROY_VIDEO_CODEC_HANDLE 1
/* VIRGL_CCMD_CREATE_VIDEO_BUFFER */
#define VIRGL_CREATE_VIDEO_BUFFER_MIN_SIZE 5
#define VIRGL_CREATE_VIDEO_BUFFER_HANDLE 1
#define VIRGL_CREATE_VIDEO_BUFFER_FORMAT 2
#define VIRGL_CREATE_VIDEO_BUFFER_WIDTH 3
#define VIRGL_CREATE_VIDEO_BUFFER_HEIGHT 4
#define VIRGL_CREATE_VIDEO_BUFFER_RES_BASE 5
/* VIRGL_CCMD_DESTROY_VIDEO_BUFFER */
#define VIRGL_DESTROY_VIDEO_BUFFER_MIN_SIZE 1
#define VIRGL_DESTROY_VIDEO_BUFFER_HANDLE 1
/* VIRGL_CCMD_BEGIN_FRAME */
#define VIRGL_BEGIN_FRAME_MIN_SIZE 2
#define VIRGL_BEGIN_FRAME_CDC_HANDLE 1
#define VIRGL_BEGIN_FRAME_TGT_HANDLE 2
/* VIRGL_CCMD_DECODE_MACROBLOCK */
/* VIRGL_CCMD_DECODE_BITSTREAM */
#define VIRGL_DECODE_BS_MIN_SIZE 5
#define VIRGL_DECODE_BS_CDC_HANDLE 1
#define VIRGL_DECODE_BS_TGT_HANDLE 2
#define VIRGL_DECODE_BS_DSC_HANDLE 3
#define VIRGL_DECODE_BS_BUF_HANDLE 4
#define VIRGL_DECODE_BS_BUF_SIZE 5
/* VIRGL_CCMD_ENCODE_BITSTREAM */
#define VIRGL_ENCODE_BS_MIN_SIZE 5
#define VIRGL_ENCODE_BS_CDC_HANDLE 1
#define VIRGL_ENCODE_BS_SRC_HANDLE 2
#define VIRGL_ENCODE_BS_DEST_HANDLE 3
#define VIRGL_ENCODE_BS_DESC_HANDLE 4
#define VIRGL_ENCODE_BS_FEED_HANDLE 5
/* VIRGL_CCMD_END_FRAME */
#define VIRGL_END_FRAME_MIN_SIZE 2
#define VIRGL_END_FRAME_CDC_HANDLE 1
#define VIRGL_END_FRAME_TGT_HANDLE 2
/* VIRGL_CCMD_CLEAR_SURFACE */
#define VIRGL_CLEAR_SURFACE_SIZE 10
#define VIRGL_CLEAR_SURFACE_S0 1
#define VIRGL_CLEAR_SURFACE_S0_RENDER_CONDITION(x) (((x)&0x1) << 0)
#define VIRGL_CLEAR_SURFACE_S0_BUFFERS(x) (((x)&0x7) << 1)
#define VIRGL_CLEAR_SURFACE_HANDLE 2
#define VIRGL_CLEAR_SURFACE_COLOR_0 3 /* color is 4 * u32/f32/i32 or (depth/f64+stencil/u32) */
#define VIRGL_CLEAR_SURFACE_COLOR_1 4
#define VIRGL_CLEAR_SURFACE_COLOR_2 5
#define VIRGL_CLEAR_SURFACE_COLOR_3 6
#define VIRGL_CLEAR_SURFACE_DST_X 7
#define VIRGL_CLEAR_SURFACE_DST_Y 8
#define VIRGL_CLEAR_SURFACE_WIDTH 9
#define VIRGL_CLEAR_SURFACE_HEIGHT 10
/* VIRGL_CCMD_GET_PIPE_RESOURCE_LAYOUT */
#define VIRGL_RESOURCE_LAYOUT_SIZE 2
#define VIRGL_RESOURCE_LAYOUT_HANDLE_OUT 1
#define VIRGL_RESOURCE_LAYOUT_HANDLE_TARGET 2
#endif
+980
View File
@@ -0,0 +1,980 @@
/**************************************************************************
*
* Copyright (C) 2022 Kylin Software Co., Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
/**
* @file
* Data structure definition of video hardware layer.
*
* These structures are used for communication between host and guest, and
* they are 4-byte aligned.
*
* 'virgl_picture_desc' and other related structures mainly describe sequence
* parameters, picture parameters, slice parameters, etc., as well as some
* context information for encoding and decoding. The video backend needs them
* to reconstruct VA-API calls.
*
* @author Feng Jiang <jiangfeng@kylinos.cn>
*/
#ifndef VIRGL_VIDEO_HW_H
#define VIRGL_VIDEO_HW_H
#include <stdint.h>
struct virgl_base_picture_desc {
uint16_t profile; /* enum pipe_video_profile */
uint8_t entry_point; /* enum pipe_video_entrypoint */
uint8_t protected_playback;
uint8_t decrypt_key[256];
uint32_t key_size;
};
struct virgl_enc_quality_modes {
uint32_t level;
uint32_t preset_mode;
uint32_t pre_encode_mode;
uint32_t vbaq_mode;
};
/* H.264 sequence parameter set */
struct virgl_h264_sps {
uint8_t level_idc;
uint8_t chroma_format_idc;
uint8_t separate_colour_plane_flag;
uint8_t bit_depth_luma_minus8;
uint8_t bit_depth_chroma_minus8;
uint8_t seq_scaling_matrix_present_flag;
uint8_t ScalingList4x4[6][16];
uint8_t ScalingList8x8[6][64];
uint8_t log2_max_frame_num_minus4;
uint8_t pic_order_cnt_type;
uint8_t log2_max_pic_order_cnt_lsb_minus4;
uint8_t delta_pic_order_always_zero_flag;
int32_t offset_for_non_ref_pic;
int32_t offset_for_top_to_bottom_field;
int32_t offset_for_ref_frame[256];
uint8_t num_ref_frames_in_pic_order_cnt_cycle;
uint8_t max_num_ref_frames;
uint8_t frame_mbs_only_flag;
uint8_t mb_adaptive_frame_field_flag;
uint8_t direct_8x8_inference_flag;
uint8_t MinLumaBiPredSize8x8;
uint8_t reserved[2];
};
/* H.264 picture parameter set */
struct virgl_h264_pps {
struct virgl_h264_sps sps; /* Seq Param Set */
uint8_t entropy_coding_mode_flag;
uint8_t bottom_field_pic_order_in_frame_present_flag;
uint8_t num_slice_groups_minus1;
uint8_t slice_group_map_type;
uint8_t slice_group_change_rate_minus1;
uint8_t num_ref_idx_l0_default_active_minus1;
uint8_t num_ref_idx_l1_default_active_minus1;
uint8_t weighted_pred_flag;
uint8_t weighted_bipred_idc;
int8_t pic_init_qp_minus26;
int8_t pic_init_qs_minus26;
int8_t chroma_qp_index_offset;
uint8_t deblocking_filter_control_present_flag;
uint8_t constrained_intra_pred_flag;
uint8_t redundant_pic_cnt_present_flag;
uint8_t transform_8x8_mode_flag;
uint8_t ScalingList4x4[6][16];
uint8_t ScalingList8x8[6][64];
int8_t second_chroma_qp_index_offset;
uint8_t reserved[3];
};
struct virgl_h264_picture_desc {
struct virgl_base_picture_desc base;
struct virgl_h264_pps pps; /* Picture Param Set */
uint32_t frame_num;
uint8_t field_pic_flag;
uint8_t bottom_field_flag;
uint8_t num_ref_idx_l0_active_minus1;
uint8_t num_ref_idx_l1_active_minus1;
uint32_t slice_count;
int32_t field_order_cnt[2];
uint8_t is_long_term[16];
uint8_t top_is_reference[16];
uint8_t bottom_is_reference[16];
uint32_t field_order_cnt_list[16][2];
uint32_t frame_num_list[16];
uint32_t buffer_id[16];
uint8_t is_reference;
uint8_t num_ref_frames;
uint8_t reserved[2];
};
struct virgl_h264_enc_seq_param
{
uint32_t enc_constraint_set_flags;
uint32_t enc_frame_cropping_flag;
uint32_t enc_frame_crop_left_offset;
uint32_t enc_frame_crop_right_offset;
uint32_t enc_frame_crop_top_offset;
uint32_t enc_frame_crop_bottom_offset;
uint32_t pic_order_cnt_type;
uint32_t num_temporal_layers;
uint32_t vui_parameters_present_flag;
struct {
uint32_t aspect_ratio_info_present_flag: 1;
uint32_t timing_info_present_flag: 1;
uint32_t reserved:30;
} vui_flags;
uint32_t aspect_ratio_idc;
uint32_t sar_width;
uint32_t sar_height;
uint32_t num_units_in_tick;
uint32_t time_scale;
};
struct virgl_h264_enc_rate_control
{
uint32_t target_bitrate;
uint32_t peak_bitrate;
uint32_t frame_rate_num;
uint32_t frame_rate_den;
uint32_t vbv_buffer_size;
uint32_t vbv_buf_lv;
uint32_t target_bits_picture;
uint32_t peak_bits_picture_integer;
uint32_t peak_bits_picture_fraction;
uint32_t fill_data_enable;
uint32_t skip_frame_enable;
uint32_t enforce_hrd;
uint32_t max_au_size;
uint32_t max_qp;
uint32_t min_qp;
uint8_t rate_ctrl_method; /* see enum pipe_h2645_enc_rate_control_method */
uint8_t reserved[3];
};
struct virgl_h264_enc_motion_estimation
{
uint32_t motion_est_quarter_pixel;
uint32_t enc_disable_sub_mode;
uint32_t lsmvert;
uint32_t enc_en_ime_overw_dis_subm;
uint32_t enc_ime_overw_dis_subm_no;
uint32_t enc_ime2_search_range_x;
uint32_t enc_ime2_search_range_y;
};
struct virgl_h264_enc_pic_control
{
uint32_t enc_cabac_enable;
uint32_t enc_cabac_init_idc;
};
struct virgl_h264_slice_descriptor
{
uint32_t macroblock_address;
uint32_t num_macroblocks;
uint8_t slice_type; /* see enum pipe_h264_slice_type */
uint8_t reserved[3];
};
struct virgl_h264_enc_picture_desc
{
struct virgl_base_picture_desc base;
struct virgl_h264_enc_seq_param seq;
struct virgl_h264_enc_rate_control rate_ctrl[4];
struct virgl_h264_enc_motion_estimation motion_est;
struct virgl_h264_enc_pic_control pic_ctrl;
uint32_t intra_idr_period;
uint32_t quant_i_frames;
uint32_t quant_p_frames;
uint32_t quant_b_frames;
uint32_t frame_num;
uint32_t frame_num_cnt;
uint32_t p_remain;
uint32_t i_remain;
uint32_t idr_pic_id;
uint32_t gop_cnt;
uint32_t pic_order_cnt;
uint32_t num_ref_idx_l0_active_minus1;
uint32_t num_ref_idx_l1_active_minus1;
uint32_t ref_idx_l0_list[32];
uint8_t l0_is_long_term[32];
uint32_t ref_idx_l1_list[32];
uint8_t l1_is_long_term[32];
uint32_t gop_size;
struct virgl_enc_quality_modes quality_modes;
uint32_t num_slice_descriptors;
struct virgl_h264_slice_descriptor slices_descriptors[128];
uint8_t picture_type; /* see enum pipe_h2645_enc_picture_type */
uint8_t not_referenced;
uint8_t is_ltr;
uint8_t enable_vui;
uint32_t ltr_index;
};
struct virgl_h265_sps
{
uint32_t pic_width_in_luma_samples;
uint32_t pic_height_in_luma_samples;
uint8_t chroma_format_idc;
uint8_t separate_colour_plane_flag;
uint8_t bit_depth_luma_minus8;
uint8_t bit_depth_chroma_minus8;
uint8_t log2_max_pic_order_cnt_lsb_minus4;
uint8_t sps_max_dec_pic_buffering_minus1;
uint8_t log2_min_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_luma_coding_block_size;
uint8_t log2_min_transform_block_size_minus2;
uint8_t log2_diff_max_min_transform_block_size;
uint8_t max_transform_hierarchy_depth_inter;
uint8_t max_transform_hierarchy_depth_intra;
uint8_t ScalingList4x4[6][16];
uint8_t ScalingList8x8[6][64];
uint8_t ScalingList16x16[6][64];
uint8_t ScalingList32x32[2][64];
uint8_t ScalingListDCCoeff16x16[6];
uint8_t ScalingListDCCoeff32x32[2];
uint8_t scaling_list_enabled_flag;
uint8_t amp_enabled_flag;
uint8_t sample_adaptive_offset_enabled_flag;
uint8_t pcm_enabled_flag;
uint8_t pcm_sample_bit_depth_luma_minus1;
uint8_t pcm_sample_bit_depth_chroma_minus1;
uint8_t log2_min_pcm_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
uint8_t pcm_loop_filter_disabled_flag;
uint8_t num_short_term_ref_pic_sets;
uint8_t long_term_ref_pics_present_flag;
uint8_t num_long_term_ref_pics_sps;
uint8_t sps_temporal_mvp_enabled_flag;
uint8_t strong_intra_smoothing_enabled_flag;
uint8_t reserved[2];
};
struct virgl_h265_pps
{
struct virgl_h265_sps sps;
uint8_t dependent_slice_segments_enabled_flag;
uint8_t output_flag_present_flag;
uint8_t num_extra_slice_header_bits;
uint8_t sign_data_hiding_enabled_flag;
uint8_t cabac_init_present_flag;
uint8_t num_ref_idx_l0_default_active_minus1;
uint8_t num_ref_idx_l1_default_active_minus1;
int8_t init_qp_minus26;
uint8_t constrained_intra_pred_flag;
uint8_t transform_skip_enabled_flag;
uint8_t cu_qp_delta_enabled_flag;
uint8_t diff_cu_qp_delta_depth;
int8_t pps_cb_qp_offset;
int8_t pps_cr_qp_offset;
uint8_t pps_slice_chroma_qp_offsets_present_flag;
uint8_t weighted_pred_flag;
uint8_t weighted_bipred_flag;
uint8_t transquant_bypass_enabled_flag;
uint8_t tiles_enabled_flag;
uint8_t entropy_coding_sync_enabled_flag;
uint16_t column_width_minus1[20];
uint16_t row_height_minus1[22];
uint8_t num_tile_columns_minus1;
uint8_t num_tile_rows_minus1;
uint8_t uniform_spacing_flag;
uint8_t loop_filter_across_tiles_enabled_flag;
uint8_t pps_loop_filter_across_slices_enabled_flag;
uint8_t deblocking_filter_control_present_flag;
uint8_t deblocking_filter_override_enabled_flag;
uint8_t pps_deblocking_filter_disabled_flag;
int8_t pps_beta_offset_div2;
int8_t pps_tc_offset_div2;
uint8_t lists_modification_present_flag;
uint8_t log2_parallel_merge_level_minus2;
uint16_t st_rps_bits;
uint8_t slice_segment_header_extension_present_flag;
uint8_t reserved;
};
struct virgl_h265_picture_desc
{
struct virgl_base_picture_desc base;
struct virgl_h265_pps pps;
int32_t CurrPicOrderCntVal;
uint32_t ref[16];
int32_t PicOrderCntVal[16];
uint32_t NumPocTotalCurr;
uint32_t NumDeltaPocsOfRefRpsIdx;
uint32_t NumShortTermPictureSliceHeaderBits;
uint32_t NumLongTermPictureSliceHeaderBits;
uint8_t IsLongTerm[16];
uint8_t IDRPicFlag;
uint8_t RAPPicFlag;
uint8_t CurrRpsIdx;
uint8_t NumPocStCurrBefore;
uint8_t NumPocStCurrAfter;
uint8_t NumPocLtCurr;
uint8_t UseRefPicList;
uint8_t UseStRpsBits;
uint8_t RefPicSetStCurrBefore[8];
uint8_t RefPicSetStCurrAfter[8];
uint8_t RefPicSetLtCurr[8];
uint8_t RefPicList[2][15];
uint8_t reserved[2];
};
struct virgl_h265_enc_seq_param
{
uint8_t general_profile_idc;
uint8_t general_level_idc;
uint8_t general_tier_flag;
uint8_t strong_intra_smoothing_enabled_flag;
uint32_t intra_period;
uint32_t ip_period;
uint16_t pic_width_in_luma_samples;
uint16_t pic_height_in_luma_samples;
uint32_t chroma_format_idc;
uint32_t bit_depth_luma_minus8;
uint32_t bit_depth_chroma_minus8;
uint8_t amp_enabled_flag;
uint8_t sample_adaptive_offset_enabled_flag;
uint8_t pcm_enabled_flag;
uint8_t sps_temporal_mvp_enabled_flag;
uint8_t log2_min_luma_coding_block_size_minus3;
uint8_t log2_diff_max_min_luma_coding_block_size;
uint8_t log2_min_transform_block_size_minus2;
uint8_t log2_diff_max_min_transform_block_size;
uint16_t conf_win_left_offset;
uint16_t conf_win_right_offset;
uint16_t conf_win_top_offset;
uint16_t conf_win_bottom_offset;
uint32_t vui_parameters_present_flag;
struct {
uint32_t aspect_ratio_info_present_flag: 1;
uint32_t timing_info_present_flag: 1;
uint32_t reserved:30;
} vui_flags;
uint32_t aspect_ratio_idc;
uint32_t sar_width;
uint32_t sar_height;
uint32_t num_units_in_tick;
uint32_t time_scale;
uint8_t max_transform_hierarchy_depth_inter;
uint8_t max_transform_hierarchy_depth_intra;
uint8_t conformance_window_flag;
uint8_t reserved;
};
struct virgl_h265_enc_pic_param
{
uint8_t log2_parallel_merge_level_minus2;
uint8_t nal_unit_type;
uint8_t constrained_intra_pred_flag;
uint8_t pps_loop_filter_across_slices_enabled_flag;
uint8_t transform_skip_enabled_flag;
uint8_t reserved[3];
};
struct virgl_h265_enc_slice_param
{
uint8_t max_num_merge_cand;
int8_t slice_cb_qp_offset;
int8_t slice_cr_qp_offset;
int8_t slice_beta_offset_div2;
uint32_t slice_deblocking_filter_disabled_flag;
int8_t slice_tc_offset_div2;
uint8_t cabac_init_flag;
uint8_t slice_loop_filter_across_slices_enabled_flag;
uint8_t reserved;
};
struct virgl_h265_enc_rate_control
{
uint32_t target_bitrate;
uint32_t peak_bitrate;
uint32_t frame_rate_num;
uint32_t frame_rate_den;
uint32_t quant_i_frames;
uint32_t quant_p_frames;
uint32_t quant_b_frames;
uint32_t vbv_buffer_size;
uint32_t vbv_buf_lv;
uint32_t target_bits_picture;
uint32_t peak_bits_picture_integer;
uint32_t peak_bits_picture_fraction;
uint32_t fill_data_enable;
uint32_t skip_frame_enable;
uint32_t enforce_hrd;
uint32_t max_au_size;
uint32_t max_qp;
uint32_t min_qp;
uint8_t rate_ctrl_method; /* see enum pipe_h2645_enc_rate_control_method */
uint8_t reserved[3];
};
struct virgl_h265_slice_descriptor
{
uint32_t slice_segment_address;
uint32_t num_ctu_in_slice;
uint8_t slice_type; /* see enum pipe_h265_slice_type */
uint8_t reserved[3];
};
struct virgl_h265_enc_picture_desc
{
struct virgl_base_picture_desc base;
struct virgl_h265_enc_seq_param seq;
struct virgl_h265_enc_pic_param pic;
struct virgl_h265_enc_slice_param slice;
struct virgl_h265_enc_rate_control rc;
uint32_t decoded_curr_pic;
uint32_t reference_frames[16];
uint32_t frame_num;
uint32_t pic_order_cnt;
uint32_t pic_order_cnt_type;
uint32_t num_ref_idx_l0_active_minus1;
uint32_t num_ref_idx_l1_active_minus1;
uint32_t ref_idx_l0_list[15];
uint32_t ref_idx_l1_list[15];
uint32_t num_slice_descriptors;
struct virgl_h265_slice_descriptor slices_descriptors[128];
struct virgl_enc_quality_modes quality_modes;
uint8_t picture_type; /* see enum pipe_h2645_enc_picture_type */
uint8_t not_referenced;
uint8_t reserved[2];
};
struct virgl_mpeg4_picture_desc
{
struct virgl_base_picture_desc base;
int32_t trd[2];
int32_t trb[2];
uint16_t vop_time_increment_resolution;
uint8_t vop_coding_type;
uint8_t vop_fcode_forward;
uint8_t vop_fcode_backward;
uint8_t resync_marker_disable;
uint8_t interlaced;
uint8_t quant_type;
uint8_t quarter_sample;
uint8_t short_video_header;
uint8_t rounding_control;
uint8_t alternate_vertical_scan_flag;
uint8_t top_field_first;
uint8_t intra_matrix[64];
uint8_t non_intra_matrix[64];
uint32_t ref[2];
};
struct virgl_mpeg12_picture_desc
{
struct virgl_base_picture_desc base;
unsigned picture_coding_type;
unsigned picture_structure;
unsigned frame_pred_frame_dct;
unsigned q_scale_type;
unsigned alternate_scan;
unsigned intra_vlc_format;
unsigned concealment_motion_vectors;
unsigned intra_dc_precision;
unsigned f_code[2][2];
unsigned top_field_first;
unsigned full_pel_forward_vector;
unsigned full_pel_backward_vector;
unsigned num_slices;
uint8_t intra_matrix[64];
uint8_t non_intra_matrix[64];
uint32_t ref[2];
};
struct virgl_vc1_picture_desc
{
struct virgl_base_picture_desc base;
uint32_t slice_count;
uint8_t picture_type;
uint8_t frame_coding_mode;
uint8_t postprocflag;
uint8_t pulldown;
uint8_t interlace;
uint8_t tfcntrflag;
uint8_t finterpflag;
uint8_t psf;
uint8_t dquant;
uint8_t panscan_flag;
uint8_t refdist_flag;
uint8_t quantizer;
uint8_t extended_mv;
uint8_t extended_dmv;
uint8_t overlap;
uint8_t vstransform;
uint8_t loopfilter;
uint8_t fastuvmc;
uint8_t range_mapy_flag;
uint8_t range_mapy;
uint8_t range_mapuv_flag;
uint8_t range_mapuv;
uint8_t multires;
uint8_t syncmarker;
uint8_t rangered;
uint8_t maxbframes;
uint8_t deblockEnable;
uint8_t pquant;
uint32_t ref[2];
};
struct virgl_mjpeg_picture_desc
{
struct virgl_base_picture_desc base;
struct
{
uint16_t picture_width;
uint16_t picture_height;
struct {
uint8_t component_id;
uint8_t h_sampling_factor;
uint8_t v_sampling_factor;
uint8_t quantiser_table_selector;
} components[255];
uint8_t num_components;
uint16_t crop_x;
uint16_t crop_y;
uint16_t crop_width;
uint16_t crop_height;
} picture_parameter;
struct
{
uint8_t load_quantiser_table[4];
uint8_t quantiser_table[4][64];
} quantization_table;
struct
{
uint8_t load_huffman_table[2];
struct {
uint8_t num_dc_codes[16];
uint8_t dc_values[12];
uint8_t num_ac_codes[16];
uint8_t ac_values[162];
uint8_t pad[2];
} table[2];
} huffman_table;
struct
{
unsigned slice_data_size;
unsigned slice_data_offset;
unsigned slice_data_flag;
unsigned slice_horizontal_position;
unsigned slice_vertical_position;
struct {
uint8_t component_selector;
uint8_t dc_table_selector;
uint8_t ac_table_selector;
} components[4];
uint8_t num_components;
uint16_t restart_interval;
unsigned num_mcus;
} slice_parameter;
};
struct virgl_vp9_segment_parameter
{
struct {
uint16_t segment_reference_enabled:1;
uint16_t segment_reference:2;
uint16_t segment_reference_skipped:1;
} segment_flags;
uint8_t filter_level[4][2];
int16_t luma_ac_quant_scale;
int16_t luma_dc_quant_scale;
int16_t chroma_ac_quant_scale;
int16_t chroma_dc_quant_scale;
};
struct virgl_vp9_picture_desc
{
struct virgl_base_picture_desc base;
uint32_t ref[16];
struct {
uint16_t frame_width;
uint16_t frame_height;
struct {
uint32_t subsampling_x:1;
uint32_t subsampling_y:1;
uint32_t frame_type:1;
uint32_t show_frame:1;
uint32_t error_resilient_mode:1;
uint32_t intra_only:1;
uint32_t allow_high_precision_mv:1;
uint32_t mcomp_filter_type:3;
uint32_t frame_parallel_decoding_mode:1;
uint32_t reset_frame_context:2;
uint32_t refresh_frame_context:1;
uint32_t frame_context_idx:2;
uint32_t segmentation_enabled:1;
uint32_t segmentation_temporal_update:1;
uint32_t segmentation_update_map:1;
uint32_t last_ref_frame:3;
uint32_t last_ref_frame_sign_bias:1;
uint32_t golden_ref_frame:3;
uint32_t golden_ref_frame_sign_bias:1;
uint32_t alt_ref_frame:3;
uint32_t alt_ref_frame_sign_bias:1;
uint32_t lossless_flag:1;
} pic_fields;
uint8_t filter_level;
uint8_t sharpness_level;
uint8_t log2_tile_rows;
uint8_t log2_tile_columns;
uint8_t frame_header_length_in_bytes;
uint16_t first_partition_size;
uint8_t mb_segment_tree_probs[7];
uint8_t segment_pred_probs[3];
uint8_t profile;
uint8_t bit_depth;
bool mode_ref_delta_enabled;
bool mode_ref_delta_update;
uint8_t base_qindex;
int8_t y_dc_delta_q;
int8_t uv_ac_delta_q;
int8_t uv_dc_delta_q;
uint8_t abs_delta;
uint8_t ref_deltas[4];
uint8_t mode_deltas[2];
} picture_parameter;
struct {
uint32_t slice_data_size;
uint32_t slice_data_offset;
uint32_t slice_data_flag;
struct virgl_vp9_segment_parameter seg_param[8];
} slice_parameter;
};
struct virgl_av1_picture_desc
{
struct virgl_base_picture_desc base;
uint32_t ref[16];
uint32_t film_grain_target;
struct {
uint8_t profile;
uint8_t order_hint_bits_minus_1;
uint8_t bit_depth_idx;
struct {
uint32_t use_128x128_superblock:1;
uint32_t enable_filter_intra:1;
uint32_t enable_intra_edge_filter:1;
uint32_t enable_interintra_compound:1;
uint32_t enable_masked_compound:1;
uint32_t enable_dual_filter:1;
uint32_t enable_order_hint:1;
uint32_t enable_jnt_comp:1;
uint32_t enable_cdef:1;
uint32_t mono_chrome:1;
uint32_t ref_frame_mvs:1;
uint32_t film_grain_params_present:1;
} seq_info_fields;
uint32_t current_frame_id;
uint16_t frame_width;
uint16_t frame_height;
uint16_t max_width;
uint16_t max_height;
uint8_t ref_frame_idx[7];
uint8_t primary_ref_frame;
uint8_t order_hint;
struct {
struct {
uint32_t enabled:1;
uint32_t update_map:1;
uint32_t update_data:1;
uint32_t temporal_update:1;
} segment_info_fields;
int16_t feature_data[8][8];
uint8_t feature_mask[8];
} seg_info;
struct {
struct {
uint32_t apply_grain:1;
uint32_t chroma_scaling_from_luma:1;
uint32_t grain_scaling_minus_8:2;
uint32_t ar_coeff_lag:2;
uint32_t ar_coeff_shift_minus_6:2;
uint32_t grain_scale_shift:2;
uint32_t overlap_flag:1;
uint32_t clip_to_restricted_range:1;
} film_grain_info_fields;
uint16_t grain_seed;
uint8_t num_y_points;
uint8_t point_y_value[14];
uint8_t point_y_scaling[14];
uint8_t num_cb_points;
uint8_t point_cb_value[10];
uint8_t point_cb_scaling[10];
uint8_t num_cr_points;
uint8_t point_cr_value[10];
uint8_t point_cr_scaling[10];
int8_t ar_coeffs_y[24];
int8_t ar_coeffs_cb[25];
int8_t ar_coeffs_cr[25];
uint8_t cb_mult;
uint8_t cb_luma_mult;
uint16_t cb_offset;
uint8_t cr_mult;
uint8_t cr_luma_mult;
uint16_t cr_offset;
} film_grain_info;
uint8_t tile_cols;
uint8_t tile_rows;
uint32_t tile_col_start_sb[65];
uint32_t tile_row_start_sb[65];
uint16_t width_in_sbs[64];
uint16_t height_in_sbs[64];
uint16_t context_update_tile_id;
struct {
uint32_t frame_type:2;
uint32_t show_frame:1;
uint32_t showable_frame:1;
uint32_t error_resilient_mode:1;
uint32_t disable_cdf_update:1;
uint32_t allow_screen_content_tools:1;
uint32_t force_integer_mv:1;
uint32_t allow_intrabc:1;
uint32_t use_superres:1;
uint32_t allow_high_precision_mv:1;
uint32_t is_motion_mode_switchable:1;
uint32_t use_ref_frame_mvs:1;
uint32_t disable_frame_end_update_cdf:1;
uint32_t uniform_tile_spacing_flag:1;
uint32_t allow_warped_motion:1;
uint32_t large_scale_tile:1;
} pic_info_fields;
uint8_t superres_scale_denominator;
uint8_t interp_filter;
uint8_t filter_level[2];
uint8_t filter_level_u;
uint8_t filter_level_v;
struct {
uint8_t sharpness_level:3;
uint8_t mode_ref_delta_enabled:1;
uint8_t mode_ref_delta_update:1;
} loop_filter_info_fields;
int8_t ref_deltas[8];
int8_t mode_deltas[2];
uint8_t base_qindex;
int8_t y_dc_delta_q;
int8_t u_dc_delta_q;
int8_t u_ac_delta_q;
int8_t v_dc_delta_q;
int8_t v_ac_delta_q;
struct {
uint16_t using_qmatrix:1;
uint16_t qm_y:4;
uint16_t qm_u:4;
uint16_t qm_v:4;
} qmatrix_fields;
struct {
uint32_t delta_q_present_flag:1;
uint32_t log2_delta_q_res:2;
uint32_t delta_lf_present_flag:1;
uint32_t log2_delta_lf_res:2;
uint32_t delta_lf_multi:1;
uint32_t tx_mode:2;
uint32_t reference_select:1;
uint32_t reduced_tx_set_used:1;
uint32_t skip_mode_present:1;
} mode_control_fields;
uint8_t cdef_damping_minus_3;
uint8_t cdef_bits;
uint8_t cdef_y_strengths[8];
uint8_t cdef_uv_strengths[8];
struct {
uint16_t yframe_restoration_type:2;
uint16_t cbframe_restoration_type:2;
uint16_t crframe_restoration_type:2;
uint16_t lr_unit_shift:2;
uint16_t lr_uv_shift:1;
} loop_restoration_fields;
uint16_t lr_unit_size[3];
struct {
uint32_t wmtype;
uint8_t invalid;
int32_t wmmat[8];
} wm[7];
uint32_t refresh_frame_flags;
uint8_t matrix_coefficients;
} picture_parameter;
struct {
uint32_t slice_data_size[256];
uint32_t slice_data_offset[256];
uint16_t slice_data_row[256];
uint16_t slice_data_col[256];
uint8_t slice_data_anchor_frame_idx[256];
uint16_t slice_count;
} slice_parameter;
};
union virgl_picture_desc {
struct virgl_base_picture_desc base;
struct virgl_h264_picture_desc h264;
struct virgl_h265_picture_desc h265;
struct virgl_mpeg4_picture_desc mpeg4;
struct virgl_mpeg12_picture_desc mpeg12;
struct virgl_vc1_picture_desc vc1;
struct virgl_mjpeg_picture_desc mjpeg;
struct virgl_av1_picture_desc av1;
struct virgl_h264_enc_picture_desc h264_enc;
struct virgl_h265_enc_picture_desc h265_enc;
struct virgl_vp9_picture_desc vp9;
};
enum virgl_video_encode_stat {
VIRGL_VIDEO_ENCODE_STAT_NOT_STARTED = 0,
VIRGL_VIDEO_ENCODE_STAT_IN_PROGRESS,
VIRGL_VIDEO_ENCODE_STAT_SUCCESS,
VIRGL_VIDEO_ENCODE_STAT_FAILURE,
};
struct virgl_video_encode_feedback {
uint8_t stat; /* see enum virgl_video_encode_stat */
uint8_t reserved[3];
uint32_t coded_size; /* size of encoded data in bytes */
};
#endif /* VIRGL_VIDEO_HW_H */
@@ -0,0 +1,137 @@
/*
* Copyright 2022 Google
* SPDX-License-Identifier: MIT
*/
#ifndef VIRTGPU_GFXSTREAM_PROTOCOL_H
#define VIRTGPU_GFXSTREAM_PROTOCOL_H
#include <stdint.h>
// Address Space Graphics contexts
#define GFXSTREAM_CONTEXT_CREATE 0x1001
#define GFXSTREAM_CONTEXT_PING 0x1002
#define GFXSTREAM_CONTEXT_PING_WITH_RESPONSE 0x1003
// Native Sync FD
#define GFXSTREAM_CREATE_EXPORT_SYNC 0x9000
#define GFXSTREAM_CREATE_IMPORT_SYNC 0x9001
// Vulkan Sync
#define GFXSTREAM_CREATE_EXPORT_SYNC_VK 0xa000
#define GFXSTREAM_CREATE_IMPORT_SYNC_VK 0xa001
#define GFXSTREAM_CREATE_QSRI_EXPORT_VK 0xa002
#define GFXSTREAM_RESOURCE_CREATE_3D 0xa003
#define GFXSTREAM_ACQUIRE_SYNC 0xa004
// clang-format off
// A placeholder command to ensure virtio-gpu completes
#define GFXSTREAM_PLACEHOLDER_COMMAND_VK 0xf002
// clang-format on
struct gfxstreamHeader {
uint32_t opCode;
};
struct gfxstreamContextCreate {
struct gfxstreamHeader hdr;
uint32_t resourceId;
};
struct gfxstreamContextPing {
struct gfxstreamHeader hdr;
uint32_t resourceId;
};
struct gfxstreamCreateExportSync {
struct gfxstreamHeader hdr;
uint32_t syncHandleLo;
uint32_t syncHandleHi;
};
struct gfxstreamCreateExportSyncVK {
struct gfxstreamHeader hdr;
uint32_t deviceHandleLo;
uint32_t deviceHandleHi;
uint32_t fenceHandleLo;
uint32_t fenceHandleHi;
};
struct gfxstreamCreateQSRIExportVK {
struct gfxstreamHeader hdr;
uint32_t imageHandleLo;
uint32_t imageHandleHi;
};
struct gfxstreamPlaceholderCommandVk {
struct gfxstreamHeader hdr;
uint32_t pad;
uint32_t padding;
};
struct gfxstreamResourceCreate3d {
struct gfxstreamHeader hdr;
uint32_t target;
uint32_t format;
uint32_t bind;
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t arraySize;
uint32_t lastLevel;
uint32_t nrSamples;
uint32_t flags;
uint32_t pad;
uint64_t blobId;
};
struct gfxstreamAcquireSync {
struct gfxstreamHeader hdr;
uint32_t padding;
uint64_t syncId;
};
struct vulkanCapset {
uint32_t protocolVersion;
// ASG Ring Parameters
uint32_t ringSize;
uint32_t bufferSize;
uint32_t colorBufferMemoryIndex;
uint32_t deferredMapping;
uint32_t blobAlignment;
uint32_t noRenderControlEnc;
uint32_t alwaysBlob;
uint32_t externalSync;
uint32_t virglSupportedFormats[16];
uint32_t vulkanBatchedDescriptorSetUpdate;
uint32_t hasTraceAsyncCommand;
uint32_t hasSetMetadataCommand;
};
struct magmaCapset {
uint32_t protocolVersion;
// ASG Ring Parameters
uint32_t ringSize;
uint32_t bufferSize;
uint32_t blobAlignment;
};
struct glesCapset {
uint32_t protocolVersion;
// ASG Ring Parameters
uint32_t ringSize;
uint32_t bufferSize;
uint32_t blobAlignment;
};
struct composerCapset {
uint32_t protocolVersion;
// ASG Ring Parameters
uint32_t ringSize;
uint32_t bufferSize;
uint32_t blobAlignment;
};
#endif
+352
View File
@@ -0,0 +1,352 @@
/**************************************************************************
*
* Copyright (C) 2015 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
**************************************************************************/
#ifndef VTEST_PROTOCOL
#define VTEST_PROTOCOL
#define VTEST_DEFAULT_SOCKET_NAME "/tmp/.virgl_test"
#define VTEST_PROTOCOL_VERSION 4
/* 32-bit length field */
/* 32-bit cmd field */
#define VTEST_HDR_SIZE 2
#define VTEST_CMD_LEN 0 /* length of data */
#define VTEST_CMD_ID 1
#define VTEST_CMD_DATA_START 2
/* vtest cmds */
#define VCMD_GET_CAPS 1
#define VCMD_RESOURCE_CREATE 2
#define VCMD_RESOURCE_UNREF 3
#define VCMD_TRANSFER_GET 4
#define VCMD_TRANSFER_PUT 5
#define VCMD_SUBMIT_CMD 6
#define VCMD_RESOURCE_BUSY_WAIT 7
/* pass the process cmd line for debugging */
#define VCMD_CREATE_RENDERER 8
#define VCMD_GET_CAPS2 9
/* get caps */
/* 0 length cmd */
/* resp VCMD_GET_CAPS + caps */
#define VCMD_PING_PROTOCOL_VERSION 10
#define VCMD_PROTOCOL_VERSION 11
/* since protocol version 2 */
#define VCMD_RESOURCE_CREATE2 12
#define VCMD_TRANSFER_GET2 13
#define VCMD_TRANSFER_PUT2 14
/* since protocol version 3 */
#define VCMD_GET_PARAM 15
#define VCMD_GET_CAPSET 16
#define VCMD_CONTEXT_INIT 17
#define VCMD_RESOURCE_CREATE_BLOB 18
#define VCMD_SYNC_CREATE 19
#define VCMD_SYNC_UNREF 20
#define VCMD_SYNC_READ 21
#define VCMD_SYNC_WRITE 22
#define VCMD_SYNC_WAIT 23
#define VCMD_SUBMIT_CMD2 24
/* since protocol version 4 */
#define VCMD_DRM_SYNC_CREATE 25
#define VCMD_DRM_SYNC_DESTROY 26
#define VCMD_DRM_SYNC_HANDLE_TO_FD 27
#define VCMD_DRM_SYNC_FD_TO_HANDLE 28
#define VCMD_DRM_SYNC_IMPORT_SYNC_FILE 29
#define VCMD_DRM_SYNC_EXPORT_SYNC_FILE 30
#define VCMD_DRM_SYNC_WAIT 31
#define VCMD_DRM_SYNC_RESET 32
#define VCMD_DRM_SYNC_SIGNAL 33
#define VCMD_DRM_SYNC_TIMELINE_SIGNAL 34
#define VCMD_DRM_SYNC_TIMELINE_WAIT 35
#define VCMD_DRM_SYNC_QUERY 36
#define VCMD_DRM_SYNC_TRANSFER 37
#define VCMD_RESOURCE_EXPORT_FD 38
#define VCMD_RES_CREATE_SIZE 10
#define VCMD_RES_CREATE_RES_HANDLE 0 /* must be 0 since protocol version 3 */
#define VCMD_RES_CREATE_TARGET 1
#define VCMD_RES_CREATE_FORMAT 2
#define VCMD_RES_CREATE_BIND 3
#define VCMD_RES_CREATE_WIDTH 4
#define VCMD_RES_CREATE_HEIGHT 5
#define VCMD_RES_CREATE_DEPTH 6
#define VCMD_RES_CREATE_ARRAY_SIZE 7
#define VCMD_RES_CREATE_LAST_LEVEL 8
#define VCMD_RES_CREATE_NR_SAMPLES 9
/* resp res_id since protocol version 3 */
#define VCMD_RES_CREATE2_SIZE 11
#define VCMD_RES_CREATE2_RES_HANDLE 0 /* must be 0 since protocol version 3 */
#define VCMD_RES_CREATE2_TARGET 1
#define VCMD_RES_CREATE2_FORMAT 2
#define VCMD_RES_CREATE2_BIND 3
#define VCMD_RES_CREATE2_WIDTH 4
#define VCMD_RES_CREATE2_HEIGHT 5
#define VCMD_RES_CREATE2_DEPTH 6
#define VCMD_RES_CREATE2_ARRAY_SIZE 7
#define VCMD_RES_CREATE2_LAST_LEVEL 8
#define VCMD_RES_CREATE2_NR_SAMPLES 9
#define VCMD_RES_CREATE2_DATA_SIZE 10
/* resp res_id since protocol version 3, and fd if data_size >0 */
#define VCMD_RES_UNREF_SIZE 1
#define VCMD_RES_UNREF_RES_HANDLE 0
#define VCMD_TRANSFER_HDR_SIZE 11
#define VCMD_TRANSFER_RES_HANDLE 0
#define VCMD_TRANSFER_LEVEL 1
#define VCMD_TRANSFER_STRIDE 2
#define VCMD_TRANSFER_LAYER_STRIDE 3
#define VCMD_TRANSFER_X 4
#define VCMD_TRANSFER_Y 5
#define VCMD_TRANSFER_Z 6
#define VCMD_TRANSFER_WIDTH 7
#define VCMD_TRANSFER_HEIGHT 8
#define VCMD_TRANSFER_DEPTH 9
#define VCMD_TRANSFER_DATA_SIZE 10
#define VCMD_TRANSFER2_HDR_SIZE 10
#define VCMD_TRANSFER2_RES_HANDLE 0
#define VCMD_TRANSFER2_LEVEL 1
#define VCMD_TRANSFER2_X 2
#define VCMD_TRANSFER2_Y 3
#define VCMD_TRANSFER2_Z 4
#define VCMD_TRANSFER2_WIDTH 5
#define VCMD_TRANSFER2_HEIGHT 6
#define VCMD_TRANSFER2_DEPTH 7
#define VCMD_TRANSFER2_DATA_SIZE 8
#define VCMD_TRANSFER2_OFFSET 9
#define VCMD_BUSY_WAIT_FLAG_WAIT 1
#define VCMD_BUSY_WAIT_SIZE 2
#define VCMD_BUSY_WAIT_HANDLE 0
#define VCMD_BUSY_WAIT_FLAGS 1
#define VCMD_PING_PROTOCOL_VERSION_SIZE 0
#define VCMD_PROTOCOL_VERSION_SIZE 1
#define VCMD_PROTOCOL_VERSION_VERSION 0
enum vcmd_param {
VCMD_PARAM_MAX_TIMELINE_COUNT = 1,
VCMD_PARAM_HAS_TIMELINE_SYNCOBJ = 2,
};
#define VCMD_GET_PARAM_SIZE 1
#define VCMD_GET_PARAM_PARAM 0
/* resp param validity and value */
#define VCMD_GET_CAPSET_SIZE 2
#define VCMD_GET_CAPSET_ID 0
#define VCMD_GET_CAPSET_VERSION 1
/* resp capset validity and contents */
#define VCMD_CONTEXT_INIT_SIZE 1
#define VCMD_CONTEXT_INIT_CAPSET_ID 0
enum vcmd_blob_type {
VCMD_BLOB_TYPE_GUEST = 1,
VCMD_BLOB_TYPE_HOST3D = 2,
VCMD_BLOB_TYPE_HOST3D_GUEST = 3,
};
enum vcmd_blob_flag {
VCMD_BLOB_FLAG_MAPPABLE = 1 << 0,
VCMD_BLOB_FLAG_SHAREABLE = 1 << 1,
VCMD_BLOB_FLAG_CROSS_DEVICE = 1 << 2,
};
#define VCMD_RES_CREATE_BLOB_SIZE 6
#define VCMD_RES_CREATE_BLOB_TYPE 0
#define VCMD_RES_CREATE_BLOB_FLAGS 1
#define VCMD_RES_CREATE_BLOB_SIZE_LO 2
#define VCMD_RES_CREATE_BLOB_SIZE_HI 3
#define VCMD_RES_CREATE_BLOB_ID_LO 4
#define VCMD_RES_CREATE_BLOB_ID_HI 5
/* resp res_id and mmap'able fd */
#define VCMD_SYNC_CREATE_SIZE 2
#define VCMD_SYNC_CREATE_VALUE_LO 0
#define VCMD_SYNC_CREATE_VALUE_HI 1
/* resp sync id */
#define VCMD_SYNC_UNREF_SIZE 1
#define VCMD_SYNC_UNREF_ID 0
#define VCMD_SYNC_READ_SIZE 1
#define VCMD_SYNC_READ_ID 0
/* resp sync value */
#define VCMD_SYNC_WRITE_SIZE 3
#define VCMD_SYNC_WRITE_ID 0
#define VCMD_SYNC_WRITE_VALUE_LO 1
#define VCMD_SYNC_WRITE_VALUE_HI 2
enum vcmd_sync_wait_flag {
VCMD_SYNC_WAIT_FLAG_ANY = 1 << 0,
};
#define VCMD_SYNC_WAIT_SIZE(count) (2 + 3 * count)
#define VCMD_SYNC_WAIT_FLAGS 0
#define VCMD_SYNC_WAIT_TIMEOUT 1
#define VCMD_SYNC_WAIT_ID(n) (2 + 3 * (n) + 0)
#define VCMD_SYNC_WAIT_VALUE_LO(n) (2 + 3 * (n) + 1)
#define VCMD_SYNC_WAIT_VALUE_HI(n) (2 + 3 * (n) + 2)
/* resp poll'able fd */
enum vcmd_submit_cmd2_flag {
VCMD_SUBMIT_CMD2_FLAG_RING_IDX = 1 << 0,
VCMD_SUBMIT_CMD2_FLAG_IN_FENCE_FD = 1 << 1,
VCMD_SUBMIT_CMD2_FLAG_OUT_FENCE_FD = 1 << 2,
};
struct vcmd_submit_cmd2_batch {
uint32_t flags;
uint32_t cmd_offset;
uint32_t cmd_size;
/* sync_count pairs of (id, val) starting at sync_offset */
uint32_t sync_offset;
uint32_t sync_count;
/* ignored unless VCMD_SUBMIT_CMD2_FLAG_RING_IDX is set */
uint32_t ring_idx;
uint32_t num_in_syncobj;
uint32_t num_out_syncobj;
};
#define VCMD_SUBMIT_CMD2_BATCH_COUNT 0
#define VCMD_SUBMIT_CMD2_BATCH_FLAGS(n) (1 + 8 * (n) + 0)
#define VCMD_SUBMIT_CMD2_BATCH_CMD_OFFSET(n) (1 + 8 * (n) + 1)
#define VCMD_SUBMIT_CMD2_BATCH_CMD_SIZE(n) (1 + 8 * (n) + 2)
#define VCMD_SUBMIT_CMD2_BATCH_SYNC_OFFSET(n) (1 + 8 * (n) + 3)
#define VCMD_SUBMIT_CMD2_BATCH_SYNC_COUNT(n) (1 + 8 * (n) + 4)
#define VCMD_SUBMIT_CMD2_BATCH_RING_IDX(n) (1 + 8 * (n) + 5)
#define VCMD_SUBMIT_CMD2_BATCH_NUM_IN_SYNCOBJ(n) (1 + 8 * (n) + 6)
#define VCMD_SUBMIT_CMD2_BATCH_NUM_OUT_SYNCOBJ(n) (1 + 8 * (n) + 7)
#define VCMD_DRM_SYNC_CREATE_SIZE 1
#define VCMD_DRM_SYNC_CREATE_FLAGS 0
/* resp sync handle */
#define VCMD_DRM_SYNC_DESTROY_SIZE 1
#define VCMD_DRM_SYNC_DESTROY_HANDLE 0
#define VCMD_DRM_SYNC_HANDLE_TO_FD_SIZE 1
#define VCMD_DRM_SYNC_HANDLE_TO_FD_HANDLE 0
/* resp sync fd */
#define VCMD_DRM_SYNC_FD_TO_HANDLE_SIZE 0
/* req sync fd */
/* resp sync handle */
#define VCMD_DRM_SYNC_IMPORT_SYNC_FILE_SIZE 1
#define VCMD_DRM_SYNC_IMPORT_SYNC_FILE_HANDLE 0
/* req sync fd */
#define VCMD_DRM_SYNC_EXPORT_SYNC_FILE_SIZE 1
#define VCMD_DRM_SYNC_EXPORT_SYNC_FILE_HANDLE 0
/* resp sync fd */
/* Extra flag for VCMD_DRM_SYNC_WAIT/VCMD_DRM_SYNC_TIMELINE_WAIT
* on top of the existing drm ioctl flags, to indicate that the
* client expects an fd back from the server to wait on.
*
* If the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FD flag is set, then
* first_signaled and status is returned via the eventfd
*/
#define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FD (1 << 31)
#define VCMD_DRM_SYNC_WAIT_SIZE 4
#define VCMD_DRM_SYNC_WAIT_NUM_HANDLES 0
#define VCMD_DRM_SYNC_WAIT_TIMEOUT_LO 1
#define VCMD_DRM_SYNC_WAIT_TIMEOUT_HI 2
#define VCMD_DRM_SYNC_WAIT_FLAGS 3
/* req handles[num_handles]
* if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FD) {
* rsp eventfd
* } else {
* rsp first_signaled
* rsp status
* }
*/
#define VCMD_DRM_SYNC_RESET_SIZE 1
#define VCMD_DRM_SYNC_RESET_NUM_HANDLES 0
/* req handles[num_handles] */
#define VCMD_DRM_SYNC_SIGNAL_SIZE 1
#define VCMD_DRM_SYNC_SIGNAL_NUM_HANDLES 0
/* req handles[num_handles] */
#define VCMD_DRM_SYNC_TIMELINE_SIGNAL_SIZE 1
#define VCMD_DRM_SYNC_TIMELINE_SIGNAL_NUM_HANDLES 0
/* req points[num_handles] */
/* req handles[num_handles] */
#define VCMD_DRM_SYNC_TIMELINE_WAIT_SIZE 4
#define VCMD_DRM_SYNC_TIMELINE_WAIT_NUM_HANDLES 0
#define VCMD_DRM_SYNC_TIMELINE_WAIT_TIMEOUT_LO 1
#define VCMD_DRM_SYNC_TIMELINE_WAIT_TIMEOUT_HI 2
#define VCMD_DRM_SYNC_TIMELINE_WAIT_FLAGS 3
/* req points[num_handles]
* req handles[num_handles]
* if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FD) {
* rsp eventfd
* } else {
* rsp first_signaled
* rsp status
* }
*/
#define VCMD_DRM_SYNC_QUERY_SIZE 2
#define VCMD_DRM_SYNC_QUERY_NUM_HANDLES 0
#define VCMD_DRM_SYNC_QUERY_FLAGS 1
/* rsp points[num_handles]*/
#define VCMD_DRM_SYNC_TRANSFER_SIZE 7
#define VCMD_DRM_SYNC_TRANSFER_DST_HANDLE 0
#define VCMD_DRM_SYNC_TRANSFER_DST_POINT_LO 1
#define VCMD_DRM_SYNC_TRANSFER_DST_POINT_HI 2
#define VCMD_DRM_SYNC_TRANSFER_SRC_HANDLE 3
#define VCMD_DRM_SYNC_TRANSFER_SRC_POINT_LO 4
#define VCMD_DRM_SYNC_TRANSFER_SRC_POINT_HI 5
#define VCMD_DRM_SYNC_TRANSFER_FLAGS 6
#define VCMD_RESOURCE_EXPORT_FD_SIZE 1
#define VCMD_RESOURCE_EXPORT_FD_RES_HANDLE 0
/* rsp fd */
#endif /* VTEST_PROTOCOL */
+28
View File
@@ -0,0 +1,28 @@
BasedOnStyle: InheritParentConfig
DisableFormat: false
AlwaysBreakAfterReturnType: TopLevel
BinPackParameters: false
ColumnLimit: 78
Cpp11BracedListStyle: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"vn_common.h"$'
Priority: 0
- Regex: '^"vn_'
Priority: 3
- Regex: '^"(venus-protocol/|virtio-gpu/|vtest/)'
Priority: 2
- Regex: '^"(c11/|util/|drm-uapi/|vk_|wsi_|git_)'
Priority: 2
- Regex: '.*'
Priority: 1
ForEachMacros:
- vk_outarray_append_typed
SpaceBeforeParens: ControlStatementsExceptControlMacros
+151
View File
@@ -0,0 +1,151 @@
# Copyright 2019 Google LLC
# SPDX-License-Identifier: MIT
#
# based in part on anv and radv which are:
# Copyright © 2017 Intel Corporation
vn_entrypoints = custom_target(
'vn_entrypoints',
input : [vk_entrypoints_gen, vk_api_xml],
output : ['vn_entrypoints.h', 'vn_entrypoints.c'],
command : [
prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
'--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@', '--prefix', 'vn',
'--beta', with_vulkan_beta.to_string()
],
)
icd_file_name = libname_prefix + 'vulkan_virtio.' + libname_suffix
virtio_icd = custom_target(
'virtio_icd',
input : [vk_icd_gen, vk_api_xml],
output : 'virtio_icd.' + vulkan_manifest_suffix,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--icd-lib-path', vulkan_icd_lib_path,
'--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
install_dir : with_vulkan_icd_dir,
install_tag : 'runtime',
install : true,
)
_dev_icdname = 'virtio_devenv_icd.@[email protected]'.format(host_machine.cpu())
_dev_icd = custom_target(
'virtio_devenv_icd',
input : [vk_icd_gen, vk_api_xml],
output : _dev_icdname,
command : [
prog_python, '@INPUT0@',
'--api-version', '1.4', '--xml', '@INPUT1@',
'--sizeof-pointer', sizeof_pointer,
'--icd-lib-path', meson.current_build_dir(),
'--icd-filename', icd_file_name,
'--out', '@OUTPUT@',
],
build_by_default : true,
)
devenv.append('VK_DRIVER_FILES', _dev_icd.full_path())
libvn_files = files(
'vn_acceleration_structure.c',
'vn_buffer.c',
'vn_command_buffer.c',
'vn_common.c',
'vn_cs.c',
'vn_descriptor_heap.c',
'vn_descriptor_set.c',
'vn_device.c',
'vn_device_memory.c',
'vn_feedback.c',
'vn_host_copy.c',
'vn_icd.c',
'vn_image.c',
'vn_instance.c',
'vn_physical_device.c',
'vn_pipeline.c',
'vn_query_pool.c',
'vn_queue.c',
'vn_render_pass.c',
'vn_ring.c',
'vn_renderer_internal.c',
'vn_renderer_util.c',
)
vn_incs = [
inc_include,
inc_src,
inc_virtio,
]
vn_deps = [
dep_thread,
idep_mesautil,
idep_vulkan_util,
idep_vulkan_lite_runtime,
idep_vulkan_wsi,
idep_xmlconfig,
]
vn_c_args = [
no_override_init_args,
soong_compat_c_args,
] + cc.get_supported_arguments([
'-Werror=switch',
])
vn_link_args = [
ld_args_bsymbolic,
ld_args_gc_sections,
vulkan_icd_link_args,
]
vn_libs = []
if not with_platform_windows
libvn_files += files('vn_renderer_vtest.c')
endif
if system_has_kms_drm
libvn_files += files('vn_renderer_virtgpu.c')
vn_deps += dep_libdrm
endif
if with_platform_wayland or with_platform_x11 or \
(system_has_kms_drm and not with_platform_android) or \
with_platform_windows
libvn_files += files('vn_wsi.c')
vn_c_args += '-DVN_USE_WSI_PLATFORM'
endif
if with_platform_wayland
vn_deps += dep_wayland_client
endif
if with_platform_x11
vn_deps += dep_xcb_dri3
endif
if with_platform_android
libvn_files += files('vn_android.c')
vn_deps += [dep_android, idep_u_gralloc]
endif
libvulkan_virtio = shared_library(
'vulkan_virtio',
[libvn_files, vn_entrypoints, sha1_h],
include_directories : vn_incs,
link_with : vn_libs,
dependencies : vn_deps,
c_args : vn_c_args,
link_args : vn_link_args,
link_depends : vulkan_icd_link_depends,
gnu_symbol_visibility : 'hidden',
install : true,
)
@@ -0,0 +1,161 @@
/*
* Copyright 2025 Google LLC
* SPDX-License-Identifier: MIT
*/
#include "vn_acceleration_structure.h"
#include "venus-protocol/vn_protocol_driver_acceleration_structure.h"
#include "vn_device.h"
VKAPI_ATTR VkResult VKAPI_CALL
vn_CreateAccelerationStructureKHR(
VkDevice device,
const VkAccelerationStructureCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkAccelerationStructureKHR *pAccelerationStructure)
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_acceleration_structure *accel =
vk_zalloc(alloc, sizeof(*accel), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!accel)
return vn_error(dev->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
vn_object_base_init(&accel->base,
VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR, &dev->base);
VkAccelerationStructureKHR accel_handle =
vn_acceleration_structure_to_handle(accel);
vn_async_vkCreateAccelerationStructureKHR(
dev->primary_ring, device, pCreateInfo, NULL, &accel_handle);
*pAccelerationStructure = accel_handle;
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
vn_DestroyAccelerationStructureKHR(
VkDevice device,
VkAccelerationStructureKHR accelerationStructure,
const VkAllocationCallbacks *pAllocator)
{
struct vn_device *dev = vn_device_from_handle(device);
struct vn_acceleration_structure *accel =
vn_acceleration_structure_from_handle(accelerationStructure);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!accel)
return;
vn_async_vkDestroyAccelerationStructureKHR(dev->primary_ring, device,
accelerationStructure, NULL);
vn_object_base_fini(&accel->base);
vk_free(alloc, accel);
}
VKAPI_ATTR void VKAPI_CALL
vn_GetAccelerationStructureBuildSizesKHR(
VkDevice device,
VkAccelerationStructureBuildTypeKHR buildType,
const VkAccelerationStructureBuildGeometryInfoKHR *pBuildInfo,
const uint32_t *pMaxPrimitiveCounts,
VkAccelerationStructureBuildSizesInfoKHR *pSizeInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
vn_call_vkGetAccelerationStructureBuildSizesKHR(
dev->primary_ring, device, buildType, pBuildInfo, pMaxPrimitiveCounts,
pSizeInfo);
}
VKAPI_ATTR VkDeviceAddress VKAPI_CALL
vn_GetAccelerationStructureDeviceAddressKHR(
VkDevice device, const VkAccelerationStructureDeviceAddressInfoKHR *pInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
return vn_call_vkGetAccelerationStructureDeviceAddressKHR(
dev->primary_ring, device, pInfo);
}
VKAPI_ATTR void VKAPI_CALL
vn_GetDeviceAccelerationStructureCompatibilityKHR(
VkDevice device,
const VkAccelerationStructureVersionInfoKHR *pVersionInfo,
VkAccelerationStructureCompatibilityKHR *pCompatibility)
{
struct vn_device *dev = vn_device_from_handle(device);
/* TODO per device cache */
vn_call_vkGetDeviceAccelerationStructureCompatibilityKHR(
dev->primary_ring, device, pVersionInfo, pCompatibility);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_BuildAccelerationStructuresKHR(
VkDevice device,
VkDeferredOperationKHR deferredOperation,
uint32_t infoCount,
const VkAccelerationStructureBuildGeometryInfoKHR *pInfos,
const VkAccelerationStructureBuildRangeInfoKHR *const *ppBuildRangeInfos)
{
struct vn_device *dev = vn_device_from_handle(device);
UNREACHABLE("Unimplemented");
return vn_error(dev->instance, VK_ERROR_FEATURE_NOT_PRESENT);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_CopyAccelerationStructureKHR(
VkDevice device,
VkDeferredOperationKHR deferredOperation,
const VkCopyAccelerationStructureInfoKHR *pInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
UNREACHABLE("Unimplemented");
return vn_error(dev->instance, VK_ERROR_FEATURE_NOT_PRESENT);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_CopyAccelerationStructureToMemoryKHR(
VkDevice device,
VkDeferredOperationKHR deferredOperation,
const VkCopyAccelerationStructureToMemoryInfoKHR *pInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
UNREACHABLE("Unimplemented");
return vn_error(dev->instance, VK_ERROR_FEATURE_NOT_PRESENT);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_CopyMemoryToAccelerationStructureKHR(
VkDevice device,
VkDeferredOperationKHR deferredOperation,
const VkCopyMemoryToAccelerationStructureInfoKHR *pInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
UNREACHABLE("Unimplemented");
return vn_error(dev->instance, VK_ERROR_FEATURE_NOT_PRESENT);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_WriteAccelerationStructuresPropertiesKHR(
VkDevice device,
uint32_t accelerationStructureCount,
const VkAccelerationStructureKHR *pAccelerationStructures,
VkQueryType queryType,
size_t dataSize,
void *pData,
size_t stride)
{
struct vn_device *dev = vn_device_from_handle(device);
UNREACHABLE("Unimplemented");
return vn_error(dev->instance, VK_ERROR_FEATURE_NOT_PRESENT);
}
@@ -0,0 +1,19 @@
/*
* Copyright 2025 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_ACCELERATION_STRUCTURE_H
#define VN_ACCELERATION_STRUCTURE_H
#include "vn_common.h"
struct vn_acceleration_structure {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_acceleration_structure,
base.vk,
VkAccelerationStructureKHR,
VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR)
#endif /* VN_ACCELERATION_STRUCTURE_H */
+247
View File
@@ -0,0 +1,247 @@
/*
* Copyright 2021 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat
* Copyright © 2016 Bas Nieuwenhuizen
*/
#include "vn_android.h"
#include <dlfcn.h>
#include <vndk/hardware_buffer.h>
#include "util/os_file.h"
#include "util/u_gralloc/u_gralloc.h"
#include "vn_buffer.h"
#include "vn_device.h"
#include "vn_device_memory.h"
#include "vn_image.h"
#define VN_MAX_PLANES 4
static int
vn_android_gralloc_get_dma_buf_fd(const native_handle_t *handle)
{
/* There can be multiple fds wrapped inside a native_handle_t, but we
* expect the 1st one pointing to the dma_buf. For multi-planar format,
* there should only exist one undelying dma_buf. The other fd(s) could be
* dups to the same dma_buf or point to the shared memory used to store
* gralloc buffer metadata.
*/
assert(handle);
if (handle->numFds < 1) {
vn_log(NULL, "handle->numFds is %d, expected >= 1", handle->numFds);
return -1;
}
if (handle->data[0] < 0) {
vn_log(NULL, "handle->data[0] < 0");
return -1;
}
return handle->data[0];
}
static VkResult
vn_android_image_from_anb_internal(struct vn_device *dev,
VkImageCreateInfo *create_info,
const VkAllocationCallbacks *alloc,
struct vn_image **out_img)
{
assert(vk_find_struct_const(create_info->pNext, NATIVE_BUFFER_ANDROID));
VkImageDrmFormatModifierExplicitCreateInfoEXT mod_info;
VkSubresourceLayout layouts[VN_MAX_PLANES];
VkResult result = vk_android_get_anb_layout(create_info, &mod_info,
layouts, VN_MAX_PLANES);
if (result != VK_SUCCESS)
return result;
mod_info.pNext = create_info->pNext;
const VkExternalMemoryImageCreateInfo external_info = {
.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
.pNext = &mod_info,
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
};
/* create_info is a already local copy from the caller */
create_info->pNext = &external_info;
/* encoder will strip the Android specific pNext structs */
if (*out_img) {
/* driver side img obj has been created for deferred init like ahb */
return vn_image_init_deferred(dev, create_info, *out_img);
}
return vn_image_create(dev, create_info, alloc, out_img);
}
VkResult
vn_android_image_from_anb(struct vn_device *dev,
const VkImageCreateInfo *create_info,
const VkAllocationCallbacks *alloc,
struct vn_image **out_img)
{
VkImageCreateInfo local_create = *create_info;
local_create.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
struct vn_image *img = NULL;
VkResult result =
vn_android_image_from_anb_internal(dev, &local_create, alloc, &img);
if (result != VK_SUCCESS)
return result;
result =
vk_android_import_anb(&dev->base.vk, create_info, alloc, &img->base.vk);
if (result != VK_SUCCESS) {
vn_DestroyImage(vn_device_to_handle(dev), vn_image_to_handle(img),
alloc);
return result;
}
*out_img = img;
return VK_SUCCESS;
}
VkDeviceMemory
vn_android_get_wsi_memory(struct vn_device *dev,
const VkBindImageMemoryInfo *bind_info)
{
struct vn_image *img = vn_image_from_handle(bind_info->image);
VkImageCreateInfo *create_info = img->base.vk.android_deferred_create_info;
assert(create_info);
const VkNativeBufferANDROID *anb_info =
vk_find_struct_const(bind_info->pNext, NATIVE_BUFFER_ANDROID);
assert(anb_info && anb_info->handle);
/* Inject ANB into the deferred pNext chain to leverage the existing common
* Android helper vk_android_get_anb_layout, which could be refactored to
* take ANB directly instead.
*/
VkNativeBufferANDROID local_anb = *anb_info;
local_anb.pNext = create_info->pNext;
create_info->pNext = &local_anb;
VkResult result = vn_android_image_from_anb_internal(
dev, create_info, &dev->base.vk.alloc, &img);
if (result != VK_SUCCESS)
return VK_NULL_HANDLE;
result = vk_android_import_anb_memory(&dev->base.vk, &img->base.vk,
anb_info, &dev->base.vk.alloc);
if (result != VK_SUCCESS)
return VK_NULL_HANDLE;
return img->base.vk.anb_memory;
}
static VkResult
vn_android_ahb_image_init(struct vn_device *dev,
struct AHardwareBuffer *ahb,
struct vn_image *img)
{
VkImageCreateInfo *create_info = img->base.vk.android_deferred_create_info;
VkResult result;
assert(create_info);
VkImageDrmFormatModifierExplicitCreateInfoEXT mod_info;
VkSubresourceLayout layouts[VN_MAX_PLANES];
result = vk_android_get_ahb_layout(ahb, &mod_info, layouts, VN_MAX_PLANES);
if (result != VK_SUCCESS)
return result;
__vk_append_struct(create_info, &mod_info);
VkExternalMemoryImageCreateInfo external_info = {
.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
};
__vk_append_struct(create_info, &external_info);
return vn_image_init_deferred(dev, create_info, img);
}
VkResult
vn_android_device_import_ahb(struct vn_device *dev,
struct vn_device_memory *mem,
const struct VkMemoryAllocateInfo *alloc_info)
{
struct vk_device_memory *mem_vk = &mem->base.vk;
VkResult result;
const native_handle_t *handle =
AHardwareBuffer_getNativeHandle(mem_vk->ahardware_buffer);
int dma_buf_fd = vn_android_gralloc_get_dma_buf_fd(handle);
if (dma_buf_fd < 0)
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
uint32_t mem_type_bits = 0;
result = vn_get_memory_dma_buf_properties(dev, dma_buf_fd, &mem_type_bits);
if (result != VK_SUCCESS)
return result;
const VkMemoryDedicatedAllocateInfo *dedicated_info =
vk_find_struct_const(alloc_info->pNext, MEMORY_DEDICATED_ALLOCATE_INFO);
VkMemoryRequirements mem_reqs;
if (dedicated_info && dedicated_info->image != VK_NULL_HANDLE) {
struct vn_image *img = vn_image_from_handle(dedicated_info->image);
result = vn_android_ahb_image_init(dev, mem_vk->ahardware_buffer, img);
if (result != VK_SUCCESS)
return result;
mem_reqs = img->requirements[0].memory.memoryRequirements;
mem_reqs.memoryTypeBits &= mem_type_bits;
} else if (dedicated_info && dedicated_info->buffer != VK_NULL_HANDLE) {
struct vn_buffer *buf = vn_buffer_from_handle(dedicated_info->buffer);
mem_reqs = buf->requirements.memory.memoryRequirements;
mem_reqs.memoryTypeBits &= mem_type_bits;
} else {
mem_reqs.size = mem_vk->size;
mem_reqs.memoryTypeBits = mem_type_bits;
}
if (!mem_reqs.memoryTypeBits)
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
if (!((1 << mem_vk->memory_type_index) & mem_reqs.memoryTypeBits))
mem_vk->memory_type_index = ffs(mem_reqs.memoryTypeBits) - 1;
mem_vk->size = mem_reqs.size;
int dup_fd = os_dupfd_cloexec(dma_buf_fd);
if (dup_fd < 0)
return (errno == EMFILE) ? VK_ERROR_TOO_MANY_OBJECTS
: VK_ERROR_OUT_OF_HOST_MEMORY;
/* Spec requires AHB export info to be present, so we must strip it. In
* practice, the AHB import path here only needs the main allocation info
* and the dedicated_info.
*/
VkMemoryDedicatedAllocateInfo local_dedicated_info;
/* Override when dedicated_info exists and is not the tail struct. */
if (dedicated_info && dedicated_info->pNext) {
local_dedicated_info = *dedicated_info;
local_dedicated_info.pNext = NULL;
dedicated_info = &local_dedicated_info;
}
const VkMemoryAllocateInfo local_alloc_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.pNext = dedicated_info,
.allocationSize = mem_vk->size,
.memoryTypeIndex = mem_vk->memory_type_index,
};
result =
vn_device_memory_import_dma_buf(dev, mem, &local_alloc_info, dup_fd);
if (result != VK_SUCCESS) {
close(dup_fd);
return result;
}
return VK_SUCCESS;
}
+68
View File
@@ -0,0 +1,68 @@
/*
* Copyright 2021 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_ANDROID_H
#define VN_ANDROID_H
#include "vn_common.h"
#include <vulkan/vk_android_native_buffer.h>
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_android.h>
#include "vk_android.h"
#ifdef VK_USE_PLATFORM_ANDROID_KHR
VkResult
vn_android_image_from_anb(struct vn_device *dev,
const VkImageCreateInfo *image_info,
const VkAllocationCallbacks *alloc,
struct vn_image **out_img);
VkDeviceMemory
vn_android_get_wsi_memory(struct vn_device *dev,
const VkBindImageMemoryInfo *bind_info);
VkResult
vn_android_device_import_ahb(struct vn_device *dev,
struct vn_device_memory *mem,
const struct VkMemoryAllocateInfo *alloc_info);
#else /* VK_USE_PLATFORM_ANDROID_KHR */
static inline VkResult
vn_android_image_from_anb(UNUSED struct vn_device *dev,
UNUSED const VkImageCreateInfo *image_info,
UNUSED const VkAllocationCallbacks *alloc,
UNUSED struct vn_image **out_img)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
static inline VkDeviceMemory
vn_android_get_wsi_memory(UNUSED struct vn_device *dev,
UNUSED const VkBindImageMemoryInfo *bind_info)
{
return VK_NULL_HANDLE;
}
static inline VkResult
vn_android_device_import_ahb(
UNUSED struct vn_device *dev,
UNUSED struct vn_device_memory *mem,
UNUSED const struct VkMemoryAllocateInfo *alloc_info)
{
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
#endif /* VN_ANDROID_H */
+553
View File
@@ -0,0 +1,553 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#include "vn_buffer.h"
#include "venus-protocol/vn_protocol_driver_buffer.h"
#include "venus-protocol/vn_protocol_driver_buffer_view.h"
#include "vn_device.h"
#include "vn_device_memory.h"
#include "vn_physical_device.h"
/* buffer commands */
static uint64_t
vn_buffer_get_cache_index(const VkBufferCreateInfo *create_info,
struct vn_buffer_reqs_cache *cache)
{
/* No need to cache for size exceeding the limit. */
if (create_info->size > cache->max_buffer_size)
return 0;
/* Only 7 bits are taken for VkBufferCreateFlagBits as of spec 1.4.339. We
* preserve 12 bits for the create flags.
*/
if (create_info->flags & 0xFFFFF000)
return 0;
/* VK_SHARING_MODE_EXCLUSIVE or VK_SHARING_MODE_CONCURRENT across all */
const bool is_exclusive =
create_info->sharingMode == VK_SHARING_MODE_EXCLUSIVE;
const bool is_concurrent =
create_info->sharingMode == VK_SHARING_MODE_CONCURRENT &&
create_info->queueFamilyIndexCount == cache->queue_family_count;
if (!is_exclusive && !is_concurrent)
return 0;
/* Per spec:
*
* VkBufferCreateInfo:
* If the pNext chain includes a VkBufferUsageFlags2CreateInfo structure,
* VkBufferUsageFlags2CreateInfo::usage from that structure is used instead
* of usage from this structure.
*
* VUID-VkBufferCreateInfo-None-09500
* If the pNext chain does not include a VkBufferUsageFlags2CreateInfo
* structure, usage must not be 0
*
* VUID-VkBufferUsageFlags2CreateInfo-usage-requiredbitmask
* usage must not be 0
*/
uint64_t usage = (uint64_t)create_info->usage;
vk_foreach_struct_const(pnext, create_info->pNext) {
switch (pnext->sType) {
case VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO: {
const VkBufferUsageFlags2CreateInfo *usage2 = (void *)pnext;
usage = (uint64_t)usage2->usage;
break;
}
default:
/* Other pNext structs are not cacheable. */
return 0;
}
}
/* Only 34 bits are taken for VkBufferUsageFlagBits2 as of spec 1.4.339. We
* preserve 51 bits for the usage flags.
*/
if (usage & 0xFFF8000000000000ULL)
return 0;
/* Combine sharing mode, flags and usage bits to form a unique index:
*
* | 63: concurrent | 51 ~ 62: create flags | 0 ~ 50: usage |
*/
return (uint64_t)is_concurrent << 63 | (uint64_t)create_info->flags << 51 |
usage;
}
static inline uint64_t
vn_buffer_get_max_buffer_size(struct vn_physical_device *physical_dev)
{
/* Without maintenance4, hardcode the min of supported drivers:
* - anv: 1ull << 30
* - radv: UINT32_MAX - 4
* - tu: UINT32_MAX + 1
* - lvp: UINT32_MAX
* - mali: UINT32_MAX
*/
static const uint64_t safe_max_buffer_size = 1ULL << 30;
return physical_dev->base.vk.supported_features.maintenance4
? physical_dev->base.vk.properties.maxBufferSize
: safe_max_buffer_size;
}
void
vn_buffer_reqs_cache_init(struct vn_device *dev)
{
assert(dev->physical_device->queue_family_count);
dev->buffer_reqs_cache.max_buffer_size =
vn_buffer_get_max_buffer_size(dev->physical_device);
dev->buffer_reqs_cache.queue_family_count =
dev->physical_device->queue_family_count;
simple_mtx_init(&dev->buffer_reqs_cache.mutex, mtx_plain);
util_sparse_array_init(&dev->buffer_reqs_cache.entries,
sizeof(struct vn_buffer_reqs_cache_entry), 64);
}
static void
vn_buffer_reqs_cache_debug_dump(struct vn_buffer_reqs_cache *cache)
{
vn_log(NULL, "dumping buffer cache statistics");
vn_log(NULL, " cache hit: %d", cache->debug.cache_hit_count);
vn_log(NULL, " cache miss: %d", cache->debug.cache_miss_count);
vn_log(NULL, " cache skip: %d", cache->debug.cache_skip_count);
}
void
vn_buffer_reqs_cache_fini(struct vn_device *dev)
{
util_sparse_array_finish(&dev->buffer_reqs_cache.entries);
simple_mtx_destroy(&dev->buffer_reqs_cache.mutex);
if (VN_DEBUG(CACHE))
vn_buffer_reqs_cache_debug_dump(&dev->buffer_reqs_cache);
}
static inline VkDeviceSize
vn_buffer_get_aligned_memory_requirement_size(VkDeviceSize size,
const VkMemoryRequirements *req)
{
/* TODO remove comment after mandating VK_KHR_maintenance4
*
* This is based on below implementation defined behavior:
* req.size <= align64(info.size, req.alignment)
*/
return align64(size, req->alignment);
}
static struct vn_buffer_reqs_cache_entry *
vn_buffer_get_cached_memory_requirements(
struct vn_buffer_reqs_cache *cache,
const VkBufferCreateInfo *create_info,
struct vn_buffer_memory_requirements *out)
{
if (VN_PERF(NO_ASYNC_BUFFER_CREATE))
return NULL;
/* 12.7. Resource Memory Association
*
* The memoryTypeBits member is identical for all VkBuffer objects created
* with the same value for the flags and usage members in the
* VkBufferCreateInfo structure and the handleTypes member of the
* VkExternalMemoryBufferCreateInfo structure passed to vkCreateBuffer.
*/
const uint64_t idx = vn_buffer_get_cache_index(create_info, cache);
if (idx) {
struct vn_buffer_reqs_cache_entry *entry =
util_sparse_array_get(&cache->entries, idx);
if (entry->valid) {
*out = entry->requirements;
out->memory.memoryRequirements.size =
vn_buffer_get_aligned_memory_requirement_size(
create_info->size, &out->memory.memoryRequirements);
p_atomic_inc(&cache->debug.cache_hit_count);
} else {
p_atomic_inc(&cache->debug.cache_miss_count);
}
return entry;
}
p_atomic_inc(&cache->debug.cache_skip_count);
return NULL;
}
static void
vn_buffer_reqs_cache_entry_init(struct vn_buffer_reqs_cache *cache,
struct vn_buffer_reqs_cache_entry *entry,
VkMemoryRequirements2 *req)
{
simple_mtx_lock(&cache->mutex);
/* Entry might have already been initialized by another thread
* before the lock
*/
if (entry->valid)
goto unlock;
entry->requirements.memory = *req;
const VkMemoryDedicatedRequirements *dedicated_req =
vk_find_struct_const(req->pNext, MEMORY_DEDICATED_REQUIREMENTS);
if (dedicated_req)
entry->requirements.dedicated = *dedicated_req;
entry->valid = true;
unlock:
simple_mtx_unlock(&cache->mutex);
/* ensure invariance of the memory requirement size */
req->memoryRequirements.size =
vn_buffer_get_aligned_memory_requirement_size(
req->memoryRequirements.size,
&entry->requirements.memory.memoryRequirements);
}
static void
vn_copy_cached_memory_requirements(
const struct vn_buffer_memory_requirements *cached,
VkMemoryRequirements2 *out_mem_req)
{
union {
VkBaseOutStructure *pnext;
VkMemoryRequirements2 *two;
VkMemoryDedicatedRequirements *dedicated;
} u = { .two = out_mem_req };
while (u.pnext) {
switch (u.pnext->sType) {
case VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2:
u.two->memoryRequirements = cached->memory.memoryRequirements;
break;
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS:
u.dedicated->prefersDedicatedAllocation =
cached->dedicated.prefersDedicatedAllocation;
u.dedicated->requiresDedicatedAllocation =
cached->dedicated.requiresDedicatedAllocation;
break;
default:
break;
}
u.pnext = u.pnext->pNext;
}
}
static VkResult
vn_buffer_init(struct vn_device *dev,
const VkBufferCreateInfo *create_info,
struct vn_buffer *buf)
{
VkDevice dev_handle = vn_device_to_handle(dev);
VkBuffer buf_handle = vn_buffer_to_handle(buf);
struct vn_buffer_reqs_cache *cache = &dev->buffer_reqs_cache;
VkResult result;
/* If cacheable and mem requirements found in cache, make async call */
struct vn_buffer_reqs_cache_entry *entry =
vn_buffer_get_cached_memory_requirements(cache, create_info,
&buf->requirements);
/* Check size instead of entry->valid to be lock free */
if (buf->requirements.memory.memoryRequirements.size) {
vn_async_vkCreateBuffer(dev->primary_ring, dev_handle, create_info,
NULL, &buf_handle);
return VK_SUCCESS;
}
/* If cache miss or not cacheable, make synchronous call */
result = vn_call_vkCreateBuffer(dev->primary_ring, dev_handle, create_info,
NULL, &buf_handle);
if (result != VK_SUCCESS)
return result;
buf->requirements.memory.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2;
buf->requirements.memory.pNext = &buf->requirements.dedicated;
buf->requirements.dedicated.sType =
VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS;
buf->requirements.dedicated.pNext = NULL;
vn_call_vkGetBufferMemoryRequirements2(
dev->primary_ring, dev_handle,
&(VkBufferMemoryRequirementsInfo2){
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2,
.buffer = buf_handle,
},
&buf->requirements.memory);
/* If cacheable, store mem requirements from the synchronous call */
if (entry) {
vn_buffer_reqs_cache_entry_init(cache, entry,
&buf->requirements.memory);
}
return VK_SUCCESS;
}
VkResult
vn_buffer_create(struct vn_device *dev,
const VkBufferCreateInfo *create_info,
const VkAllocationCallbacks *alloc,
struct vn_buffer **out_buf)
{
struct vn_buffer *buf = NULL;
VkResult result;
buf = vk_zalloc(alloc, sizeof(*buf), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!buf)
return VK_ERROR_OUT_OF_HOST_MEMORY;
vn_object_base_init(&buf->base, VK_OBJECT_TYPE_BUFFER, &dev->base);
result = vn_buffer_init(dev, create_info, buf);
if (result != VK_SUCCESS) {
vn_object_base_fini(&buf->base);
vk_free(alloc, buf);
return result;
}
*out_buf = buf;
return VK_SUCCESS;
}
struct vn_buffer_create_info {
VkBufferCreateInfo create;
VkExternalMemoryBufferCreateInfo external;
VkBufferOpaqueCaptureAddressCreateInfo capture;
VkBufferDeviceAddressCreateInfoEXT address;
};
static const VkBufferCreateInfo *
vn_buffer_fix_create_info(
const VkBufferCreateInfo *create_info,
const VkExternalMemoryHandleTypeFlagBits renderer_handle_type,
struct vn_buffer_create_info *local_info)
{
local_info->create = *create_info;
VkBaseOutStructure *cur = (void *)&local_info->create;
vk_foreach_struct_const(src, create_info->pNext) {
void *next = NULL;
switch (src->sType) {
case VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO:
memcpy(&local_info->external, src, sizeof(local_info->external));
local_info->external.handleTypes = renderer_handle_type;
next = &local_info->external;
break;
case VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO:
memcpy(&local_info->capture, src, sizeof(local_info->capture));
next = &local_info->capture;
break;
case VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT:
memcpy(&local_info->address, src, sizeof(local_info->address));
next = &local_info->address;
break;
default:
break;
}
if (next) {
cur->pNext = next;
cur = next;
}
}
cur->pNext = NULL;
return &local_info->create;
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_CreateBuffer(VkDevice device,
const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkBuffer *pBuffer)
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
const VkExternalMemoryHandleTypeFlagBits renderer_handle_type =
dev->physical_device->external_memory.renderer_handle_type;
struct vn_buffer_create_info local_info;
const VkExternalMemoryBufferCreateInfo *external_info =
vk_find_struct_const(pCreateInfo->pNext,
EXTERNAL_MEMORY_BUFFER_CREATE_INFO);
if (external_info && external_info->handleTypes &&
external_info->handleTypes != renderer_handle_type) {
pCreateInfo = vn_buffer_fix_create_info(
pCreateInfo, renderer_handle_type, &local_info);
}
struct vn_buffer *buf;
VkResult result = vn_buffer_create(dev, pCreateInfo, alloc, &buf);
if (result != VK_SUCCESS)
return vn_error(dev->instance, result);
*pBuffer = vn_buffer_to_handle(buf);
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
vn_DestroyBuffer(VkDevice device,
VkBuffer buffer,
const VkAllocationCallbacks *pAllocator)
{
struct vn_device *dev = vn_device_from_handle(device);
struct vn_buffer *buf = vn_buffer_from_handle(buffer);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!buf)
return;
vn_async_vkDestroyBuffer(dev->primary_ring, device, buffer, NULL);
vn_object_base_fini(&buf->base);
vk_free(alloc, buf);
}
VKAPI_ATTR VkDeviceAddress VKAPI_CALL
vn_GetBufferDeviceAddress(VkDevice device,
const VkBufferDeviceAddressInfo *pInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
return vn_call_vkGetBufferDeviceAddress(dev->primary_ring, device, pInfo);
}
VKAPI_ATTR uint64_t VKAPI_CALL
vn_GetBufferOpaqueCaptureAddress(VkDevice device,
const VkBufferDeviceAddressInfo *pInfo)
{
struct vn_device *dev = vn_device_from_handle(device);
return vn_call_vkGetBufferOpaqueCaptureAddress(dev->primary_ring, device,
pInfo);
}
VKAPI_ATTR void VKAPI_CALL
vn_GetBufferMemoryRequirements2(VkDevice device,
const VkBufferMemoryRequirementsInfo2 *pInfo,
VkMemoryRequirements2 *pMemoryRequirements)
{
const struct vn_buffer *buf = vn_buffer_from_handle(pInfo->buffer);
vn_copy_cached_memory_requirements(&buf->requirements,
pMemoryRequirements);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_BindBufferMemory2(VkDevice device,
uint32_t bindInfoCount,
const VkBindBufferMemoryInfo *pBindInfos)
{
struct vn_device *dev = vn_device_from_handle(device);
vn_async_vkBindBufferMemory2(dev->primary_ring, device, bindInfoCount,
pBindInfos);
for (uint32_t i = 0; i < bindInfoCount; i++) {
const VkBindMemoryStatus *bind_status =
vk_find_struct((void *)pBindInfos[i].pNext, BIND_MEMORY_STATUS);
if (bind_status)
*bind_status->pResult = VK_SUCCESS;
}
return VK_SUCCESS;
}
/* buffer view commands */
VKAPI_ATTR VkResult VKAPI_CALL
vn_CreateBufferView(VkDevice device,
const VkBufferViewCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkBufferView *pView)
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_buffer_view *view =
vk_zalloc(alloc, sizeof(*view), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!view)
return vn_error(dev->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
vn_object_base_init(&view->base, VK_OBJECT_TYPE_BUFFER_VIEW, &dev->base);
VkBufferView view_handle = vn_buffer_view_to_handle(view);
vn_async_vkCreateBufferView(dev->primary_ring, device, pCreateInfo, NULL,
&view_handle);
*pView = view_handle;
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
vn_DestroyBufferView(VkDevice device,
VkBufferView bufferView,
const VkAllocationCallbacks *pAllocator)
{
struct vn_device *dev = vn_device_from_handle(device);
struct vn_buffer_view *view = vn_buffer_view_from_handle(bufferView);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!view)
return;
vn_async_vkDestroyBufferView(dev->primary_ring, device, bufferView, NULL);
vn_object_base_fini(&view->base);
vk_free(alloc, view);
}
VKAPI_ATTR void VKAPI_CALL
vn_GetDeviceBufferMemoryRequirements(
VkDevice device,
const VkDeviceBufferMemoryRequirements *pInfo,
VkMemoryRequirements2 *pMemoryRequirements)
{
struct vn_device *dev = vn_device_from_handle(device);
struct vn_buffer_reqs_cache *cache = &dev->buffer_reqs_cache;
struct vn_buffer_memory_requirements reqs = { 0 };
/* If cacheable and mem requirements found in cache, skip host call */
struct vn_buffer_reqs_cache_entry *entry =
vn_buffer_get_cached_memory_requirements(cache, pInfo->pCreateInfo,
&reqs);
/* Check size instead of entry->valid to be lock free */
if (reqs.memory.memoryRequirements.size) {
vn_copy_cached_memory_requirements(&reqs, pMemoryRequirements);
return;
}
/* Make the host call if not found in cache or not cacheable */
vn_call_vkGetDeviceBufferMemoryRequirements(dev->primary_ring, device,
pInfo, pMemoryRequirements);
/* If cacheable, store mem requirements from the host call */
if (entry)
vn_buffer_reqs_cache_entry_init(cache, entry, pMemoryRequirements);
}
+78
View File
@@ -0,0 +1,78 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_BUFFER_H
#define VN_BUFFER_H
#include "vn_common.h"
struct vn_buffer_memory_requirements {
VkMemoryRequirements2 memory;
VkMemoryDedicatedRequirements dedicated;
};
struct vn_buffer_reqs_cache_entry {
struct vn_buffer_memory_requirements requirements;
atomic_bool valid;
};
struct vn_buffer_reqs_cache {
uint64_t max_buffer_size;
uint32_t queue_family_count;
/* lazily cache memory requirements for native buffer infos */
struct util_sparse_array entries;
/* protect entries */
simple_mtx_t mutex;
struct {
uint32_t cache_skip_count;
uint32_t cache_hit_count;
uint32_t cache_miss_count;
} debug;
};
struct vn_buffer {
struct vn_object_base base;
struct vn_buffer_memory_requirements requirements;
struct {
/* buffer is prime blit dst */
struct vn_device_memory *mem;
} wsi;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_buffer,
base.vk,
VkBuffer,
VK_OBJECT_TYPE_BUFFER)
struct vn_buffer_view {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_buffer_view,
base.vk,
VkBufferView,
VK_OBJECT_TYPE_BUFFER_VIEW)
VkResult
vn_buffer_create(struct vn_device *dev,
const VkBufferCreateInfo *create_info,
const VkAllocationCallbacks *alloc,
struct vn_buffer **out_buf);
void
vn_buffer_reqs_cache_init(struct vn_device *dev);
void
vn_buffer_reqs_cache_fini(struct vn_device *dev);
#endif /* VN_BUFFER_H */
File diff suppressed because it is too large. Load diff
+128
View File
@@ -0,0 +1,128 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_COMMAND_BUFFER_H
#define VN_COMMAND_BUFFER_H
#include "vn_common.h"
#include "vn_cs.h"
struct vn_command_pool {
struct vn_command_pool_base base;
struct list_head command_buffers;
/* The list contains the recycled query records allocated from the same
* command pool.
*
* For normal cmd pool, no additional locking is needed as below have
* already been protected by external synchronization:
* - alloc: record query, reset query and patch-in query records from the
* secondary cmds
* - recycle: explicit and implicit cmd reset, cmd free and pool reset
* - free: pool purge reset and pool destroy
*
* For feedback cmd pool, external locking is needed for now for below:
* - alloc: queue submission
* - recycle: queue submission and companion cmd reset/free
* - free: device destroy
*/
struct list_head free_query_records;
/* for scrubbing VK_IMAGE_LAYOUT_PRESENT_SRC_KHR */
struct vn_cached_storage storage;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_command_pool,
base.vk.base,
VkCommandPool,
VK_OBJECT_TYPE_COMMAND_POOL)
/* command buffer builder to:
* - fix wsi image ownership and layout transitions
* - scrub ignored bits in VkCommandBufferBeginInfo
* - support asynchronization query optimization (query feedback)
*/
struct vn_command_buffer_builder {
/* track the active legacy render pass */
const struct vn_render_pass *render_pass;
/* track the wsi images requiring layout fixes */
const struct vn_image **present_src_images;
/* track if inside a render pass instance */
bool in_render_pass;
/* track the active subpass for view mask used in the subpass */
uint32_t subpass_index;
/* track the active view mask inside a render pass instance */
uint32_t view_mask;
/* track if VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT was set */
bool is_simultaneous;
/* track the recorded queries and resets */
struct list_head query_records;
};
struct vn_query_feedback_cmd;
struct vn_command_buffer {
struct vn_command_buffer_base base;
struct vn_cs_encoder cs;
struct vn_command_buffer_builder builder;
struct vn_query_feedback_cmd *linked_qfb_cmd;
};
VK_DEFINE_HANDLE_CASTS(vn_command_buffer,
base.vk.base,
VkCommandBuffer,
VK_OBJECT_TYPE_COMMAND_BUFFER)
static inline struct vn_command_pool *
vn_cmd_pool(struct vn_command_buffer *cmd)
{
return container_of(cmd->base.vk.pool, struct vn_command_pool, base.vk);
}
static inline struct vn_command_buffer *
vn_cmd_from_vk(struct vk_command_buffer *cmd_vk)
{
return container_of(cmd_vk, struct vn_command_buffer, base.vk);
}
/* Queries recorded to support qfb.
* - query_count is the actual queries used with multiview considered
* - copy is whether the record is for result copy or query reset
*
* The query records are tracked at each cmd with the recording order. Those
* from the secondary cmds are patched into the primary ones at this moment.
*/
struct vn_cmd_query_record {
struct vn_query_pool *query_pool;
uint32_t query;
uint32_t query_count;
bool copy;
struct list_head head;
};
struct vn_cmd_query_record *
vn_cmd_pool_alloc_query_record(struct vn_command_pool *cmd_pool,
struct vn_query_pool *query_pool,
uint32_t query,
uint32_t query_count,
bool copy);
static inline void
vn_cmd_pool_free_query_records(struct vn_command_pool *cmd_pool,
struct list_head *query_records)
{
list_splicetail(query_records, &cmd_pool->free_query_records);
}
#endif /* VN_COMMAND_BUFFER_H */
+416
View File
@@ -0,0 +1,416 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#include "vn_common.h"
#include <stdarg.h>
#include "util/log.h"
#include "util/os_misc.h"
#include "util/u_debug.h"
#include "venus-protocol/vn_protocol_driver_info.h"
#include "vk_enum_to_str.h"
#include "vn_instance.h"
#include "vn_ring.h"
static const struct debug_control vn_debug_options[] = {
/* clang-format off */
{ "init", VN_DEBUG_INIT },
{ "result", VN_DEBUG_RESULT },
{ "vtest", VN_DEBUG_VTEST },
{ "wsi", VN_DEBUG_WSI },
{ "no_abort", VN_DEBUG_NO_ABORT },
{ "log_ctx_info", VN_DEBUG_LOG_CTX_INFO },
{ "cache", VN_DEBUG_CACHE },
{ "no_sparse", VN_DEBUG_NO_SPARSE },
{ "no_gpl", VN_DEBUG_NO_GPL },
{ "no_second_queue", VN_DEBUG_NO_SECOND_QUEUE },
{ "no_ray_tracing", VN_DEBUG_NO_RAY_TRACING },
{ "mem_budget", VN_DEBUG_MEM_BUDGET },
{ "no_desc_heap", VN_DEBUG_NO_DESC_HEAP },
{ NULL, 0 },
/* clang-format on */
};
static const struct debug_control vn_perf_options[] = {
/* clang-format off */
{ "no_async_set_alloc", VN_PERF_NO_ASYNC_SET_ALLOC },
{ "no_async_buffer_create", VN_PERF_NO_ASYNC_BUFFER_CREATE },
{ "no_async_queue_submit", VN_PERF_NO_ASYNC_QUEUE_SUBMIT },
{ "no_event_feedback", VN_PERF_NO_EVENT_FEEDBACK },
{ "no_fence_feedback", VN_PERF_NO_FENCE_FEEDBACK },
{ "no_cmd_batching", VN_PERF_NO_CMD_BATCHING },
{ "no_semaphore_feedback", VN_PERF_NO_SEMAPHORE_FEEDBACK },
{ "no_query_feedback", VN_PERF_NO_QUERY_FEEDBACK },
{ "no_async_mem_alloc", VN_PERF_NO_ASYNC_MEM_ALLOC },
{ "no_tiled_wsi_image", VN_PERF_NO_TILED_WSI_IMAGE },
{ "no_multi_ring", VN_PERF_NO_MULTI_RING },
{ "no_async_image_create", VN_PERF_NO_ASYNC_IMAGE_CREATE },
{ "no_async_image_format", VN_PERF_NO_ASYNC_IMAGE_FORMAT },
{ "no_async_present", VN_PERF_NO_ASYNC_PRESENT },
{ NULL, 0 },
/* clang-format on */
};
uint64_t vn_next_obj_id = 1;
struct vn_env vn_env;
static void
vn_env_init_once(void)
{
vn_env.debug =
parse_debug_string(os_get_option("VN_DEBUG"), vn_debug_options);
vn_env.perf =
parse_debug_string(os_get_option("VN_PERF"), vn_perf_options);
}
void
vn_env_init(void)
{
static once_flag once = ONCE_FLAG_INIT;
call_once(&once, vn_env_init_once);
/* log per VkInstance creation */
if (VN_DEBUG(INIT)) {
vn_log(NULL,
"vn_env is as below:"
"\n\tdebug = 0x%" PRIx64 ""
"\n\tperf = 0x%" PRIx64 "",
vn_env.debug, vn_env.perf);
}
}
void
vn_log(struct vn_instance *instance, const char *format, ...)
{
va_list ap;
va_start(ap, format);
mesa_log_v(MESA_LOG_DEBUG, "MESA-VIRTIO", format, ap);
va_end(ap);
/* instance may be NULL or partially initialized */
}
VkResult
vn_log_result(struct vn_instance *instance,
VkResult result,
const char *where)
{
vn_log(instance, "%s: %s", where, vk_Result_to_str(result));
return result;
}
uint32_t
vn_extension_get_spec_version(const char *name)
{
const int32_t index = vn_info_extension_index(name);
return index >= 0 ? vn_info_extension_get(index)->spec_version : 0;
}
static inline bool
vn_watchdog_timeout(const struct vn_watchdog *watchdog)
{
return !watchdog->alive;
}
static inline void
vn_watchdog_release(struct vn_watchdog *watchdog)
{
if (vn_gettid() == watchdog->tid) {
watchdog->tid = 0;
mtx_unlock(&watchdog->mutex);
}
}
static bool
vn_watchdog_acquire(struct vn_watchdog *watchdog, bool alive)
{
pid_t tid = vn_gettid();
if (!watchdog->tid && tid != watchdog->tid &&
mtx_trylock(&watchdog->mutex) == thrd_success) {
/* register as the only waiting thread that monitors the ring. */
watchdog->tid = tid;
/* Always set alive to true for new watchdog owner because the
* last owner might have just unset the alive bit before release.
*/
alive = true;
}
if (tid != watchdog->tid)
return false;
watchdog->alive = alive;
return true;
}
void
vn_relax_fini(struct vn_relax_state *state)
{
vn_watchdog_release(&state->instance->ring.watchdog);
}
static inline const char *
vn_relax_reason_string(enum vn_relax_reason reason)
{
/* deliberately avoid default case for -Wswitch to catch upon compile */
switch (reason) {
case VN_RELAX_REASON_RING_SEQNO:
return "ring seqno";
case VN_RELAX_REASON_TLS_RING_SEQNO:
return "tls ring seqno";
case VN_RELAX_REASON_RING_SPACE:
return "ring space";
case VN_RELAX_REASON_FENCE:
return "fence";
case VN_RELAX_REASON_SEMAPHORE:
return "semaphore";
case VN_RELAX_REASON_QUERY:
return "query";
}
return "";
}
static struct vn_relax_profile
vn_relax_get_profile(enum vn_relax_reason reason)
{
/* This is the helper to map a vn_relax_reason to a profile. For new
* profiles added, we MUST also update the pre-calculated "first_warn_time"
* in vn_watchdog_init() if the "first warn" comes sooner.
*/
/* deliberately avoid default case for -Wswitch to catch upon compile */
switch (reason) {
case VN_RELAX_REASON_RING_SEQNO:
/* warn every 4096 iters after having already slept ~3.5s:
* (yielded 255 times)
* stuck in wait with iter at 4096 (3.5s slept already)
* stuck in wait with iter at 8192 (14s slept already)
* stuck in wait with iter at 12288 (35s slept already)
* ...
* aborting after 895s
*/
return (struct vn_relax_profile){
.base_sleep_us = 160,
.busy_wait_order = 8,
.warn_order = 12,
.abort_order = 16,
};
case VN_RELAX_REASON_TLS_RING_SEQNO:
case VN_RELAX_REASON_RING_SPACE:
case VN_RELAX_REASON_FENCE:
case VN_RELAX_REASON_SEMAPHORE:
case VN_RELAX_REASON_QUERY:
/* warn every 1024 iters after having already slept ~3.5s:
* (yielded 15 times)
* stuck in wait with iter at 1024 (3.5s slept already)
* stuck in wait with iter at 2048 (14s slept already)
* stuck in wait with iter at 3072 (35s slept already)
* ...
* aborting after 895s
*/
return (struct vn_relax_profile){
.base_sleep_us = 160,
.busy_wait_order = 4,
.warn_order = 10,
.abort_order = 14,
};
}
UNREACHABLE("unhandled vn_relax_reason");
}
struct vn_relax_state
vn_relax_init(struct vn_instance *instance, enum vn_relax_reason reason)
{
struct vn_ring *ring = instance->ring.ring;
struct vn_watchdog *watchdog = &instance->ring.watchdog;
if (vn_watchdog_acquire(watchdog, true))
vn_ring_unset_status_bits(ring, VK_RING_STATUS_ALIVE_BIT_MESA);
return (struct vn_relax_state){
.instance = instance,
.iter = 0,
.profile = vn_relax_get_profile(reason),
.reason_str = vn_relax_reason_string(reason),
};
}
void
vn_relax(struct vn_relax_state *state)
{
const uint32_t base_sleep_us = state->profile.base_sleep_us;
const uint32_t busy_wait_order = state->profile.busy_wait_order;
const uint32_t warn_order = state->profile.warn_order;
const uint32_t abort_order = state->profile.abort_order;
uint32_t *iter = &state->iter;
(*iter)++;
if (*iter < (1 << busy_wait_order)) {
thrd_yield();
return;
}
state->warn = false;
if (unlikely(*iter % (1 << warn_order) == 0)) {
struct vn_instance *instance = state->instance;
state->warn = true;
vn_log(instance, "stuck in %s wait with iter at %d", state->reason_str,
*iter);
struct vn_ring *ring = instance->ring.ring;
const uint32_t status = vn_ring_load_status(ring);
if (status & VK_RING_STATUS_FATAL_BIT_MESA) {
vn_log(instance, "aborting on ring fatal error at iter %d", *iter);
abort();
}
struct vn_watchdog *watchdog = &instance->ring.watchdog;
const bool alive = status & VK_RING_STATUS_ALIVE_BIT_MESA;
if (vn_watchdog_acquire(watchdog, alive))
vn_ring_unset_status_bits(ring, VK_RING_STATUS_ALIVE_BIT_MESA);
if (vn_watchdog_timeout(watchdog) && !VN_DEBUG(NO_ABORT)) {
vn_log(instance, "aborting on expired ring alive status at iter %d",
*iter);
abort();
}
if (*iter >= (1 << abort_order) && !VN_DEBUG(NO_ABORT)) {
vn_log(instance, "aborting");
abort();
}
}
const uint32_t shift = util_last_bit(*iter) - busy_wait_order - 1;
os_time_sleep(base_sleep_us << shift);
}
struct vn_ring *
vn_tls_get_ring(struct vn_instance *instance)
{
if (VN_PERF(NO_MULTI_RING))
return instance->ring.ring;
struct vn_tls *tls = vn_tls_get();
if (unlikely(!tls)) {
/* only allow to fallback on missing tls */
return instance->ring.ring;
}
/* look up tls_ring owned by instance */
list_for_each_entry(struct vn_tls_ring, tls_ring, &tls->tls_rings,
tls_head) {
mtx_lock(&tls_ring->mutex);
if (tls_ring->instance == instance) {
mtx_unlock(&tls_ring->mutex);
assert(tls_ring->ring);
return tls_ring->ring;
}
mtx_unlock(&tls_ring->mutex);
}
struct vn_tls_ring *tls_ring = calloc(1, sizeof(*tls_ring));
if (!tls_ring)
return NULL;
/* keep the extra for potential roundtrip sync on tls ring */
static const size_t extra_size = sizeof(uint32_t);
/* only need a small ring for synchronous cmds on tls ring */
static const size_t buf_size = 16 * 1024;
/* single cmd can use the entire ring shmem on tls ring */
static const uint8_t direct_order = 0;
struct vn_ring_layout layout;
vn_ring_get_layout(buf_size, extra_size, &layout);
tls_ring->ring =
vn_ring_create(instance, &layout, direct_order, true /* is_tls_ring */);
if (!tls_ring->ring) {
free(tls_ring);
return NULL;
}
mtx_init(&tls_ring->mutex, mtx_plain);
tls_ring->instance = instance;
list_add(&tls_ring->tls_head, &tls->tls_rings);
list_add(&tls_ring->vk_head, &instance->ring.tls_rings);
return tls_ring->ring;
}
void
vn_tls_destroy_ring(struct vn_tls_ring *tls_ring)
{
mtx_lock(&tls_ring->mutex);
if (tls_ring->ring) {
vn_ring_destroy(tls_ring->ring);
tls_ring->ring = NULL;
tls_ring->instance = NULL;
mtx_unlock(&tls_ring->mutex);
} else {
mtx_unlock(&tls_ring->mutex);
mtx_destroy(&tls_ring->mutex);
free(tls_ring);
}
}
static void
vn_tls_free(void *tls)
{
if (tls) {
list_for_each_entry_safe(struct vn_tls_ring, tls_ring,
&((struct vn_tls *)tls)->tls_rings, tls_head)
vn_tls_destroy_ring(tls_ring);
}
free(tls);
}
static tss_t vn_tls_key;
static bool vn_tls_key_valid;
static void
vn_tls_key_create_once(void)
{
vn_tls_key_valid = tss_create(&vn_tls_key, vn_tls_free) == thrd_success;
if (!vn_tls_key_valid && VN_DEBUG(INIT))
vn_log(NULL, "WARNING: failed to create vn_tls_key");
}
struct vn_tls *
vn_tls_get(void)
{
static once_flag once = ONCE_FLAG_INIT;
call_once(&once, vn_tls_key_create_once);
if (unlikely(!vn_tls_key_valid))
return NULL;
struct vn_tls *tls = tss_get(vn_tls_key);
if (likely(tls))
return tls;
tls = calloc(1, sizeof(*tls));
if (!tls)
return NULL;
/* initialize tls */
tls->async_pipeline_create = false;
list_inithead(&tls->tls_rings);
if (tss_set(vn_tls_key, tls) != thrd_success) {
free(tls);
return NULL;
}
return tls;
}
+714
View File
@@ -0,0 +1,714 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_COMMON_H
#define VN_COMMON_H
#include <assert.h>
#include <inttypes.h>
#include <limits.h>
#include <stdatomic.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <vulkan/vulkan.h>
#include "util/bitscan.h"
#include "util/bitset.h"
#include "util/compiler.h"
#include "util/detect_os.h"
#include "util/list.h"
#include "util/macros.h"
#include "util/os_time.h"
#include "util/perf/cpu_trace.h"
#include "util/simple_mtx.h"
#include "util/u_atomic.h"
#include "util/u_math.h"
#include "util/u_thread.h"
#include "util/xmlconfig.h"
#include "vk_alloc.h"
#include "vk_command_buffer.h"
#include "vk_command_pool.h"
#include "vk_debug_report.h"
#include "vk_device.h"
#include "vk_device_memory.h"
#include "vk_image.h"
#include "vk_instance.h"
#include "vk_object.h"
#include "vk_physical_device.h"
#include "vk_queue.h"
#include "vk_util.h"
#if DETECT_OS_WINDOWS
#include <processthreadsapi.h>
#else
#include <sys/syscall.h>
#include "drm-uapi/drm_fourcc.h"
#include "util/libsync.h"
#endif
#include "vn_entrypoints.h"
#define VN_DEFAULT_ALIGN 8
#define VN_WATCHDOG_REPORT_PERIOD_US 3000000
#define VN_DEBUG(category) (unlikely(vn_env.debug & VN_DEBUG_##category))
#define VN_PERF(category) (unlikely(vn_env.perf & VN_PERF_##category))
#define vn_error(instance, error) \
(VN_DEBUG(RESULT) ? vn_log_result((instance), (error), __func__) : (error))
#define vn_result(instance, result) \
((result) >= VK_SUCCESS ? (result) : vn_error((instance), (result)))
#define VN_TRACE_SCOPE(name) MESA_TRACE_SCOPE(name)
#define VN_TRACE_FUNC() MESA_TRACE_SCOPE(__func__)
#define VN_MAKE_NVIDIA_VERSION(major, minor, sub_minor, patch) \
((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 14U) | \
(((uint32_t)(sub_minor)) << 6U) | ((uint32_t)(patch)))
struct vn_instance;
struct vn_physical_device;
struct vn_device;
struct vn_queue;
struct vn_fence;
struct vn_semaphore;
struct vn_device_memory;
struct vn_buffer;
struct vn_buffer_view;
struct vn_image;
struct vn_image_view;
struct vn_sampler;
struct vn_sampler_ycbcr_conversion;
struct vn_descriptor_set_layout;
struct vn_descriptor_pool;
struct vn_descriptor_set;
struct vn_descriptor_update_template;
struct vn_render_pass;
struct vn_framebuffer;
struct vn_event;
struct vn_query_pool;
struct vn_shader_module;
struct vn_pipeline_layout;
struct vn_pipeline_cache;
struct vn_pipeline;
struct vn_command_pool;
struct vn_command_buffer;
struct vn_cs_encoder;
struct vn_cs_decoder;
struct vn_ring;
struct vn_renderer;
struct vn_renderer_shmem;
struct vn_renderer_bo;
struct vn_renderer_sync;
enum vn_debug {
VN_DEBUG_INIT = 1ull << 0,
VN_DEBUG_RESULT = 1ull << 1,
VN_DEBUG_VTEST = 1ull << 2,
VN_DEBUG_WSI = 1ull << 3,
VN_DEBUG_NO_ABORT = 1ull << 4,
VN_DEBUG_LOG_CTX_INFO = 1ull << 5,
VN_DEBUG_CACHE = 1ull << 6,
VN_DEBUG_NO_SPARSE = 1ull << 7,
VN_DEBUG_NO_GPL = 1ull << 8,
VN_DEBUG_NO_SECOND_QUEUE = 1ull << 9,
VN_DEBUG_NO_RAY_TRACING = 1ull << 10,
VN_DEBUG_MEM_BUDGET = 1ull << 11,
VN_DEBUG_NO_DESC_HEAP = 1ull << 12,
};
enum vn_perf {
VN_PERF_NO_ASYNC_SET_ALLOC = 1ull << 0,
VN_PERF_NO_ASYNC_BUFFER_CREATE = 1ull << 1,
VN_PERF_NO_ASYNC_QUEUE_SUBMIT = 1ull << 2,
VN_PERF_NO_EVENT_FEEDBACK = 1ull << 3,
VN_PERF_NO_FENCE_FEEDBACK = 1ull << 4,
VN_PERF_NO_CMD_BATCHING = 1ull << 6,
VN_PERF_NO_SEMAPHORE_FEEDBACK = 1ull << 7,
VN_PERF_NO_QUERY_FEEDBACK = 1ull << 8,
VN_PERF_NO_ASYNC_MEM_ALLOC = 1ull << 9,
VN_PERF_NO_TILED_WSI_IMAGE = 1ull << 10,
VN_PERF_NO_MULTI_RING = 1ull << 11,
VN_PERF_NO_ASYNC_IMAGE_CREATE = 1ull << 12,
VN_PERF_NO_ASYNC_IMAGE_FORMAT = 1ull << 13,
VN_PERF_NO_ASYNC_PRESENT = 1ull << 14,
};
typedef uint64_t vn_object_id;
/* base class of vn_instance */
struct vn_instance_base {
struct vk_instance vk;
vn_object_id id;
};
/* base class of vn_physical_device */
struct vn_physical_device_base {
struct vk_physical_device vk;
vn_object_id id;
};
/* base class of vn_device */
struct vn_device_base {
struct vk_device vk;
vn_object_id id;
};
/* base class of vn_queue */
struct vn_queue_base {
struct vk_queue vk;
vn_object_id id;
};
/* base class of vn_command_pool */
struct vn_command_pool_base {
struct vk_command_pool vk;
vn_object_id id;
};
/* base class of vn_command_buffer */
struct vn_command_buffer_base {
struct vk_command_buffer vk;
vn_object_id id;
};
/* base class of vn_device_memory */
struct vn_device_memory_base {
struct vk_device_memory vk;
vn_object_id id;
};
/* base class of vn_image */
struct vn_image_base {
struct vk_image vk;
vn_object_id id;
};
/* base class of other driver objects */
struct vn_object_base {
struct vk_object_base vk;
vn_object_id id;
};
struct vn_refcount {
atomic_int count;
};
struct vn_env {
uint64_t debug;
uint64_t perf;
};
extern struct vn_env vn_env;
/* Only one "waiting" thread may fulfill the "watchdog" role at a time. Every
* VN_WATCHDOG_REPORT_PERIOD_US or longer, the watchdog tests the ring's ALIVE
* status, updates the "alive" atomic, and resets the ALIVE status for the
* next cycle. Other waiting threads just check the "alive" atomic. The
* watchdog role may be released and acquired by another waiting thread
* dynamically.
*
* Examples of "waiting" are to wait for:
* - ring to reach a seqno
* - ring space to be released
* - sync primitives to signal
* - query result being available
*/
struct vn_watchdog {
mtx_t mutex;
atomic_int tid;
atomic_bool alive;
};
enum vn_relax_reason {
VN_RELAX_REASON_RING_SEQNO,
VN_RELAX_REASON_TLS_RING_SEQNO,
VN_RELAX_REASON_RING_SPACE,
VN_RELAX_REASON_FENCE,
VN_RELAX_REASON_SEMAPHORE,
VN_RELAX_REASON_QUERY,
};
/* vn_relax_profile defines the driver side polling behavior
*
* - base_sleep_us:
* - the minimum polling interval after initial busy waits
*
* - busy_wait_order:
* - initial 2 ^ busy_wait_order times thrd_yield()
*
* - warn_order:
* - number of polls at order N:
* - fn_cnt(N) = 2 ^ N
* - interval of poll at order N:
* - fn_step(N) = base_sleep_us * (2 ^ (N - busy_wait_order))
* - warn occasionally if we have slept at least:
* - for (i = busy_wait_order; i < warn_order; i++)
* total_sleep += fn_cnt(i) * fn_step(i)
*
* - abort_order:
* - similar to warn_order, but would abort() instead
*/
struct vn_relax_profile {
uint32_t base_sleep_us;
uint32_t busy_wait_order;
uint32_t warn_order;
uint32_t abort_order;
};
struct vn_relax_state {
struct vn_instance *instance;
uint32_t iter;
const struct vn_relax_profile profile;
const char *reason_str;
bool warn;
};
/* TLS ring
* - co-owned by TLS and VkInstance
* - initialized in TLS upon requested
* - teardown happens upon thread exit or instance destroy
* - teardown is split into 2 stages:
* 1. one owner locks and destroys the ring and mark destroyed
* 2. the other owner locks and frees up the tls ring storage
*/
struct vn_tls_ring {
mtx_t mutex;
struct vn_ring *ring;
struct vn_instance *instance;
struct list_head tls_head;
struct list_head vk_head;
};
struct vn_tls {
/* Track the threads on which swapchain and command pool creations occur.
* Pipeline create on those threads are forced async via the primary ring.
*/
bool async_pipeline_create;
/* Track TLS rings owned across instances. */
struct list_head tls_rings;
};
/* A cached storage for object internal usages with below constraints:
* - It belongs to the object and shares the lifetime.
* - The storage reuse is protected by external synchronization.
* - The returned storage is not zero-initialized.
* - It never shrinks unless being purged via fini.
*
* The current users are:
* - VkCommandPool
* - VkQueue
*/
struct vn_cached_storage {
const VkAllocationCallbacks *alloc;
size_t size;
void *data;
};
void
vn_env_init(void);
void
vn_log(struct vn_instance *instance, const char *format, ...)
PRINTFLIKE(2, 3);
VkResult
vn_log_result(struct vn_instance *instance,
VkResult result,
const char *where);
#define VN_REFCOUNT_INIT(val) \
(struct vn_refcount) \
{ \
.count = (val), \
}
static inline int
vn_refcount_load_relaxed(const struct vn_refcount *ref)
{
return atomic_load_explicit(&ref->count, memory_order_relaxed);
}
static inline int
vn_refcount_fetch_add_relaxed(struct vn_refcount *ref, int val)
{
return atomic_fetch_add_explicit(&ref->count, val, memory_order_relaxed);
}
static inline int
vn_refcount_fetch_sub_release(struct vn_refcount *ref, int val)
{
return atomic_fetch_sub_explicit(&ref->count, val, memory_order_release);
}
static inline bool
vn_refcount_is_valid(const struct vn_refcount *ref)
{
return vn_refcount_load_relaxed(ref) > 0;
}
static inline void
vn_refcount_inc(struct vn_refcount *ref)
{
/* no ordering imposed */
ASSERTED const int old = vn_refcount_fetch_add_relaxed(ref, 1);
assert(old >= 1);
}
static inline bool
vn_refcount_dec(struct vn_refcount *ref)
{
/* prior reads/writes cannot be reordered after this */
const int old = vn_refcount_fetch_sub_release(ref, 1);
assert(old >= 1);
/* subsequent free cannot be reordered before this */
if (old == 1)
atomic_thread_fence(memory_order_acquire);
return old == 1;
}
extern uint64_t vn_next_obj_id;
static inline uint64_t
vn_get_next_obj_id(void)
{
return p_atomic_fetch_add(&vn_next_obj_id, 1);
}
uint32_t
vn_extension_get_spec_version(const char *name);
static inline void
vn_watchdog_init(struct vn_watchdog *watchdog)
{
#ifndef NDEBUG
/* ensure minimum check period is greater than maximum renderer
* reporting period (with margin of safety to ensure no false
* positives).
*
* first_warn_time is pre-calculated based on parameters in vn_relax
* and must update together.
*/
static const uint32_t first_warn_time = 3481600;
static const uint32_t safety_margin = 250000;
assert(first_warn_time - safety_margin >= VN_WATCHDOG_REPORT_PERIOD_US);
#endif
mtx_init(&watchdog->mutex, mtx_plain);
watchdog->tid = 0;
/* initialized to be alive to avoid vn_watchdog_timout false alarm */
watchdog->alive = true;
}
static inline void
vn_watchdog_fini(struct vn_watchdog *watchdog)
{
mtx_destroy(&watchdog->mutex);
}
struct vn_relax_state
vn_relax_init(struct vn_instance *instance, enum vn_relax_reason reason);
void
vn_relax(struct vn_relax_state *state);
void
vn_relax_fini(struct vn_relax_state *state);
static inline bool
vn_relax_warn(struct vn_relax_state *state)
{
return state->warn;
}
static_assert(sizeof(vn_object_id) >= sizeof(uintptr_t), "");
static inline VkResult
vn_instance_base_init(
struct vn_instance_base *instance,
const struct vk_instance_extension_table *supported_extensions,
const struct vk_instance_dispatch_table *dispatch_table,
const VkInstanceCreateInfo *info,
const VkAllocationCallbacks *alloc)
{
VkResult result = vk_instance_init(&instance->vk, supported_extensions,
dispatch_table, info, alloc);
instance->id = vn_get_next_obj_id();
return result;
}
static inline void
vn_instance_base_fini(struct vn_instance_base *instance)
{
vk_instance_finish(&instance->vk);
}
static inline VkResult
vn_physical_device_base_init(
struct vn_physical_device_base *physical_dev,
struct vn_instance_base *instance,
const struct vk_device_extension_table *supported_extensions,
const struct vk_physical_device_dispatch_table *dispatch_table)
{
VkResult result = vk_physical_device_init(&physical_dev->vk, &instance->vk,
supported_extensions, NULL, NULL,
dispatch_table);
physical_dev->id = vn_get_next_obj_id();
return result;
}
static inline void
vn_physical_device_base_fini(struct vn_physical_device_base *physical_dev)
{
vk_physical_device_finish(&physical_dev->vk);
}
static inline VkResult
vn_device_base_init(struct vn_device_base *dev,
struct vn_physical_device_base *physical_dev,
const struct vk_device_dispatch_table *dispatch_table,
const VkDeviceCreateInfo *info,
const VkAllocationCallbacks *alloc)
{
VkResult result = vk_device_init(&dev->vk, &physical_dev->vk,
dispatch_table, info, alloc);
dev->id = vn_get_next_obj_id();
return result;
}
static inline void
vn_device_base_fini(struct vn_device_base *dev)
{
vk_device_finish(&dev->vk);
}
static inline VkResult
vn_queue_base_init(struct vn_queue_base *queue,
struct vn_device_base *dev,
const VkDeviceQueueCreateInfo *queue_info,
uint32_t queue_index)
{
VkResult result =
vk_queue_init(&queue->vk, &dev->vk, queue_info, queue_index);
queue->id = vn_get_next_obj_id();
return result;
}
static inline void
vn_queue_base_fini(struct vn_queue_base *queue)
{
vk_queue_finish(&queue->vk);
}
static inline VkResult
vn_command_pool_base_init(struct vn_command_pool_base *cmd_pool,
struct vn_device_base *dev,
const VkCommandPoolCreateInfo *info,
const VkAllocationCallbacks *alloc)
{
VkResult result =
vk_command_pool_init(&dev->vk, &cmd_pool->vk, info, alloc);
cmd_pool->id = vn_get_next_obj_id();
return result;
}
static inline void
vn_command_pool_base_fini(struct vn_command_pool_base *cmd_pool)
{
vk_command_pool_finish(&cmd_pool->vk);
}
static inline VkResult
vn_command_buffer_base_init(struct vn_command_buffer_base *cmd,
struct vn_command_pool_base *cmd_pool,
const struct vk_command_buffer_ops *ops,
VkCommandBufferLevel level)
{
VkResult result =
vk_command_buffer_init(&cmd_pool->vk, &cmd->vk, ops, level);
cmd->id = vn_get_next_obj_id();
return result;
}
static inline void
vn_command_buffer_base_fini(struct vn_command_buffer_base *cmd)
{
vk_command_buffer_finish(&cmd->vk);
}
static inline void
vn_object_base_init(struct vn_object_base *obj,
VkObjectType type,
struct vn_device_base *dev)
{
vk_object_base_init(&dev->vk, &obj->vk, type);
obj->id = vn_get_next_obj_id();
}
static inline void
vn_object_base_fini(struct vn_object_base *obj)
{
vk_object_base_finish(&obj->vk);
}
static inline void
vn_object_set_id(void *obj, vn_object_id id, VkObjectType type)
{
assert(((const struct vk_object_base *)obj)->type == type);
switch (type) {
case VK_OBJECT_TYPE_INSTANCE:
((struct vn_instance_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
((struct vn_physical_device_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_DEVICE:
((struct vn_device_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_QUEUE:
((struct vn_queue_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_COMMAND_POOL:
((struct vn_command_pool_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_COMMAND_BUFFER:
((struct vn_command_buffer_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_DEVICE_MEMORY:
((struct vn_device_memory_base *)obj)->id = id;
break;
case VK_OBJECT_TYPE_IMAGE:
((struct vn_image_base *)obj)->id = id;
break;
default:
((struct vn_object_base *)obj)->id = id;
break;
}
}
static inline vn_object_id
vn_object_get_id(const void *obj, VkObjectType type)
{
assert(((const struct vk_object_base *)obj)->type == type);
switch (type) {
case VK_OBJECT_TYPE_INSTANCE:
return ((struct vn_instance_base *)obj)->id;
case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
return ((struct vn_physical_device_base *)obj)->id;
case VK_OBJECT_TYPE_DEVICE:
return ((struct vn_device_base *)obj)->id;
case VK_OBJECT_TYPE_QUEUE:
return ((struct vn_queue_base *)obj)->id;
case VK_OBJECT_TYPE_COMMAND_POOL:
return ((struct vn_command_pool_base *)obj)->id;
case VK_OBJECT_TYPE_COMMAND_BUFFER:
return ((struct vn_command_buffer_base *)obj)->id;
case VK_OBJECT_TYPE_DEVICE_MEMORY:
return ((struct vn_device_memory_base *)obj)->id;
case VK_OBJECT_TYPE_IMAGE:
return ((struct vn_image_base *)obj)->id;
default:
return ((struct vn_object_base *)obj)->id;
}
}
static inline pid_t
vn_gettid(void)
{
#if DETECT_OS_ANDROID
return gettid();
#elif DETECT_OS_FREEBSD
return syscall(SYS_thr_self);
#elif DETECT_OS_WINDOWS
return GetCurrentThreadId();
#else
return syscall(SYS_gettid);
#endif
}
struct vn_tls *
vn_tls_get(void);
static inline void
vn_tls_set_async_pipeline_create(void)
{
struct vn_tls *tls = vn_tls_get();
if (likely(tls))
tls->async_pipeline_create = true;
}
static inline bool
vn_tls_get_async_pipeline_create(void)
{
const struct vn_tls *tls = vn_tls_get();
if (likely(tls))
return tls->async_pipeline_create;
return true;
}
struct vn_ring *
vn_tls_get_ring(struct vn_instance *instance);
void
vn_tls_destroy_ring(struct vn_tls_ring *tls_ring);
static inline uint32_t
vn_cache_key_hash_function(const void *key)
{
return _mesa_hash_data(key, BLAKE3_KEY_LEN);
}
static inline bool
vn_cache_key_equal_function(const void *key1, const void *key2)
{
return memcmp(key1, key2, BLAKE3_KEY_LEN) == 0;
}
static inline void
vn_cached_storage_init(struct vn_cached_storage *storage,
const VkAllocationCallbacks *alloc)
{
storage->alloc = alloc;
storage->size = 0;
storage->data = NULL;
}
static inline void *
vn_cached_storage_get(struct vn_cached_storage *storage, size_t size)
{
if (size > storage->size) {
void *data =
vk_realloc(storage->alloc, storage->data, size, VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!data)
return NULL;
storage->size = size;
storage->data = data;
}
return storage->data;
}
static inline void
vn_cached_storage_fini(struct vn_cached_storage *storage)
{
vk_free(storage->alloc, storage->data);
}
#endif /* VN_COMMON_H */
+313
View File
@@ -0,0 +1,313 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*/
#include "vn_cs.h"
#include "vn_instance.h"
#include "vn_renderer.h"
struct vn_cs_renderer_protocol_info _vn_cs_renderer_protocol_info = {
.mutex = SIMPLE_MTX_INITIALIZER,
};
static void
vn_cs_renderer_protocol_info_init_once(struct vn_instance *instance)
{
const struct vn_renderer_info *renderer_info = &instance->renderer->info;
/* assume renderer protocol supports all extensions if bit 0 is not set */
const bool support_all_exts =
!vn_info_extension_mask_test(renderer_info->vk_extension_mask, 0);
_vn_cs_renderer_protocol_info.api_version = renderer_info->vk_xml_version;
STATIC_ASSERT(sizeof(renderer_info->vk_extension_mask) >=
sizeof(_vn_cs_renderer_protocol_info.extension_bitset));
for (uint32_t i = 1; i <= VN_INFO_EXTENSION_MAX_NUMBER; i++) {
/* use protocl helper to ensure mask decoding matches encoding */
if (support_all_exts ||
vn_info_extension_mask_test(renderer_info->vk_extension_mask, i))
BITSET_SET(_vn_cs_renderer_protocol_info.extension_bitset, i);
}
}
void
vn_cs_renderer_protocol_info_init(struct vn_instance *instance)
{
simple_mtx_lock(&_vn_cs_renderer_protocol_info.mutex);
if (_vn_cs_renderer_protocol_info.init_once) {
simple_mtx_unlock(&_vn_cs_renderer_protocol_info.mutex);
return;
}
vn_cs_renderer_protocol_info_init_once(instance);
_vn_cs_renderer_protocol_info.init_once = true;
simple_mtx_unlock(&_vn_cs_renderer_protocol_info.mutex);
}
static void
vn_cs_encoder_sanity_check(struct vn_cs_encoder *enc)
{
assert(enc->buffer_count <= enc->buffer_max);
size_t total_committed_size = 0;
for (uint32_t i = 0; i < enc->buffer_count; i++)
total_committed_size += enc->buffers[i].committed_size;
assert(enc->total_committed_size == total_committed_size);
if (enc->buffer_count) {
const struct vn_cs_encoder_buffer *cur_buf =
&enc->buffers[enc->buffer_count - 1];
assert(cur_buf->base <= enc->cur && enc->cur <= enc->end &&
enc->end <= cur_buf->base + enc->current_buffer_size);
if (cur_buf->committed_size)
assert(enc->cur == enc->end);
} else {
assert(!enc->current_buffer_size);
assert(!enc->cur && !enc->end);
}
}
static void
vn_cs_encoder_add_buffer(struct vn_cs_encoder *enc,
struct vn_renderer_shmem *shmem,
size_t offset,
void *base,
size_t size)
{
/* add a buffer and make it current */
assert(enc->buffer_count < enc->buffer_max);
struct vn_cs_encoder_buffer *cur_buf = &enc->buffers[enc->buffer_count++];
/* shmem ownership transferred */
cur_buf->shmem = shmem;
cur_buf->offset = offset;
cur_buf->base = base;
cur_buf->committed_size = 0;
/* update the write pointer */
enc->cur = base;
enc->end = base + size;
}
static void
vn_cs_encoder_commit_buffer(struct vn_cs_encoder *enc)
{
assert(enc->buffer_count);
struct vn_cs_encoder_buffer *cur_buf =
&enc->buffers[enc->buffer_count - 1];
const size_t written_size = enc->cur - cur_buf->base;
if (cur_buf->committed_size) {
assert(cur_buf->committed_size == written_size);
} else {
cur_buf->committed_size = written_size;
enc->total_committed_size += written_size;
}
}
static void
vn_cs_encoder_gc_buffers(struct vn_cs_encoder *enc)
{
/* when the shmem pool is used, no need to cache the shmem in cs */
if (enc->storage_type == VN_CS_ENCODER_STORAGE_SHMEM_POOL) {
for (uint32_t i = 0; i < enc->buffer_count; i++) {
vn_renderer_shmem_unref(enc->instance->renderer,
enc->buffers[i].shmem);
}
enc->buffer_count = 0;
enc->total_committed_size = 0;
enc->current_buffer_size = 0;
enc->cur = NULL;
enc->end = NULL;
return;
}
/* free all but the current buffer */
assert(enc->buffer_count);
struct vn_cs_encoder_buffer *cur_buf =
&enc->buffers[enc->buffer_count - 1];
for (uint32_t i = 0; i < enc->buffer_count - 1; i++)
vn_renderer_shmem_unref(enc->instance->renderer, enc->buffers[i].shmem);
/* move the current buffer to the beginning, skipping the used part */
const size_t used = cur_buf->offset + cur_buf->committed_size;
enc->buffer_count = 0;
vn_cs_encoder_add_buffer(enc, cur_buf->shmem, used,
cur_buf->base + cur_buf->committed_size,
enc->current_buffer_size - used);
enc->total_committed_size = 0;
}
void
vn_cs_encoder_init(struct vn_cs_encoder *enc,
struct vn_instance *instance,
enum vn_cs_encoder_storage_type storage_type,
size_t min_size)
{
/* VN_CS_ENCODER_INITIALIZER* should be used instead */
assert(storage_type != VN_CS_ENCODER_STORAGE_POINTER);
memset(enc, 0, sizeof(*enc));
enc->instance = instance;
enc->storage_type = storage_type;
enc->min_buffer_size = min_size;
}
void
vn_cs_encoder_fini(struct vn_cs_encoder *enc)
{
if (unlikely(enc->storage_type == VN_CS_ENCODER_STORAGE_POINTER))
return;
for (uint32_t i = 0; i < enc->buffer_count; i++)
vn_renderer_shmem_unref(enc->instance->renderer, enc->buffers[i].shmem);
free(enc->buffers);
}
/**
* Reset a cs for reuse.
*/
void
vn_cs_encoder_reset(struct vn_cs_encoder *enc)
{
/* enc->error is sticky */
if (likely(enc->buffer_count))
vn_cs_encoder_gc_buffers(enc);
}
static uint32_t
next_array_size(uint32_t cur_size, uint32_t min_size)
{
const uint32_t next_size = cur_size ? cur_size * 2 : min_size;
return next_size > cur_size ? next_size : 0;
}
static size_t
next_buffer_size(size_t cur_size, size_t min_size, size_t need)
{
size_t next_size = cur_size ? cur_size * 2 : min_size;
while (next_size < need) {
next_size *= 2;
if (!next_size)
return 0;
}
return next_size;
}
static bool
vn_cs_encoder_grow_buffer_array(struct vn_cs_encoder *enc)
{
const uint32_t buf_max = next_array_size(enc->buffer_max, 4);
if (!buf_max)
return false;
void *bufs = realloc(enc->buffers, sizeof(*enc->buffers) * buf_max);
if (!bufs)
return false;
enc->buffers = bufs;
enc->buffer_max = buf_max;
return true;
}
/**
* Add a new vn_cs_encoder_buffer to a cs.
*/
bool
vn_cs_encoder_reserve_internal(struct vn_cs_encoder *enc, size_t size)
{
VN_TRACE_FUNC();
if (unlikely(enc->storage_type == VN_CS_ENCODER_STORAGE_POINTER))
return false;
if (enc->buffer_count >= enc->buffer_max) {
if (!vn_cs_encoder_grow_buffer_array(enc))
return false;
assert(enc->buffer_count < enc->buffer_max);
}
size_t buf_size = 0;
if (likely(enc->buffer_count)) {
vn_cs_encoder_commit_buffer(enc);
if (enc->storage_type == VN_CS_ENCODER_STORAGE_SHMEM_ARRAY) {
/* if the current buffer is reused from the last vn_cs_encoder_reset
* (i.e., offset != 0), do not double the size
*
* TODO better strategy to grow buffer size
*/
const struct vn_cs_encoder_buffer *cur_buf =
&enc->buffers[enc->buffer_count - 1];
if (cur_buf->offset)
buf_size = next_buffer_size(0, enc->current_buffer_size, size);
}
}
if (!buf_size) {
/* double the size */
buf_size = next_buffer_size(enc->current_buffer_size,
enc->min_buffer_size, size);
if (!buf_size)
return false;
}
struct vn_renderer_shmem *shmem;
size_t buf_offset;
if (enc->storage_type == VN_CS_ENCODER_STORAGE_SHMEM_ARRAY) {
shmem = vn_renderer_shmem_create(enc->instance->renderer, buf_size);
buf_offset = 0;
} else {
assert(enc->storage_type == VN_CS_ENCODER_STORAGE_SHMEM_POOL);
shmem =
vn_instance_cs_shmem_alloc(enc->instance, buf_size, &buf_offset);
}
if (!shmem)
return false;
vn_cs_encoder_add_buffer(enc, shmem, buf_offset,
shmem->mmap_ptr + buf_offset, buf_size);
enc->current_buffer_size = buf_size;
vn_cs_encoder_sanity_check(enc);
return true;
}
/*
* Commit written data.
*/
void
vn_cs_encoder_commit(struct vn_cs_encoder *enc)
{
if (likely(enc->buffer_count)) {
vn_cs_encoder_commit_buffer(enc);
/* trigger the slow path on next vn_cs_encoder_reserve */
enc->end = enc->cur;
}
vn_cs_encoder_sanity_check(enc);
}
bool
vn_cs_encoder_needs_roundtrip(struct vn_cs_encoder *enc)
{
if (!enc->instance->renderer->info.has_guest_vram)
return false;
/* check pinned shmems for new shmem allocs */
for (uint32_t i = 0; i < enc->buffer_count; i++) {
const struct vn_renderer_shmem *shmem = enc->buffers[i].shmem;
if (shmem && !shmem->cache_timestamp)
return true;
}
return false;
}
+260
View File
@@ -0,0 +1,260 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_CS_H
#define VN_CS_H
#include "vn_common.h"
#include "venus-protocol/vn_protocol_driver_info.h"
#define VN_CS_ENCODER_BUFFER_INITIALIZER(storage) \
(struct vn_cs_encoder_buffer) \
{ \
.base = storage, \
}
/* note that buffers points to an unamed local variable */
#define VN_CS_ENCODER_INITIALIZER_LOCAL(storage, size) \
(struct vn_cs_encoder) \
{ \
.storage_type = VN_CS_ENCODER_STORAGE_POINTER, \
.buffers = &VN_CS_ENCODER_BUFFER_INITIALIZER(storage), \
.buffer_count = 1, .buffer_max = 1, .current_buffer_size = size, \
.cur = storage, .end = (const void *)(storage) + (size), \
}
#define VN_CS_ENCODER_INITIALIZER(buf, size) \
(struct vn_cs_encoder) \
{ \
.storage_type = VN_CS_ENCODER_STORAGE_POINTER, .buffers = (buf), \
.buffer_count = 1, .buffer_max = 1, .current_buffer_size = size, \
.cur = (buf)->base, .end = (buf)->base + (size), \
}
#define VN_CS_DECODER_INITIALIZER(storage, size) \
(struct vn_cs_decoder) \
{ \
.cur = storage, .end = (const void *)(storage) + (size), \
}
enum vn_cs_encoder_storage_type {
/* a pointer to an externally-managed storage */
VN_CS_ENCODER_STORAGE_POINTER,
/* an array of dynamically allocated shmems */
VN_CS_ENCODER_STORAGE_SHMEM_ARRAY,
/* same as above, but shmems are suballocated from a pool */
VN_CS_ENCODER_STORAGE_SHMEM_POOL,
};
struct vn_cs_encoder_buffer {
struct vn_renderer_shmem *shmem;
size_t offset;
void *base;
size_t committed_size;
};
struct vn_cs_encoder {
struct vn_instance *instance;
enum vn_cs_encoder_storage_type storage_type;
size_t min_buffer_size;
bool fatal_error;
struct vn_cs_encoder_buffer *buffers;
uint32_t buffer_count;
uint32_t buffer_max;
size_t total_committed_size;
/* the current buffer is buffers[buffer_count - 1].shmem */
size_t current_buffer_size;
/* cur is the write pointer. When cur passes end, the slow path is
* triggered.
*/
void *cur;
const void *end;
};
struct vn_cs_decoder {
const void *cur;
const void *end;
};
struct vn_cs_renderer_protocol_info {
simple_mtx_t mutex;
bool init_once;
uint32_t api_version;
BITSET_DECLARE(extension_bitset, VN_INFO_EXTENSION_MAX_NUMBER + 1);
};
extern struct vn_cs_renderer_protocol_info _vn_cs_renderer_protocol_info;
static inline bool
vn_cs_renderer_protocol_has_api_version(uint32_t api_version)
{
return _vn_cs_renderer_protocol_info.api_version >= api_version;
}
static inline bool
vn_cs_renderer_protocol_has_extension(uint32_t ext_number)
{
return BITSET_TEST(_vn_cs_renderer_protocol_info.extension_bitset,
ext_number);
}
void
vn_cs_renderer_protocol_info_init(struct vn_instance *instance);
void
vn_cs_encoder_init(struct vn_cs_encoder *enc,
struct vn_instance *instance,
enum vn_cs_encoder_storage_type storage_type,
size_t min_size);
void
vn_cs_encoder_fini(struct vn_cs_encoder *enc);
void
vn_cs_encoder_reset(struct vn_cs_encoder *enc);
static inline void
vn_cs_encoder_set_fatal(const struct vn_cs_encoder *enc)
{
/* This is fatal and should be treated as VK_ERROR_DEVICE_LOST or even
* abort(). Note that vn_cs_encoder_reset does not clear this.
*/
((struct vn_cs_encoder *)enc)->fatal_error = true;
}
static inline bool
vn_cs_encoder_get_fatal(const struct vn_cs_encoder *enc)
{
return enc->fatal_error;
}
static inline bool
vn_cs_encoder_is_empty(const struct vn_cs_encoder *enc)
{
return !enc->buffer_count || enc->cur == enc->buffers[0].base;
}
static inline size_t
vn_cs_encoder_get_len(const struct vn_cs_encoder *enc)
{
if (unlikely(!enc->buffer_count))
return 0;
size_t len = enc->total_committed_size;
const struct vn_cs_encoder_buffer *cur_buf =
&enc->buffers[enc->buffer_count - 1];
if (!cur_buf->committed_size)
len += enc->cur - cur_buf->base;
return len;
}
bool
vn_cs_encoder_reserve_internal(struct vn_cs_encoder *enc, size_t size);
/**
* Reserve space for commands.
*/
static inline bool
vn_cs_encoder_reserve(struct vn_cs_encoder *enc, size_t size)
{
if (unlikely(size > enc->end - enc->cur)) {
if (!vn_cs_encoder_reserve_internal(enc, size)) {
vn_cs_encoder_set_fatal(enc);
return false;
}
assert(size <= enc->end - enc->cur);
}
return true;
}
static inline void
vn_cs_encoder_write(struct vn_cs_encoder *enc,
size_t size,
const void *val,
size_t val_size)
{
assert(val_size <= size);
assert(size <= enc->end - enc->cur);
/* we should not rely on the compiler to optimize away memcpy... */
memcpy(enc->cur, val, val_size);
enc->cur += size;
}
void
vn_cs_encoder_commit(struct vn_cs_encoder *enc);
bool
vn_cs_encoder_needs_roundtrip(struct vn_cs_encoder *enc);
static inline void
vn_cs_decoder_init(struct vn_cs_decoder *dec, const void *data, size_t size)
{
*dec = VN_CS_DECODER_INITIALIZER(data, size);
}
static inline void
vn_cs_decoder_set_fatal(const struct vn_cs_decoder *dec)
{
abort();
}
static inline bool
vn_cs_decoder_peek_internal(const struct vn_cs_decoder *dec,
size_t size,
void *val,
size_t val_size)
{
assert(val_size <= size);
if (unlikely(size > dec->end - dec->cur)) {
vn_cs_decoder_set_fatal(dec);
memset(val, 0, val_size);
return false;
}
/* we should not rely on the compiler to optimize away memcpy... */
memcpy(val, dec->cur, val_size);
return true;
}
static inline void
vn_cs_decoder_read(struct vn_cs_decoder *dec,
size_t size,
void *val,
size_t val_size)
{
if (vn_cs_decoder_peek_internal(dec, size, val, val_size))
dec->cur += size;
}
static inline void
vn_cs_decoder_peek(const struct vn_cs_decoder *dec,
size_t size,
void *val,
size_t val_size)
{
vn_cs_decoder_peek_internal(dec, size, val, val_size);
}
static inline vn_object_id
vn_cs_handle_load_id(const void **handle, VkObjectType type)
{
return *handle ? vn_object_get_id(*handle, type) : 0;
}
static inline void
vn_cs_handle_store_id(void **handle, vn_object_id id, VkObjectType type)
{
vn_object_set_id(*handle, id, type);
}
#endif /* VN_CS_H */
+71
View File
@@ -0,0 +1,71 @@
/*
* Copyright 2026 Google LLC
* SPDX-License-Identifier: MIT
*/
#ifndef VN_DESCRIPTOR_H
#define VN_DESCRIPTOR_H
#include "vn_common.h"
enum vn_descriptor_type {
VN_DESCRIPTOR_TYPE_SAMPLER,
VN_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
VN_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
VN_DESCRIPTOR_TYPE_STORAGE_IMAGE,
VN_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER,
VN_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER,
VN_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
VN_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VN_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC,
VN_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC,
VN_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
VN_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK,
VN_DESCRIPTOR_TYPE_MUTABLE_EXT,
VN_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR,
/* add new enum types before this line */
VN_NUM_DESCRIPTOR_TYPES,
};
/* Map VkDescriptorType to contiguous enum vn_descriptor_type */
static enum vn_descriptor_type
vn_descriptor_type(VkDescriptorType type)
{
switch (type) {
case VK_DESCRIPTOR_TYPE_SAMPLER:
return VN_DESCRIPTOR_TYPE_SAMPLER;
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
return VN_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
return VN_DESCRIPTOR_TYPE_SAMPLED_IMAGE;
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
return VN_DESCRIPTOR_TYPE_STORAGE_IMAGE;
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
return VN_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER;
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
return VN_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
return VN_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
return VN_DESCRIPTOR_TYPE_STORAGE_BUFFER;
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
return VN_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
return VN_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
return VN_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
case VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK:
return VN_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK;
case VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR:
return VN_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR;
case VK_DESCRIPTOR_TYPE_MUTABLE_EXT:
return VN_DESCRIPTOR_TYPE_MUTABLE_EXT;
default:
break;
}
UNREACHABLE("bad VkDescriptorType");
}
#endif /* VN_DESCRIPTOR_H */
+176
View File
@@ -0,0 +1,176 @@
/*
* Copyright 2026 Google LLC
* SPDX-License-Identifier: MIT
*/
#include "venus-protocol/vn_protocol_driver_descriptor_heap.h"
#include "vn_descriptor.h"
#include "vn_device.h"
#include "vn_physical_device.h"
/* descriptor heap commands */
VKAPI_ATTR VkResult VKAPI_CALL
vn_WriteSamplerDescriptorsEXT(VkDevice device,
uint32_t samplerCount,
const VkSamplerCreateInfo *pSamplers,
const VkHostAddressRangeEXT *pDescriptors)
{
struct vn_device *dev = vn_device_from_handle(device);
VkPhysicalDevice physical_dev_handle =
vn_physical_device_to_handle(dev->physical_device);
const VkDeviceSize size = vn_GetPhysicalDeviceDescriptorSizeEXT(
physical_dev_handle, VK_DESCRIPTOR_TYPE_SAMPLER);
/* TODO move out from primary ring? */
for (uint32_t i = 0; i < samplerCount; i++) {
assert(pDescriptors[i].size >= size);
VkResult result = vn_call_vkWriteSamplerDescriptorMESA(
dev->primary_ring, device, &pSamplers[i], size,
pDescriptors[i].address);
if (result != VK_SUCCESS)
return vn_error(dev->instance, result);
}
return VK_SUCCESS;
}
static uint32_t
vn_descriptor_heap_get_descriptor_count(
struct vn_device *dev, const VkResourceDescriptorInfoEXT *resource)
{
switch (resource->type) {
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
break;
default:
return 1;
}
if (!resource->data.pImage)
return 1;
const VkSamplerYcbcrConversionInfo *ycbcr = vk_find_struct_const(
resource->data.pImage->pView->pNext, SAMPLER_YCBCR_CONVERSION_INFO);
if (!ycbcr)
return 1;
VkImage img_handle = resource->data.pImage->pView->image;
VK_FROM_HANDLE(vk_image, img, img_handle);
const bool has_mod =
img->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
uint64_t mod = 0;
if (has_mod) {
VkImageDrmFormatModifierPropertiesEXT mod_props = {
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT,
};
ASSERTED VkResult result = vn_GetImageDrmFormatModifierPropertiesEXT(
vn_device_to_handle(dev), img_handle, &mod_props);
assert(result == VK_SUCCESS);
mod = mod_props.drmFormatModifier;
}
const VkPhysicalDeviceImageDrmFormatModifierInfoEXT mod_info = {
.sType =
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT,
.drmFormatModifier = mod,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
};
const VkPhysicalDeviceImageFormatInfo2 format_info = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
.pNext = has_mod ? &mod_info : NULL,
.format = img->format,
.type = img->image_type,
.tiling = img->tiling,
.usage = img->usage,
.flags = img->create_flags,
};
VkSamplerYcbcrConversionImageFormatProperties ycbcr_props = {
.sType =
VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES,
};
VkImageFormatProperties2 format_props = {
.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2,
.pNext = &ycbcr_props,
};
ASSERTED VkResult result = vn_GetPhysicalDeviceImageFormatProperties2(
vn_physical_device_to_handle(dev->physical_device), &format_info,
&format_props);
assert(result == VK_SUCCESS);
return ycbcr_props.combinedImageSamplerDescriptorCount;
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_WriteResourceDescriptorsEXT(VkDevice device,
uint32_t resourceCount,
const VkResourceDescriptorInfoEXT *pResources,
const VkHostAddressRangeEXT *pDescriptors)
{
struct vn_device *dev = vn_device_from_handle(device);
VkPhysicalDevice physical_dev_handle =
vn_physical_device_to_handle(dev->physical_device);
/* TODO move out from primary ring? */
for (uint32_t i = 0; i < resourceCount; i++) {
const uint32_t descriptor_count =
vn_descriptor_heap_get_descriptor_count(dev, &pResources[i]);
const VkDeviceSize descriptor_size =
vn_GetPhysicalDeviceDescriptorSizeEXT(physical_dev_handle,
pResources[i].type);
const VkDeviceSize size = descriptor_size * descriptor_count;
assert(pDescriptors[i].size >= size);
VkResult result = vn_call_vkWriteResourceDescriptorMESA(
dev->primary_ring, device, &pResources[i], size,
pDescriptors[i].address);
if (result != VK_SUCCESS)
return vn_error(dev->instance, result);
}
return VK_SUCCESS;
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_GetImageOpaqueCaptureDataEXT(VkDevice device,
uint32_t imageCount,
const VkImage *pImages,
VkHostAddressRangeEXT *pDatas)
{
struct vn_device *dev = vn_device_from_handle(device);
return vn_call_vkGetImageOpaqueCaptureDataEXT(dev->primary_ring, device,
imageCount, pImages, pDatas);
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_RegisterCustomBorderColorEXT(
VkDevice device,
const VkSamplerCustomBorderColorCreateInfoEXT *pBorderColor,
VkBool32 requestIndex,
uint32_t *pIndex)
{
struct vn_device *dev = vn_device_from_handle(device);
if (requestIndex == VK_TRUE) {
vn_async_vkRegisterCustomBorderColorEXT(
dev->primary_ring, device, pBorderColor, requestIndex, pIndex);
return VK_SUCCESS;
}
/* TODO manage indexes to make it async */
return vn_call_vkRegisterCustomBorderColorEXT(
dev->primary_ring, device, pBorderColor, requestIndex, pIndex);
}
VKAPI_ATTR void VKAPI_CALL
vn_UnregisterCustomBorderColorEXT(VkDevice device, uint32_t index)
{
struct vn_device *dev = vn_device_from_handle(device);
vn_async_vkUnregisterCustomBorderColorEXT(dev->primary_ring, device,
index);
}
File diff suppressed because it is too large. Load diff
+180
View File
@@ -0,0 +1,180 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_DESCRIPTOR_SET_H
#define VN_DESCRIPTOR_SET_H
#include "vn_descriptor.h"
struct vn_descriptor_set_layout_binding {
enum vn_descriptor_type type;
uint32_t count;
bool has_immutable_samplers;
BITSET_DECLARE(mutable_descriptor_types, VN_NUM_DESCRIPTOR_TYPES);
};
struct vn_descriptor_set_layout {
struct vn_object_base base;
struct vn_refcount refcount;
uint32_t last_binding;
bool has_variable_descriptor_count;
bool is_push_descriptor;
/* bindings must be the last field in the layout */
struct vn_descriptor_set_layout_binding bindings[];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_set_layout,
base.vk,
VkDescriptorSetLayout,
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
struct vn_descriptor_pool_state {
uint32_t set_count;
uint32_t iub_binding_count;
uint32_t descriptor_counts[VN_NUM_DESCRIPTOR_TYPES];
};
struct vn_descriptor_pool_state_mutable {
uint32_t max;
uint32_t used;
BITSET_DECLARE(types, VN_NUM_DESCRIPTOR_TYPES);
};
enum vn_async_set_alloc_state {
/* Must do synchronous set alloc. It comes from either no_async_set_alloc
* perf option or transition from below conditional states.
*/
VN_ASYNC_SET_ALLOC_NONE,
/* Can still do async set alloc, but the pool might become fragmented after
* freeing up any descriptor set and that will change the state to NONE.
*/
VN_ASYNC_SET_ALLOC_BEFORE_FREE,
/* Can still do async set alloc, and the sets allocated are with the same
* number of descriptors and types. Allocating a set with different number
* of descriptors or types will change the state to BEFORE_FREE.
*/
VN_ASYNC_SET_ALLOC_SAME_ALLOC,
/* Will always do async set alloc, since the pool is not created with
* VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT.
*/
VN_ASYNC_SET_ALLOC_ALWAYS,
};
struct vn_descriptor_pool {
struct vn_object_base base;
VkAllocationCallbacks allocator;
struct list_head descriptor_sets;
enum vn_async_set_alloc_state initial_state;
enum vn_async_set_alloc_state current_state;
struct vn_descriptor_set_layout *last_layout;
struct vn_descriptor_pool_state max;
struct vn_descriptor_pool_state used;
uint32_t mutable_states_count;
struct vn_descriptor_pool_state_mutable *mutable_states;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_pool,
base.vk,
VkDescriptorPool,
VK_OBJECT_TYPE_DESCRIPTOR_POOL)
struct vn_descriptor_set {
struct vn_object_base base;
struct vn_descriptor_set_layout *layout;
uint32_t last_binding_descriptor_count;
struct list_head head;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_set,
base.vk,
VkDescriptorSet,
VK_OBJECT_TYPE_DESCRIPTOR_SET)
struct vn_descriptor_update_template {
struct vn_object_base base;
struct {
VkPipelineBindPoint pipeline_bind_point;
struct vn_descriptor_set_layout *set_layout;
} push;
uint32_t entry_count;
uint32_t img_info_count;
uint32_t buf_info_count;
uint32_t bview_count;
uint32_t iub_count;
uint32_t accel_count;
VkDescriptorUpdateTemplateEntry entries[];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_update_template,
base.vk,
VkDescriptorUpdateTemplate,
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE)
struct vn_descriptor_set_writes {
VkWriteDescriptorSet *writes;
VkDescriptorImageInfo *img_infos;
};
struct vn_descriptor_set_update {
uint32_t write_count;
VkWriteDescriptorSet *writes;
VkDescriptorImageInfo *img_infos;
VkDescriptorBufferInfo *buf_infos;
VkBufferView *bview_handles;
VkWriteDescriptorSetInlineUniformBlock *iubs;
VkWriteDescriptorSetAccelerationStructureKHR *accels;
};
uint32_t
vn_descriptor_set_count_write_images(uint32_t write_count,
const VkWriteDescriptorSet *writes);
const VkWriteDescriptorSet *
vn_descriptor_set_get_writes(uint32_t write_count,
const VkWriteDescriptorSet *writes,
VkPipelineLayout pipeline_layout_handle,
struct vn_descriptor_set_writes *local);
void
vn_descriptor_set_fill_update_with_template(
struct vn_descriptor_update_template *templ,
VkDescriptorSet set_handle,
const uint8_t *data,
struct vn_descriptor_set_update *update);
void
vn_descriptor_set_layout_destroy(struct vn_device *dev,
struct vn_descriptor_set_layout *layout);
static inline struct vn_descriptor_set_layout *
vn_descriptor_set_layout_ref(struct vn_device *dev,
struct vn_descriptor_set_layout *layout)
{
vn_refcount_inc(&layout->refcount);
return layout;
}
static inline void
vn_descriptor_set_layout_unref(struct vn_device *dev,
struct vn_descriptor_set_layout *layout)
{
if (vn_refcount_dec(&layout->refcount))
vn_descriptor_set_layout_destroy(dev, layout);
}
#endif /* VN_DESCRIPTOR_SET_H */
+695
View File
@@ -0,0 +1,695 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#include "vn_device.h"
#include "util/disk_cache.h"
#include "util/hex.h"
#include "venus-protocol/vn_protocol_driver_device.h"
#include "vn_android.h"
#include "vn_instance.h"
#include "vn_physical_device.h"
#include "vn_queue.h"
#include "vn_ring.h"
/* device commands */
static void
vn_queue_fini(struct vn_queue *queue)
{
VkDevice dev_handle = vk_device_to_handle(queue->base.vk.base.device);
if (queue->async_present.initialized) {
mtx_lock(&queue->async_present.mutex);
queue->async_present.join = true;
cnd_signal(&queue->async_present.cond);
mtx_unlock(&queue->async_present.mutex);
thrd_join(queue->async_present.thread, NULL);
simple_mtx_destroy(&queue->async_present.queue_mutex);
mtx_destroy(&queue->async_present.mutex);
cnd_destroy(&queue->async_present.cond);
vn_DestroyFence(dev_handle, queue->async_present.fence, NULL);
}
if (queue->wait_fence != VK_NULL_HANDLE) {
vn_DestroyFence(dev_handle, queue->wait_fence, NULL);
}
if (queue->sparse_semaphore != VK_NULL_HANDLE) {
vn_DestroySemaphore(dev_handle, queue->sparse_semaphore, NULL);
}
vn_cached_storage_fini(&queue->storage);
vn_queue_base_fini(&queue->base);
}
static VkResult
vn_queue_init(struct vn_device *dev,
struct vn_queue *queue,
const VkDeviceQueueCreateInfo *queue_info,
uint32_t queue_index,
struct vn_queue *shared_queue)
{
VkResult result =
vn_queue_base_init(&queue->base, &dev->base, queue_info, queue_index);
if (result != VK_SUCCESS)
return result;
vn_cached_storage_init(&queue->storage, &dev->base.vk.alloc);
if (dev->physical_device->emulate_second_queue ==
queue_info->queueFamilyIndex &&
shared_queue != NULL) {
assert(queue_index > 0);
queue->emulated = true;
queue->base.id = shared_queue->base.id;
queue->can_feedback = shared_queue->can_feedback;
queue->ring_idx = shared_queue->ring_idx;
return VK_SUCCESS;
}
queue->can_feedback = vn_queue_family_can_feedback(
dev->physical_device, queue_info->queueFamilyIndex);
const int ring_idx = vn_instance_acquire_ring_idx(dev->instance);
if (ring_idx < 0) {
vn_log(dev->instance, "failed binding VkQueue to renderer timeline");
return VK_ERROR_INITIALIZATION_FAILED;
}
queue->ring_idx = (uint32_t)ring_idx;
const VkDeviceQueueTimelineInfoMESA timeline_info = {
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_TIMELINE_INFO_MESA,
.ringIdx = queue->ring_idx,
};
const VkDeviceQueueInfo2 device_queue_info = {
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2,
.pNext = &timeline_info,
.flags = queue_info->flags,
.queueFamilyIndex = queue_info->queueFamilyIndex,
.queueIndex = queue_index,
};
VkQueue queue_handle = vn_queue_to_handle(queue);
vn_call_vkGetDeviceQueue2(dev->primary_ring, vn_device_to_handle(dev),
&device_queue_info, &queue_handle);
return VK_SUCCESS;
}
static VkResult
vn_device_init_queues(struct vn_device *dev,
const VkDeviceCreateInfo *create_info)
{
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
uint32_t count = 0;
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++)
count += create_info->pQueueCreateInfos[i].queueCount;
struct vn_queue *queues =
vk_zalloc(alloc, sizeof(*queues) * count, VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!queues)
return VK_ERROR_OUT_OF_HOST_MEMORY;
count = 0;
struct vn_queue *shared_queue = NULL;
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) {
VkResult result;
const VkDeviceQueueCreateInfo *queue_info =
&create_info->pQueueCreateInfos[i];
for (uint32_t j = 0; j < queue_info->queueCount; j++) {
result =
vn_queue_init(dev, &queues[count], queue_info, j, shared_queue);
if (result != VK_SUCCESS) {
for (uint32_t k = 0; k < count; k++)
vn_queue_fini(&queues[k]);
vk_free(alloc, queues);
return result;
}
shared_queue = &queues[count++];
}
}
dev->queues = queues;
dev->queue_count = count;
return VK_SUCCESS;
}
static bool
vn_device_queue_family_init(struct vn_device *dev,
const VkDeviceCreateInfo *create_info)
{
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
uint32_t *queue_families = NULL;
uint32_t count = 0;
queue_families = vk_zalloc(
alloc, sizeof(*queue_families) * create_info->queueCreateInfoCount,
VN_DEFAULT_ALIGN, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!queue_families)
return false;
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) {
const uint32_t index =
create_info->pQueueCreateInfos[i].queueFamilyIndex;
bool new_index = true;
for (uint32_t j = 0; j < count; j++) {
if (queue_families[j] == index) {
new_index = false;
break;
}
}
if (new_index)
queue_families[count++] = index;
}
dev->queue_families = queue_families;
dev->queue_family_count = count;
return true;
}
static inline void
vn_device_queue_family_fini(struct vn_device *dev)
{
vk_free(&dev->base.vk.alloc, dev->queue_families);
}
static bool
find_extension_names(const char *const *exts,
uint32_t ext_count,
const char *name)
{
for (uint32_t i = 0; i < ext_count; i++) {
if (!strcmp(exts[i], name))
return true;
}
return false;
}
static bool
merge_extension_names(const char *const *exts,
uint32_t ext_count,
const char *const *extra_exts,
uint32_t extra_count,
const char *const *block_exts,
uint32_t block_count,
const VkAllocationCallbacks *alloc,
const char *const **out_exts,
uint32_t *out_count)
{
const char **merged =
vk_alloc(alloc, sizeof(*merged) * (ext_count + extra_count),
VN_DEFAULT_ALIGN, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
if (!merged)
return false;
uint32_t count = 0;
for (uint32_t i = 0; i < ext_count; i++) {
if (!find_extension_names(block_exts, block_count, exts[i]))
merged[count++] = exts[i];
}
for (uint32_t i = 0; i < extra_count; i++) {
if (!find_extension_names(exts, ext_count, extra_exts[i]))
merged[count++] = extra_exts[i];
}
*out_exts = merged;
*out_count = count;
return true;
}
static const VkDeviceCreateInfo *
vn_device_fix_create_info(const struct vn_device *dev,
const VkDeviceCreateInfo *dev_info,
const VkAllocationCallbacks *alloc,
VkDeviceCreateInfo *local_info)
{
const struct vn_physical_device *physical_dev = dev->physical_device;
const struct vk_device_extension_table *app_exts =
&dev->base.vk.enabled_extensions;
const struct vk_device_extension_table *renderer_exts =
&physical_dev->renderer_extensions;
/* extra_exts and block_exts must not overlap */
const char *extra_exts[16];
const char *block_exts[32];
uint32_t extra_count = 0;
uint32_t block_count = 0;
/* fix for WSI (treat AHB as WSI extension for simplicity) */
const bool has_wsi =
app_exts->KHR_swapchain || app_exts->ANDROID_native_buffer ||
app_exts->ANDROID_external_memory_android_hardware_buffer;
if (has_wsi) {
if (renderer_exts->EXT_image_drm_format_modifier &&
!app_exts->EXT_image_drm_format_modifier) {
extra_exts[extra_count++] =
VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME;
if (physical_dev->renderer_version < VK_API_VERSION_1_2 &&
!app_exts->KHR_image_format_list) {
extra_exts[extra_count++] =
VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME;
}
}
if (renderer_exts->EXT_queue_family_foreign &&
!app_exts->EXT_queue_family_foreign) {
extra_exts[extra_count++] =
VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME;
}
if (app_exts->KHR_swapchain) {
/* see vn_physical_device_get_native_extensions */
block_exts[block_count++] = VK_KHR_PRESENT_ID_EXTENSION_NAME;
block_exts[block_count++] = VK_KHR_PRESENT_ID_2_EXTENSION_NAME;
block_exts[block_count++] = VK_KHR_PRESENT_WAIT_EXTENSION_NAME;
block_exts[block_count++] = VK_KHR_PRESENT_WAIT_2_EXTENSION_NAME;
block_exts[block_count++] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
block_exts[block_count++] =
VK_KHR_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME;
block_exts[block_count++] =
VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME;
block_exts[block_count++] =
VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME;
block_exts[block_count++] =
VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME;
block_exts[block_count++] = VK_EXT_HDR_METADATA_EXTENSION_NAME;
block_exts[block_count++] = VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME;
}
if (app_exts->ANDROID_native_buffer) {
/* see vn_QueueSignalReleaseImageANDROID */
if (!app_exts->KHR_external_fence_fd) {
assert(physical_dev->renderer_sync_fd.fence_exportable);
extra_exts[extra_count++] =
VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME;
}
block_exts[block_count++] = VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME;
}
if (app_exts->ANDROID_external_memory_android_hardware_buffer) {
block_exts[block_count++] =
VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME;
}
}
if (app_exts->KHR_external_memory_fd ||
app_exts->EXT_external_memory_dma_buf || has_wsi) {
if (physical_dev->external_memory.renderer_handle_type ==
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT) {
if (!app_exts->EXT_external_memory_dma_buf) {
extra_exts[extra_count++] =
VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME;
}
if (!app_exts->KHR_external_memory_fd) {
extra_exts[extra_count++] =
VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME;
}
}
}
/* see vn_queue_submission_count_batch_semaphores */
if (!app_exts->KHR_external_semaphore_fd && has_wsi) {
assert(physical_dev->renderer_sync_fd.semaphore_importable);
extra_exts[extra_count++] = VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME;
}
/* see vn_cmd_set_external_acquire_unmodified */
if (VN_PRESENT_SRC_INTERNAL_LAYOUT != VK_IMAGE_LAYOUT_PRESENT_SRC_KHR &&
renderer_exts->EXT_external_memory_acquire_unmodified &&
!app_exts->EXT_external_memory_acquire_unmodified && has_wsi) {
extra_exts[extra_count++] =
VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXTENSION_NAME;
}
if (app_exts->KHR_map_memory2) {
/* see vn_physical_device_get_native_extensions */
block_exts[block_count++] = VK_KHR_MAP_MEMORY_2_EXTENSION_NAME;
}
if (app_exts->EXT_map_memory_placed) {
/* see vn_physical_device_get_native_extensions */
block_exts[block_count++] = VK_EXT_MAP_MEMORY_PLACED_EXTENSION_NAME;
}
if (app_exts->EXT_device_memory_report) {
/* see vn_physical_device_get_native_extensions */
block_exts[block_count++] = VK_EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME;
}
if (app_exts->EXT_physical_device_drm) {
/* see vn_physical_device_get_native_extensions */
block_exts[block_count++] = VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME;
}
if (app_exts->EXT_tooling_info) {
/* see vn_physical_device_get_native_extensions */
block_exts[block_count++] = VK_EXT_TOOLING_INFO_EXTENSION_NAME;
}
if (app_exts->EXT_pci_bus_info) {
/* always filter for simplicity */
block_exts[block_count++] = VK_EXT_PCI_BUS_INFO_EXTENSION_NAME;
}
assert(extra_count <= ARRAY_SIZE(extra_exts));
assert(block_count <= ARRAY_SIZE(block_exts));
if (!extra_count && (!block_count || !dev_info->enabledExtensionCount))
return dev_info;
*local_info = *dev_info;
if (!merge_extension_names(dev_info->ppEnabledExtensionNames,
dev_info->enabledExtensionCount, extra_exts,
extra_count, block_exts, block_count, alloc,
&local_info->ppEnabledExtensionNames,
&local_info->enabledExtensionCount))
return NULL;
return local_info;
}
static inline VkResult
vn_device_feedback_pool_init(struct vn_device *dev)
{
/* The feedback pool defaults to suballocate slots of 8 bytes each. Initial
* pool size of 4096 corresponds to a total of 512 fences, semaphores and
* events, which well covers the common scenarios. Pool can grow anyway.
*/
static const uint32_t pool_size = 4096;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
if (VN_PERF(NO_EVENT_FEEDBACK) && VN_PERF(NO_FENCE_FEEDBACK) &&
VN_PERF(NO_SEMAPHORE_FEEDBACK))
return VK_SUCCESS;
return vn_feedback_pool_init(dev, &dev->feedback_pool, pool_size, alloc);
}
static inline void
vn_device_feedback_pool_fini(struct vn_device *dev)
{
if (VN_PERF(NO_EVENT_FEEDBACK) && VN_PERF(NO_FENCE_FEEDBACK) &&
VN_PERF(NO_SEMAPHORE_FEEDBACK))
return;
vn_feedback_pool_fini(&dev->feedback_pool);
}
static void
vn_device_update_shader_cache_id(struct vn_device *dev)
{
/* venus utilizes the host side shader cache.
* This is a WA to generate shader cache files containing headers
* with a unique cache id that will change based on host driver
* identifiers. This allows fossilize replay to detect if the host
* side shader cach is no longer up to date.
* The shader cache is destroyed after creating the necessary files
* and not utilized by venus.
*/
#if !defined(VK_USE_PLATFORM_ANDROID_KHR) && defined(ENABLE_SHADER_CACHE)
const uint8_t *device_uuid =
dev->physical_device->base.vk.properties.pipelineCacheUUID;
char uuid[VK_UUID_SIZE * 2 + 1];
mesa_bytes_to_hex(uuid, device_uuid, VK_UUID_SIZE);
struct disk_cache *cache = disk_cache_create("venus", uuid, 0);
if (!cache)
return;
/* The entry header is what contains the cache id / timestamp so we
* need to create a fake entry.
*/
uint8_t key[BLAKE3_KEY_LEN];
char data[] = "Fake Shader";
disk_cache_compute_key(cache, data, sizeof(data), key);
disk_cache_put(cache, key, data, sizeof(data), NULL);
disk_cache_destroy(cache);
#endif
}
static VkResult
vn_get_timestamp(struct vk_device *device, uint64_t *timestamp)
{
VkDevice dev_handle = vk_device_to_handle(device);
struct vn_device *dev = vn_device_from_handle(dev_handle);
UNUSED uint64_t device_max_deviation;
const VkCalibratedTimestampInfoKHR ts_info = {
.sType = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_KHR,
.timeDomain = VK_TIME_DOMAIN_DEVICE_KHR,
};
return vn_call_vkGetCalibratedTimestampsKHR(dev->primary_ring, dev_handle,
1, &ts_info, timestamp,
&device_max_deviation);
}
static VkResult
vn_device_init(struct vn_device *dev,
struct vn_physical_device *physical_dev,
const VkDeviceCreateInfo *create_info,
const VkAllocationCallbacks *alloc)
{
struct vn_instance *instance = physical_dev->instance;
VkPhysicalDevice physical_dev_handle =
vn_physical_device_to_handle(physical_dev);
VkDevice dev_handle = vn_device_to_handle(dev);
VkDeviceCreateInfo local_create_info;
VkResult result;
dev->base.vk.get_timestamp = vn_get_timestamp;
dev->instance = instance;
dev->physical_device = physical_dev;
dev->device_mask = 1;
dev->renderer = instance->renderer;
dev->primary_ring = instance->ring.ring;
create_info =
vn_device_fix_create_info(dev, create_info, alloc, &local_create_info);
if (!create_info)
return VK_ERROR_OUT_OF_HOST_MEMORY;
const VkDeviceGroupDeviceCreateInfo *group = vk_find_struct_const(
create_info->pNext, DEVICE_GROUP_DEVICE_CREATE_INFO);
if (group && group->physicalDeviceCount)
dev->device_mask = (1 << group->physicalDeviceCount) - 1;
VkDeviceCreateInfo final_create_info = *create_info;
STACK_ARRAY(VkDeviceQueueCreateInfo, queue_infos,
create_info->queueCreateInfoCount);
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) {
const VkDeviceQueueCreateInfo *queue_info =
&create_info->pQueueCreateInfos[i];
if (queue_info->queueFamilyIndex ==
physical_dev->emulate_second_queue &&
queue_info->queueCount == 2) {
typed_memcpy(queue_infos, create_info->pQueueCreateInfos,
create_info->queueCreateInfoCount);
final_create_info.pQueueCreateInfos = queue_infos;
queue_infos[i].queueCount = 1;
break;
}
}
result = vn_call_vkCreateDevice(dev->primary_ring, physical_dev_handle,
&final_create_info, NULL, &dev_handle);
STACK_ARRAY_FINISH(queue_infos);
/* free the fixed extensions here since no longer needed below */
if (create_info == &local_create_info)
vk_free(alloc, (void *)create_info->ppEnabledExtensionNames);
if (result != VK_SUCCESS)
return result;
if (!vn_device_queue_family_init(dev, create_info)) {
result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out_destroy_device;
}
result = vn_device_feedback_pool_init(dev);
if (result != VK_SUCCESS)
goto out_queue_family_fini;
result = vn_feedback_cmd_pools_init(dev);
if (result != VK_SUCCESS)
goto out_feedback_pool_fini;
result = vn_device_init_queues(dev, create_info);
if (result != VK_SUCCESS)
goto out_feedback_cmd_pools_fini;
vn_buffer_reqs_cache_init(dev);
vn_image_reqs_cache_init(dev);
/* This is a WA to allow fossilize replay to detect if the host side shader
* cache is no longer up to date.
*/
vn_device_update_shader_cache_id(dev);
dev->has_sync2 = physical_dev->renderer_version >= VK_API_VERSION_1_3 ||
dev->base.vk.enabled_extensions.KHR_synchronization2;
simple_mtx_init(&dev->mutex, mtx_plain);
list_inithead(&dev->chains);
return VK_SUCCESS;
out_feedback_cmd_pools_fini:
vn_feedback_cmd_pools_fini(dev);
out_feedback_pool_fini:
vn_device_feedback_pool_fini(dev);
out_queue_family_fini:
vn_device_queue_family_fini(dev);
out_destroy_device:
/* surpress -Wc23-extensions */
{
struct vn_ring_submit_command ring_submit;
vn_submit_vkDestroyDevice(dev->primary_ring, 0, dev_handle, NULL,
&ring_submit);
if (ring_submit.ring_seqno_valid)
vn_ring_wait_seqno(dev->primary_ring, ring_submit.ring_seqno);
}
return result;
}
VKAPI_ATTR VkResult VKAPI_CALL
vn_CreateDevice(VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDevice *pDevice)
{
VN_TRACE_FUNC();
struct vn_physical_device *physical_dev =
vn_physical_device_from_handle(physicalDevice);
struct vn_instance *instance = physical_dev->instance;
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &instance->base.vk.alloc;
struct vn_device *dev;
VkResult result;
dev = vk_zalloc(alloc, sizeof(*dev), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!dev)
return vn_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
struct vk_device_dispatch_table dispatch_table;
vk_device_dispatch_table_from_entrypoints(&dispatch_table,
&vn_device_entrypoints, true);
vk_device_dispatch_table_from_entrypoints(&dispatch_table,
&wsi_device_entrypoints, false);
result = vn_device_base_init(&dev->base, &physical_dev->base,
&dispatch_table, pCreateInfo, alloc);
if (result != VK_SUCCESS) {
vk_free(alloc, dev);
return vn_error(instance, result);
}
result = vn_device_init(dev, physical_dev, pCreateInfo, alloc);
if (result != VK_SUCCESS) {
vn_device_base_fini(&dev->base);
vk_free(alloc, dev);
return vn_error(instance, result);
}
if (VN_DEBUG(LOG_CTX_INFO)) {
vn_log(instance, "%s", physical_dev->base.vk.properties.deviceName);
vn_log(instance, "%s", physical_dev->base.vk.properties.driverInfo);
}
vn_tls_set_async_pipeline_create();
*pDevice = vn_device_to_handle(dev);
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL
vn_DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator)
{
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!dev)
return;
assert(list_is_empty(&dev->chains));
simple_mtx_destroy(&dev->mutex);
vn_image_reqs_cache_fini(dev);
vn_buffer_reqs_cache_fini(dev);
for (uint32_t i = 0; i < dev->queue_count; i++)
vn_queue_fini(&dev->queues[i]);
vn_feedback_cmd_pools_fini(dev);
vn_device_feedback_pool_fini(dev);
vn_device_queue_family_fini(dev);
vn_async_vkDestroyDevice(dev->primary_ring, device, NULL);
/* We must emit vkDestroyDevice before releasing bound ring_idx. Otherwise,
* another thread might reuse their ring_idx while they are still bound to
* the queues in the renderer.
*/
for (uint32_t i = 0; i < dev->queue_count; i++) {
if (!dev->queues[i].emulated)
vn_instance_release_ring_idx(dev->instance, dev->queues[i].ring_idx);
}
vk_free(alloc, dev->queues);
vn_device_base_fini(&dev->base);
vk_free(alloc, dev);
}
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
vn_GetDeviceProcAddr(VkDevice device, const char *pName)
{
struct vn_device *dev = vn_device_from_handle(device);
return vk_device_get_proc_addr(&dev->base.vk, pName);
}
VKAPI_ATTR void VKAPI_CALL
vn_GetDeviceGroupPeerMemoryFeatures(
VkDevice device,
uint32_t heapIndex,
uint32_t localDeviceIndex,
uint32_t remoteDeviceIndex,
VkPeerMemoryFeatureFlags *pPeerMemoryFeatures)
{
struct vn_device *dev = vn_device_from_handle(device);
/* TODO get and cache the values in vkCreateDevice */
vn_call_vkGetDeviceGroupPeerMemoryFeatures(
dev->primary_ring, device, heapIndex, localDeviceIndex,
remoteDeviceIndex, pPeerMemoryFeatures);
}
+64
View File
@@ -0,0 +1,64 @@
/*
* Copyright 2019 Google LLC
* SPDX-License-Identifier: MIT
*
* based in part on anv and radv which are:
* Copyright © 2015 Intel Corporation
* Copyright © 2016 Red Hat.
* Copyright © 2016 Bas Nieuwenhuizen
*/
#ifndef VN_DEVICE_H
#define VN_DEVICE_H
#include "vn_common.h"
#include "vn_buffer.h"
#include "vn_device_memory.h"
#include "vn_feedback.h"
#include "vn_image.h"
struct vn_device {
struct vn_device_base base;
struct vn_instance *instance;
struct vn_physical_device *physical_device;
uint32_t device_mask;
struct vn_renderer *renderer;
struct vn_ring *primary_ring;
/* unique queue family indices in which to create the device queues */
uint32_t *queue_families;
uint32_t queue_family_count;
struct vn_feedback_pool feedback_pool;
/* feedback cmd pool per queue family used by the device
* - length matches queue_family_count
* - order matches queue_families
*/
struct vn_feedback_cmd_pool *fb_cmd_pools;
struct vn_queue *queues;
uint32_t queue_count;
struct vn_buffer_reqs_cache buffer_reqs_cache;
struct vn_image_reqs_cache image_reqs_cache;
bool has_sync2;
simple_mtx_t mutex;
struct list_head chains;
};
VK_DEFINE_HANDLE_CASTS(vn_device,
base.vk.base,
VkDevice,
VK_OBJECT_TYPE_DEVICE)
static inline struct vn_device *
vn_device_from_vk(struct vk_device *dev_vk)
{
return container_of(dev_vk, struct vn_device, base.vk);
}
#endif /* VN_DEVICE_H */
Loaded 100 of 12511 files, more files were not shown because too many files have changed in this diff. Show more