#define VK_ICD_WSI_PLATFORM_MAX 5
+struct anv_wsi_device {
+ struct anv_wsi_interface * wsi[VK_ICD_WSI_PLATFORM_MAX];
+};
+
struct anv_physical_device {
VK_LOADER_DATA _loader_data;
uint32_t eu_total;
uint32_t subslice_total;
- struct anv_wsi_interface * wsi[VK_ICD_WSI_PLATFORM_MAX];
+ struct anv_wsi_device wsi_device;
};
struct anv_instance {
{
VkResult result;
- memset(physical_device->wsi, 0, sizeof(physical_device->wsi));
+ memset(physical_device->wsi_device.wsi, 0, sizeof(physical_device->wsi_device.wsi));
#ifdef VK_USE_PLATFORM_XCB_KHR
result = anv_x11_init_wsi(physical_device);
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi[surface->platform];
+ struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_support(surface, device, queueFamilyIndex, pSupported);
}
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi[surface->platform];
+ struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_capabilities(surface, pSurfaceCapabilities);
}
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi[surface->platform];
+ struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_formats(surface, device, pSurfaceFormatCount,
pSurfaceFormats);
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi[surface->platform];
+ struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_present_modes(surface, pPresentModeCount,
pPresentModes);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, pCreateInfo->surface);
struct anv_wsi_interface *iface =
- device->instance->physicalDevice.wsi[surface->platform];
+ device->instance->physicalDevice.wsi_device.wsi[surface->platform];
struct anv_swapchain *swapchain;
VkResult result = iface->create_swapchain(surface, device, pCreateInfo,
}
static struct wsi_wl_display *
-wsi_wl_get_display(struct anv_physical_device *device,
+wsi_wl_get_display(struct anv_wsi_device *wsi_device,
struct wl_display *wl_display)
{
struct wsi_wayland *wsi =
- (struct wsi_wayland *)device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
+ (struct wsi_wayland *)wsi_device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
pthread_mutex_lock(&wsi->mutex);
{
ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
- return wsi_wl_get_display(physical_device, display) != NULL;
+ return wsi_wl_get_display(&physical_device->wsi_device, display) != NULL;
}
static VkResult
{
VkIcdSurfaceWayland *surface = (VkIcdSurfaceWayland *)icd_surface;
struct wsi_wl_display *display =
- wsi_wl_get_display(device, surface->display);
+ wsi_wl_get_display(&device->wsi_device, surface->display);
uint32_t count = u_vector_length(&display->formats);
chain->images[i].buffer = NULL;
chain->queue = NULL;
- chain->display = wsi_wl_get_display(&device->instance->physicalDevice,
+ chain->display = wsi_wl_get_display(&device->instance->physicalDevice.wsi_device,
surface->display);
if (!chain->display) {
result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
wsi->base.get_present_modes = wsi_wl_surface_get_present_modes;
wsi->base.create_swapchain = wsi_wl_surface_create_swapchain;
- device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND] = &wsi->base;
+ device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_WAYLAND] = &wsi->base;
return VK_SUCCESS;
fail_alloc:
vk_free(&device->instance->alloc, wsi);
fail:
- device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND] = NULL;
+ device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_WAYLAND] = NULL;
return result;
}
anv_wl_finish_wsi(struct anv_physical_device *device)
{
struct wsi_wayland *wsi =
- (struct wsi_wayland *)device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
+ (struct wsi_wayland *)device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_WAYLAND];
if (wsi) {
_mesa_hash_table_destroy(wsi->displays, NULL);
}
static struct wsi_x11_connection *
-wsi_x11_get_connection(struct anv_wsi_interface **wsi_dev,
+wsi_x11_get_connection(struct anv_wsi_device *wsi_dev,
const VkAllocationCallbacks *alloc,
xcb_connection_t *conn)
{
struct wsi_x11 *wsi =
- (struct wsi_x11 *)wsi_dev[VK_ICD_WSI_PLATFORM_XCB];
+ (struct wsi_x11 *)wsi_dev->wsi[VK_ICD_WSI_PLATFORM_XCB];
pthread_mutex_lock(&wsi->mutex);
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
struct wsi_x11_connection *wsi_conn =
- wsi_x11_get_connection(device->wsi, &device->instance->alloc, connection);
+ wsi_x11_get_connection(&device->wsi_device, &device->instance->alloc, connection);
if (!wsi_conn->has_dri3) {
fprintf(stderr, "vulkan: No DRI3 support\n");
xcb_window_t window = x11_surface_get_window(icd_surface);
struct wsi_x11_connection *wsi_conn =
- wsi_x11_get_connection(device->wsi, &device->instance->alloc, conn);
+ wsi_x11_get_connection(&device->wsi_device, &device->instance->alloc, conn);
if (!wsi_conn)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
wsi->base.get_present_modes = x11_surface_get_present_modes;
wsi->base.create_swapchain = x11_surface_create_swapchain;
- device->wsi[VK_ICD_WSI_PLATFORM_XCB] = &wsi->base;
- device->wsi[VK_ICD_WSI_PLATFORM_XLIB] = &wsi->base;
+ device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_XCB] = &wsi->base;
+ device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_XLIB] = &wsi->base;
return VK_SUCCESS;
fail_alloc:
vk_free(&device->instance->alloc, wsi);
fail:
- device->wsi[VK_ICD_WSI_PLATFORM_XCB] = NULL;
- device->wsi[VK_ICD_WSI_PLATFORM_XLIB] = NULL;
+ device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_XCB] = NULL;
+ device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_XLIB] = NULL;
return result;
}
anv_x11_finish_wsi(struct anv_physical_device *device)
{
struct wsi_x11 *wsi =
- (struct wsi_x11 *)device->wsi[VK_ICD_WSI_PLATFORM_XCB];
+ (struct wsi_x11 *)device->wsi_device.wsi[VK_ICD_WSI_PLATFORM_XCB];
if (wsi) {
_mesa_hash_table_destroy(wsi->connections, NULL);