tu: C++-proofing: fix casting from void * fpermissive warnings

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21931>
This commit is contained in:
Danylo Piliaiev
2023-03-14 19:03:03 +01:00
committed by Marge Bot
parent c618e2a2d4
commit 40b7e5c48a
18 changed files with 233 additions and 170 deletions
+3 -3
View File
@@ -64,7 +64,7 @@ tu_hal_open(const struct hw_module_t *mod,
assert(mod == &HAL_MODULE_INFO_SYM.common);
assert(strcmp(id, HWVULKAN_DEVICE_0) == 0);
hwvulkan_device_t *hal_dev = malloc(sizeof(*hal_dev));
hwvulkan_device_t *hal_dev = (hwvulkan_device_t *) malloc(sizeof(*hal_dev));
if (!hal_dev)
return -1;
@@ -174,7 +174,7 @@ tu_gralloc_info_cros(struct tu_device *device,
uint64_t *modifier)
{
const gralloc_module_t *gralloc = device->gralloc;
const gralloc_module_t *gralloc = (const gralloc_module_t *) device->gralloc;
struct cros_gralloc0_buffer_info info;
int ret;
@@ -211,7 +211,7 @@ tu_gralloc_info(struct tu_device *device,
"Could not open gralloc\n");
}
const gralloc_module_t *gralloc = device->gralloc;
const gralloc_module_t *gralloc = (const gralloc_module_t *) device->gralloc;
mesa_logi("opened gralloc module name: %s", gralloc->common.name);
+19 -9
View File
@@ -106,7 +106,8 @@ create_submission_data(struct tu_device *dev, struct tu_autotune *at,
struct tu_submission_data, node);
list_del(&submission_data->node);
} else {
submission_data = calloc(1, sizeof(struct tu_submission_data));
submission_data = (struct tu_submission_data *) calloc(
1, sizeof(struct tu_submission_data));
tu_cs_init(&submission_data->fence_cs, dev, TU_CS_MODE_GROW, 5, "autotune fence cs");
}
submission_data->fence = fence;
@@ -193,7 +194,8 @@ get_history(struct tu_autotune *at, uint64_t rp_key, uint32_t *avg_samples)
struct hash_entry *entry =
_mesa_hash_table_search(at->ht, &rp_key);
if (entry) {
struct tu_renderpass_history *history = entry->data;
struct tu_renderpass_history *history =
(struct tu_renderpass_history *) entry->data;
if (history->num_results > 0) {
*avg_samples = p_atomic_read(&history->avg_samples);
has_history = true;
@@ -207,7 +209,8 @@ get_history(struct tu_autotune *at, uint64_t rp_key, uint32_t *avg_samples)
static struct tu_renderpass_result *
create_history_result(struct tu_autotune *at, uint64_t rp_key)
{
struct tu_renderpass_result *result = calloc(1, sizeof(*result));
struct tu_renderpass_result *result =
(struct tu_renderpass_result *) calloc(1, sizeof(*result));
result->rp_key = rp_key;
return result;
@@ -285,7 +288,8 @@ queue_pending_results(struct tu_autotune *at, struct tu_cmd_buffer *cmdbuf)
list_for_each_entry_safe(struct tu_renderpass_result, result,
&cmdbuf->renderpass_autotune_results, node) {
/* TODO: copying each result isn't nice */
struct tu_renderpass_result *copy = malloc(sizeof(*result));
struct tu_renderpass_result *copy =
(struct tu_renderpass_result *) malloc(sizeof(*result));
*copy = *result;
tu_bo_get_ref(copy->bo.bo);
list_addtail(&copy->node, &at->pending_results);
@@ -317,7 +321,8 @@ tu_autotune_on_submit(struct tu_device *dev,
struct hash_entry *entry =
_mesa_hash_table_search(at->ht, &result->rp_key);
if (!entry) {
history = calloc(1, sizeof(*history));
history =
(struct tu_renderpass_history *) calloc(1, sizeof(*history));
history->key = result->rp_key;
list_inithead(&history->results);
@@ -354,7 +359,8 @@ tu_autotune_on_submit(struct tu_device *dev,
* command buffers, otherwise this table may grow big.
*/
hash_table_foreach(at->ht, entry) {
struct tu_renderpass_history *history = entry->data;
struct tu_renderpass_history *history =
(struct tu_renderpass_history *) entry->data;
if (fence_before(gpu_fence, history->last_fence + MAX_HISTORY_LIFETIME))
continue;
@@ -415,7 +421,8 @@ tu_autotune_fini(struct tu_autotune *at, struct tu_device *dev)
}
hash_table_foreach(at->ht, entry) {
struct tu_renderpass_history *history = entry->data;
struct tu_renderpass_history *history =
(struct tu_renderpass_history *) entry->data;
mesa_logi("%016"PRIx64" \tavg_passed=%u results=%u",
history->key, history->avg_samples, history->num_results);
@@ -426,7 +433,8 @@ tu_autotune_fini(struct tu_autotune *at, struct tu_device *dev)
mtx_lock(&dev->autotune_mutex);
hash_table_foreach(at->ht, entry) {
struct tu_renderpass_history *history = entry->data;
struct tu_renderpass_history *history =
(struct tu_renderpass_history *) entry->data;
free_history(dev, history);
}
mtx_unlock(&dev->autotune_mutex);
@@ -625,7 +633,9 @@ tu_autotune_begin_renderpass(struct tu_cmd_buffer *cmd,
uint64_t result_iova = autotune_result->bo.iova;
autotune_result->samples = tu_suballoc_bo_map(&autotune_result->bo);
autotune_result->samples =
(struct tu_renderpass_samples *) tu_suballoc_bo_map(
&autotune_result->bo);
tu_cs_emit_regs(cs, A6XX_RB_SAMPLE_COUNT_CONTROL(.copy = true));
+11 -8
View File
@@ -1675,14 +1675,16 @@ tu_create_cmd_buffer(struct vk_command_pool *pool,
container_of(pool->base.device, struct tu_device, vk);
struct tu_cmd_buffer *cmd_buffer;
cmd_buffer = vk_zalloc2(&device->vk.alloc, NULL, sizeof(*cmd_buffer), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
cmd_buffer = (struct tu_cmd_buffer *) vk_zalloc2(
&device->vk.alloc, NULL, sizeof(*cmd_buffer), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (cmd_buffer == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
VkResult result = vk_command_buffer_init(pool, &cmd_buffer->vk,
&tu_cmd_buffer_ops, 0);
VkResult result =
vk_command_buffer_init(pool, &cmd_buffer->vk, &tu_cmd_buffer_ops,
VK_COMMAND_BUFFER_LEVEL_PRIMARY);
if (result != VK_SUCCESS) {
vk_free2(&device->vk.alloc, NULL, cmd_buffer);
return result;
@@ -1857,7 +1859,8 @@ tu_BeginCommandBuffer(VkCommandBuffer commandBuffer,
vk_foreach_struct_const(ext, pBeginInfo->pInheritanceInfo) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT: {
const VkCommandBufferInheritanceConditionalRenderingInfoEXT *cond_rend = (void *) ext;
const VkCommandBufferInheritanceConditionalRenderingInfoEXT *cond_rend =
(VkCommandBufferInheritanceConditionalRenderingInfoEXT *) ext;
cmd_buffer->state.predication_active = cond_rend->conditionalRenderingEnable;
break;
default:
@@ -2370,7 +2373,7 @@ tu_push_descriptor_set_update_layout(struct tu_device *device,
VK_QUERY_SCOPE_COMMAND_BUFFER_KHR);
if (!new_buf)
return VK_ERROR_OUT_OF_HOST_MEMORY;
set->mapped_ptr = new_buf;
set->mapped_ptr = (uint32_t *) new_buf;
set->host_size = layout->size;
}
return VK_SUCCESS;
@@ -2616,7 +2619,7 @@ tu_CmdPushConstants(VkCommandBuffer commandBuffer,
const void *pValues)
{
TU_FROM_HANDLE(tu_cmd_buffer, cmd, commandBuffer);
memcpy((void*) cmd->push_constants + offset, pValues, size);
memcpy((char *) cmd->push_constants + offset, pValues, size);
cmd->state.dirty |= TU_CMD_DIRTY_SHADER_CONSTS;
}
@@ -4325,7 +4328,7 @@ tu_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
cmd->state.framebuffer = fb;
cmd->state.render_area = pRenderPassBegin->renderArea;
cmd->state.attachments =
cmd->state.attachments = (const struct tu_image_view **)
vk_alloc(&cmd->vk.pool->alloc, pass->attachment_count *
sizeof(cmd->state.attachments[0]), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+4 -4
View File
@@ -49,7 +49,7 @@ void
tu_cs_init_suballoc(struct tu_cs *cs, struct tu_device *device,
struct tu_suballoc_bo *suballoc_bo)
{
uint32_t *start = tu_suballoc_bo_map(suballoc_bo);
uint32_t *start = (uint32_t *) tu_suballoc_bo_map(suballoc_bo);
uint32_t *end = start + (suballoc_bo->size >> 2);
memset(cs, 0, sizeof(*cs));
@@ -116,7 +116,7 @@ tu_cs_add_bo(struct tu_cs *cs, uint32_t size)
/* grow cs->bos if needed */
if (cs->bo_count == cs->bo_capacity) {
uint32_t new_capacity = MAX2(4, 2 * cs->bo_capacity);
struct tu_bo **new_bos =
struct tu_bo **new_bos = (struct tu_bo **)
realloc(cs->bos, new_capacity * sizeof(struct tu_bo *));
if (!new_bos)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -162,7 +162,7 @@ tu_cs_reserve_entry(struct tu_cs *cs)
/* grow cs->entries if needed */
if (cs->entry_count == cs->entry_capacity) {
uint32_t new_capacity = MAX2(4, cs->entry_capacity * 2);
struct tu_cs_entry *new_entries =
struct tu_cs_entry *new_entries = (struct tu_cs_entry *)
realloc(cs->entries, new_capacity * sizeof(struct tu_cs_entry));
if (!new_entries)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -310,7 +310,7 @@ tu_cs_alloc(struct tu_cs *cs,
struct tu_bo *bo = tu_cs_current_bo(cs);
size_t offset = align(tu_cs_get_offset(cs), size);
memory->map = bo->map + offset * sizeof(uint32_t);
memory->map = (uint32_t *) bo->map + offset;
memory->iova = bo->iova + offset * sizeof(uint32_t);
cs->start = cs->cur = (uint32_t*) bo->map + offset + count * size;
+2 -2
View File
@@ -119,8 +119,8 @@ tu_breadcrumbs_init(struct tu_device *device)
return;
}
struct breadcrumbs_context *ctx =
malloc(sizeof(struct breadcrumbs_context));
struct breadcrumbs_context *ctx = (struct breadcrumbs_context *) malloc(
sizeof(struct breadcrumbs_context));
ctx->device = device;
ctx->breadcrumb_idx = 0;
ctx->thread_stop = false;
+49 -34
View File
@@ -32,7 +32,7 @@
static inline uint8_t *
pool_base(struct tu_descriptor_pool *pool)
{
return pool->host_bo ?: pool->bo->map;
return pool->host_bo ?: (uint8_t *) pool->bo->map;
}
static uint32_t
@@ -158,7 +158,9 @@ tu_CreateDescriptorSetLayout(
immutable_sampler_count * sizeof(struct tu_sampler) +
ycbcr_sampler_count * sizeof(struct tu_sampler_ycbcr_conversion);
set_layout = vk_descriptor_set_layout_zalloc(&device->vk, size);
set_layout =
(struct tu_descriptor_set_layout *) vk_descriptor_set_layout_zalloc(
&device->vk, size);
if (!set_layout)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -166,9 +168,10 @@ tu_CreateDescriptorSetLayout(
set_layout->vk.destroy = tu_descriptor_set_layout_destroy;
/* We just allocate all the immutable samplers at the end of the struct */
struct tu_sampler *samplers = (void*) &set_layout->binding[num_bindings];
struct tu_sampler *samplers =
(struct tu_sampler *) &set_layout->binding[num_bindings];
struct tu_sampler_ycbcr_conversion *ycbcr_samplers =
(void*) &samplers[immutable_sampler_count];
(struct tu_sampler_ycbcr_conversion *) &samplers[immutable_sampler_count];
VkDescriptorSetLayoutBinding *bindings = NULL;
VkResult result = vk_create_sorted_bindings(
@@ -288,7 +291,7 @@ tu_CreateDescriptorSetLayout(
return vk_error(device, result);
}
char *map = set_layout->embedded_samplers->map;
char *map = (char *) set_layout->embedded_samplers->map;
for (unsigned i = 0; i < set_layout->binding_count; i++) {
if (!set_layout->binding[i].immutable_samplers_offset)
continue;
@@ -534,8 +537,9 @@ tu_CreatePipelineLayout(VkDevice _device,
assert(pCreateInfo->sType ==
VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
layout = vk_object_alloc(&device->vk, pAllocator, sizeof(*layout),
VK_OBJECT_TYPE_PIPELINE_LAYOUT);
layout = (struct tu_pipeline_layout *) vk_object_alloc(
&device->vk, pAllocator, sizeof(*layout),
VK_OBJECT_TYPE_PIPELINE_LAYOUT);
if (layout == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -608,8 +612,9 @@ tu_descriptor_set_create(struct tu_device *device,
set = (struct tu_descriptor_set*)pool->host_memory_ptr;
pool->host_memory_ptr += mem_size;
} else {
set = vk_alloc2(&device->vk.alloc, NULL, mem_size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
set = (struct tu_descriptor_set *) vk_alloc2(
&device->vk.alloc, NULL, mem_size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!set)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -807,8 +812,8 @@ tu_CreateDescriptorPool(VkDevice _device,
size += sizeof(struct tu_descriptor_pool_entry) * pCreateInfo->maxSets;
}
pool = vk_object_zalloc(&device->vk, pAllocator, size,
VK_OBJECT_TYPE_DESCRIPTOR_POOL);
pool = (struct tu_descriptor_pool *) vk_object_zalloc(
&device->vk, pAllocator, size, VK_OBJECT_TYPE_DESCRIPTOR_POOL);
if (!pool)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -828,8 +833,9 @@ tu_CreateDescriptorPool(VkDevice _device,
if (ret)
goto fail_map;
} else {
pool->host_bo = vk_alloc2(&device->vk.alloc, pAllocator, bo_size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
pool->host_bo =
(uint8_t *) vk_alloc2(&device->vk.alloc, pAllocator, bo_size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!pool->host_bo) {
ret = VK_ERROR_OUT_OF_HOST_MEMORY;
goto fail_alloc;
@@ -1153,41 +1159,42 @@ tu_GetDescriptorEXT(
void *pDescriptor)
{
TU_FROM_HANDLE(tu_device, device, _device);
uint32_t *dest = (uint32_t *) pDescriptor;
switch (pDescriptorInfo->type) {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
write_ubo_descriptor_addr(pDescriptor, pDescriptorInfo->data.pUniformBuffer);
write_ubo_descriptor_addr(dest, pDescriptorInfo->data.pUniformBuffer);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
write_buffer_descriptor_addr(device, pDescriptor, pDescriptorInfo->data.pStorageBuffer);
write_buffer_descriptor_addr(device, dest, pDescriptorInfo->data.pStorageBuffer);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
write_texel_buffer_descriptor_addr(pDescriptor, pDescriptorInfo->data.pUniformTexelBuffer);
write_texel_buffer_descriptor_addr(dest, pDescriptorInfo->data.pUniformTexelBuffer);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
write_texel_buffer_descriptor_addr(pDescriptor, pDescriptorInfo->data.pStorageTexelBuffer);
write_texel_buffer_descriptor_addr(dest, pDescriptorInfo->data.pStorageTexelBuffer);
break;
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
write_image_descriptor(pDescriptor, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
write_image_descriptor(dest, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
pDescriptorInfo->data.pSampledImage);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
write_image_descriptor(pDescriptor, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
write_image_descriptor(dest, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
pDescriptorInfo->data.pStorageImage);
break;
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
write_combined_image_sampler_descriptor(pDescriptor,
write_combined_image_sampler_descriptor(dest,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
pDescriptorInfo->data.pCombinedImageSampler,
true);
break;
case VK_DESCRIPTOR_TYPE_SAMPLER:
write_sampler_descriptor(pDescriptor, *pDescriptorInfo->data.pSampler);
write_sampler_descriptor(dest, *pDescriptorInfo->data.pSampler);
break;
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
/* nothing in descriptor set - framebuffer state is used instead */
if (TU_DEBUG(DYNAMIC)) {
write_image_descriptor(pDescriptor, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
write_image_descriptor(dest, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT,
pDescriptorInfo->data.pInputAttachmentImage);
}
break;
@@ -1248,7 +1255,7 @@ tu_update_descriptor_sets(const struct tu_device *device,
vk_find_struct_const(writeset->pNext,
WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK);
uint32_t remaining = inline_write->dataSize;
const uint8_t *src = inline_write->pData;
const uint8_t *src = (const uint8_t *) inline_write->pData;
uint32_t dst_offset = writeset->dstArrayElement;
do {
uint8_t *dst = (uint8_t *)(ptr) + dst_offset;
@@ -1462,8 +1469,9 @@ tu_CreateDescriptorUpdateTemplate(
sizeof(struct tu_descriptor_update_template_entry) * dst_entry_count;
struct tu_descriptor_update_template *templ;
templ = vk_object_alloc(&device->vk, pAllocator, size,
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE);
templ = (struct tu_descriptor_update_template *) vk_object_alloc(
&device->vk, pAllocator, size,
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE);
if (!templ)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -1592,19 +1600,23 @@ tu_update_descriptor_set_with_template(
switch(templ->entry[i].descriptor_type) {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: {
assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
write_ubo_descriptor(set->dynamic_descriptors + dst_offset, src);
write_ubo_descriptor(set->dynamic_descriptors + dst_offset,
(const VkDescriptorBufferInfo *) src);
break;
}
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
write_ubo_descriptor(ptr, src);
write_ubo_descriptor(ptr, (const VkDescriptorBufferInfo *) src);
break;
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: {
assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
write_buffer_descriptor(device, set->dynamic_descriptors + dst_offset, src);
write_buffer_descriptor(device,
set->dynamic_descriptors + dst_offset,
(const VkDescriptorBufferInfo *) src);
break;
}
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
write_buffer_descriptor(device, ptr, src);
write_buffer_descriptor(device, ptr,
(const VkDescriptorBufferInfo *) src);
break;
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
@@ -1612,13 +1624,14 @@ tu_update_descriptor_set_with_template(
break;
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE: {
write_image_descriptor(ptr, templ->entry[i].descriptor_type, src);
write_image_descriptor(ptr, templ->entry[i].descriptor_type,
(const VkDescriptorImageInfo *) src);
break;
}
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
write_combined_image_sampler_descriptor(ptr,
templ->entry[i].descriptor_type,
src,
(const VkDescriptorImageInfo *) src,
templ->entry[i].has_sampler);
if (samplers)
write_sampler_push(ptr + A6XX_TEX_CONST_DWORDS, &samplers[j]);
@@ -1632,7 +1645,8 @@ tu_update_descriptor_set_with_template(
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
/* nothing in descriptor set - framebuffer state is used instead */
if (TU_DEBUG(DYNAMIC))
write_image_descriptor(ptr, templ->entry[i].descriptor_type, src);
write_image_descriptor(ptr, templ->entry[i].descriptor_type,
(const VkDescriptorImageInfo *) src);
break;
default:
unreachable("unimplemented descriptor type");
@@ -1668,8 +1682,9 @@ tu_CreateSamplerYcbcrConversion(
TU_FROM_HANDLE(tu_device, device, _device);
struct tu_sampler_ycbcr_conversion *conversion;
conversion = vk_object_alloc(&device->vk, pAllocator, sizeof(*conversion),
VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION);
conversion = (struct tu_sampler_ycbcr_conversion *) vk_object_alloc(
&device->vk, pAllocator, sizeof(*conversion),
VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION);
if (!conversion)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
+5 -2
View File
@@ -233,7 +233,8 @@ static inline const struct tu_sampler *
tu_immutable_samplers(const struct tu_descriptor_set_layout *set,
const struct tu_descriptor_set_binding_layout *binding)
{
return (void *) ((const char *) set + binding->immutable_samplers_offset);
return (struct tu_sampler *) ((const char *) set +
binding->immutable_samplers_offset);
}
static inline const struct tu_sampler_ycbcr_conversion *
@@ -243,7 +244,9 @@ tu_immutable_ycbcr_samplers(const struct tu_descriptor_set_layout *set,
if (!binding->ycbcr_samplers_offset)
return NULL;
return (void *) ((const char *) set + binding->ycbcr_samplers_offset);
return (
struct tu_sampler_ycbcr_conversion *) ((const char *) set +
binding->ycbcr_samplers_offset);
}
#endif /* TU_DESCRIPTOR_SET_H */
+82 -58
View File
@@ -63,7 +63,7 @@ tu_device_get_cache_uuid(struct tu_physical_device *device, void *uuid)
memset(uuid, 0, VK_UUID_SIZE);
_mesa_sha1_init(&ctx);
if (!disk_cache_get_function_identifier(tu_device_get_cache_uuid, &ctx))
if (!disk_cache_get_function_identifier((void *)tu_device_get_cache_uuid, &ctx))
return -1;
_mesa_sha1_update(&ctx, &family, sizeof(family));
@@ -457,8 +457,8 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
if (pAllocator == NULL)
pAllocator = vk_default_allocator();
instance = vk_zalloc(pAllocator, sizeof(*instance), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
instance = (struct tu_instance *) vk_zalloc(
pAllocator, sizeof(*instance), 8, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!instance)
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -724,25 +724,29 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT: {
VkPhysicalDevice4444FormatsFeaturesEXT *features = (void *)ext;
VkPhysicalDevice4444FormatsFeaturesEXT *features =
(VkPhysicalDevice4444FormatsFeaturesEXT *) ext;
features->formatA4R4G4B4 = true;
features->formatA4B4G4R4 = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT: {
VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *features = (void *)ext;
VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *features =
(VkPhysicalDeviceBorderColorSwizzleFeaturesEXT *) ext;
features->borderColorSwizzle = true;
features->borderColorSwizzleFromImage = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT: {
VkPhysicalDeviceCustomBorderColorFeaturesEXT *features = (void *) ext;
VkPhysicalDeviceCustomBorderColorFeaturesEXT *features =
(VkPhysicalDeviceCustomBorderColorFeaturesEXT *) ext;
features->customBorderColors = true;
features->customBorderColorWithoutFormat = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT: {
VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *features = (void *)ext;
VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *features =
(VkPhysicalDeviceExtendedDynamicStateFeaturesEXT *) ext;
features->extendedDynamicState = true;
break;
}
@@ -811,12 +815,14 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES: {
VkPhysicalDeviceScalarBlockLayoutFeatures *features = (void *)ext;
VkPhysicalDeviceScalarBlockLayoutFeatures *features =
(VkPhysicalDeviceScalarBlockLayoutFeatures *) ext;
features->scalarBlockLayout = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: {
VkPhysicalDeviceRobustness2FeaturesEXT *features = (void *)ext;
VkPhysicalDeviceRobustness2FeaturesEXT *features =
(VkPhysicalDeviceRobustness2FeaturesEXT *) ext;
features->robustBufferAccess2 = true;
features->robustImageAccess2 = true;
features->nullDescriptor = true;
@@ -1367,7 +1373,8 @@ tu_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT: {
VkPhysicalDeviceCustomBorderColorPropertiesEXT *props = (void *)ext;
VkPhysicalDeviceCustomBorderColorPropertiesEXT *props =
(VkPhysicalDeviceCustomBorderColorPropertiesEXT *) ext;
props->maxCustomBorderColorSamplers = TU_BORDER_COLOR_COUNT;
break;
}
@@ -1378,7 +1385,8 @@ tu_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT: {
VkPhysicalDeviceRobustness2PropertiesEXT *props = (void *)ext;
VkPhysicalDeviceRobustness2PropertiesEXT *props =
(VkPhysicalDeviceRobustness2PropertiesEXT *) ext;
/* see write_buffer_descriptor() */
props->robustStorageBufferAccessSizeAlignment = 4;
/* see write_ubo_descriptor() */
@@ -1576,7 +1584,8 @@ tu_GetPhysicalDeviceQueueFamilyProperties2(
vk_foreach_struct(ext, p->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR: {
VkQueueFamilyGlobalPriorityPropertiesKHR *props = (void *)ext;
VkQueueFamilyGlobalPriorityPropertiesKHR *props =
(VkQueueFamilyGlobalPriorityPropertiesKHR *) ext;
tu_physical_device_get_global_priority_properties(pdevice, props);
break;
}
@@ -1744,7 +1753,7 @@ tu_trace_destroy_ts_buffer(struct u_trace_context *utctx, void *timestamps)
{
struct tu_device *device =
container_of(utctx, struct tu_device, trace_context);
struct tu_bo *bo = timestamps;
struct tu_bo *bo = (struct tu_bo *) timestamps;
tu_bo_finish(device, bo);
}
@@ -1753,8 +1762,8 @@ static void
tu_trace_record_ts(struct u_trace *ut, void *cs, void *timestamps,
unsigned idx, bool end_of_pipe)
{
struct tu_bo *bo = timestamps;
struct tu_cs *ts_cs = cs;
struct tu_bo *bo = (struct tu_bo *) timestamps;
struct tu_cs *ts_cs = (struct tu_cs *) cs;
unsigned ts_offset = idx * sizeof(uint64_t);
tu_cs_emit_pkt7(ts_cs, CP_EVENT_WRITE, 4);
@@ -1769,8 +1778,9 @@ tu_trace_read_ts(struct u_trace_context *utctx,
{
struct tu_device *device =
container_of(utctx, struct tu_device, trace_context);
struct tu_bo *bo = timestamps;
struct tu_u_trace_submission_data *submission_data = flush_data;
struct tu_bo *bo = (struct tu_bo *) timestamps;
struct tu_u_trace_submission_data *submission_data =
(struct tu_u_trace_submission_data *) flush_data;
/* Only need to stall on results for the first entry: */
if (idx == 0) {
@@ -1781,7 +1791,7 @@ tu_trace_read_ts(struct u_trace_context *utctx,
return U_TRACE_NO_TIMESTAMP;
}
uint64_t *ts = bo->map;
uint64_t *ts = (uint64_t *) bo->map;
/* Don't translate the no-timestamp marker: */
if (ts[idx] == U_TRACE_NO_TIMESTAMP)
@@ -1795,7 +1805,8 @@ tu_trace_delete_flush_data(struct u_trace_context *utctx, void *flush_data)
{
struct tu_device *device =
container_of(utctx, struct tu_device, trace_context);
struct tu_u_trace_submission_data *submission_data = flush_data;
struct tu_u_trace_submission_data *submission_data =
(struct tu_u_trace_submission_data *) flush_data;
tu_u_trace_submission_data_finish(device, submission_data);
}
@@ -1806,9 +1817,9 @@ tu_copy_timestamp_buffer(struct u_trace_context *utctx, void *cmdstream,
void *ts_to, uint32_t to_offset,
uint32_t count)
{
struct tu_cs *cs = cmdstream;
struct tu_bo *bo_from = ts_from;
struct tu_bo *bo_to = ts_to;
struct tu_cs *cs = (struct tu_cs *) cmdstream;
struct tu_bo *bo_from = (struct tu_bo *) ts_from;
struct tu_bo *bo_to = (struct tu_bo *) ts_to;
tu_cs_emit_pkt7(cs, CP_MEMCPY, 5);
tu_cs_emit(cs, count * sizeof(uint64_t) / sizeof(uint32_t));
@@ -1851,8 +1862,9 @@ VkResult
tu_create_copy_timestamp_cs(struct tu_cmd_buffer *cmdbuf, struct tu_cs** cs,
struct u_trace **trace_copy)
{
*cs = vk_zalloc(&cmdbuf->device->vk.alloc, sizeof(struct tu_cs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
*cs = (struct tu_cs *) vk_zalloc(&cmdbuf->device->vk.alloc,
sizeof(struct tu_cs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (*cs == NULL) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -1866,8 +1878,9 @@ tu_create_copy_timestamp_cs(struct tu_cmd_buffer *cmdbuf, struct tu_cs** cs,
tu_cs_emit_wfi(*cs);
tu_cs_emit_pkt7(*cs, CP_WAIT_FOR_ME, 0);
*trace_copy = vk_zalloc(&cmdbuf->device->vk.alloc, sizeof(struct u_trace), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
*trace_copy = (struct u_trace *) vk_zalloc(
&cmdbuf->device->vk.alloc, sizeof(struct u_trace), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (*trace_copy == NULL) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -1893,7 +1906,7 @@ tu_u_trace_submission_data_create(
uint32_t cmd_buffer_count,
struct tu_u_trace_submission_data **submission_data)
{
*submission_data =
*submission_data = (struct tu_u_trace_submission_data *)
vk_zalloc(&device->vk.alloc,
sizeof(struct tu_u_trace_submission_data), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
@@ -1904,10 +1917,10 @@ tu_u_trace_submission_data_create(
struct tu_u_trace_submission_data *data = *submission_data;
data->cmd_trace_data =
vk_zalloc(&device->vk.alloc,
cmd_buffer_count * sizeof(struct tu_u_trace_cmd_data), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
data->cmd_trace_data = (struct tu_u_trace_cmd_data *) vk_zalloc(
&device->vk.alloc,
cmd_buffer_count * sizeof(struct tu_u_trace_cmd_data), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!data->cmd_trace_data) {
goto fail;
@@ -2013,12 +2026,12 @@ tu_init_dbg_reg_stomper(struct tu_device *device)
tu_reg_stomper_options,
TU_DEBUG_REG_STOMP_CMDBUF);
struct tu_cs *cmdbuf_cs = calloc(1, sizeof(struct tu_cs));
struct tu_cs *cmdbuf_cs = (struct tu_cs *) calloc(1, sizeof(struct tu_cs));
tu_cs_init(cmdbuf_cs, device, TU_CS_MODE_GROW, 4096,
"cmdbuf reg stomp cs");
tu_cs_begin(cmdbuf_cs);
struct tu_cs *rp_cs = calloc(1, sizeof(struct tu_cs));
struct tu_cs *rp_cs = (struct tu_cs *) calloc(1, sizeof(struct tu_cs));
tu_cs_init(rp_cs, device, TU_CS_MODE_GROW, 4096, "rp reg stomp cs");
tu_cs_begin(rp_cs);
@@ -2074,7 +2087,9 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
vk_foreach_struct_const(ext, pCreateInfo->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT: {
const VkPhysicalDeviceCustomBorderColorFeaturesEXT *border_color_features = (const void *)ext;
const VkPhysicalDeviceCustomBorderColorFeaturesEXT
*border_color_features =
(const VkPhysicalDeviceCustomBorderColorFeaturesEXT *) ext;
custom_border_colors = border_color_features->customBorderColors;
border_color_without_format =
border_color_features->customBorderColorWithoutFormat;
@@ -2087,12 +2102,14 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT: {
VkPhysicalDeviceRobustness2FeaturesEXT *features = (void *)ext;
VkPhysicalDeviceRobustness2FeaturesEXT *features =
(VkPhysicalDeviceRobustness2FeaturesEXT *) ext;
robust_buffer_access2 = features->robustBufferAccess2;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR: {
VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *features = (void *)ext;
VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *features =
(VkPhysicalDeviceGlobalPriorityQueryFeaturesKHR *) ext;
global_priority_query = features->globalPriorityQuery;
break;
}
@@ -2101,8 +2118,9 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
}
}
device = vk_zalloc2(&physical_device->instance->vk.alloc, pAllocator,
sizeof(*device), 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
device = (struct tu_device *) vk_zalloc2(
&physical_device->instance->vk.alloc, pAllocator, sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!device)
return vk_startup_errorf(physical_device->instance, VK_ERROR_OUT_OF_HOST_MEMORY, "OOM");
@@ -2154,9 +2172,10 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
const VkDeviceQueueCreateInfo *queue_create =
&pCreateInfo->pQueueCreateInfos[i];
uint32_t qfi = queue_create->queueFamilyIndex;
device->queues[qfi] = vk_alloc(
&device->vk.alloc, queue_create->queueCount * sizeof(struct tu_queue),
8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
device->queues[qfi] = (struct tu_queue *) vk_alloc(
&device->vk.alloc,
queue_create->queueCount * sizeof(struct tu_queue), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!device->queues[qfi]) {
result = vk_startup_errorf(physical_device->instance,
VK_ERROR_OUT_OF_HOST_MEMORY,
@@ -2226,7 +2245,7 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
goto fail_global_bo_map;
}
global = device->global_bo->map;
global = (struct tu6_global *)device->global_bo->map;
tu_init_clear_blit_shaders(device);
global->predicate = 0;
global->vtx_stats_query_not_running = 1;
@@ -2265,13 +2284,15 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice,
*/
struct tu_cs *cs;
if (!(device->perfcntrs_pass_cs = calloc(1, sizeof(struct tu_cs)))) {
if (!(device->perfcntrs_pass_cs =
(struct tu_cs *) calloc(1, sizeof(struct tu_cs)))) {
result = vk_startup_errorf(device->instance,
VK_ERROR_OUT_OF_HOST_MEMORY, "OOM");
goto fail_perfcntrs_pass_alloc;
}
device->perfcntrs_pass_cs_entries = calloc(32, sizeof(struct tu_cs_entry));
device->perfcntrs_pass_cs_entries =
(struct tu_cs_entry *) calloc(32, sizeof(struct tu_cs_entry));
if (!device->perfcntrs_pass_cs_entries) {
result = vk_startup_errorf(device->instance,
VK_ERROR_OUT_OF_HOST_MEMORY, "OOM");
@@ -2587,8 +2608,8 @@ tu_AllocateMemory(VkDevice _device,
if (mem_heap_used > mem_heap->size)
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
mem = vk_object_alloc(&device->vk, pAllocator, sizeof(*mem),
VK_OBJECT_TYPE_DEVICE_MEMORY);
mem = (struct tu_device_memory *) vk_object_alloc(
&device->vk, pAllocator, sizeof(*mem), VK_OBJECT_TYPE_DEVICE_MEMORY);
if (mem == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -2716,7 +2737,7 @@ tu_MapMemory(VkDevice _device,
return result;
}
*ppData = mem->bo->map + offset;
*ppData = (char *) mem->bo->map + offset;
return VK_SUCCESS;
}
@@ -2858,7 +2879,7 @@ tu_CreateEvent(VkDevice _device,
{
TU_FROM_HANDLE(tu_device, device, _device);
struct tu_event *event =
struct tu_event *event = (struct tu_event *)
vk_object_alloc(&device->vk, pAllocator, sizeof(*event),
VK_OBJECT_TYPE_EVENT);
if (!event)
@@ -2936,8 +2957,8 @@ tu_CreateBuffer(VkDevice _device,
TU_FROM_HANDLE(tu_device, device, _device);
struct tu_buffer *buffer;
buffer = vk_buffer_create(&device->vk, pCreateInfo, pAllocator,
sizeof(*buffer));
buffer = (struct tu_buffer *) vk_buffer_create(
&device->vk, pCreateInfo, pAllocator, sizeof(*buffer));
if (buffer == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -2982,8 +3003,8 @@ tu_CreateFramebuffer(VkDevice _device,
size_t size = sizeof(*framebuffer);
if (!imageless)
size += sizeof(struct tu_attachment_info) * pCreateInfo->attachmentCount;
framebuffer = vk_object_alloc(&device->vk, pAllocator, size,
VK_OBJECT_TYPE_FRAMEBUFFER);
framebuffer = (struct tu_framebuffer *) vk_object_alloc(
&device->vk, pAllocator, size, VK_OBJECT_TYPE_FRAMEBUFFER);
if (framebuffer == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -3142,8 +3163,8 @@ tu_CreateSampler(VkDevice _device,
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
sampler = vk_object_alloc(&device->vk, pAllocator, sizeof(*sampler),
VK_OBJECT_TYPE_SAMPLER);
sampler = (struct tu_sampler *) vk_object_alloc(
&device->vk, pAllocator, sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER);
if (!sampler)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -3325,11 +3346,12 @@ tu_debug_bos_add(struct tu_device *dev, uint64_t size, const char *name)
struct tu_debug_bos_entry *debug_bos;
if (!entry) {
debug_bos = calloc(1, sizeof(struct tu_debug_bos_entry));
debug_bos = (struct tu_debug_bos_entry *) calloc(
1, sizeof(struct tu_debug_bos_entry));
debug_bos->name = strdup(name);
_mesa_hash_table_insert(dev->bo_sizes, debug_bos->name, debug_bos);
} else {
debug_bos = entry->data;
debug_bos = (struct tu_debug_bos_entry *) entry->data;
}
debug_bos->count++;
@@ -3351,7 +3373,8 @@ tu_debug_bos_del(struct tu_device *dev, struct tu_bo *bo)
/* If we're finishing the BO, it should have been added already */
assert(entry);
struct tu_debug_bos_entry *debug_bos = entry->data;
struct tu_debug_bos_entry *debug_bos =
(struct tu_debug_bos_entry *) entry->data;
debug_bos->count--;
debug_bos->size -= align(bo->size, 4096);
if (!debug_bos->count) {
@@ -3385,7 +3408,8 @@ tu_debug_bos_print_stats(struct tu_device *dev)
uint32_t count = 0;
hash_table_foreach(dev->bo_sizes, entry)
{
struct tu_debug_bos_entry *debug_bos = (void *) entry->data;
struct tu_debug_bos_entry *debug_bos =
(struct tu_debug_bos_entry *) entry->data;
util_dynarray_append(&dyn, struct tu_debug_bos_entry *, debug_bos);
size += debug_bos->size / 1024;
count += debug_bos->count;
+3 -2
View File
@@ -41,7 +41,8 @@ get_cmd_buffer(struct tu_device *dev, struct tu_cmd_buffer **cmd_buffer_out)
* shrinking the array of pending entries.
*/
struct dynamic_rendering_entry *new_entry =
util_dynarray_begin(&dev->dynamic_rendering_pending);
(struct dynamic_rendering_entry *) util_dynarray_begin(
&dev->dynamic_rendering_pending);
uint32_t entries = 0;
util_dynarray_foreach(&dev->dynamic_rendering_pending,
struct dynamic_rendering_entry, entry) {
@@ -208,7 +209,7 @@ tu_insert_dynamic_cmdbufs(struct tu_device *dev,
}
}
struct tu_cmd_buffer **new_cmds =
struct tu_cmd_buffer **new_cmds = (struct tu_cmd_buffer **)
vk_alloc(&dev->vk.alloc, cmds.size, alignof(struct tu_cmd_buffer *),
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!new_cmds)
+5 -5
View File
@@ -681,10 +681,10 @@ tu_GetPhysicalDeviceImageFormatProperties2(
{
switch (s->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO:
external_info = (const void *) s;
external_info = (const VkPhysicalDeviceExternalImageFormatInfo *) s;
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT:
image_view_info = (const void *) s;
image_view_info = (const VkPhysicalDeviceImageViewImageFormatInfoEXT *) s;
break;
default:
break;
@@ -696,13 +696,13 @@ tu_GetPhysicalDeviceImageFormatProperties2(
{
switch (s->sType) {
case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES:
external_props = (void *) s;
external_props = (VkExternalImageFormatProperties *) s;
break;
case VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT:
cubic_props = (void *) s;
cubic_props = (VkFilterCubicImageViewImageFormatPropertiesEXT *) s;
break;
case VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES:
ycbcr_props = (void *) s;
ycbcr_props = (VkSamplerYcbcrConversionImageFormatProperties *) s;
break;
default:
break;
+5 -5
View File
@@ -669,7 +669,7 @@ tu_CreateImage(VkDevice _device,
const VkSubresourceLayout *plane_layouts = NULL;
TU_FROM_HANDLE(tu_device, device, _device);
struct tu_image *image =
struct tu_image *image = (struct tu_image *)
vk_object_zalloc(&device->vk, alloc, sizeof(*image), VK_OBJECT_TYPE_IMAGE);
if (!image)
@@ -859,8 +859,8 @@ tu_CreateImageView(VkDevice _device,
TU_FROM_HANDLE(tu_device, device, _device);
struct tu_image_view *view;
view = vk_object_alloc(&device->vk, pAllocator, sizeof(*view),
VK_OBJECT_TYPE_IMAGE_VIEW);
view = (struct tu_image_view *) vk_object_alloc(
&device->vk, pAllocator, sizeof(*view), VK_OBJECT_TYPE_IMAGE_VIEW);
if (view == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -913,8 +913,8 @@ tu_CreateBufferView(VkDevice _device,
TU_FROM_HANDLE(tu_device, device, _device);
struct tu_buffer_view *view;
view = vk_object_alloc(&device->vk, pAllocator, sizeof(*view),
VK_OBJECT_TYPE_BUFFER_VIEW);
view = (struct tu_buffer_view *) vk_object_alloc(
&device->vk, pAllocator, sizeof(*view), VK_OBJECT_TYPE_BUFFER_VIEW);
if (!view)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
+15 -13
View File
@@ -317,7 +317,7 @@ tu_bo_init(struct tu_device *dev,
/* grow the bo list if needed */
if (idx >= dev->bo_list_size) {
uint32_t new_len = idx + 64;
struct drm_msm_gem_submit_bo *new_ptr =
struct drm_msm_gem_submit_bo *new_ptr = (struct drm_msm_gem_submit_bo *)
vk_realloc(&dev->vk.alloc, dev->bo_list, new_len * sizeof(*dev->bo_list),
8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!new_ptr) {
@@ -779,7 +779,7 @@ tu_queue_submit_create_locked(struct tu_queue *queue,
memset(new_submit, 0, sizeof(struct tu_queue_submit));
new_submit->cmd_buffers = (void *)vk_cmd_buffers;
new_submit->cmd_buffers = (struct tu_cmd_buffer **) vk_cmd_buffers;
new_submit->nr_cmd_buffers = vk_submit->command_buffer_count;
tu_insert_dynamic_cmdbufs(queue->device, &new_submit->cmd_buffers,
&new_submit->nr_cmd_buffers);
@@ -806,9 +806,9 @@ tu_queue_submit_create_locked(struct tu_queue *queue,
if (new_submit->autotune_fence)
entry_count++;
new_submit->cmds = vk_zalloc(&queue->device->vk.alloc,
entry_count * sizeof(*new_submit->cmds), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
new_submit->cmds = (struct drm_msm_gem_submit_cmd *) vk_zalloc(
&queue->device->vk.alloc, entry_count * sizeof(*new_submit->cmds), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (new_submit->cmds == NULL) {
result = vk_error(queue, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -828,9 +828,10 @@ tu_queue_submit_create_locked(struct tu_queue *queue,
}
/* Allocate without wait timeline semaphores */
new_submit->in_syncobjs = vk_zalloc(&queue->device->vk.alloc,
nr_in_syncobjs * sizeof(*new_submit->in_syncobjs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
new_submit->in_syncobjs = (struct drm_msm_gem_submit_syncobj *) vk_zalloc(
&queue->device->vk.alloc,
nr_in_syncobjs * sizeof(*new_submit->in_syncobjs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (new_submit->in_syncobjs == NULL) {
result = vk_error(queue, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -838,9 +839,10 @@ tu_queue_submit_create_locked(struct tu_queue *queue,
}
/* Allocate with signal timeline semaphores considered */
new_submit->out_syncobjs = vk_zalloc(&queue->device->vk.alloc,
nr_out_syncobjs * sizeof(*new_submit->out_syncobjs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
new_submit->out_syncobjs = (struct drm_msm_gem_submit_syncobj *) vk_zalloc(
&queue->device->vk.alloc,
nr_out_syncobjs * sizeof(*new_submit->out_syncobjs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (new_submit->out_syncobjs == NULL) {
result = vk_error(queue, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -1000,7 +1002,7 @@ tu_queue_submit_locked(struct tu_queue *queue, struct tu_queue_submit *submit)
submit->u_trace_submission_data;
submission_data->submission_id = queue->device->submit_count;
/* We have to allocate it here since it is different between drm/kgsl */
submission_data->syncobj =
submission_data->syncobj = (struct tu_u_trace_syncobj *)
vk_alloc(&queue->device->vk.alloc, sizeof(struct tu_u_trace_syncobj),
8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
submission_data->syncobj->fence = req.fence;
@@ -1198,7 +1200,7 @@ tu_knl_drm_msm_load(struct tu_instance *instance,
return result;
}
struct tu_physical_device *device =
struct tu_physical_device *device = (struct tu_physical_device *)
vk_zalloc(&instance->vk.alloc, sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!device) {
+6 -6
View File
@@ -495,7 +495,7 @@ kgsl_syncobj_wait_any(struct tu_device* device, struct kgsl_syncobj **syncobjs,
if (convert_ts_to_fd) {
kgsl_syncobj_foreach_state(syncobjs, KGSL_SYNCOBJ_STATE_TS) {
struct pollfd *poll_fd = u_vector_add(&poll_fds);
struct pollfd *poll_fd = (struct pollfd *) u_vector_add(&poll_fds);
poll_fd->fd = timestamp_to_fd(sync->queue, sync->timestamp);
poll_fd->events = POLLIN;
}
@@ -510,7 +510,7 @@ kgsl_syncobj_wait_any(struct tu_device* device, struct kgsl_syncobj **syncobjs,
}
if (num_fds) {
struct pollfd *poll_fd = u_vector_add(&poll_fds);
struct pollfd *poll_fd = (struct pollfd *) u_vector_add(&poll_fds);
poll_fd->fd = timestamp_to_fd(queue, lowest_timestamp);
poll_fd->events = POLLIN;
}
@@ -518,7 +518,7 @@ kgsl_syncobj_wait_any(struct tu_device* device, struct kgsl_syncobj **syncobjs,
if (num_fds) {
kgsl_syncobj_foreach_state(syncobjs, KGSL_SYNCOBJ_STATE_FD) {
struct pollfd *poll_fd = u_vector_add(&poll_fds);
struct pollfd *poll_fd = (struct pollfd *) u_vector_add(&poll_fds);
poll_fd->fd = sync->fd;
poll_fd->events = POLLIN;
}
@@ -536,7 +536,7 @@ kgsl_syncobj_wait_any(struct tu_device* device, struct kgsl_syncobj **syncobjs,
} else {
int ret, i;
struct pollfd *fds = poll_fds.data;
struct pollfd *fds = (struct pollfd *) poll_fds.data;
uint32_t fds_count = u_vector_length(&poll_fds);
do {
ret = poll(fds, fds_count, get_relative_ms(abs_timeout_ns));
@@ -920,7 +920,7 @@ kgsl_queue_submit(struct tu_queue *queue, struct vk_queue_submit *vk_submit)
if (tu_autotune_submit_requires_fence(cmd_buffers, cmdbuf_count))
entry_count++;
struct kgsl_command_object *cmds =
struct kgsl_command_object *cmds = (struct kgsl_command_object *)
vk_alloc(&queue->device->vk.alloc, sizeof(*cmds) * entry_count,
alignof(*cmds), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
if (cmds == NULL) {
@@ -1125,7 +1125,7 @@ tu_knl_kgsl_load(struct tu_instance *instance, int fd)
"I can't KHR_display");
}
struct tu_physical_device *device =
struct tu_physical_device *device = (struct tu_physical_device *)
vk_zalloc(&instance->vk.alloc, sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!device) {
+6 -4
View File
@@ -786,14 +786,16 @@ tu_CreateRenderPass2(VkDevice _device,
attachments_offset = size;
size += pCreateInfo->attachmentCount * sizeof(pass->attachments[0]);
pass = vk_object_zalloc(&device->vk, pAllocator, size,
VK_OBJECT_TYPE_RENDER_PASS);
pass = (struct tu_render_pass *) vk_object_zalloc(
&device->vk, pAllocator, size, VK_OBJECT_TYPE_RENDER_PASS);
if (pass == NULL)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
pass->attachment_count = pCreateInfo->attachmentCount;
pass->subpass_count = pCreateInfo->subpassCount;
pass->attachments = (void *) pass + attachments_offset;
pass->attachments =
(struct tu_render_pass_attachment *) ((char *) pass +
attachments_offset);
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
struct tu_render_pass_attachment *att = &pass->attachments[i];
@@ -831,7 +833,7 @@ tu_CreateRenderPass2(VkDevice _device,
}
if (subpass_attachment_count) {
pass->subpass_attachments = vk_alloc2(
pass->subpass_attachments = (struct tu_subpass_attachment *) vk_alloc2(
&device->vk.alloc, pAllocator,
subpass_attachment_count * sizeof(struct tu_subpass_attachment), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+6 -5
View File
@@ -4758,8 +4758,9 @@ tu_pipeline_builder_build(struct tu_pipeline_builder *builder,
{
VkResult result;
*pipeline = vk_object_zalloc(&builder->device->vk, builder->alloc,
sizeof(**pipeline), VK_OBJECT_TYPE_PIPELINE);
*pipeline = (struct tu_pipeline *) vk_object_zalloc(
&builder->device->vk, builder->alloc, sizeof(**pipeline),
VK_OBJECT_TYPE_PIPELINE);
if (!*pipeline)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -5179,8 +5180,8 @@ tu_compute_pipeline_create(VkDevice device,
int64_t pipeline_start = os_time_get_nano();
pipeline = vk_object_zalloc(&dev->vk, pAllocator, sizeof(*pipeline),
VK_OBJECT_TYPE_PIPELINE);
pipeline = (struct tu_pipeline *) vk_object_zalloc(
&dev->vk, pAllocator, sizeof(*pipeline), VK_OBJECT_TYPE_PIPELINE);
if (!pipeline)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@@ -5586,7 +5587,7 @@ write_ir_text(VkPipelineExecutableInternalRepresentationKHR* ir,
return true;
}
strncpy(ir->pData, data, ir->dataSize);
strncpy((char *) ir->pData, data, ir->dataSize);
if (ir->dataSize < data_len)
return false;
+9 -7
View File
@@ -126,9 +126,9 @@ struct PACKED primitives_generated_query_slot {
pool->bo->iova + pool->stride * (query) + \
sizeof(struct query_slot) + sizeof(type) * (i)
#define query_result_addr(pool, query, type, i) \
pool->bo->map + pool->stride * (query) + \
sizeof(struct query_slot) + sizeof(type) * (i)
#define query_result_addr(pool, query, type, i) \
(uint64_t *) ((char *) pool->bo->map + pool->stride * (query) + \
sizeof(struct query_slot) + sizeof(type) * (i))
#define query_is_available(slot) slot->available
@@ -172,9 +172,11 @@ fd_perfcntr_type_to_vk_storage[] = {
/*
* Returns a pointer to a given slot in a query pool.
*/
static void* slot_address(struct tu_query_pool *pool, uint32_t query)
static struct query_slot *
slot_address(struct tu_query_pool *pool, uint32_t query)
{
return (char*)pool->bo->map + query * pool->stride;
return (struct query_slot *) ((char *) pool->bo->map +
query * pool->stride);
}
static void
@@ -253,7 +255,7 @@ tu_CreateQueryPool(VkDevice _device,
unreachable("Invalid query type");
}
struct tu_query_pool *pool =
struct tu_query_pool *pool = (struct tu_query_pool *)
vk_object_alloc(&device->vk, pAllocator, pool_size,
VK_OBJECT_TYPE_QUERY_POOL);
if (!pool)
@@ -477,7 +479,7 @@ get_query_pool_results(struct tu_device *device,
{
assert(dataSize >= stride * queryCount);
char *result_base = pData;
char *result_base = (char *) pData;
VkResult result = VK_SUCCESS;
for (uint32_t i = 0; i < queryCount; i++) {
uint32_t query = firstQuery + i;
+2 -2
View File
@@ -593,7 +593,7 @@ struct lower_instr_params {
static bool
lower_instr(nir_builder *b, nir_instr *instr, void *cb_data)
{
struct lower_instr_params *params = cb_data;
struct lower_instr_params *params = (struct lower_instr_params *) cb_data;
b->cursor = nir_before_instr(instr);
switch (instr->type) {
case nir_instr_type_tex:
@@ -618,7 +618,7 @@ lower_inline_ubo(nir_builder *b, nir_instr *instr, void *cb_data)
if (intrin->intrinsic != nir_intrinsic_load_ubo)
return false;
struct lower_instr_params *params = cb_data;
struct lower_instr_params *params = (struct lower_instr_params *) cb_data;
struct tu_shader *shader = params->shader;
const struct tu_pipeline_layout *layout = params->layout;
+1 -1
View File
@@ -122,5 +122,5 @@ tu_suballoc_bo_free(struct tu_suballocator *suballoc, struct tu_suballoc_bo *bo)
void *
tu_suballoc_bo_map(struct tu_suballoc_bo *bo)
{
return bo->bo->map + (bo->iova - bo->bo->iova);
return (char *)bo->bo->map + (bo->iova - bo->bo->iova);
}