haasn / libplacebo

Official mirror of libplacebo
http://libplacebo.org/
GNU Lesser General Public License v2.1
547 stars 69 forks source link

plplay crashed with the newest commit #182

Closed CarterLi closed 1 year ago

CarterLi commented 1 year ago

lldb and stack trace

$ lldb build/demos/plplay                                                                                          SEGV
(lldb) target create "build/demos/plplay"
Current executable set to '/Users/carter/libplacebo/build/demos/plplay' (arm64).
(lldb) run /Users/carter/Downloads/240-1000nits.mp4
Process 46381 launched: '/Users/carter/libplacebo/build/demos/plplay' (arm64)
Opening file: '/Users/carter/Downloads/240-1000nits.mp4'
Format: mov,mp4,m4a,3gp,3g2,mj2
Found video track (stream 0)
Resolution: 3840 x 2160
FPS: 23.976024
TBR: 23.976024
TBN: 0.000042
Bitrate: 903 kbps
Format: yuv420p10le
Initialized libplacebo v6.292.0-19-g1d709233 (API v293)
Attempting to initialize API: GLFW (vulkan)
Creating 3840x2160 window...
2023-07-27 14:34:38.344449+0800 plplay[46381:336106] [Window] Warning: Window GLFWWindow 0x10493a310 ordered front from a non-active application and may order beneath the active application's windows.
2023-07-27 14:34:38.347128+0800 plplay[46381:336106] [Window] Warning: Window GLFWWindow 0x10493a310 ordered front from a non-active application and may order beneath the active application's windows.
API debugging requested but no debug meta layers present... ignoring
Creating vulkan instance with extensions:
    VK_KHR_get_physical_device_properties2
    VK_KHR_surface
    VK_EXT_swapchain_colorspace
    VK_KHR_external_memory_capabilities
    VK_KHR_external_semaphore_capabilities
    VK_KHR_get_surface_capabilities2
    VK_KHR_portability_enumeration
    VK_KHR_surface
    VK_EXT_metal_surface
[mvk-info] MoltenVK version 1.2.4, supporting Vulkan version 1.2.250.
    The following 90 Vulkan extensions are supported:
        VK_KHR_16bit_storage v1
        VK_KHR_8bit_storage v1
        VK_KHR_bind_memory2 v1
        VK_KHR_buffer_device_address v1
        VK_KHR_copy_commands2 v1
        VK_KHR_create_renderpass2 v1
        VK_KHR_dedicated_allocation v3
        VK_KHR_depth_stencil_resolve v1
        VK_KHR_descriptor_update_template v1
        VK_KHR_device_group v4
        VK_KHR_device_group_creation v1
        VK_KHR_driver_properties v1
        VK_KHR_dynamic_rendering v1
        VK_KHR_external_fence v1
        VK_KHR_external_fence_capabilities v1
        VK_KHR_external_memory v1
        VK_KHR_external_memory_capabilities v1
        VK_KHR_external_semaphore v1
        VK_KHR_external_semaphore_capabilities v1
        VK_KHR_fragment_shader_barycentric v1
        VK_KHR_get_memory_requirements2 v1
        VK_KHR_get_physical_device_properties2 v2
        VK_KHR_get_surface_capabilities2 v1
        VK_KHR_imageless_framebuffer v1
        VK_KHR_image_format_list v1
        VK_KHR_maintenance1 v2
        VK_KHR_maintenance2 v1
        VK_KHR_maintenance3 v1
        VK_KHR_map_memory2 v1
        VK_KHR_multiview v1
        VK_KHR_portability_subset v1
        VK_KHR_push_descriptor v2
        VK_KHR_relaxed_block_layout v1
        VK_KHR_sampler_mirror_clamp_to_edge v3
        VK_KHR_sampler_ycbcr_conversion v14
        VK_KHR_separate_depth_stencil_layouts v1
        VK_KHR_shader_draw_parameters v1
        VK_KHR_shader_float_controls v4
        VK_KHR_shader_float16_int8 v1
        VK_KHR_shader_subgroup_extended_types v1
        VK_KHR_spirv_1_4 v1
        VK_KHR_storage_buffer_storage_class v1
        VK_KHR_surface v25
        VK_KHR_swapchain v70
        VK_KHR_swapchain_mutable_format v1
        VK_KHR_timeline_semaphore v2
        VK_KHR_uniform_buffer_standard_layout v1
        VK_KHR_variable_pointers v1
        VK_EXT_buffer_device_address v2
        VK_EXT_debug_marker v4
        VK_EXT_debug_report v10
        VK_EXT_debug_utils v2
        VK_EXT_descriptor_indexing v2
        VK_EXT_external_memory_host v1
        VK_EXT_fragment_shader_interlock v1
        VK_EXT_hdr_metadata v2
        VK_EXT_host_query_reset v1
        VK_EXT_image_robustness v1
        VK_EXT_inline_uniform_block v1
        VK_EXT_memory_budget v1
        VK_EXT_metal_objects v1
        VK_EXT_metal_surface v1
        VK_EXT_pipeline_creation_cache_control v3
        VK_EXT_post_depth_coverage v1
        VK_EXT_private_data v1
        VK_EXT_robustness2 v1
        VK_EXT_sample_locations v1
        VK_EXT_scalar_block_layout v1
        VK_EXT_separate_stencil_usage v1
        VK_EXT_shader_atomic_float v1
        VK_EXT_shader_stencil_export v1
        VK_EXT_shader_viewport_index_layer v1
        VK_EXT_subgroup_size_control v2
        VK_EXT_surface_maintenance1 v1
        VK_EXT_swapchain_colorspace v4
        VK_EXT_swapchain_maintenance1 v1
        VK_EXT_texel_buffer_alignment v1
        VK_EXT_texture_compression_astc_hdr v1
        VK_EXT_vertex_attribute_divisor v3
        VK_AMD_gpu_shader_half_float v2
        VK_AMD_negative_viewport_height v1
        VK_AMD_shader_image_load_store_lod v1
        VK_AMD_shader_trinary_minmax v1
        VK_IMG_format_pvrtc v1
        VK_INTEL_shader_integer_functions2 v1
        VK_GOOGLE_display_timing v1
        VK_MVK_macos_surface v3
        VK_MVK_moltenvk v37
        VK_NV_fragment_shader_barycentric v1
        VK_NV_glsl_shader v1
