panfrost: Prepare indirect dispatch helpers to per-gen XML
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12551>
This commit is contained in:
parent
792a0ab0b1
commit
1447db0d51
|
@ -3186,9 +3186,9 @@ panfrost_launch_grid(struct pipe_context *pipe,
|
|||
},
|
||||
};
|
||||
|
||||
indirect_dep = pan_indirect_dispatch_emit(&batch->pool.base,
|
||||
&batch->scoreboard,
|
||||
&indirect);
|
||||
indirect_dep = GENX(pan_indirect_dispatch_emit)(&batch->pool.base,
|
||||
&batch->scoreboard,
|
||||
&indirect);
|
||||
}
|
||||
|
||||
panfrost_add_job(&batch->pool.base, &batch->scoreboard,
|
||||
|
@ -3527,6 +3527,7 @@ screen_destroy(struct pipe_screen *pscreen)
|
|||
{
|
||||
struct panfrost_device *dev = pan_device(pscreen);
|
||||
pan_blitter_cleanup(dev);
|
||||
GENX(pan_indirect_dispatch_cleanup)(dev);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3666,4 +3667,5 @@ GENX(panfrost_cmdstream_screen_init)(struct panfrost_screen *screen)
|
|||
|
||||
pan_blitter_init(dev, &screen->blitter.bin_pool.base,
|
||||
&screen->blitter.desc_pool.base);
|
||||
GENX(pan_indirect_dispatch_init)(dev);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "pan_resource.h"
|
||||
#include "pan_public.h"
|
||||
#include "pan_util.h"
|
||||
#include "pan_indirect_dispatch.h"
|
||||
#include "pan_indirect_draw.h"
|
||||
#include "decode.h"
|
||||
|
||||
|
@ -709,7 +708,6 @@ panfrost_destroy_screen(struct pipe_screen *pscreen)
|
|||
struct panfrost_screen *screen = pan_screen(pscreen);
|
||||
|
||||
panfrost_resource_screen_destroy(pscreen);
|
||||
pan_indirect_dispatch_cleanup(dev);
|
||||
panfrost_cleanup_indirect_draw_shaders(dev);
|
||||
panfrost_pool_cleanup(&screen->indirect_draw.bin_pool);
|
||||
panfrost_pool_cleanup(&screen->blitter.bin_pool);
|
||||
|
@ -901,7 +899,6 @@ panfrost_create_screen(int fd, struct renderonly *ro)
|
|||
PAN_BO_EXECUTE, 65536, "Indirect draw shaders",
|
||||
false, true);
|
||||
panfrost_init_indirect_draw_shaders(dev, &screen->indirect_draw.bin_pool.base);
|
||||
pan_indirect_dispatch_init(dev);
|
||||
panfrost_pool_init(&screen->blitter.bin_pool, NULL, dev, PAN_BO_EXECUTE,
|
||||
4096, "Blitter shaders", false, true);
|
||||
panfrost_pool_init(&screen->blitter.desc_pool, NULL, dev, 0, 65536,
|
||||
|
|
|
@ -48,6 +48,21 @@ foreach ver : pixel_format_versions
|
|||
)
|
||||
endforeach
|
||||
|
||||
libpanfrost_per_arch = []
|
||||
|
||||
foreach ver : ['4', '5', '6', '7']
|
||||
libpanfrost_per_arch += static_library(
|
||||
'pan-arch-v' + ver,
|
||||
[
|
||||
'pan_indirect_dispatch.c',
|
||||
],
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw],
|
||||
c_args : ['-DPAN_ARCH=' + ver],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
dependencies : [dep_libdrm, idep_pan_packers, idep_nir],
|
||||
)
|
||||
endforeach
|
||||
|
||||
libpanfrost_lib_files = files(
|
||||
'pan_encoder.h',
|
||||
|
||||
|
@ -58,7 +73,6 @@ libpanfrost_lib_files = files(
|
|||
'pan_blitter.c',
|
||||
'pan_clear.c',
|
||||
'pan_cs.c',
|
||||
'pan_indirect_dispatch.c',
|
||||
'pan_indirect_draw.c',
|
||||
'pan_samples.c',
|
||||
'pan_tiler.c',
|
||||
|
@ -83,7 +97,7 @@ libpanfrost_lib = static_library(
|
|||
gnu_symbol_visibility : 'hidden',
|
||||
dependencies: [dep_libdrm, idep_nir],
|
||||
build_by_default : false,
|
||||
link_with: [libpanfrost_pixel_format],
|
||||
link_with: [libpanfrost_pixel_format, libpanfrost_per_arch],
|
||||
)
|
||||
|
||||
libpanfrost_decode = static_library(
|
||||
|
@ -97,7 +111,7 @@ libpanfrost_decode = static_library(
|
|||
)
|
||||
|
||||
libpanfrost_dep = declare_dependency(
|
||||
link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_midgard, libpanfrost_bifrost, libpanfrost_pixel_format],
|
||||
link_with: [libpanfrost_lib, libpanfrost_decode, libpanfrost_midgard, libpanfrost_bifrost, libpanfrost_pixel_format, libpanfrost_per_arch],
|
||||
include_directories: [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_panfrost_hw, inc_panfrost],
|
||||
dependencies: [dep_libdrm, idep_nir, idep_pan_packers],
|
||||
)
|
||||
|
|
|
@ -112,9 +112,9 @@ get_push_uniforms(struct pan_pool *pool,
|
|||
}
|
||||
|
||||
unsigned
|
||||
pan_indirect_dispatch_emit(struct pan_pool *pool,
|
||||
struct pan_scoreboard *scoreboard,
|
||||
const struct pan_indirect_dispatch_info *dispatch_info)
|
||||
GENX(pan_indirect_dispatch_emit)(struct pan_pool *pool,
|
||||
struct pan_scoreboard *scoreboard,
|
||||
const struct pan_indirect_dispatch_info *dispatch_info)
|
||||
{
|
||||
struct panfrost_device *dev = pool->dev;
|
||||
struct panfrost_ptr job =
|
||||
|
@ -141,7 +141,7 @@ pan_indirect_dispatch_emit(struct pan_pool *pool,
|
|||
|
||||
pan_section_pack(job.cpu, COMPUTE_JOB, DRAW, cfg) {
|
||||
cfg.draw_descriptor_is_64b = true;
|
||||
cfg.texture_descriptor_is_64b = !pan_is_bifrost(dev);
|
||||
cfg.texture_descriptor_is_64b = PAN_ARCH <= 5;
|
||||
cfg.state = get_rsd(dev);
|
||||
cfg.thread_storage = get_tls(pool->dev);
|
||||
cfg.uniform_buffers = get_ubos(pool, &inputs);
|
||||
|
@ -155,7 +155,7 @@ pan_indirect_dispatch_emit(struct pan_pool *pool,
|
|||
}
|
||||
|
||||
void
|
||||
pan_indirect_dispatch_init(struct panfrost_device *dev)
|
||||
GENX(pan_indirect_dispatch_init)(struct panfrost_device *dev)
|
||||
{
|
||||
nir_builder b =
|
||||
nir_builder_init_simple_shader(MESA_SHADER_COMPUTE,
|
||||
|
@ -249,8 +249,10 @@ pan_indirect_dispatch_init(struct panfrost_device *dev)
|
|||
0, "Indirect dispatch descriptors");
|
||||
|
||||
mali_ptr address = dev->indirect_dispatch.bin->ptr.gpu;
|
||||
if (!pan_is_bifrost(dev))
|
||||
address |= shader_info.midgard.first_tag;
|
||||
|
||||
#if PAN_ARCH <= 5
|
||||
address |= shader_info.midgard.first_tag;
|
||||
#endif
|
||||
|
||||
void *rsd = dev->indirect_dispatch.descs->ptr.cpu;
|
||||
pan_pack(rsd, RENDERER_STATE, cfg) {
|
||||
|
@ -265,7 +267,7 @@ pan_indirect_dispatch_init(struct panfrost_device *dev)
|
|||
}
|
||||
|
||||
void
|
||||
pan_indirect_dispatch_cleanup(struct panfrost_device *dev)
|
||||
GENX(pan_indirect_dispatch_cleanup)(struct panfrost_device *dev)
|
||||
{
|
||||
panfrost_bo_unreference(dev->indirect_dispatch.bin);
|
||||
panfrost_bo_unreference(dev->indirect_dispatch.descs);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef __PAN_INDIRECT_DISPATCH_SHADERS_H__
|
||||
#define __PAN_INDIRECT_DISPATCH_SHADERS_H__
|
||||
|
||||
#include "gen_macros.h"
|
||||
|
||||
struct pan_device;
|
||||
struct pan_scoreboard;
|
||||
struct pan_pool;
|
||||
|
@ -35,14 +37,14 @@ struct pan_indirect_dispatch_info {
|
|||
};
|
||||
|
||||
unsigned
|
||||
pan_indirect_dispatch_emit(struct pan_pool *pool,
|
||||
struct pan_scoreboard *scoreboard,
|
||||
const struct pan_indirect_dispatch_info *dispatch_info);
|
||||
GENX(pan_indirect_dispatch_emit)(struct pan_pool *pool,
|
||||
struct pan_scoreboard *scoreboard,
|
||||
const struct pan_indirect_dispatch_info *dispatch_info);
|
||||
|
||||
void
|
||||
pan_indirect_dispatch_init(struct panfrost_device *dev);
|
||||
GENX(pan_indirect_dispatch_init)(struct panfrost_device *dev);
|
||||
|
||||
void
|
||||
pan_indirect_dispatch_cleanup(struct panfrost_device *dev);
|
||||
GENX(pan_indirect_dispatch_cleanup)(struct panfrost_device *dev);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue