Mesa (master): zink: pre-fetch all format properties during screen init
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 25 23:08:28 UTC 2021
Module: Mesa
Branch: master
Commit: ee4b844b12326f166a6b3c8ad7ea4a73e4153f9a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee4b844b12326f166a6b3c8ad7ea4a73e4153f9a
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Wed Oct 7 12:45:04 2020 -0400
zink: pre-fetch all format properties during screen init
this ends up being a tradeoff where we waste a little startup time and
an extra ~4k memory for the overall screen object in exchange for never having
to fetch format properties again, which is a surprisingly expensive call
to be making as much as we have to make it
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9293>
---
src/gallium/drivers/zink/zink_screen.c | 12 ++++++++++++
src/gallium/drivers/zink/zink_screen.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index e13162dfa8d..42eb3a25c9d 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -1175,6 +1175,17 @@ check_device_needs_mesa_wsi(struct zink_screen *screen)
screen->info.driver_props.driverID == VK_DRIVER_ID_MESA_RADV_KHR
) {
screen->needs_mesa_wsi = true;
+ }
+}
+
+static void
+populate_format_props(struct zink_screen *screen)
+{
+ for (unsigned i = 0; i < PIPE_FORMAT_COUNT; i++) {
+ VkFormat format = zink_get_format(screen, i);
+ if (!format)
+ continue;
+ vkGetPhysicalDeviceFormatProperties(screen->pdev, format, &screen->format_props[i]);
}
}
@@ -1297,6 +1308,7 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
zink_screen_init_compiler(screen);
disk_cache_init(screen);
+ populate_format_props(screen);
VkPipelineCacheCreateInfo pcci;
pcci.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
diff --git a/src/gallium/drivers/zink/zink_screen.h b/src/gallium/drivers/zink/zink_screen.h
index 9b2d5319b2b..359c1d2950a 100644
--- a/src/gallium/drivers/zink/zink_screen.h
+++ b/src/gallium/drivers/zink/zink_screen.h
@@ -121,6 +121,8 @@ struct zink_screen {
struct {
bool dual_color_blend_by_location;
} driconf;
+
+ VkFormatProperties format_props[PIPE_FORMAT_COUNT];
};
static inline struct zink_screen *
More information about the mesa-commit
mailing list