Mesa (main): mesa/st: migrate compute dispatch to mesa
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Dec 20 04:34:29 UTC 2021
Module: Mesa
Branch: main
Commit: 56f5e6949757b97f3857b1cc1a79b0e6eec84c36
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56f5e6949757b97f3857b1cc1a79b0e6eec84c36
Author: Dave Airlie <airlied at redhat.com>
Date: Wed Dec 15 10:51:31 2021 +1000
mesa/st: migrate compute dispatch to mesa
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14256>
---
src/mesa/main/compute.c | 33 +++++++++++++++++---
src/mesa/meson.build | 2 --
src/mesa/state_tracker/st_cb_compute.c | 55 ----------------------------------
src/mesa/state_tracker/st_cb_compute.h | 36 ----------------------
src/mesa/state_tracker/st_context.c | 1 -
5 files changed, 29 insertions(+), 98 deletions(-)
diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c
index fa1cf74d23a..2e2e91a7be2 100644
--- a/src/mesa/main/compute.c
+++ b/src/mesa/main/compute.c
@@ -24,10 +24,14 @@
#include "glheader.h"
#include "bufferobj.h"
#include "context.h"
+#include "state.h"
#include "api_exec_decl.h"
#include "pipe/p_state.h"
-#include "state_tracker/st_cb_compute.h"
+
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_cb_bitmap.h"
+#include "state_tracker/st_util.h"
static bool
check_valid_to_compute(struct gl_context *ctx, const char *function)
@@ -280,6 +284,27 @@ valid_dispatch_indirect(struct gl_context *ctx, GLintptr indirect)
return GL_TRUE;
}
+static void
+do_dispatch_compute(struct gl_context *ctx,
+ struct pipe_grid_info *info)
+{
+ struct st_context *st = st_context(ctx);
+ struct pipe_context *pipe = st->pipe;
+
+ st_flush_bitmap_cache(st);
+ st_invalidate_readpix_cache(st);
+
+ if (ctx->NewState)
+ _mesa_update_state(ctx);
+
+ if ((st->dirty | ctx->NewDriverState) & st->active_states &
+ ST_PIPELINE_COMPUTE_STATE_MASK ||
+ st->compute_shader_may_be_dirty)
+ st_validate_state(st, ST_PIPELINE_COMPUTE);
+
+ pipe->launch_grid(pipe, info);
+}
+
static ALWAYS_INLINE void
dispatch_compute(GLuint num_groups_x, GLuint num_groups_y,
GLuint num_groups_z, bool no_error)
@@ -309,7 +334,7 @@ dispatch_compute(GLuint num_groups_x, GLuint num_groups_y,
info.block[1] = prog->info.workgroup_size[1];
info.block[2] = prog->info.workgroup_size[2];
- st_dispatch_compute(ctx, &info);
+ do_dispatch_compute(ctx, &info);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_mesa_flush(ctx);
@@ -353,7 +378,7 @@ dispatch_compute_indirect(GLintptr indirect, bool no_error)
info.block[1] = prog->info.workgroup_size[1];
info.block[2] = prog->info.workgroup_size[2];
- st_dispatch_compute(ctx, &info);
+ do_dispatch_compute(ctx, &info);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_mesa_flush(ctx);
@@ -402,7 +427,7 @@ dispatch_compute_group_size(GLuint num_groups_x, GLuint num_groups_y,
if (num_groups_x == 0u || num_groups_y == 0u || num_groups_z == 0u)
return;
- st_dispatch_compute(ctx, &info);
+ do_dispatch_compute(ctx, &info);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_mesa_flush(ctx);
diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index e22b74fc5dc..db3c41e872b 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -332,8 +332,6 @@ files_libmesa = files(
'state_tracker/st_cb_blit.h',
'state_tracker/st_cb_clear.c',
'state_tracker/st_cb_clear.h',
- 'state_tracker/st_cb_compute.c',
- 'state_tracker/st_cb_compute.h',
'state_tracker/st_cb_condrender.c',
'state_tracker/st_cb_condrender.h',
'state_tracker/st_cb_copyimage.c',
diff --git a/src/mesa/state_tracker/st_cb_compute.c b/src/mesa/state_tracker/st_cb_compute.c
deleted file mode 100644
index 79040343397..00000000000
--- a/src/mesa/state_tracker/st_cb_compute.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2016 Samuel Pitoiset
- * All Rights Reserved.
- *
- * 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-#include "main/state.h"
-#include "st_atom.h"
-#include "st_context.h"
-#include "st_cb_bitmap.h"
-#include "st_cb_compute.h"
-#include "st_util.h"
-
-#include "pipe/p_context.h"
-
-void st_dispatch_compute(struct gl_context *ctx,
- struct pipe_grid_info *info)
-{
- struct st_context *st = st_context(ctx);
- struct pipe_context *pipe = st->pipe;
-
- st_flush_bitmap_cache(st);
- st_invalidate_readpix_cache(st);
-
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
- if ((st->dirty | ctx->NewDriverState) & st->active_states &
- ST_PIPELINE_COMPUTE_STATE_MASK ||
- st->compute_shader_may_be_dirty)
- st_validate_state(st, ST_PIPELINE_COMPUTE);
-
- pipe->launch_grid(pipe, info);
-}
diff --git a/src/mesa/state_tracker/st_cb_compute.h b/src/mesa/state_tracker/st_cb_compute.h
deleted file mode 100644
index 825ac9e26cd..00000000000
--- a/src/mesa/state_tracker/st_cb_compute.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2016 Samuel Pitoiset
- * All Rights Reserved.
- *
- * 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, sub license, 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 NON-INFRINGEMENT.
- * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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 ST_CB_COMPUTE_H
-#define ST_CB_COMPUTE_H
-
-struct pipe_grid_info;
-
-void st_dispatch_compute(struct gl_context *ctx,
- struct pipe_grid_info *grid_info);
-
-#endif /* ST_CB_COMPUTE_H */
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 7f0ec42de2f..6f0335baebf 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -42,7 +42,6 @@
#include "st_debug.h"
#include "st_cb_bitmap.h"
#include "st_cb_clear.h"
-#include "st_cb_compute.h"
#include "st_cb_condrender.h"
#include "st_cb_drawpixels.h"
#include "st_cb_drawtex.h"
More information about the mesa-commit
mailing list