Mesa (master): gallium/api: add state invalidate interface as alternative to cso_save/restore
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jan 15 10:07:39 UTC 2021
Module: Mesa
Branch: master
Commit: a93ca3be01e51df30c0e7ec58927053e7057afd9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a93ca3be01e51df30c0e7ec58927053e7057afd9
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sun Dec 20 02:45:20 2020 -0500
gallium/api: add state invalidate interface as alternative to cso_save/restore
Some cso_context save/restore capabilities will be removed to decrease
CPU overhead. This is the alternative solution that e.g. the HUD will use.
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Zoltán Böszörményi <zboszor at gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8180>
---
src/gallium/include/frontend/api.h | 15 +++++++++++++++
src/mesa/state_tracker/st_manager.c | 18 ++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/src/gallium/include/frontend/api.h b/src/gallium/include/frontend/api.h
index b0cafc7073c..70afed3499a 100644
--- a/src/gallium/include/frontend/api.h
+++ b/src/gallium/include/frontend/api.h
@@ -146,6 +146,15 @@ enum st_attachment_type {
#define ST_FLUSH_WAIT (1 << 2)
#define ST_FLUSH_FENCE_FD (1 << 3)
+/**
+ * State invalidation flags to notify frontends that states have been changed
+ * behind their back.
+ */
+#define ST_INVALIDATE_FS_SAMPLER_VIEWS (1 << 0)
+#define ST_INVALIDATE_FS_CONSTBUF0 (1 << 1)
+#define ST_INVALIDATE_VS_CONSTBUF0 (1 << 2)
+#define ST_INVALIDATE_VERTEX_BUFFERS (1 << 3)
+
/**
* Value to st_manager->get_param function.
*/
@@ -430,6 +439,12 @@ struct st_context_iface
* Called from the main thread.
*/
void (*thread_finish)(struct st_context_iface *stctxi);
+
+ /**
+ * Invalidate states to notify the frontend that states have been changed
+ * behind its back.
+ */
+ void (*invalidate_state)(struct st_context_iface *stctxi, unsigned flags);
};
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index ea3d5207ffd..42c3947b7af 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -833,6 +833,23 @@ st_thread_finish(struct st_context_iface *stctxi)
}
+static void
+st_context_invalidate_state(struct st_context_iface *stctxi,
+ unsigned flags)
+{
+ struct st_context *st = (struct st_context *) stctxi;
+
+ if (flags & ST_INVALIDATE_FS_SAMPLER_VIEWS)
+ st->dirty |= ST_NEW_FS_SAMPLER_VIEWS;
+ if (flags & ST_INVALIDATE_FS_CONSTBUF0)
+ st->dirty |= ST_NEW_FS_CONSTANTS;
+ if (flags & ST_INVALIDATE_VS_CONSTBUF0)
+ st->dirty |= ST_NEW_VS_CONSTANTS;
+ if (flags & ST_INVALIDATE_VERTEX_BUFFERS)
+ st->dirty |= ST_NEW_VERTEX_ARRAYS;
+}
+
+
static void
st_manager_destroy(struct st_manager *smapi)
{
@@ -985,6 +1002,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
st->iface.share = st_context_share;
st->iface.start_thread = st_start_thread;
st->iface.thread_finish = st_thread_finish;
+ st->iface.invalidate_state = st_context_invalidate_state;
st->iface.st_context_private = (void *) smapi;
st->iface.cso_context = st->cso_context;
st->iface.pipe = st->pipe;
More information about the mesa-commit
mailing list