v3dv/meta: fix hash table insertion

So far we were using directly the local variable key to do the
insertion, when the hash table expects a permanent address. We add a
key field on all the meta structures (that are already basically a
wrapper over v3dv_pipeline).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Alejandro Piñeiro 2020-08-07 15:16:19 +02:00 committed by Marge Bot
parent 5a59a331e2
commit e8ceb8f56a
3 changed files with 14 additions and 5 deletions

View File

@ -575,7 +575,9 @@ get_color_clear_pipeline(struct v3dv_device *device,
if (result != VK_SUCCESS)
goto fail;
_mesa_hash_table_insert(device->meta.color_clear.cache, &key, *pipeline);
(*pipeline)->key = key;
_mesa_hash_table_insert(device->meta.color_clear.cache,
&(*pipeline)->key, *pipeline);
mtx_unlock(&device->meta.mtx);
return VK_SUCCESS;
@ -653,7 +655,9 @@ get_depth_clear_pipeline(struct v3dv_device *device,
if (result != VK_SUCCESS)
goto fail;
_mesa_hash_table_insert(device->meta.depth_clear.cache, &key, *pipeline);
(*pipeline)->key = key;
_mesa_hash_table_insert(device->meta.depth_clear.cache,
&(*pipeline)->key, *pipeline);
mtx_unlock(&device->meta.mtx);
return VK_SUCCESS;

View File

@ -3609,7 +3609,9 @@ get_blit_pipeline(struct v3dv_device *device,
if (!ok)
goto fail;
_mesa_hash_table_insert(device->meta.blit.cache[src_type], &key, *pipeline);
memcpy((*pipeline)->key, key, sizeof((*pipeline)->key));
_mesa_hash_table_insert(device->meta.blit.cache[src_type],
&(*pipeline)->key, *pipeline);
mtx_unlock(&device->meta.mtx);
return true;

View File

@ -228,23 +228,26 @@ struct v3dv_queue {
mtx_t mutex;
};
#define V3DV_META_BLIT_CACHE_KEY_SIZE (4 * sizeof(uint32_t))
struct v3dv_meta_color_clear_pipeline {
VkPipeline pipeline;
VkRenderPass pass;
bool free_render_pass;
uint64_t key;
};
struct v3dv_meta_depth_clear_pipeline {
VkPipeline pipeline;
uint64_t key;
};
struct v3dv_meta_blit_pipeline {
VkPipeline pipeline;
VkRenderPass pass;
uint8_t key[V3DV_META_BLIT_CACHE_KEY_SIZE];
};
#define V3DV_META_BLIT_CACHE_KEY_SIZE (4 * sizeof(uint32_t))
struct v3dv_pipeline_cache_stats {
uint32_t miss;
uint32_t hit;