From: Dave Airlie Date: Wed, 15 Dec 2021 00:51:31 +0000 (+1000) Subject: mesa/st: migrate compute dispatch to mesa X-Git-Tag: upstream/22.3.5~14650 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56f5e6949757b97f3857b1cc1a79b0e6eec84c36;p=platform%2Fupstream%2Fmesa.git mesa/st: migrate compute dispatch to mesa Reviewed-by: Emma Anholt Part-of: --- diff --git a/src/mesa/main/compute.c b/src/mesa/main/compute.c index fa1cf74..2e2e91a 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 e22b74f..db3c41e 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 7904034..0000000 --- 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 825ac9e..0000000 --- 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 7f0ec42..6f0335b 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"