tu: C++-proofing: misc fixes
authorDanylo Piliaiev <dpiliaiev@igalia.com>
Mon, 13 Mar 2023 13:19:43 +0000 (14:19 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 24 Mar 2023 15:49:25 +0000 (15:49 +0000)
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21931>

src/freedreno/vulkan/tu_autotune.c
src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_device.h
src/freedreno/vulkan/tu_perfetto.cc
src/freedreno/vulkan/tu_pipeline.c

index 378bbb0..97c4c82 100644 (file)
@@ -364,7 +364,7 @@ tu_autotune_on_submit(struct tu_device *dev,
          continue;
 
       if (TU_AUTOTUNE_DEBUG_LOG)
-         mesa_logi("Removed old history entry %016"PRIx64"", history->key);
+         mesa_logi("Removed old history entry %016" PRIx64 "", history->key);
 
       u_rwlock_wrlock(&at->ht_lock);
       _mesa_hash_table_remove_key(at->ht, &history->key);
@@ -423,7 +423,7 @@ tu_autotune_fini(struct tu_autotune *at, struct tu_device *dev)
          struct tu_renderpass_history *history =
             (struct tu_renderpass_history *) entry->data;
 
-         mesa_logi("%016"PRIx64" \tavg_passed=%u results=%u",
+         mesa_logi("%016" PRIx64 " \tavg_passed=%u results=%u",
                    history->key, history->avg_samples, history->num_results);
       }
    }
index f93a893..4ffec4f 100644 (file)
@@ -1864,10 +1864,10 @@ tu_BeginCommandBuffer(VkCommandBuffer commandBuffer,
                (VkCommandBufferInheritanceConditionalRenderingInfoEXT *) ext;
             cmd_buffer->state.predication_active = cond_rend->conditionalRenderingEnable;
             break;
+         }
          default:
             break;
          }
-         }
       }
 
       if (pass_continue) {
@@ -2371,7 +2371,7 @@ tu_push_descriptor_set_update_layout(struct tu_device *device,
    if (set->host_size < layout->size) {
       void *new_buf =
          vk_realloc(&device->vk.alloc, set->mapped_ptr, layout->size, 8,
-                    VK_QUERY_SCOPE_COMMAND_BUFFER_KHR);
+                    VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
       if (!new_buf)
          return VK_ERROR_OUT_OF_HOST_MEMORY;
       set->mapped_ptr = (uint32_t *) new_buf;
index bf62728..1e3d40c 100644 (file)
@@ -2273,7 +2273,7 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
    }
 
    device->mem_cache = vk_pipeline_cache_create(&device->vk, &pcc_info,
-                                                false);
+                                                NULL);
    if (!device->mem_cache) {
       result = VK_ERROR_OUT_OF_HOST_MEMORY;
       vk_startup_errorf(device->instance, result, "create pipeline cache failed");
index 96224a0..1cdf120 100644 (file)
@@ -203,6 +203,11 @@ struct tu6_global
 #define global_iova_arr(cmd, member, idx)                                    \
    (global_iova(cmd, member) + sizeof_field(struct tu6_global, member[0]) * (idx))
 
+struct tu_pvtmem_bo {
+      mtx_t mtx;
+      struct tu_bo *bo;
+      uint32_t per_fiber_size, per_sp_size;
+};
 
 #ifdef ANDROID
 enum tu_gralloc_type
@@ -240,11 +245,7 @@ struct tu_device
       bool initialized;
    } scratch_bos[48 - MIN_SCRATCH_BO_SIZE_LOG2];
 
-   struct tu_pvtmem_bo {
-      mtx_t mtx;
-      struct tu_bo *bo;
-      uint32_t per_fiber_size, per_sp_size;
-   } fiber_pvtmem_bo, wave_pvtmem_bo;
+   struct tu_pvtmem_bo fiber_pvtmem_bo, wave_pvtmem_bo;
 
    struct tu_bo *global_bo;
    struct tu6_global *global_bo_map;
index 5e33537..c0772f2 100644 (file)
 #include "tu_tracepoints_perfetto.h"
 
 /* we can't include tu_knl.h and tu_device.h */
+
+#ifdef __cplusplus
 extern "C" {
+#endif
+
 int
 tu_device_get_gpu_timestamp(struct tu_device *dev,
                             uint64_t *ts);
@@ -26,7 +30,10 @@ tu_device_ticks_to_ns(struct tu_device *dev, uint64_t ts);
 
 struct u_trace_context *
 tu_device_get_u_trace(struct tu_device *device);
+
+#ifdef __cplusplus
 }
+#endif
 
 /**
  * Queue-id's
index 5747aa0..e8d7dc6 100644 (file)
@@ -2900,7 +2900,7 @@ tu_shaders_init(struct tu_device *dev, const void *key_data, size_t key_size)
 {
    VK_MULTIALLOC(ma);
    VK_MULTIALLOC_DECL(&ma, struct tu_compiled_shaders, shaders, 1);
-   VK_MULTIALLOC_DECL_SIZE(&ma, void, obj_key_data, key_size);
+   VK_MULTIALLOC_DECL_SIZE(&ma, char, obj_key_data, key_size);
 
    if (!vk_multialloc_zalloc(&ma, &dev->vk.alloc,
                              VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
@@ -3026,7 +3026,7 @@ tu_nir_shaders_init(struct tu_device *dev, const void *key_data, size_t key_size
 {
    VK_MULTIALLOC(ma);
    VK_MULTIALLOC_DECL(&ma, struct tu_nir_shaders, shaders, 1);
-   VK_MULTIALLOC_DECL_SIZE(&ma, void, obj_key_data, key_size);
+   VK_MULTIALLOC_DECL_SIZE(&ma, char, obj_key_data, key_size);
 
    if (!vk_multialloc_zalloc(&ma, &dev->vk.alloc,
                              VK_SYSTEM_ALLOCATION_SCOPE_DEVICE))
@@ -4521,7 +4521,7 @@ tu_pipeline_builder_parse_multisample_and_color_blend(
    pipeline->output.feedback_loop_may_involve_textures =
       builder->feedback_loop_may_involve_textures;
 
-   static const VkPipelineColorBlendStateCreateInfo dummy_blend_info;
+   static const VkPipelineColorBlendStateCreateInfo dummy_blend_info = {};
    const VkPipelineMultisampleStateCreateInfo *msaa_info =
       builder->create_info->pMultisampleState;
    pipeline->output.samples = msaa_info->rasterizationSamples;