[Mesa-dev] [PATCH 19/22] anv/wsi: remove all anv references from WSI common code
Dave Airlie
airlied at gmail.com
Mon Oct 17 04:24:42 UTC 2016
From: Dave Airlie <airlied at redhat.com>
the WSI code should be now be clean for sharing.
---
src/intel/vulkan/Makefile.sources | 1 -
src/intel/vulkan/anv_private.h | 2 +-
src/intel/vulkan/anv_wsi.c | 41 +++++++++---------
src/intel/vulkan/anv_wsi.h | 50 ----------------------
src/intel/vulkan/anv_wsi_wayland.c | 8 +---
src/intel/vulkan/anv_wsi_x11.c | 14 +++----
src/intel/vulkan/wsi_common.h | 45 +++++++++++---------
src/intel/vulkan/wsi_common_wayland.c | 78 ++++++++++++++++++++---------------
src/intel/vulkan/wsi_common_wayland.h | 6 ++-
src/intel/vulkan/wsi_common_x11.c | 36 ++++++++--------
src/intel/vulkan/wsi_common_x11.h | 10 +++--
11 files changed, 127 insertions(+), 164 deletions(-)
delete mode 100644 src/intel/vulkan/anv_wsi.h
diff --git a/src/intel/vulkan/Makefile.sources b/src/intel/vulkan/Makefile.sources
index bd3afc0..b88dccb 100644
--- a/src/intel/vulkan/Makefile.sources
+++ b/src/intel/vulkan/Makefile.sources
@@ -42,7 +42,6 @@ VULKAN_FILES := \
anv_query.c \
anv_util.c \
anv_wsi.c \
- anv_wsi.h \
wsi_common.h \
genX_pipeline_util.h \
vk_format_info.h
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 9a508a2..0f4a724 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -477,7 +477,7 @@ struct anv_physical_device {
uint32_t eu_total;
uint32_t subslice_total;
- struct anv_wsi_device wsi_device;
+ struct wsi_device wsi_device;
};
struct anv_instance {
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 84edeeb..064581d 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -21,10 +21,11 @@
* IN THE SOFTWARE.
*/
-#include "anv_wsi.h"
+#include "anv_private.h"
+#include "wsi_common.h"
#include "vk_format_info.h"
-static const struct anv_wsi_callbacks anv_wsi_cbs = {
+static const struct wsi_callbacks wsi_cbs = {
.get_phys_device_format_properties = anv_GetPhysicalDeviceFormatProperties,
};
@@ -36,18 +37,18 @@ anv_init_wsi(struct anv_physical_device *physical_device)
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->wsi_device, &physical_device->instance->alloc);
+ result = wsi_x11_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
if (result != VK_SUCCESS)
return result;
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- result = anv_wl_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc,
+ result = wsi_wl_init_wsi(&physical_device->wsi_device, &physical_device->instance->alloc,
anv_physical_device_to_handle(physical_device),
- &anv_wsi_cbs);
+ &wsi_cbs);
if (result != VK_SUCCESS) {
#ifdef VK_USE_PLATFORM_XCB_KHR
- anv_x11_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
+ wsi_x11_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
#endif
return result;
}
@@ -60,10 +61,10 @@ void
anv_finish_wsi(struct anv_physical_device *physical_device)
{
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
- anv_wl_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
+ wsi_wl_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
- anv_x11_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
+ wsi_x11_finish_wsi(&physical_device->wsi_device, &physical_device->instance->alloc);
#endif
}
@@ -86,7 +87,7 @@ VkResult anv_GetPhysicalDeviceSurfaceSupportKHR(
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
+ struct wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_support(surface, &device->wsi_device,
&device->instance->alloc,
@@ -100,7 +101,7 @@ VkResult anv_GetPhysicalDeviceSurfaceCapabilitiesKHR(
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
+ struct wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_capabilities(surface, pSurfaceCapabilities);
}
@@ -113,7 +114,7 @@ VkResult anv_GetPhysicalDeviceSurfaceFormatsKHR(
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
+ struct wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_formats(surface, &device->wsi_device, pSurfaceFormatCount,
pSurfaceFormats);
@@ -127,7 +128,7 @@ VkResult anv_GetPhysicalDeviceSurfacePresentModesKHR(
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- struct anv_wsi_interface *iface = device->wsi_device.wsi[surface->platform];
+ struct wsi_interface *iface = device->wsi_device.wsi[surface->platform];
return iface->get_present_modes(surface, pPresentModeCount,
pPresentModes);
@@ -244,7 +245,7 @@ x11_anv_wsi_image_free(VkDevice device,
anv_FreeMemory(device, memory_h, pAllocator);
}
-static const struct anv_wsi_image_fns anv_wsi_image_fns = {
+static const struct wsi_image_fns anv_wsi_image_fns = {
.create_wsi_image = x11_anv_wsi_image_create,
.free_wsi_image = x11_anv_wsi_image_free,
};
@@ -257,9 +258,9 @@ VkResult anv_CreateSwapchainKHR(
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, pCreateInfo->surface);
- struct anv_wsi_interface *iface =
+ struct wsi_interface *iface =
device->instance->physicalDevice.wsi_device.wsi[surface->platform];
- struct anv_swapchain *swapchain;
+ struct wsi_swapchain *swapchain;
const VkAllocationCallbacks *alloc;
if (pAllocator)
@@ -279,7 +280,7 @@ VkResult anv_CreateSwapchainKHR(
for (unsigned i = 0; i < ARRAY_SIZE(swapchain->fences); i++)
swapchain->fences[i] = VK_NULL_HANDLE;
- *pSwapchain = anv_swapchain_to_handle(swapchain);
+ *pSwapchain = wsi_swapchain_to_handle(swapchain);
return VK_SUCCESS;
}
@@ -290,7 +291,7 @@ void anv_DestroySwapchainKHR(
const VkAllocationCallbacks* pAllocator)
{
ANV_FROM_HANDLE(anv_device, device, _device);
- ANV_FROM_HANDLE(anv_swapchain, swapchain, _swapchain);
+ ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
const VkAllocationCallbacks *alloc;
if (pAllocator)
@@ -311,7 +312,7 @@ VkResult anv_GetSwapchainImagesKHR(
uint32_t* pSwapchainImageCount,
VkImage* pSwapchainImages)
{
- ANV_FROM_HANDLE(anv_swapchain, swapchain, _swapchain);
+ ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
return swapchain->get_images(swapchain, pSwapchainImageCount,
pSwapchainImages);
@@ -325,7 +326,7 @@ VkResult anv_AcquireNextImageKHR(
VkFence fence,
uint32_t* pImageIndex)
{
- ANV_FROM_HANDLE(anv_swapchain, swapchain, _swapchain);
+ ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
return swapchain->acquire_next_image(swapchain, timeout, semaphore,
pImageIndex);
@@ -339,7 +340,7 @@ VkResult anv_QueuePresentKHR(
VkResult result;
for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) {
- ANV_FROM_HANDLE(anv_swapchain, swapchain, pPresentInfo->pSwapchains[i]);
+ ANV_FROM_HANDLE(wsi_swapchain, swapchain, pPresentInfo->pSwapchains[i]);
assert(anv_device_from_handle(swapchain->device) == queue->device);
diff --git a/src/intel/vulkan/anv_wsi.h b/src/intel/vulkan/anv_wsi.h
deleted file mode 100644
index 1cf3cae..0000000
--- a/src/intel/vulkan/anv_wsi.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2015 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef ANV_WSI_H
-#define ANV_WSI_H
-
-#include "anv_private.h"
-
-struct anv_swapchain;
-
-ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_swapchain, VkSwapchainKHR)
-
-struct anv_wsi_callbacks {
- void (*get_phys_device_format_properties)(VkPhysicalDevice physicalDevice,
- VkFormat format,
- VkFormatProperties *pFormatProperties);
-};
-
-VkResult anv_x11_init_wsi(struct anv_wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc);
-void anv_x11_finish_wsi(struct anv_wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc);
-
-VkResult anv_wl_init_wsi(struct anv_wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc,
- VkPhysicalDevice physical_device,
- const struct anv_wsi_callbacks *cbs);
-void anv_wl_finish_wsi(struct anv_wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc);
-#endif /* ANV_WSI_H */
diff --git a/src/intel/vulkan/anv_wsi_wayland.c b/src/intel/vulkan/anv_wsi_wayland.c
index 79dbf70..bd59cf4 100644
--- a/src/intel/vulkan/anv_wsi_wayland.c
+++ b/src/intel/vulkan/anv_wsi_wayland.c
@@ -24,12 +24,8 @@
#include <wayland-client.h>
#include <wayland-drm-client-protocol.h>
-#include "anv_wsi.h"
-
-#include "vk_format_info.h"
-#include <util/hash_table.h>
-
#include "wsi_common_wayland.h"
+#include "anv_private.h"
VkBool32 anv_GetPhysicalDeviceWaylandPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
@@ -56,5 +52,5 @@ VkResult anv_CreateWaylandSurfaceKHR(
else
alloc = &instance->alloc;
- return anv_create_wl_surface(alloc, pCreateInfo, pSurface);
+ return wsi_create_wl_surface(alloc, pCreateInfo, pSurface);
}
diff --git a/src/intel/vulkan/anv_wsi_x11.c b/src/intel/vulkan/anv_wsi_x11.c
index 1a23b2d..60bc568 100644
--- a/src/intel/vulkan/anv_wsi_x11.c
+++ b/src/intel/vulkan/anv_wsi_x11.c
@@ -27,12 +27,8 @@
#include <xcb/dri3.h>
#include <xcb/present.h>
-#include "anv_wsi.h"
-
#include "wsi_common_x11.h"
-
-#include "vk_format_info.h"
-#include "util/hash_table.h"
+#include "anv_private.h"
VkBool32 anv_GetPhysicalDeviceXcbPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
@@ -42,7 +38,7 @@ VkBool32 anv_GetPhysicalDeviceXcbPresentationSupportKHR(
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
- return anv_get_physical_device_xcb_presentation_support(
+ return wsi_get_physical_device_xcb_presentation_support(
&device->wsi_device,
&device->instance->alloc,
queueFamilyIndex, connection, visual_id);
@@ -56,7 +52,7 @@ VkBool32 anv_GetPhysicalDeviceXlibPresentationSupportKHR(
{
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
- return anv_get_physical_device_xcb_presentation_support(
+ return wsi_get_physical_device_xcb_presentation_support(
&device->wsi_device,
&device->instance->alloc,
queueFamilyIndex, XGetXCBConnection(dpy), visualID);
@@ -77,7 +73,7 @@ VkResult anv_CreateXcbSurfaceKHR(
else
alloc = &instance->alloc;
- return anv_create_xcb_surface(alloc, pCreateInfo, pSurface);
+ return wsi_create_xcb_surface(alloc, pCreateInfo, pSurface);
}
VkResult anv_CreateXlibSurfaceKHR(
@@ -96,5 +92,5 @@ VkResult anv_CreateXlibSurfaceKHR(
else
alloc = &instance->alloc;
- return anv_create_xlib_surface(alloc, pCreateInfo, pSurface);
+ return wsi_create_xlib_surface(alloc, pCreateInfo, pSurface);
}
diff --git a/src/intel/vulkan/wsi_common.h b/src/intel/vulkan/wsi_common.h
index b7d6d09..769bd6d 100644
--- a/src/intel/vulkan/wsi_common.h
+++ b/src/intel/vulkan/wsi_common.h
@@ -8,8 +8,8 @@
#include <vulkan/vulkan.h>
#include <vulkan/vk_icd.h>
-struct anv_wsi_device;
-struct anv_wsi_image_fns {
+struct wsi_device;
+struct wsi_image_fns {
VkResult (*create_wsi_image)(VkDevice device_h,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
@@ -25,34 +25,34 @@ struct anv_wsi_image_fns {
VkDeviceMemory memory_h);
};
-struct anv_swapchain {
+struct wsi_swapchain {
VkDevice device;
VkAllocationCallbacks alloc;
- const struct anv_wsi_image_fns *image_fns;
+ const struct wsi_image_fns *image_fns;
VkFence fences[3];
- VkResult (*destroy)(struct anv_swapchain *swapchain,
+ VkResult (*destroy)(struct wsi_swapchain *swapchain,
const VkAllocationCallbacks *pAllocator);
- VkResult (*get_images)(struct anv_swapchain *swapchain,
+ VkResult (*get_images)(struct wsi_swapchain *swapchain,
uint32_t *pCount, VkImage *pSwapchainImages);
- VkResult (*acquire_next_image)(struct anv_swapchain *swap_chain,
+ VkResult (*acquire_next_image)(struct wsi_swapchain *swap_chain,
uint64_t timeout, VkSemaphore semaphore,
uint32_t *image_index);
- VkResult (*queue_present)(struct anv_swapchain *swap_chain,
+ VkResult (*queue_present)(struct wsi_swapchain *swap_chain,
uint32_t image_index);
};
-struct anv_wsi_interface {
+struct wsi_interface {
VkResult (*get_support)(VkIcdSurfaceBase *surface,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
VkBool32* pSupported);
VkResult (*get_capabilities)(VkIcdSurfaceBase *surface,
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
VkResult (*get_formats)(VkIcdSurfaceBase *surface,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
uint32_t* pSurfaceFormatCount,
VkSurfaceFormatKHR* pSurfaceFormats);
VkResult (*get_present_modes)(VkIcdSurfaceBase *surface,
@@ -60,20 +60,20 @@ struct anv_wsi_interface {
VkPresentModeKHR* pPresentModes);
VkResult (*create_swapchain)(VkIcdSurfaceBase *surface,
VkDevice device,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
- const struct anv_wsi_image_fns *image_fns,
- struct anv_swapchain **swapchain);
+ const struct wsi_image_fns *image_fns,
+ struct wsi_swapchain **swapchain);
};
#define VK_ICD_WSI_PLATFORM_MAX 5
-struct anv_wsi_device {
- struct anv_wsi_interface * wsi[VK_ICD_WSI_PLATFORM_MAX];
+struct wsi_device {
+ struct wsi_interface * wsi[VK_ICD_WSI_PLATFORM_MAX];
};
-struct anv_wsi_callbacks {
+struct wsi_callbacks {
void (*get_phys_device_format_properties)(VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormatProperties *pFormatProperties);
@@ -94,10 +94,17 @@ struct anv_wsi_callbacks {
}
WSI_DEFINE_NONDISP_HANDLE_CASTS(_VkIcdSurfaceBase, VkSurfaceKHR)
+WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, VkSwapchainKHR)
+VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
+ const VkAllocationCallbacks *alloc,
+ VkPhysicalDevice physical_device,
+ const struct wsi_callbacks *cbs);
+void wsi_wl_finish_wsi(struct wsi_device *wsi_device,
+ const VkAllocationCallbacks *alloc);
-VkResult anv_x11_init_wsi(struct anv_wsi_device *wsi_device,
+VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
-void anv_x11_finish_wsi(struct anv_wsi_device *wsi_device,
+void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc);
#endif
diff --git a/src/intel/vulkan/wsi_common_wayland.c b/src/intel/vulkan/wsi_common_wayland.c
index a057110..fc6775a 100644
--- a/src/intel/vulkan/wsi_common_wayland.c
+++ b/src/intel/vulkan/wsi_common_wayland.c
@@ -24,11 +24,21 @@
#include <wayland-client.h>
#include <wayland-drm-client-protocol.h>
-#include "anv_wsi.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
#include "wsi_common_wayland.h"
#include "vk_format_info.h"
#include <util/hash_table.h>
+#include <util/u_vector.h>
+
+#define typed_memcpy(dest, src, count) ({ \
+ static_assert(sizeof(*src) == sizeof(*dest), ""); \
+ memcpy((dest), (src), (count) * sizeof(*(src))); \
+})
#define MIN_NUM_IMAGES 2
@@ -46,7 +56,7 @@ struct wsi_wl_display {
};
struct wsi_wayland {
- struct anv_wsi_interface base;
+ struct wsi_interface base;
const VkAllocationCallbacks *alloc;
VkPhysicalDevice physical_device;
@@ -55,7 +65,7 @@ struct wsi_wayland {
/* Hash table of wl_display -> wsi_wl_display mappings */
struct hash_table * displays;
- const struct anv_wsi_callbacks *cbs;
+ const struct wsi_callbacks *cbs;
};
static void
@@ -293,7 +303,7 @@ fail:
}
static struct wsi_wl_display *
-wsi_wl_get_display(struct anv_wsi_device *wsi_device,
+wsi_wl_get_display(struct wsi_device *wsi_device,
struct wl_display *wl_display)
{
struct wsi_wayland *wsi =
@@ -328,7 +338,7 @@ wsi_wl_get_display(struct anv_wsi_device *wsi_device,
}
VkBool32
-wsi_wl_get_presentation_support(struct anv_wsi_device *wsi_device,
+wsi_wl_get_presentation_support(struct wsi_device *wsi_device,
struct wl_display *wl_display)
{
return wsi_wl_get_display(wsi_device, wl_display) != NULL;
@@ -336,7 +346,7 @@ wsi_wl_get_presentation_support(struct anv_wsi_device *wsi_device,
static VkResult
wsi_wl_surface_get_support(VkIcdSurfaceBase *surface,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
VkBool32* pSupported)
@@ -379,7 +389,7 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
static VkResult
wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
uint32_t* pSurfaceFormatCount,
VkSurfaceFormatKHR* pSurfaceFormats)
{
@@ -426,7 +436,7 @@ wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *surface,
return VK_SUCCESS;
}
-VkResult anv_create_wl_surface(const VkAllocationCallbacks *pAllocator,
+VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
VkSurfaceKHR *pSurface)
{
@@ -435,7 +445,7 @@ VkResult anv_create_wl_surface(const VkAllocationCallbacks *pAllocator,
surface = vk_alloc(pAllocator, sizeof *surface, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (surface == NULL)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
surface->base.platform = VK_ICD_WSI_PLATFORM_WAYLAND;
surface->display = pCreateInfo->display;
@@ -454,7 +464,7 @@ struct wsi_wl_image {
};
struct wsi_wl_swapchain {
- struct anv_swapchain base;
+ struct wsi_swapchain base;
struct wsi_wl_display * display;
struct wl_event_queue * queue;
@@ -472,10 +482,10 @@ struct wsi_wl_swapchain {
};
static VkResult
-wsi_wl_swapchain_get_images(struct anv_swapchain *anv_chain,
+wsi_wl_swapchain_get_images(struct wsi_swapchain *wsi_chain,
uint32_t *pCount, VkImage *pSwapchainImages)
{
- struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)anv_chain;
+ struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
if (pSwapchainImages == NULL) {
*pCount = chain->image_count;
@@ -492,12 +502,12 @@ wsi_wl_swapchain_get_images(struct anv_swapchain *anv_chain,
}
static VkResult
-wsi_wl_swapchain_acquire_next_image(struct anv_swapchain *anv_chain,
+wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain *wsi_chain,
uint64_t timeout,
VkSemaphore semaphore,
uint32_t *image_index)
{
- struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)anv_chain;
+ struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
int ret = wl_display_dispatch_queue_pending(chain->display->display,
chain->queue);
@@ -506,7 +516,7 @@ wsi_wl_swapchain_acquire_next_image(struct anv_swapchain *anv_chain,
* kicked by the server so this seems more-or-less correct.
*/
if (ret < 0)
- return vk_error(VK_ERROR_OUT_OF_DATE_KHR);
+ return VK_ERROR_OUT_OF_DATE_KHR;
while (1) {
for (uint32_t i = 0; i < chain->image_count; i++) {
@@ -524,7 +534,7 @@ wsi_wl_swapchain_acquire_next_image(struct anv_swapchain *anv_chain,
int ret = wl_display_roundtrip_queue(chain->display->display,
chain->queue);
if (ret < 0)
- return vk_error(VK_ERROR_OUT_OF_DATE_KHR);
+ return VK_ERROR_OUT_OF_DATE_KHR;
}
}
@@ -543,17 +553,17 @@ static const struct wl_callback_listener frame_listener = {
};
static VkResult
-wsi_wl_swapchain_queue_present(struct anv_swapchain *anv_chain,
+wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
uint32_t image_index)
{
- struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)anv_chain;
+ struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
if (chain->present_mode == VK_PRESENT_MODE_FIFO_KHR) {
while (!chain->fifo_ready) {
int ret = wl_display_dispatch_queue(chain->display->display,
chain->queue);
if (ret < 0)
- return vk_error(VK_ERROR_OUT_OF_DATE_KHR);
+ return VK_ERROR_OUT_OF_DATE_KHR;
}
}
@@ -636,10 +646,10 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
}
static VkResult
-wsi_wl_swapchain_destroy(struct anv_swapchain *anv_chain,
+wsi_wl_swapchain_destroy(struct wsi_swapchain *wsi_chain,
const VkAllocationCallbacks *pAllocator)
{
- struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)anv_chain;
+ struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
for (uint32_t i = 0; i < chain->image_count; i++) {
if (chain->images[i].buffer)
@@ -656,11 +666,11 @@ wsi_wl_swapchain_destroy(struct anv_swapchain *anv_chain,
static VkResult
wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
VkDevice device,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
- const struct anv_wsi_image_fns *image_fns,
- struct anv_swapchain **swapchain_out)
+ const struct wsi_image_fns *image_fns,
+ struct wsi_swapchain **swapchain_out)
{
VkIcdSurfaceWayland *surface = (VkIcdSurfaceWayland *)icd_surface;
struct wsi_wl_swapchain *chain;
@@ -685,7 +695,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain = vk_alloc(pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (chain == NULL)
- return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
chain->base.device = device;
chain->base.destroy = wsi_wl_swapchain_destroy;
@@ -713,13 +723,13 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->display = wsi_wl_get_display(wsi_device,
surface->display);
if (!chain->display) {
- result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
+ result = VK_ERROR_INITIALIZATION_FAILED;
goto fail;
}
chain->queue = wl_display_create_queue(chain->display->display);
if (!chain->queue) {
- result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
+ result = VK_ERROR_INITIALIZATION_FAILED;
goto fail;
}
@@ -742,10 +752,10 @@ fail:
}
VkResult
-anv_wl_init_wsi(struct anv_wsi_device *wsi_device,
+wsi_wl_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
VkPhysicalDevice physical_device,
- const struct anv_wsi_callbacks *cbs)
+ const struct wsi_callbacks *cbs)
{
struct wsi_wayland *wsi;
VkResult result;
@@ -753,7 +763,7 @@ anv_wl_init_wsi(struct anv_wsi_device *wsi_device,
wsi = vk_alloc(alloc, sizeof(*wsi), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!wsi) {
- result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto fail;
}
@@ -763,10 +773,10 @@ anv_wl_init_wsi(struct anv_wsi_device *wsi_device,
int ret = pthread_mutex_init(&wsi->mutex, NULL);
if (ret != 0) {
if (ret == ENOMEM) {
- result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
} else {
/* FINISHME: Choose a better error. */
- result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
}
goto fail_alloc;
@@ -775,7 +785,7 @@ anv_wl_init_wsi(struct anv_wsi_device *wsi_device,
wsi->displays = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
if (!wsi->displays) {
- result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ result = VK_ERROR_OUT_OF_HOST_MEMORY;
goto fail_mutex;
}
@@ -801,7 +811,7 @@ fail:
}
void
-anv_wl_finish_wsi(struct anv_wsi_device *wsi_device,
+wsi_wl_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc)
{
struct wsi_wayland *wsi =
diff --git a/src/intel/vulkan/wsi_common_wayland.h b/src/intel/vulkan/wsi_common_wayland.h
index 3ac5dcb..3283b78 100644
--- a/src/intel/vulkan/wsi_common_wayland.h
+++ b/src/intel/vulkan/wsi_common_wayland.h
@@ -1,11 +1,13 @@
#ifndef WSI_COMMON_WAYLAND_H
#define WSI_COMMON_WAYLAND_H
+#include "wsi_common.h"
+
VkBool32
-wsi_wl_get_presentation_support(struct anv_wsi_device *wsi_device,
+wsi_wl_get_presentation_support(struct wsi_device *wsi_device,
struct wl_display *wl_display);
-VkResult anv_create_wl_surface(const VkAllocationCallbacks *pAllocator,
+VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
VkSurfaceKHR *pSurface);
#endif
diff --git a/src/intel/vulkan/wsi_common_x11.c b/src/intel/vulkan/wsi_common_x11.c
index b494740..02b6eb6 100644
--- a/src/intel/vulkan/wsi_common_x11.c
+++ b/src/intel/vulkan/wsi_common_x11.c
@@ -47,7 +47,7 @@ struct wsi_x11_connection {
};
struct wsi_x11 {
- struct anv_wsi_interface base;
+ struct wsi_interface base;
pthread_mutex_t mutex;
/* Hash table of xcb_connection -> wsi_x11_connection mappings */
@@ -96,7 +96,7 @@ wsi_x11_connection_destroy(const VkAllocationCallbacks *alloc,
}
static struct wsi_x11_connection *
-wsi_x11_get_connection(struct anv_wsi_device *wsi_dev,
+wsi_x11_get_connection(struct wsi_device *wsi_dev,
const VkAllocationCallbacks *alloc,
xcb_connection_t *conn)
{
@@ -242,8 +242,8 @@ visual_has_alpha(xcb_visualtype_t *visual, unsigned depth)
return (all_mask & ~rgb_mask) != 0;
}
-VkBool32 anv_get_physical_device_xcb_presentation_support(
- struct anv_wsi_device *wsi_device,
+VkBool32 wsi_get_physical_device_xcb_presentation_support(
+ struct wsi_device *wsi_device,
VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
xcb_connection_t* connection,
@@ -287,7 +287,7 @@ x11_surface_get_window(VkIcdSurfaceBase *icd_surface)
static VkResult
x11_surface_get_support(VkIcdSurfaceBase *icd_surface,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
VkBool32* pSupported)
@@ -382,7 +382,7 @@ x11_surface_get_capabilities(VkIcdSurfaceBase *icd_surface,
static VkResult
x11_surface_get_formats(VkIcdSurfaceBase *surface,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
uint32_t *pSurfaceFormatCount,
VkSurfaceFormatKHR *pSurfaceFormats)
{
@@ -415,7 +415,7 @@ x11_surface_get_present_modes(VkIcdSurfaceBase *surface,
return VK_SUCCESS;
}
-VkResult anv_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
+VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
VkSurfaceKHR *pSurface)
{
@@ -434,7 +434,7 @@ VkResult anv_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
return VK_SUCCESS;
}
-VkResult anv_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
+VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
VkSurfaceKHR *pSurface)
{
@@ -463,7 +463,7 @@ struct x11_image {
};
struct x11_swapchain {
- struct anv_swapchain base;
+ struct wsi_swapchain base;
xcb_connection_t * conn;
xcb_window_t window;
@@ -480,7 +480,7 @@ struct x11_swapchain {
};
static VkResult
-x11_get_images(struct anv_swapchain *anv_chain,
+x11_get_images(struct wsi_swapchain *anv_chain,
uint32_t* pCount, VkImage *pSwapchainImages)
{
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
@@ -536,7 +536,7 @@ x11_handle_dri3_present_event(struct x11_swapchain *chain,
}
static VkResult
-x11_acquire_next_image(struct anv_swapchain *anv_chain,
+x11_acquire_next_image(struct wsi_swapchain *anv_chain,
uint64_t timeout,
VkSemaphore semaphore,
uint32_t *image_index)
@@ -568,7 +568,7 @@ x11_acquire_next_image(struct anv_swapchain *anv_chain,
}
static VkResult
-x11_queue_present(struct anv_swapchain *anv_chain,
+x11_queue_present(struct wsi_swapchain *anv_chain,
uint32_t image_index)
{
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
@@ -703,7 +703,7 @@ x11_image_finish(struct x11_swapchain *chain,
}
static VkResult
-x11_swapchain_destroy(struct anv_swapchain *anv_chain,
+x11_swapchain_destroy(struct wsi_swapchain *anv_chain,
const VkAllocationCallbacks *pAllocator)
{
struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;
@@ -720,11 +720,11 @@ x11_swapchain_destroy(struct anv_swapchain *anv_chain,
static VkResult
x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
VkDevice device,
- struct anv_wsi_device *wsi_device,
+ struct wsi_device *wsi_device,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks* pAllocator,
- const struct anv_wsi_image_fns *image_fns,
- struct anv_swapchain **swapchain_out)
+ const struct wsi_image_fns *image_fns,
+ struct wsi_swapchain **swapchain_out)
{
struct x11_swapchain *chain;
xcb_void_cookie_t cookie;
@@ -813,7 +813,7 @@ fail_register:
}
VkResult
-anv_x11_init_wsi(struct anv_wsi_device *wsi_device,
+wsi_x11_init_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc)
{
struct wsi_x11 *wsi;
@@ -868,7 +868,7 @@ fail:
}
void
-anv_x11_finish_wsi(struct anv_wsi_device *wsi_device,
+wsi_x11_finish_wsi(struct wsi_device *wsi_device,
const VkAllocationCallbacks *alloc)
{
struct wsi_x11 *wsi =
diff --git a/src/intel/vulkan/wsi_common_x11.h b/src/intel/vulkan/wsi_common_x11.h
index e71fd77..70b145c 100644
--- a/src/intel/vulkan/wsi_common_x11.h
+++ b/src/intel/vulkan/wsi_common_x11.h
@@ -1,18 +1,20 @@
#ifndef WSI_COMMON_X11_H
#define WSI_COMMON_X11_H
-VkBool32 anv_get_physical_device_xcb_presentation_support(
- struct anv_wsi_device *wsi_device,
+#include "wsi_common.h"
+
+VkBool32 wsi_get_physical_device_xcb_presentation_support(
+ struct wsi_device *wsi_device,
VkAllocationCallbacks *alloc,
uint32_t queueFamilyIndex,
xcb_connection_t* connection,
xcb_visualid_t visual_id);
-VkResult anv_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
+VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
VkSurfaceKHR *pSurface);
-VkResult anv_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
+VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
VkSurfaceKHR *pSurface);
#endif
--
2.5.5
More information about the mesa-dev
mailing list