mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 18:24:13 +08:00
zink: Only #include <vulkan/vulkan_core.h> instead #include <vulkan/vulkan.h> in kopper_interface.h
It's pulled too much system dependent headers before this commit when #include <vulkan/vulkan.h> directly, Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19491>
This commit is contained in:
parent
5425e05f2f
commit
26a6d16db0
@ -35,17 +35,7 @@
|
||||
#define KOPPER_INTERFACE_H
|
||||
|
||||
#include <GL/internal/dri_interface.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
#include <xcb/xcb.h>
|
||||
#include <vulkan/vulkan_xcb.h>
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#include <vulkan/vulkan_wayland.h>
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#include <vulkan/vulkan_win32.h>
|
||||
#endif
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
typedef struct __DRIkopperExtensionRec __DRIkopperExtension;
|
||||
typedef struct __DRIkopperLoaderExtensionRec __DRIkopperLoaderExtension;
|
||||
@ -80,19 +70,23 @@ struct __DRIkopperExtensionRec {
|
||||
* Kopper loader extension.
|
||||
*/
|
||||
|
||||
/**
|
||||
* struct for storage the union of all platform depdendent
|
||||
* Vk*SurfaceCreateInfo* type, all platform Vk*SurfaceCreateInfo* contains
|
||||
* uint32_t flags and at most two extra pointer besides bos header.
|
||||
* For example:
|
||||
* VkWin32SurfaceCreateInfoKHR contains flags, hinstance and hwnd besides bos header
|
||||
*/
|
||||
|
||||
struct kopper_vk_surface_create_storage {
|
||||
/* First two fields are copied from VkBaseOutStructure for easily access shared properties */
|
||||
VkStructureType sType;
|
||||
struct VkBaseOutStructure *pNext;
|
||||
intptr_t padding[3];
|
||||
};
|
||||
|
||||
struct kopper_loader_info {
|
||||
union {
|
||||
VkBaseOutStructure bos;
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
VkXcbSurfaceCreateInfoKHR xcb;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
VkWaylandSurfaceCreateInfoKHR wl;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
VkWin32SurfaceCreateInfoKHR win32;
|
||||
#endif
|
||||
};
|
||||
struct kopper_vk_surface_create_storage bos;
|
||||
int has_alpha;
|
||||
int initial_swap_interval;
|
||||
};
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <dlfcn.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <fcntl.h>
|
||||
#include <xf86drm.h>
|
||||
#include "drm-uapi/drm_fourcc.h"
|
||||
@ -2653,12 +2654,14 @@ static const __DRIswrastLoaderExtension swrast_loader_extension = {
|
||||
.putImage2 = dri2_wl_swrast_put_image2,
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct kopper_vk_surface_create_storage) >= sizeof(VkWaylandSurfaceCreateInfoKHR), "");
|
||||
|
||||
static void
|
||||
kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *out)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = _draw;
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
VkWaylandSurfaceCreateInfoKHR *wlsci = &out->wl;
|
||||
VkWaylandSurfaceCreateInfoKHR *wlsci = (VkWaylandSurfaceCreateInfoKHR *)&out->bos;
|
||||
|
||||
wlsci->sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
|
||||
wlsci->pNext = NULL;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#ifdef HAVE_LIBDRM
|
||||
#include <xf86drm.h>
|
||||
#endif
|
||||
@ -1323,19 +1324,22 @@ static const __DRIswrastLoaderExtension swrast_loader_extension = {
|
||||
.getImage = swrastGetImage,
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct kopper_vk_surface_create_storage) >= sizeof(VkXcbSurfaceCreateInfoKHR), "");
|
||||
|
||||
static void
|
||||
kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *ci)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = _draw;
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dri2_surf->base.Resource.Display);
|
||||
VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&ci->bos;
|
||||
|
||||
if (dri2_surf->base.Type != EGL_WINDOW_BIT)
|
||||
return;
|
||||
ci->xcb.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
ci->xcb.pNext = NULL;
|
||||
ci->xcb.flags = 0;
|
||||
ci->xcb.connection = dri2_dpy->conn;
|
||||
ci->xcb.window = dri2_surf->drawable;
|
||||
xcb->sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
xcb->pNext = NULL;
|
||||
xcb->flags = 0;
|
||||
xcb->connection = dri2_dpy->conn;
|
||||
xcb->window = dri2_surf->drawable;
|
||||
ci->has_alpha = dri2_surf->depth == 32;
|
||||
}
|
||||
|
||||
|
@ -85,19 +85,25 @@ kopper_CreateSurface(struct zink_screen *screen, struct kopper_displaytarget *cd
|
||||
VkStructureType type = cdt->info.bos.sType;
|
||||
switch (type) {
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
case VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR:
|
||||
error = VKSCR(CreateXcbSurfaceKHR)(screen->instance, &cdt->info.xcb, NULL, &surface);
|
||||
case VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR: {
|
||||
VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
error = VKSCR(CreateXcbSurfaceKHR)(screen->instance, xcb, NULL, &surface);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
case VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR:
|
||||
error = VKSCR(CreateWaylandSurfaceKHR)(screen->instance, &cdt->info.wl, NULL, &surface);
|
||||
case VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR: {
|
||||
VkWaylandSurfaceCreateInfoKHR *wlsci = (VkWaylandSurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
error = VKSCR(CreateWaylandSurfaceKHR)(screen->instance, wlsci, NULL, &surface);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
case VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR:
|
||||
error = VKSCR(CreateWin32SurfaceKHR)(screen->instance, &cdt->info.win32, NULL, &surface);
|
||||
case VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR: {
|
||||
VkWin32SurfaceCreateInfoKHR *win32 = (VkWin32SurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
error = VKSCR(CreateWin32SurfaceKHR)(screen->instance, win32, NULL, &surface);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
unreachable("unsupported!");
|
||||
@ -176,19 +182,25 @@ find_dt_entry(struct zink_screen *screen, const struct kopper_displaytarget *cdt
|
||||
struct hash_entry *he = NULL;
|
||||
switch (cdt->type) {
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
case KOPPER_X11:
|
||||
he = _mesa_hash_table_search_pre_hashed(&screen->dts, cdt->info.xcb.window, (void*)(uintptr_t)cdt->info.xcb.window);
|
||||
case KOPPER_X11: {
|
||||
VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
he = _mesa_hash_table_search_pre_hashed(&screen->dts, xcb->window, (void*)(uintptr_t)xcb->window);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
case KOPPER_WAYLAND:
|
||||
he = _mesa_hash_table_search(&screen->dts, cdt->info.wl.surface);
|
||||
case KOPPER_WAYLAND: {
|
||||
VkWaylandSurfaceCreateInfoKHR *wlsci = (VkWaylandSurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
he = _mesa_hash_table_search(&screen->dts, wlsci->surface);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
case KOPPER_WIN32:
|
||||
he = _mesa_hash_table_search(&screen->dts, cdt->info.win32.hwnd);
|
||||
case KOPPER_WIN32: {
|
||||
VkWin32SurfaceCreateInfoKHR *win32 = (VkWin32SurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
he = _mesa_hash_table_search(&screen->dts, win32->hwnd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
unreachable("unsupported!");
|
||||
@ -425,19 +437,25 @@ zink_kopper_displaytarget_create(struct zink_screen *screen, unsigned tex_usage,
|
||||
simple_mtx_lock(&screen->dt_lock);
|
||||
switch (cdt->type) {
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
case KOPPER_X11:
|
||||
_mesa_hash_table_insert_pre_hashed(&screen->dts, cdt->info.xcb.window, (void*)(uintptr_t)cdt->info.xcb.window, cdt);
|
||||
case KOPPER_X11: {
|
||||
VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
_mesa_hash_table_insert_pre_hashed(&screen->dts, xcb->window, (void*)(uintptr_t)xcb->window, cdt);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
case KOPPER_WAYLAND:
|
||||
_mesa_hash_table_insert(&screen->dts, cdt->info.wl.surface, cdt);
|
||||
case KOPPER_WAYLAND: {
|
||||
VkWaylandSurfaceCreateInfoKHR *wlsci = (VkWaylandSurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
_mesa_hash_table_insert(&screen->dts, wlsci->surface, cdt);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
case KOPPER_WIN32:
|
||||
_mesa_hash_table_insert(&screen->dts, cdt->info.win32.hwnd, cdt);
|
||||
case KOPPER_WIN32: {
|
||||
VkWin32SurfaceCreateInfoKHR *win32 = (VkWin32SurfaceCreateInfoKHR *)&cdt->info.bos;
|
||||
_mesa_hash_table_insert(&screen->dts, win32->hwnd, cdt);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
unreachable("unsupported!");
|
||||
|
@ -421,8 +421,9 @@ kopper_get_pixmap_buffer(struct kopper_drawable *cdraw,
|
||||
__DRIscreen *cur_screen;
|
||||
struct kopper_loader_info *info = &cdraw->info;
|
||||
assert(info->bos.sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR);
|
||||
xcb_connection_t *conn = info->xcb.connection;
|
||||
pixmap = info->xcb.window;
|
||||
VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&info->bos;
|
||||
xcb_connection_t *conn = xcb->connection;
|
||||
pixmap = xcb->window;
|
||||
|
||||
if (cdraw->image)
|
||||
return cdraw->image->texture;
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "stw_winsys.h"
|
||||
|
||||
#ifdef GALLIUM_ZINK
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "kopper_interface.h"
|
||||
#endif
|
||||
|
||||
@ -125,14 +126,18 @@ stw_pipe_blit(struct pipe_context *pipe,
|
||||
}
|
||||
|
||||
#ifdef GALLIUM_ZINK
|
||||
|
||||
static_assert(sizeof(struct kopper_vk_surface_create_storage) >= sizeof(VkWin32SurfaceCreateInfoKHR), "");
|
||||
|
||||
static void
|
||||
stw_st_fill_private_loader_data(struct stw_st_framebuffer *stwfb, struct kopper_loader_info *out)
|
||||
{
|
||||
out->win32.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||
out->win32.pNext = NULL;
|
||||
out->win32.flags = 0;
|
||||
out->win32.hinstance = GetModuleHandle(NULL);
|
||||
out->win32.hwnd = stwfb->fb->hWnd;
|
||||
VkWin32SurfaceCreateInfoKHR *win32 = (VkWin32SurfaceCreateInfoKHR *)&out->bos;
|
||||
win32->sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR;
|
||||
win32->pNext = NULL;
|
||||
win32->flags = 0;
|
||||
win32->hinstance = GetModuleHandle(NULL);
|
||||
win32->hwnd = stwfb->fb->hWnd;
|
||||
out->has_alpha = true;
|
||||
}
|
||||
#endif
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "drisw_priv.h"
|
||||
#include <X11/extensions/shmproto.h>
|
||||
#include <assert.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "util/u_debug.h"
|
||||
#include "kopper_interface.h"
|
||||
#include "loader_dri_helper.h"
|
||||
@ -367,16 +368,19 @@ static const __DRIswrastLoaderExtension swrastLoaderExtension = {
|
||||
.getImage2 = swrastGetImage2,
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct kopper_vk_surface_create_storage) >= sizeof(VkXcbSurfaceCreateInfoKHR), "");
|
||||
|
||||
static void
|
||||
kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *out)
|
||||
{
|
||||
__GLXDRIdrawable *draw = _draw;
|
||||
VkXcbSurfaceCreateInfoKHR *xcb = (VkXcbSurfaceCreateInfoKHR *)&out->bos;
|
||||
|
||||
out->xcb.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
out->xcb.pNext = NULL;
|
||||
out->xcb.flags = 0;
|
||||
out->xcb.connection = XGetXCBConnection(draw->psc->dpy);
|
||||
out->xcb.window = draw->xDrawable;
|
||||
xcb->sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
|
||||
xcb->pNext = NULL;
|
||||
xcb->flags = 0;
|
||||
xcb->connection = XGetXCBConnection(draw->psc->dpy);
|
||||
xcb->window = draw->xDrawable;
|
||||
}
|
||||
|
||||
static const __DRIkopperLoaderExtension kopperLoaderExtension = {
|
||||
|
Loading…
Reference in New Issue
Block a user