panfrost: add core mask driconf options
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

These options are equivalent to the corresponding panvk options.

Signed-off-by: Benjamin Lee <benjamin.lee@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34374>
This commit is contained in:
Benjamin Lee 2025-04-07 17:31:28 -07:00 committed by Marge Bot
parent e8cc44f4bd
commit fdf43f9152
4 changed files with 43 additions and 4 deletions

View file

@ -10,3 +10,8 @@ DRI_CONF_SECTION_PERFORMANCE
*/
DRI_CONF_OPT_I(pan_csf_max_chunks, 64, 1, 65535, "CSF Tiler Max Chunks")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_MISCELLANEOUS
DRI_CONF_PAN_COMPUTE_CORE_MASK(~0ull)
DRI_CONF_PAN_FRAGMENT_CORE_MASK(~0ull)
DRI_CONF_SECTION_END

View file

@ -1401,6 +1401,7 @@ get_panthor_group_priority(struct panfrost_context *ctx)
int
GENX(csf_init_context)(struct panfrost_context *ctx)
{
struct panfrost_screen *screen = pan_screen(ctx->base.screen);
struct panfrost_device *dev = pan_device(ctx->base.screen);
struct drm_panthor_queue_create qc[] = {{
.priority = 1,
@ -1408,11 +1409,11 @@ GENX(csf_init_context)(struct panfrost_context *ctx)
}};
struct drm_panthor_group_create gc = {
.compute_core_mask = dev->kmod.props.shader_present,
.fragment_core_mask = dev->kmod.props.shader_present,
.compute_core_mask = screen->compute_core_mask,
.fragment_core_mask = screen->fragment_core_mask,
.tiler_core_mask = 1,
.max_compute_cores = util_bitcount64(dev->kmod.props.shader_present),
.max_fragment_cores = util_bitcount64(dev->kmod.props.shader_present),
.max_compute_cores = util_bitcount64(screen->compute_core_mask),
.max_fragment_cores = util_bitcount64(screen->fragment_core_mask),
.max_tiler_cores = 1,
.priority = get_panthor_group_priority(ctx),
.queues = DRM_PANTHOR_OBJ_ARRAY(ARRAY_SIZE(qc), qc),

View file

@ -780,6 +780,24 @@ panfrost_get_timestamp(struct pipe_screen *pscreen)
return pan_gpu_time_to_ns(dev, pan_kmod_query_timestamp(dev->kmod.dev));
}
static int
get_core_mask(const struct panfrost_device *dev,
const struct pipe_screen_config *config,
const char *option_name, uint64_t *mask)
{
uint64_t present = dev->kmod.props.shader_present;
*mask = driQueryOptionu64(config->options, option_name) & present;
if (!*mask) {
debug_printf("panfrost: None of the cores specified in %s are present. "
"Available shader cores are 0x%" PRIx64 ".\n",
option_name, present);
return -1;
}
return 0;
}
struct pipe_screen *
panfrost_create_screen(int fd, const struct pipe_screen_config *config,
struct renderonly *ro)
@ -836,6 +854,19 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config,
screen->force_afrc_rate = rate;
}
int result = get_core_mask(dev, config, "pan_compute_core_mask",
&screen->compute_core_mask);
if (result) {
panfrost_destroy_screen(&(screen->base));
return NULL;
}
result = get_core_mask(dev, config, "pan_fragment_core_mask",
&screen->fragment_core_mask);
if (result) {
panfrost_destroy_screen(&(screen->base));
return NULL;
}
screen->csf_tiler_heap.chunk_size = driQueryOptioni(config->options,
"pan_csf_chunk_size");
screen->csf_tiler_heap.initial_chunks = driQueryOptioni(config->options,

View file

@ -129,6 +129,8 @@ struct panfrost_screen {
unsigned max_afbc_packing_ratio;
bool force_afbc_packing;
int force_afrc_rate;
uint64_t compute_core_mask;
uint64_t fragment_core_mask;
struct {
unsigned chunk_size;