[mvk-info] GPU device:
        model: Apple M1 Pro
        type: Integrated
        vendorID: 0x106b
        deviceID: 0xd0403ef
        pipelineCacheUUID: 000027DC-0D04-03EF-0000-000000000000
    supports the following Metal Versions, GPU's and Feature Sets:
        Metal Shading Language 3.0
        GPU Family Apple 7
        GPU Family Apple 6
        GPU Family Apple 5
        GPU Family Apple 4
        GPU Family Apple 3
        GPU Family Apple 2
        GPU Family Apple 1
        GPU Family Mac 2
        GPU Family Mac 1
        GPU Family Common 3
        GPU Family Common 2
        GPU Family Common 1
        macOS GPU Family 2 v1
        macOS GPU Family 1 v4
        macOS GPU Family 1 v3
        macOS GPU Family 1 v2
        macOS GPU Family 1 v1
[mvk-info] Created VkInstance for Vulkan version 1.2.250, as requested by app, with the following 7 Vulkan extensions enabled:
        VK_KHR_external_memory_capabilities v1
        VK_KHR_external_semaphore_capabilities v1
        VK_KHR_get_physical_device_properties2 v2
        VK_KHR_get_surface_capabilities2 v1
        VK_KHR_surface v25
        VK_EXT_metal_surface v1
        VK_EXT_swapchain_colorspace v4
Probing for vulkan devices:
    GPU 0: Apple M1 Pro v1.2.250 (integrated)
           uuid: 00:00:10:6B:0D:04:03:EF:00:00:00:00:00:00:00:00
Vulkan device properties:
    Device Name: Apple M1 Pro
    Device ID: 106b:d0403ef
    Device UUID: 00:00:10:6B:0D:04:03:EF:00:00:00:00:00:00:00:00
    Driver version: 27dc
    API version: 1.2.250
Creating vulkan device with extensions:
    VK_KHR_swapchain
    VK_KHR_swapchain
    VK_KHR_push_descriptor
    VK_EXT_external_memory_host
    VK_EXT_hdr_metadata
    VK_KHR_portability_subset
    VK_EXT_metal_objects
