v3dv: remove reference to v3dv_instance on v3dv_physical_device

As we already have a reference to vk_instance at vk_physical_device,
that we are setting when calling vk_physical_device_init.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
This commit is contained in:
Alejandro Piñeiro 2021-01-27 23:45:28 +01:00 committed by Marge Bot
parent bde7e1c313
commit 3e2bbf5d50
3 changed files with 10 additions and 12 deletions

View file

@ -618,14 +618,14 @@ init_uuids(struct v3dv_physical_device *device)
const struct build_id_note *note =
build_id_find_nhdr_for_addr(init_uuids);
if (!note) {
return vk_errorf(device->instance,
return vk_errorf((struct v3dv_instance*) device->vk.instance,
VK_ERROR_INITIALIZATION_FAILED,
"Failed to find build-id");
}
unsigned build_id_len = build_id_length(note);
if (build_id_len < 20) {
return vk_errorf(device->instance,
return vk_errorf((struct v3dv_instance*) device->vk.instance,
VK_ERROR_INITIALIZATION_FAILED,
"build-id too short. It needs to be a SHA");
}
@ -679,7 +679,6 @@ physical_device_init(struct v3dv_physical_device *device,
if (result != VK_SUCCESS)
goto fail;
device->instance = instance;
assert(drm_render_device);
const char *path = drm_render_device->nodes[DRM_NODE_RENDER];
@ -1446,7 +1445,8 @@ v3dv_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
return VK_SUCCESS;
}
return vk_error(physical_device->instance, VK_ERROR_LAYER_NOT_PRESENT);
return vk_error((struct v3dv_instance*) physical_device->vk.instance,
VK_ERROR_LAYER_NOT_PRESENT);
}
static VkResult
@ -1514,7 +1514,7 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
VkDevice *pDevice)
{
V3DV_FROM_HANDLE(v3dv_physical_device, physical_device, physicalDevice);
struct v3dv_instance *instance = physical_device->instance;
struct v3dv_instance *instance = (struct v3dv_instance*) physical_device->vk.instance;
VkResult result;
struct v3dv_device *device;
@ -1561,14 +1561,14 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
return vk_error(instance, VK_ERROR_INITIALIZATION_FAILED);
}
device = vk_zalloc2(&physical_device->instance->vk.alloc, pAllocator,
device = vk_zalloc2(&physical_device->vk.instance->alloc, pAllocator,
sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!device)
return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
result = vk_device_init(&device->vk, NULL, NULL, pCreateInfo,
&physical_device->instance->vk.alloc, pAllocator);
&physical_device->vk.instance->alloc, pAllocator);
if (result != VK_SUCCESS) {
vk_free(&device->vk.alloc, device);
return vk_error(instance, result);
@ -1580,7 +1580,7 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
if (pAllocator)
device->vk.alloc = *pAllocator;
else
device->vk.alloc = physical_device->instance->vk.alloc;
device->vk.alloc = physical_device->vk.instance->alloc;
pthread_mutex_init(&device->mutex, NULL);

View file

@ -129,8 +129,6 @@ struct v3d_simulator_file;
struct v3dv_physical_device {
struct vk_physical_device vk;
struct v3dv_instance *instance;
struct v3dv_device_extension_table supported_extensions;
struct v3dv_physical_device_dispatch_table dispatch;

View file

@ -44,7 +44,7 @@ v3dv_wsi_init(struct v3dv_physical_device *physical_device)
result = wsi_device_init(&physical_device->wsi_device,
v3dv_physical_device_to_handle(physical_device),
v3dv_wsi_proc_addr,
&physical_device->instance->vk.alloc,
&physical_device->vk.instance->alloc,
physical_device->master_fd, NULL, false);
if (result != VK_SUCCESS)
@ -59,7 +59,7 @@ void
v3dv_wsi_finish(struct v3dv_physical_device *physical_device)
{
wsi_device_finish(&physical_device->wsi_device,
&physical_device->instance->vk.alloc);
&physical_device->vk.instance->alloc);
}
void v3dv_DestroySurfaceKHR(