[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][xorg-team/lib/mesa][debian-unstable] patches: Further fixes for spam caused by gfxstream.



Title: GitLab

Timo Aaltonen pushed to branch debian-unstable at X Strike Force / lib / mesa

Commits:

  • 61fcc60c
    by Timo Aaltonen at 2025-03-27T10:50:16+02:00
    patches: Further fixes for spam caused by gfxstream.
    

3 changed files:

Changes:

  • debian/changelog
    1
    +mesa (25.0.2-2) UNRELEASED; urgency=medium
    
    2
    +
    
    3
    +  * patches: Further fixes for spam caused by gfxstream.
    
    4
    +
    
    5
    + -- Timo Aaltonen <tjaalton@debian.org>  Thu, 27 Mar 2025 10:49:59 +0200
    
    6
    +
    
    1 7
     mesa (25.0.2-1) unstable; urgency=medium
    
    2 8
     
    
    3 9
       * New upstream release.
    

  • debian/patches/gfxstream-follow-the-semantics-desired-by-distro-VK.diff
    1
    +From 7b68f88da90a6e9d3ee76c5365189bbdc46f9ee0 Mon Sep 17 00:00:00 2001
    
    2
    +From: Gurchetan Singh <gurchetansingh@google.com>
    
    3
    +Date: Fri, 21 Mar 2025 08:07:20 -0700
    
    4
    +Subject: [PATCH] gfxstream: follow the semantics desired by distro VK loader
    
    5
    +
    
    6
    +- vkCreateInstance should return VK_SUCCESS absent a few specific
    
    7
    +  conditions
    
    8
    +- just don't add any physical devices later
    
    9
    +
    
    10
    +Cc: mesa-stable
    
    11
    +
    
    12
    +Reviewed-by: Aaron Ruby <aruby@qnx.com>
    
    13
    +---
    
    14
    + .../guest/vulkan/gfxstream_vk_device.cpp      | 77 +++++++++++--------
    
    15
    + .../guest/vulkan_enc/gfxstream_vk_private.h   |  1 +
    
    16
    + 2 files changed, 45 insertions(+), 33 deletions(-)
    
    17
    +
    
    18
    +diff --git a/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp b/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp
    
    19
    +index ef874b9f43d87..abd078010ea8e 100644
    
    20
    +--- a/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp
    
    21
    ++++ b/src/gfxstream/guest/vulkan/gfxstream_vk_device.cpp
    
    22
    +@@ -77,7 +77,7 @@ static VkResult SetupInstanceForProcess(void) {
    
    23
    +     auto mgr = getConnectionManager();
    
    24
    +     if (!mgr) {
    
    25
    +         mesa_logd("vulkan: Failed to get host connection\n");
    
    26
    +-        return VK_ERROR_DEVICE_LOST;
    
    27
    ++        return VK_ERROR_INITIALIZATION_FAILED;
    
    28
    +     }
    
    29
    + 
    
    30
    +     gfxstream::vk::ResourceTracker::get()->setupCaps(gNoRenderControlEnc);
    
    31
    +@@ -231,6 +231,11 @@ static void gfxstream_vk_destroy_physical_device(struct vk_physical_device* phys
    
    32
    + static VkResult gfxstream_vk_enumerate_devices(struct vk_instance* vk_instance) {
    
    33
    +     VkResult result = VK_SUCCESS;
    
    34
    +     gfxstream_vk_instance* gfxstream_instance = (gfxstream_vk_instance*)vk_instance;
    
    35
    ++
    
    36
    ++    if (gfxstream_instance->init_failed) {
    
    37
    ++        return VK_SUCCESS;
    
    38
    ++    }
    
    39
    ++
    
    40
    +     uint32_t deviceCount = 0;
    
    41
    +     auto vkEnc = gfxstream::vk::ResourceTracker::getThreadLocalEncoder();
    
    42
    +     auto resources = gfxstream::vk::ResourceTracker::get();
    
    43
    +@@ -315,24 +320,48 @@ VkResult gfxstream_vk_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
    
    44
    +     MESA_TRACE_SCOPE("vkCreateInstance");
    
    45
    + 
    
    46
    +     struct gfxstream_vk_instance* instance;
    
    47
    ++    VkResult result = VK_SUCCESS;
    
    48
    + 
    
    49
    +     pAllocator = pAllocator ?: vk_default_allocator();
    
    50
    +-    instance = (struct gfxstream_vk_instance*)vk_zalloc(pAllocator, sizeof(*instance), GFXSTREAM_DEFAULT_ALIGN,
    
    51
    +-                                                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    
    52
    +-    if (NULL == instance) {
    
    53
    ++    instance = (struct gfxstream_vk_instance*)vk_zalloc(
    
    54
    ++        pAllocator, sizeof(*instance), GFXSTREAM_DEFAULT_ALIGN, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    
    55
    ++
    
    56
    ++    if (!instance) {
    
    57
    +         return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
    
    58
    +     }
    
    59
    + 
    
    60
    +-    VkResult result = VK_SUCCESS;
    
    61
    ++    instance->init_failed = (SetupInstanceForProcess() == VK_ERROR_INITIALIZATION_FAILED);
    
    62
    ++    auto extensions = instance->init_failed ? &gfxstream_vk_instance_extensions_supported
    
    63
    ++                                            : get_instance_extensions();
    
    64
    ++    struct vk_instance_dispatch_table dispatch_table;
    
    65
    ++    memset(&dispatch_table, 0, sizeof(struct vk_instance_dispatch_table));
    
    66
    ++    vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &gfxstream_vk_instance_entrypoints,
    
    67
    ++                                                false);
    
    68
    ++#if !DETECT_OS_FUCHSIA
    
    69
    ++    vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &wsi_instance_entrypoints, false);
    
    70
    ++#endif
    
    71
    ++
    
    72
    ++    result = vk_instance_init(&instance->vk, extensions, &dispatch_table, pCreateInfo, pAllocator);
    
    73
    ++
    
    74
    ++    if (result != VK_SUCCESS) {
    
    75
    ++        vk_free(pAllocator, instance);
    
    76
    ++        return vk_error(NULL, result);
    
    77
    ++    }
    
    78
    ++
    
    79
    ++    // Note: Do not support try_create_for_drm. virtio_gpu DRM device opened in
    
    80
    ++    // init_renderer above, which can still enumerate multiple physical devices on the host.
    
    81
    ++    instance->vk.physical_devices.enumerate = gfxstream_vk_enumerate_devices;
    
    82
    ++    instance->vk.physical_devices.destroy = gfxstream_vk_destroy_physical_device;
    
    83
    ++
    
    84
    ++    if (instance->init_failed) {
    
    85
    ++        goto out;
    
    86
    ++    }
    
    87
    ++
    
    88
    +     /* Encoder call */
    
    89
    +     {
    
    90
    +-        result = SetupInstanceForProcess();
    
    91
    +-        if (VK_SUCCESS != result) {
    
    92
    +-            vk_free(pAllocator, instance);
    
    93
    +-            return vk_error(NULL, result);
    
    94
    +-        }
    
    95
    +         uint32_t initialEnabledExtensionCount = pCreateInfo->enabledExtensionCount;
    
    96
    +         const char* const* initialPpEnabledExtensionNames = pCreateInfo->ppEnabledExtensionNames;
    
    97
    ++
    
    98
    +         std::vector<const char*> filteredExts = filteredInstanceExtensionNames(
    
    99
    +             pCreateInfo->enabledExtensionCount, pCreateInfo->ppEnabledExtensionNames);
    
    100
    +         // Temporarily modify createInfo for the encoder call
    
    101
    +@@ -352,27 +381,7 @@ VkResult gfxstream_vk_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
    
    102
    +         mutableCreateInfo->ppEnabledExtensionNames = initialPpEnabledExtensionNames;
    
    103
    +     }
    
    104
    + 
    
    105
    +-    struct vk_instance_dispatch_table dispatch_table;
    
    106
    +-    memset(&dispatch_table, 0, sizeof(struct vk_instance_dispatch_table));
    
    107
    +-    vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &gfxstream_vk_instance_entrypoints,
    
    108
    +-                                                false);
    
    109
    +-#if !DETECT_OS_FUCHSIA
    
    110
    +-    vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &wsi_instance_entrypoints, false);
    
    111
    +-#endif
    
    112
    +-
    
    113
    +-    result = vk_instance_init(&instance->vk, get_instance_extensions(), &dispatch_table,
    
    114
    +-                              pCreateInfo, pAllocator);
    
    115
    +-
    
    116
    +-    if (result != VK_SUCCESS) {
    
    117
    +-        vk_free(pAllocator, instance);
    
    118
    +-        return vk_error(NULL, result);
    
    119
    +-    }
    
    120
    +-
    
    121
    +-    // Note: Do not support try_create_for_drm. virtio_gpu DRM device opened in
    
    122
    +-    // init_renderer above, which can still enumerate multiple physical devices on the host.
    
    123
    +-    instance->vk.physical_devices.enumerate = gfxstream_vk_enumerate_devices;
    
    124
    +-    instance->vk.physical_devices.destroy = gfxstream_vk_destroy_physical_device;
    
    125
    +-
    
    126
    ++out:
    
    127
    +     *pInstance = gfxstream_vk_instance_to_handle(instance);
    
    128
    +     return VK_SUCCESS;
    
    129
    + }
    
    130
    +@@ -383,8 +392,10 @@ void gfxstream_vk_DestroyInstance(VkInstance _instance, const VkAllocationCallba
    
    131
    + 
    
    132
    +     VK_FROM_HANDLE(gfxstream_vk_instance, instance, _instance);
    
    133
    + 
    
    134
    +-    auto vkEnc = gfxstream::vk::ResourceTracker::getThreadLocalEncoder();
    
    135
    +-    vkEnc->vkDestroyInstance(instance->internal_object, pAllocator, true /* do lock */);
    
    136
    ++    if (!instance->init_failed) {
    
    137
    ++        auto vkEnc = gfxstream::vk::ResourceTracker::getThreadLocalEncoder();
    
    138
    ++        vkEnc->vkDestroyInstance(instance->internal_object, pAllocator, true /* do lock */);
    
    139
    ++    }
    
    140
    + 
    
    141
    +     vk_instance_finish(&instance->vk);
    
    142
    +     vk_free(&instance->vk.alloc, instance);
    
    143
    +diff --git a/src/gfxstream/guest/vulkan_enc/gfxstream_vk_private.h b/src/gfxstream/guest/vulkan_enc/gfxstream_vk_private.h
    
    144
    +index 164c227d6fbcd..b9dc22cc036d0 100644
    
    145
    +--- a/src/gfxstream/guest/vulkan_enc/gfxstream_vk_private.h
    
    146
    ++++ b/src/gfxstream/guest/vulkan_enc/gfxstream_vk_private.h
    
    147
    +@@ -62,6 +62,7 @@
    
    148
    + struct gfxstream_vk_instance {
    
    149
    +     struct vk_instance vk;
    
    150
    +     uint32_t api_version;
    
    151
    ++    bool init_failed;
    
    152
    +     VkInstance internal_object;
    
    153
    + };
    
    154
    + 
    
    155
    +-- 
    
    156
    +GitLab
    
    157
    +

  • debian/patches/series
    ... ... @@ -5,3 +5,4 @@ gfxstream-make-virtgpu-discovery-more-robust.diff
    5 5
     gfxstream-add-common-interfaces.diff
    
    6 6
     gfxstream-check-device-before-using.diff
    
    7 7
     gfxstream-refactor-device-init.diff
    
    8
    +gfxstream-follow-the-semantics-desired-by-distro-VK.diff


  • Reply to: