[Mesa-dev] [PATCH 27/28] vulkan/wsi: Drop some unneeded cruft from the API
Jason Ekstrand
jason at jlekstrand.net
Thu Nov 16 21:29:15 UTC 2017
This drops the unneeded callbacks struct as well as the queue_get_family
callback we were using before we'd pulled QueuePresent inside.
---
src/amd/vulkan/radv_wsi.c | 18 +-----------------
src/intel/vulkan/anv_wsi.c | 19 +------------------
src/vulkan/wsi/wsi_common.c | 1 +
src/vulkan/wsi/wsi_common.h | 17 ++---------------
src/vulkan/wsi/wsi_common_wayland.c | 11 +++++------
5 files changed, 10 insertions(+), 56 deletions(-)
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 22ace6f..aa06944 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -29,24 +29,12 @@
#include "vk_util.h"
#include "util/macros.h"
-#define WSI_CB(x) .x = radv_##x
-MAYBE_UNUSED static const struct wsi_callbacks wsi_cbs = {
- WSI_CB(GetPhysicalDeviceFormatProperties),
-};
-
static PFN_vkVoidFunction
radv_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
{
return radv_lookup_entrypoint(pName);
}
-static uint32_t
-anv_wsi_queue_get_family_index(VkQueue _queue)
-{
- RADV_FROM_HANDLE(radv_queue, queue, _queue);
- return queue->queue_family_index;
-}
-
VkResult
radv_init_wsi(struct radv_physical_device *physical_device)
{
@@ -56,9 +44,6 @@ radv_init_wsi(struct radv_physical_device *physical_device)
radv_physical_device_to_handle(physical_device),
radv_wsi_proc_addr);
- physical_device->wsi_device.queue_get_family_index =
- anv_wsi_queue_get_family_index;
-
#ifdef VK_USE_PLATFORM_XCB_KHR
result = wsi_x11_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
if (result != VK_SUCCESS)
@@ -67,8 +52,7 @@ radv_init_wsi(struct radv_physical_device *physical_device)
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
result = wsi_wl_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc,
- radv_physical_device_to_handle(physical_device),
- &wsi_cbs);
+ radv_physical_device_to_handle(physical_device));
if (result != VK_SUCCESS) {
#ifdef VK_USE_PLATFORM_XCB_KHR
wsi_x11_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 6ff8ebd..add983f 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -26,13 +26,6 @@
#include "vk_format_info.h"
#include "vk_util.h"
-#ifdef VK_USE_PLATFORM_WAYLAND_KHR
-#define WSI_CB(x) .x = anv_##x
-static const struct wsi_callbacks wsi_cbs = {
- WSI_CB(GetPhysicalDeviceFormatProperties),
-};
-#endif
-
static PFN_vkVoidFunction
anv_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
{
@@ -40,12 +33,6 @@ anv_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
return anv_lookup_entrypoint(&physical_device->info, pName);
}
-static uint32_t
-anv_wsi_queue_get_family_index(VkQueue queue)
-{
- return 0;
-}
-
VkResult
anv_init_wsi(struct anv_physical_device *physical_device)
{
@@ -55,9 +42,6 @@ anv_init_wsi(struct anv_physical_device *physical_device)
anv_physical_device_to_handle(physical_device),
anv_wsi_proc_addr);
- physical_device->wsi_device.queue_get_family_index =
- anv_wsi_queue_get_family_index;
-
#ifdef VK_USE_PLATFORM_XCB_KHR
result = wsi_x11_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
if (result != VK_SUCCESS)
@@ -66,8 +50,7 @@ anv_init_wsi(struct anv_physical_device *physical_device)
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
result = wsi_wl_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc,
- anv_physical_device_to_handle(physical_device),
- &wsi_cbs);
+ anv_physical_device_to_handle(physical_device));
if (result != VK_SUCCESS) {
#ifdef VK_USE_PLATFORM_XCB_KHR
wsi_x11_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index f6a02df..cd98e95 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -64,6 +64,7 @@ wsi_device_init(struct wsi_device *wsi,
WSI_GET_CB(GetImageMemoryRequirements);
WSI_GET_CB(GetImageSubresourceLayout);
WSI_GET_CB(GetMemoryFdKHR);
+ WSI_GET_CB(GetPhysicalDeviceFormatProperties);
WSI_GET_CB(ResetFences);
WSI_GET_CB(QueueSubmit);
WSI_GET_CB(WaitForFences);
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 34283a9..2225fe0 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -48,8 +48,6 @@ struct wsi_device {
VkPhysicalDeviceMemoryProperties memory_props;
uint32_t queue_family_count;
- uint32_t (*queue_get_family_index)(VkQueue queue);
-
#define WSI_CB(cb) PFN_vk##cb cb
WSI_CB(AllocateMemory);
WSI_CB(AllocateCommandBuffers);
@@ -72,6 +70,7 @@ struct wsi_device {
WSI_CB(GetImageMemoryRequirements);
WSI_CB(GetImageSubresourceLayout);
WSI_CB(GetMemoryFdKHR);
+ WSI_CB(GetPhysicalDeviceFormatProperties);
WSI_CB(ResetFences);
WSI_CB(QueueSubmit);
WSI_CB(WaitForFences);
@@ -87,17 +86,6 @@ wsi_device_init(struct wsi_device *wsi,
VkPhysicalDevice pdevice,
WSI_FN_GetPhysicalDeviceProcAddr proc_addr);
-#define WSI_CB(cb) PFN_vk##cb cb
-struct wsi_callbacks {
- VkPhysicalDevice (*device_get_physical)(VkDevice);
-
- WSI_CB(GetDeviceProcAddr);
- WSI_CB(GetPhysicalDeviceFormatProperties);
- WSI_CB(GetPhysicalDeviceMemoryProperties);
- WSI_CB(GetPhysicalDeviceQueueFamilyProperties);
-};
-#undef WSI_CB
-
#define ICD_DEFINE_NONDISP_HANDLE_CASTS(__VkIcdType, __VkType) \
\
static inline __VkIcdType * \
@@ -123,8 +111,7 @@ void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
- VkPhysicalDevice physical_device,
- const struct wsi_callbacks *cbs);
+ VkPhysicalDevice physical_device);
void wsi_wl_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 3e2ff49..be7635b 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -67,10 +67,10 @@ struct wsi_wl_display {
struct wsi_wayland {
struct wsi_interface base;
+ struct wsi_device *wsi;
+
const VkAllocationCallbacks *alloc;
VkPhysicalDevice physical_device;
-
- const struct wsi_callbacks *cbs;
};
static void
@@ -85,7 +85,7 @@ wsi_wl_display_add_vk_format(struct wsi_wl_display *display, VkFormat format)
/* Don't add formats that aren't renderable. */
VkFormatProperties props;
- display->wsi_wl->cbs->GetPhysicalDeviceFormatProperties(display->wsi_wl->physical_device,
+ display->wsi_wl->wsi->GetPhysicalDeviceFormatProperties(display->wsi_wl->physical_device,
format, &props);
if (!(props.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT))
return;
@@ -872,8 +872,7 @@ fail:
VkResult
wsi_wl_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
- VkPhysicalDevice physical_device,
- const struct wsi_callbacks *cbs)
+ VkPhysicalDevice physical_device)
{
struct wsi_wayland *wsi;
VkResult result;
@@ -887,7 +886,7 @@ wsi_wl_init_wsi(struct wsi_device *wsi_device,
wsi->physical_device = physical_device;
wsi->alloc = alloc;
- wsi->cbs = cbs;
+ wsi->wsi = wsi_device;
wsi->base.get_support = wsi_wl_surface_get_support;
wsi->base.get_capabilities = wsi_wl_surface_get_capabilities;
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list