[Mesa-dev] [PATCH 2/2] vulkan/wsi: drop local_fd parameter from lots of places.
Dave Airlie
airlied at gmail.com
Wed Nov 29 01:29:49 UTC 2017
From: Dave Airlie <airlied at redhat.com>
this won't change over the driver lifetime, so just set it
in the wsi_device at init, and avoid passing it around
afterwards.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/vulkan/radv_wsi.c | 3 +--
src/amd/vulkan/radv_wsi_x11.c | 2 --
src/intel/vulkan/anv_wsi.c | 4 ++--
src/intel/vulkan/anv_wsi_x11.c | 2 --
src/vulkan/wsi/wsi_common.c | 9 +++++----
src/vulkan/wsi/wsi_common.h | 4 ++--
src/vulkan/wsi/wsi_common_private.h | 2 --
src/vulkan/wsi/wsi_common_wayland.c | 2 --
src/vulkan/wsi/wsi_common_x11.c | 5 +----
src/vulkan/wsi/wsi_common_x11.h | 1 -
10 files changed, 11 insertions(+), 23 deletions(-)
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 51e8ec6..ae80092 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -40,6 +40,7 @@ radv_init_wsi(struct radv_physical_device *physical_device)
{
return wsi_device_init(&physical_device->wsi_device,
radv_physical_device_to_handle(physical_device),
+ physical_device->local_fd,
radv_wsi_proc_addr,
&physical_device->instance->alloc);
}
@@ -71,7 +72,6 @@ VkResult radv_GetPhysicalDeviceSurfaceSupportKHR(
RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
return wsi_common_get_surface_support(&device->wsi_device,
- device->local_fd,
queueFamilyIndex,
surface,
&device->instance->alloc,
@@ -159,7 +159,6 @@ VkResult radv_CreateSwapchainKHR(
return wsi_common_create_swapchain(&device->physical_device->wsi_device,
radv_device_to_handle(device),
- device->physical_device->local_fd,
pCreateInfo,
alloc,
pSwapchain);
diff --git a/src/amd/vulkan/radv_wsi_x11.c b/src/amd/vulkan/radv_wsi_x11.c
index 97d4277..b50405c 100644
--- a/src/amd/vulkan/radv_wsi_x11.c
+++ b/src/amd/vulkan/radv_wsi_x11.c
@@ -46,7 +46,6 @@ VkBool32 radv_GetPhysicalDeviceXcbPresentationSupportKHR(
&device->wsi_device,
&device->instance->alloc,
queueFamilyIndex,
- device->local_fd,
connection, visual_id);
}
@@ -62,7 +61,6 @@ VkBool32 radv_GetPhysicalDeviceXlibPresentationSupportKHR(
&device->wsi_device,
&device->instance->alloc,
queueFamilyIndex,
- device->local_fd,
XGetXCBConnection(dpy), visualID);
}
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 6082c3d..481e233 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -38,6 +38,7 @@ anv_init_wsi(struct anv_physical_device *physical_device)
{
return wsi_device_init(&physical_device->wsi_device,
anv_physical_device_to_handle(physical_device),
+ physical_device->local_fd,
anv_wsi_proc_addr,
&physical_device->instance->alloc);
}
@@ -72,7 +73,6 @@ VkResult anv_GetPhysicalDeviceSurfaceSupportKHR(
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
return wsi_common_get_surface_support(&device->wsi_device,
- device->local_fd,
queueFamilyIndex,
surface,
&device->instance->alloc,
@@ -155,7 +155,7 @@ VkResult anv_CreateSwapchainKHR(
else
alloc = &device->alloc;
- return wsi_common_create_swapchain(wsi_device, _device, device->fd,
+ return wsi_common_create_swapchain(wsi_device, _device,
pCreateInfo, alloc, pSwapchain);
}
diff --git a/src/intel/vulkan/anv_wsi_x11.c b/src/intel/vulkan/anv_wsi_x11.c
index 3042509..2f83f4a 100644
--- a/src/intel/vulkan/anv_wsi_x11.c
+++ b/src/intel/vulkan/anv_wsi_x11.c
@@ -42,7 +42,6 @@ VkBool32 anv_GetPhysicalDeviceXcbPresentationSupportKHR(
&device->wsi_device,
&device->instance->alloc,
queueFamilyIndex,
- device->local_fd,
connection, visual_id);
}
@@ -58,7 +57,6 @@ VkBool32 anv_GetPhysicalDeviceXlibPresentationSupportKHR(
&device->wsi_device,
&device->instance->alloc,
queueFamilyIndex,
- device->local_fd,
XGetXCBConnection(dpy), visualID);
}
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 2de5f15..9770108 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -28,6 +28,7 @@
VkResult
wsi_device_init(struct wsi_device *wsi,
VkPhysicalDevice pdevice,
+ int local_fd,
WSI_FN_GetPhysicalDeviceProcAddr proc_addr,
const VkAllocationCallbacks *alloc)
{
@@ -35,6 +36,8 @@ wsi_device_init(struct wsi_device *wsi,
memset(wsi, 0, sizeof(*wsi));
+ wsi->local_fd = local_fd;
+
#define WSI_GET_CB(func) \
PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func)
WSI_GET_CB(GetPhysicalDeviceMemoryProperties);
@@ -523,7 +526,6 @@ wsi_destroy_image(const struct wsi_swapchain *chain,
VkResult
wsi_common_get_surface_support(struct wsi_device *wsi_device,
- int local_fd,
uint32_t queueFamilyIndex,
VkSurfaceKHR _surface,
const VkAllocationCallbacks *alloc,
@@ -533,7 +535,7 @@ wsi_common_get_surface_support(struct wsi_device *wsi_device,
struct wsi_interface *iface = wsi_device->wsi[surface->platform];
return iface->get_support(surface, wsi_device, alloc,
- queueFamilyIndex, local_fd, pSupported);
+ queueFamilyIndex, pSupported);
}
VkResult
@@ -601,7 +603,6 @@ wsi_common_get_surface_present_modes(struct wsi_device *wsi_device,
VkResult
wsi_common_create_swapchain(struct wsi_device *wsi,
VkDevice device,
- int fd,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkSwapchainKHR *pSwapchain)
@@ -610,7 +611,7 @@ wsi_common_create_swapchain(struct wsi_device *wsi,
struct wsi_interface *iface = wsi->wsi[surface->platform];
struct wsi_swapchain *swapchain;
- VkResult result = iface->create_swapchain(surface, device, wsi, fd,
+ VkResult result = iface->create_swapchain(surface, device, wsi,
pCreateInfo, pAllocator,
&swapchain);
if (result != VK_SUCCESS)
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 3e0d3be..3ca4b72 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -55,6 +55,7 @@ struct wsi_interface;
struct wsi_device {
VkPhysicalDeviceMemoryProperties memory_props;
uint32_t queue_family_count;
+ int local_fd;
#define WSI_CB(cb) PFN_vk##cb cb
WSI_CB(AllocateMemory);
@@ -92,6 +93,7 @@ typedef PFN_vkVoidFunction (VKAPI_PTR *WSI_FN_GetPhysicalDeviceProcAddr)(VkPhysi
VkResult
wsi_device_init(struct wsi_device *wsi,
VkPhysicalDevice pdevice,
+ int local_fd,
WSI_FN_GetPhysicalDeviceProcAddr proc_addr,
const VkAllocationCallbacks *alloc);
@@ -120,7 +122,6 @@ ICD_DEFINE_NONDISP_HANDLE_CASTS(VkIcdSurfaceBase, VkSurfaceKHR)
VkResult
wsi_common_get_surface_support(struct wsi_device *wsi_device,
- int local_fd,
uint32_t queueFamilyIndex,
VkSurfaceKHR surface,
const VkAllocationCallbacks *alloc,
@@ -170,7 +171,6 @@ wsi_common_acquire_next_image(const struct wsi_device *wsi,
VkResult
wsi_common_create_swapchain(struct wsi_device *wsi,
VkDevice device,
- int fd,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkSwapchainKHR *pSwapchain);
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 503b2a0..e89118c 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -96,7 +96,6 @@ struct wsi_interface {
struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
- int local_fd,
VkBool32* pSupported);
VkResult (*get_capabilities)(VkIcdSurfaceBase *surface,
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
@@ -118,7 +117,6 @@ struct wsi_interface {
VkResult (*create_swapchain)(VkIcdSurfaceBase *surface,
VkDevice device,
struct wsi_device *wsi_device,
- int local_fd,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
struct wsi_swapchain **swapchain);
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index be7635b..97a18c2 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -399,7 +399,6 @@ wsi_wl_surface_get_support(VkIcdSurfaceBase *surface,
struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
- int local_fd,
VkBool32* pSupported)
{
*pSupported = true;
@@ -769,7 +768,6 @@ static VkResult
wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
VkDevice device,
struct wsi_device *wsi_device,
- int local_fd,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
struct wsi_swapchain **swapchain_out)
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index b6aaa46..e86a7e3 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -353,7 +353,6 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
struct wsi_device *wsi_device,
VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
- int fd,
xcb_connection_t* connection,
xcb_visualid_t visual_id)
{
@@ -399,7 +398,6 @@ x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
- int local_fd,
VkBool32* pSupported)
{
xcb_connection_t *conn = x11_surface_get_connection(icd_surface);
@@ -1029,7 +1027,6 @@ static VkResult
x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
VkDevice device,
struct wsi_device *wsi_device,
- int local_fd,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks* pAllocator,
struct wsi_swapchain **swapchain_out)
@@ -1078,7 +1075,7 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->threaded = false;
chain->status = VK_SUCCESS;
- if (!wsi_x11_check_dri3_compatible(conn, local_fd))
+ if (!wsi_x11_check_dri3_compatible(conn, wsi_device->local_fd))
chain->base.use_prime_blit = true;
chain->event_id = xcb_generate_id(chain->conn);
diff --git a/src/vulkan/wsi/wsi_common_x11.h b/src/vulkan/wsi/wsi_common_x11.h
index 01f1d66..7166f09 100644
--- a/src/vulkan/wsi/wsi_common_x11.h
+++ b/src/vulkan/wsi/wsi_common_x11.h
@@ -29,7 +29,6 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
struct wsi_device *wsi_device,
VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
- int local_fd,
xcb_connection_t* connection,
xcb_visualid_t visual_id);
--
2.9.5
More information about the mesa-dev
mailing list