zink: only add MESA WSI structs for specific devices

Some drivers will drop warnings about seeing these structs in the
pNext chain and not handling them. This change makes it so we
only include the structs with Vulkan drivers that are known to
require them for proper behavior (v3dv only for now) to avoid the
warnings.

It should be noted that here we are only supressing the messages
from Zink. Since the Mesa Vulkan WSI code will include these structs,
when native Vulkan Mesa drivers are used without Zink they might
still dump these messages.

Requested by Mike Blumenkrantz.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7523>
This commit is contained in:
Iago Toral Quiroga 2020-11-06 09:20:42 +01:00
parent eba97645c9
commit 46d2f2224f
3 changed files with 20 additions and 2 deletions

View file

@ -233,7 +233,7 @@ resource_create(struct pipe_screen *pscreen,
.scanout = true,
};
if (templ->bind & PIPE_BIND_SCANOUT)
if (screen->needs_mesa_wsi && (templ->bind & PIPE_BIND_SCANOUT))
ici.pNext = &image_wsi_info;
VkResult result = vkCreateImage(screen->dev, &ici, NULL, &res->image);
@ -285,7 +285,7 @@ resource_create(struct pipe_screen *pscreen,
NULL,
};
if (templ->bind & PIPE_BIND_SCANOUT) {
if (screen->needs_mesa_wsi && (templ->bind & PIPE_BIND_SCANOUT)) {
memory_wsi_info.implicit_sync = true;
memory_wsi_info.pNext = mai.pNext;

View file

@ -1068,6 +1068,16 @@ zink_internal_setup_moltenvk(struct zink_screen *screen)
}
#endif // MVK_VERSION
static void
check_device_needs_mesa_wsi(struct zink_screen *screen)
{
/* Raspberry Pi 4 V3DV driver */
if (screen->info.props.vendorID == 0x14E4 &&
screen->info.props.deviceID == 42) {
screen->needs_mesa_wsi = true;
}
}
static struct pipe_screen *
zink_internal_create_screen(struct sw_winsys *winsys, int fd, const struct pipe_screen_config *config)
{
@ -1100,6 +1110,11 @@ zink_internal_create_screen(struct sw_winsys *winsys, int fd, const struct pipe_
goto fail;
}
/* Some Vulkan implementations have special requirements for WSI
* allocations.
*/
check_device_needs_mesa_wsi(screen);
#if defined(MVK_VERSION)
zink_internal_setup_moltenvk(screen);
#endif

View file

@ -67,6 +67,9 @@ struct zink_screen {
uint32_t loader_version;
bool have_physical_device_prop2_ext;
bool have_debug_utils_ext;
bool needs_mesa_wsi;
#if defined(MVK_VERSION)
bool have_moltenvk;
#endif