vulkan: reduce struct vk_object_base by 8 bytes
I know that, in the grand scheme of things, this isn't significant.
The problem is: now that I know the hole is there, my OCD won't allow
me to sleep until it's fixed.
We went from:
struct vk_object_base {
VK_LOADER_DATA _loader_data; /* 0 8 */
VkObjectType type; /* 8 4 */
/* XXX 4 bytes hole, try to pack */
struct vk_device * device; /* 16 8 */
struct vk_instance * instance; /* 24 8 */
_Bool client_visible; /* 32 1 */
/* XXX 7 bytes hole, try to pack */
struct util_sparse_array private_data; /* 40 24 */
/* --- cacheline 1 boundary (64 bytes) --- */
char * object_name; /* 64 8 */
/* size: 72, cachelines: 2, members: 7 */
/* sum members: 61, holes: 2, sum holes: 11 */
/* last cacheline: 8 bytes */
};
to:
struct vk_object_base {
VK_LOADER_DATA _loader_data; /* 0 8 */
VkObjectType type; /* 8 4 */
_Bool client_visible; /* 12 1 */
/* XXX 3 bytes hole, try to pack */
struct vk_device * device; /* 16 8 */
struct vk_instance * instance; /* 24 8 */
struct util_sparse_array private_data; /* 32 24 */
char * object_name; /* 56 8 */
/* size: 64, cachelines: 1, members: 7 */
/* sum members: 61, holes: 1, sum holes: 3 */
};
which is cool because now the struct nicely fits in a cacheline.
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28699>
This commit is contained in:
@@ -38,9 +38,9 @@ vk_object_base_init(struct vk_device *device,
|
||||
{
|
||||
base->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||
base->type = obj_type;
|
||||
base->client_visible = false;
|
||||
base->device = device;
|
||||
base->instance = NULL;
|
||||
base->client_visible = false;
|
||||
base->object_name = NULL;
|
||||
util_sparse_array_init(&base->private_data, sizeof(uint64_t), 8);
|
||||
}
|
||||
@@ -51,9 +51,9 @@ void vk_object_base_instance_init(struct vk_instance *instance,
|
||||
{
|
||||
base->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
|
||||
base->type = obj_type;
|
||||
base->client_visible = false;
|
||||
base->device = NULL;
|
||||
base->instance = instance;
|
||||
base->client_visible = false;
|
||||
base->object_name = NULL;
|
||||
util_sparse_array_init(&base->private_data, sizeof(uint64_t), 8);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,9 @@ struct vk_object_base {
|
||||
*/
|
||||
VkObjectType type;
|
||||
|
||||
/* True if this object is fully constructed and visible to the client */
|
||||
bool client_visible;
|
||||
|
||||
/** Pointer to the device in which this object exists, if any
|
||||
*
|
||||
* This is NULL for instances and physical devices but should point to a
|
||||
@@ -66,9 +69,6 @@ struct vk_object_base {
|
||||
*/
|
||||
struct vk_instance *instance;
|
||||
|
||||
/* True if this object is fully constructed and visible to the client */
|
||||
bool client_visible;
|
||||
|
||||
/* For VK_EXT_private_data */
|
||||
struct util_sparse_array private_data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user