v3dv: fix the command buffer private object framework for 32-bit

We were declaring the destroy callback function as taking a pointer for the
vulkan object handle and relying on an implicit conversion to the Vulkan
handle type, however that would be incorrect on 32-bit platforms, where
non-dispatchable Vulkan objects (the kind that we may allocate privately during
command buffer recording), are defined as uint64_t, so the signature of the
destry callback type doesn't match the signature of the actual Vulkan
function, leading to bogus results. Fix that by using uint64_t instead.

This fixes compilation warnings and also crashes in some tests when
compiling and executing natively in Rpi4.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga 2020-05-14 09:23:40 +02:00 committed by Marge Bot
parent 1957689249
commit ce681aac70
4 changed files with 13 additions and 13 deletions

View File

@ -199,7 +199,7 @@ v3dv_job_destroy(struct v3dv_job *job)
void
v3dv_cmd_buffer_add_private_obj(struct v3dv_cmd_buffer *cmd_buffer,
void *obj,
uint64_t obj,
v3dv_cmd_buffer_private_obj_destroy_cb destroy_cb)
{
struct v3dv_cmd_buffer_private_obj *pobj =

View File

@ -547,7 +547,7 @@ emit_color_clear_rect(struct v3dv_cmd_buffer *cmd_buffer,
goto fail;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)fb_attachment,
cmd_buffer, (uintptr_t)fb_attachment,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyImageView);
VkFramebufferCreateInfo fb_info = {
@ -567,7 +567,7 @@ emit_color_clear_rect(struct v3dv_cmd_buffer *cmd_buffer,
goto fail;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)fb,
cmd_buffer, (uintptr_t)fb,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyFramebuffer);
VkRenderPassBeginInfo rp_info = {

View File

@ -875,7 +875,7 @@ copy_image_to_buffer_blit(struct v3dv_cmd_buffer *cmd_buffer,
return handled;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)buffer_image,
cmd_buffer, (uintptr_t)buffer_image,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyImage);
/* Bind the buffer memory to the image */
@ -2242,7 +2242,7 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
return handled;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)buffer_image,
cmd_buffer, (uintptr_t)buffer_image,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyImage);
/* Allocate and bind memory for the image */
@ -2259,7 +2259,7 @@ copy_buffer_to_image_blit(struct v3dv_cmd_buffer *cmd_buffer,
return handled;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)mem,
cmd_buffer, (uintptr_t)mem,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_FreeMemory);
result = v3dv_BindImageMemory(_device, buffer_image, mem, 0);
@ -3488,7 +3488,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
goto fail;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)dst_image_view,
cmd_buffer, (uintptr_t)dst_image_view,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyImageView);
VkFramebufferCreateInfo fb_info = {
@ -3508,7 +3508,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
goto fail;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)fb,
cmd_buffer, (uintptr_t)fb,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyFramebuffer);
/* Setup descriptor set for blit source texture. We don't have to
@ -3543,7 +3543,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
goto fail;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void*)sampler,
cmd_buffer, (uintptr_t)sampler,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroySampler);
VkImageViewCreateInfo src_image_view_info = {
@ -3568,7 +3568,7 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
goto fail;
v3dv_cmd_buffer_add_private_obj(
cmd_buffer, (void *)src_image_view,
cmd_buffer, (uintptr_t)src_image_view,
(v3dv_cmd_buffer_private_obj_destroy_cb)v3dv_DestroyImageView);
VkDescriptorImageInfo image_info = {

View File

@ -863,11 +863,11 @@ VkResult v3dv_get_query_pool_results_cpu(struct v3dv_device *device,
VkQueryResultFlags flags);
typedef void (*v3dv_cmd_buffer_private_obj_destroy_cb)(VkDevice device,
void *pobj,
uint64_t pobj,
VkAllocationCallbacks *alloc);
struct v3dv_cmd_buffer_private_obj {
struct list_head list_link;
void *obj;
uint64_t obj;
v3dv_cmd_buffer_private_obj_destroy_cb destroy_cb;
};
@ -955,7 +955,7 @@ void v3dv_cmd_buffer_add_tfu_job(struct v3dv_cmd_buffer *cmd_buffer,
struct drm_v3d_submit_tfu *tfu);
void v3dv_cmd_buffer_add_private_obj(struct v3dv_cmd_buffer *cmd_buffer,
void *obj,
uint64_t obj,
v3dv_cmd_buffer_private_obj_destroy_cb destroy_cb);
struct v3dv_semaphore {