[mvk-info] Vulkan semaphores using MTLEvent.
[mvk-info] Created VkDevice to run on GPU Apple M1 Pro with the following 6 Vulkan extensions enabled:
        VK_KHR_portability_subset v1
        VK_KHR_push_descriptor v2
        VK_KHR_swapchain v70
        VK_EXT_external_memory_host v1
        VK_EXT_hdr_metadata v2
        VK_EXT_metal_objects v1
Memory heaps supported by device:
    0: flags 0x1 size   16G
Memory summary:     0 used     0 res     0 alloc, efficiency 100.00%, utilization 100.00%, max page: 1024M
shaderc SPIR-V version 1.6 rev 1
Initialized SPIR-V compiler 'shaderc'
GPU information:
    GLSL version: 450 (vulkan)
      max_shmem_size:            32768
      max_group_threads:         1024
      max_group_size[0]:         1024
      max_group_size[1]:         1024
      max_group_size[2]:         1024
      subgroup_size:             32
      min_gather_offset:         -8
      max_gather_offset:         7
    Limits:
      thread_safe:               1
      callbacks:                 1
      max_buf_size:              17179869184
      max_ubo_size:              4294967295
      max_ssbo_size:             4294967295
      max_vbo_size:              17179869184
      max_mapped_size:           17179869184
      max_buffer_texels:         67108864
      align_host_ptr:            16384
      host_cached:               1
      max_tex_1d_dim:            16384
      max_tex_2d_dim:            16384
      max_tex_3d_dim:            2048
      blittable_1d_3d:           1
      buf_transfer:              1
      align_tex_xfer_pitch:      1
      align_tex_xfer_offset:     16
      max_variable_comps:        0
      max_constants:             18446744073709551615
      max_pushc_size:            4096
      align_vertex_stride:       4
      max_dispatch[0]:           1073741824
      max_dispatch[1]:           1073741824
      max_dispatch[2]:           1073741824
      fragment_queues:           1
      compute_queues:            1
    External API interop:
      UUID: 00:00:10:6B:0D:04:03:EF:00:00:00:00:00:00:00:00
      PCI: 0000:00:00:0
      buf export caps: 0x0
      buf import caps: 0x10
      tex export caps: 0x0
      tex import caps: 0x70
      sync export caps: 0x0
      sync import caps: 0x0
Available surface configurations:
    0: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
    1: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
    2: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
    3: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
    4: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
    5: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT
    6: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT
    7: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT
    8: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT
    9: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT
    10: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT
    11: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT
    12: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT
    13: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT
    14: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT
    15: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_BT709_NONLINEAR_EXT
    16: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_BT709_NONLINEAR_EXT
    17: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_BT709_NONLINEAR_EXT
    18: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_BT709_NONLINEAR_EXT
    19: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_BT709_NONLINEAR_EXT
    20: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT
    21: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT
    22: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT
    23: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT
    24: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT
    25: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_PASS_THROUGH_EXT
    26: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_PASS_THROUGH_EXT
    27: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_PASS_THROUGH_EXT
    28: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_PASS_THROUGH_EXT
    29: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_PASS_THROUGH_EXT
    30: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT
    31: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT
    32: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT
    33: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT
    34: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT
    35: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT
    36: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT
    37: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT
    38: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT
    39: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT
    40: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT
    41: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT
    42: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT
    43: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT
    44: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT
    45: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_BT2020_LINEAR_EXT
    46: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_BT2020_LINEAR_EXT
    47: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_BT2020_LINEAR_EXT
    48: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_BT2020_LINEAR_EXT
    49: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_BT2020_LINEAR_EXT
    50: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_HDR10_HLG_EXT
    51: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_HDR10_HLG_EXT
    52: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_HDR10_HLG_EXT
    53: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_HDR10_HLG_EXT
    54: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_HDR10_HLG_EXT
    55: VK_FORMAT_B8G8R8A8_UNORM                 VK_COLOR_SPACE_HDR10_ST2084_EXT
    56: VK_FORMAT_B8G8R8A8_SRGB                  VK_COLOR_SPACE_HDR10_ST2084_EXT
    57: VK_FORMAT_R16G16B16A16_SFLOAT            VK_COLOR_SPACE_HDR10_ST2084_EXT
    58: VK_FORMAT_A2B10G10R10_UNORM_PACK32       VK_COLOR_SPACE_HDR10_ST2084_EXT
    59: VK_FORMAT_A2R10G10B10_UNORM_PACK32       VK_COLOR_SPACE_HDR10_ST2084_EXT
Picked surface configuration 28: VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_PASS_THROUGH_EXT
Picked surface configuration 8: VK_FORMAT_A2B10G10R10_UNORM_PACK32 + VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT
[mvk-info] Created 3 swapchain images with initial size (3456, 2102) and contents scale 2.0 for screen Built-in Retina Display.
Codec: hevc (HEVC (High Efficiency Video Coding))
Using software decoding
Spent 61.138 ms translating SPIR-V
Process 46381 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (plplay) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000000000000
    frame #1: 0x0000000100383950 libplacebo.293.dylib`timer_begin(gpu=0x000000010680f4b0, cmd=0x0000600002c042a0, timer=0x00006000017372e0) at gpu.c:136:5
    frame #2: 0x0000000100383774 libplacebo.293.dylib`_begin_cmd(gpu=0x000000010680f4b0, type=GRAPHICS, label="vk_pass_run", timer=0x00006000017372e0) at gpu.c:180:5
    frame #3: 0x000000010038fea4 libplacebo.293.dylib`vk_pass_run(gpu=0x000000010680f4b0, params=0x000000016fd551b8) at gpu_pass.c:863:26
    frame #4: 0x000000010034af48 libplacebo.293.dylib`pl_pass_run(gpu=0x000000010680f4b0, params=0x000000016fd553c0) at gpu.c:1230:5
    frame #5: 0x0000000100350ee0 libplacebo.293.dylib`pl_pass_run_vbo(gpu=0x000000010680f4b0, params=0x000000016fd55898) at utils.c:1124:5
    frame #6: 0x000000010038fce8 libplacebo.293.dylib`vk_pass_run(gpu=0x000000010680f4b0, params=0x000000016fd55898) at gpu_pass.c:841:16
    frame #7: 0x000000010034af48 libplacebo.293.dylib`pl_pass_run(gpu=0x000000010680f4b0, params=0x000000010588c098) at gpu.c:1230:5
    frame #8: 0x0000000100333124 libplacebo.293.dylib`run_pass(dp=0x0000600003d0c200, sh=0x0000000104a2b770, pass=0x000000010588c020) at dispatch.c:1142:5
    frame #9: 0x00000001003310a0 libplacebo.293.dylib`pl_dispatch_finish(dp=0x0000600003d0c200, params=0x000000016fd564b8) at dispatch.c:1348:5
    frame #10: 0x00000001002e20ac libplacebo.293.dylib`_img_tex(pass=0x000000016fd57d08, img=0x000000016fd56fb8, tag="src/renderer.c:1607") at renderer.c:526:15
    frame #11: 0x00000001002d53ac libplacebo.293.dylib`pass_read_image(pass=0x000000016fd57d08) at renderer.c:1607:14
    frame #12: 0x00000001002da5b0 libplacebo.293.dylib`pl_render_image_mix(rr=0x0000000104fb1330, images=0x000000016fd5aa80, ptarget=0x000000016fd5a678, params=0x000000010005c1a8) at renderer.c:3405:24
    frame #13: 0x000000010000976c plplay`render_frame(p=0x000000010005c138, frame=0x000000016fd5a9b0, mix=0x000000016fd5aa80) at plplay.c:484:10
    frame #14: 0x0000000100004868 plplay`render_loop(p=0x000000010005c138) at plplay.c:519:10
    frame #15: 0x00000001000037e8 plplay`main(argc=2, argv=0x000000016fdfef98) at plplay.c:784:10
    frame #16: 0x00000001987eff28 dyld`start + 2236
CarterLi commented 1 year ago

https://github.com/haasn/libplacebo/blob/1d7092334dead779c42f15fd66b01e3086d472f6/src/vulkan/gpu.c#L136

vk->CmdWriteTimestamp2KHR is NULL

I can confirm that plplay works fine with opengl