iris: Use intel_engines_supported_count()

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233>
This commit is contained in:
José Roberto de Souza 2023-12-06 13:02:46 -08:00 committed by Marge Bot
parent 29ee85c203
commit 0a129d8e1f
5 changed files with 20 additions and 10 deletions

View file

@ -172,8 +172,7 @@ iris_create_engines_context(struct iris_context *ice)
/* Blitter is only supported on Gfx12+ */
unsigned num_batches = IRIS_BATCH_COUNT - (devinfo->ver >= 12 ? 0 : 1);
if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false) &&
intel_engines_count(engines_info, INTEL_ENGINE_CLASS_COMPUTE) > 0)
if (iris_bufmgr_compute_engine_supported(screen->bufmgr))
engine_classes[IRIS_BATCH_COMPUTE] = INTEL_ENGINE_CLASS_COMPUTE;
enum intel_gem_create_context_flags flags = 0;

View file

@ -234,6 +234,7 @@ struct iris_bufmgr {
struct intel_bind_timeline bind_timeline; /* Xe only */
bool bo_reuse:1;
bool use_global_vm:1;
bool compute_engine_supported:1;
struct intel_aux_map_context *aux_map_ctx;
@ -2330,6 +2331,11 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse)
bufmgr->devinfo.has_compute_engine = engine_info &&
intel_engines_count(engine_info,
INTEL_ENGINE_CLASS_COMPUTE);
bufmgr->compute_engine_supported = bufmgr->devinfo.has_compute_engine &&
intel_engines_supported_count(bufmgr->fd,
&bufmgr->devinfo,
engine_info,
INTEL_ENGINE_CLASS_COMPUTE);
free(engine_info);
if (!iris_bufmgr_init_global_vm(bufmgr))
@ -2584,6 +2590,12 @@ iris_bufmgr_use_global_vm_id(struct iris_bufmgr *bufmgr)
return bufmgr->use_global_vm;
}
bool
iris_bufmgr_compute_engine_supported(struct iris_bufmgr *bufmgr)
{
return bufmgr->compute_engine_supported;
}
/**
* Return the pat entry based on the bo heap and allocation flags.
*/

View file

@ -623,6 +623,7 @@ iris_bufmgr_get_kernel_driver_backend(struct iris_bufmgr *bufmgr);
uint32_t iris_bufmgr_get_global_vm_id(struct iris_bufmgr *bufmgr);
bool iris_bufmgr_use_global_vm_id(struct iris_bufmgr *bufmgr);
struct intel_bind_timeline *iris_bufmgr_get_bind_timeline(struct iris_bufmgr *bufmgr);
bool iris_bufmgr_compute_engine_supported(struct iris_bufmgr *bufmgr);
enum iris_madvice {
IRIS_MADVICE_WILL_NEED = 0,

View file

@ -6238,7 +6238,6 @@ static void
init_aux_map_state(struct iris_batch *batch)
{
struct iris_screen *screen = batch->screen;
const struct intel_device_info *devinfo = screen->devinfo;
void *aux_map_ctx = iris_bufmgr_get_aux_map_context(screen->bufmgr);
if (!aux_map_ctx)
return;
@ -6249,8 +6248,7 @@ init_aux_map_state(struct iris_batch *batch)
uint32_t reg = 0;
switch (batch->name) {
case IRIS_BATCH_COMPUTE:
if (devinfo->has_compute_engine &&
debug_get_bool_option("INTEL_COMPUTE_CLASS", false)) {
if (iris_bufmgr_compute_engine_supported(screen->bufmgr)) {
reg = GENX(COMPCS0_AUX_TABLE_BASE_ADDR_num);
break;
}

View file

@ -112,7 +112,8 @@ error_create_exec_queue:
}
static void
iris_xe_map_intel_engine_class(const struct intel_query_engine_info *engines_info,
iris_xe_map_intel_engine_class(struct iris_bufmgr *bufmgr,
const struct intel_query_engine_info *engines_info,
enum intel_engine_class *engine_classes)
{
engine_classes[IRIS_BATCH_RENDER] = INTEL_ENGINE_CLASS_RENDER;
@ -120,8 +121,7 @@ iris_xe_map_intel_engine_class(const struct intel_query_engine_info *engines_inf
engine_classes[IRIS_BATCH_BLITTER] = INTEL_ENGINE_CLASS_COPY;
STATIC_ASSERT(IRIS_BATCH_COUNT == 3);
if (debug_get_bool_option("INTEL_COMPUTE_CLASS", false) &&
intel_engines_count(engines_info, INTEL_ENGINE_CLASS_COMPUTE) > 0)
if (iris_bufmgr_compute_engine_supported(bufmgr))
engine_classes[IRIS_BATCH_COMPUTE] = INTEL_ENGINE_CLASS_COMPUTE;
}
@ -137,7 +137,7 @@ void iris_xe_init_batches(struct iris_context *ice)
assert(engines_info);
if (!engines_info)
return;
iris_xe_map_intel_engine_class(engines_info, engine_classes);
iris_xe_map_intel_engine_class(bufmgr, engines_info, engine_classes);
iris_foreach_batch(ice, batch) {
const enum iris_batch_name name = batch - &ice->batches[0];
@ -226,7 +226,7 @@ bool iris_xe_replace_batch(struct iris_batch *batch)
INTEL_KMD_TYPE_XE);
if (!engines_info)
return false;
iris_xe_map_intel_engine_class(engines_info, engine_classes);
iris_xe_map_intel_engine_class(bufmgr, engines_info, engine_classes);
ret = iris_xe_init_batch(bufmgr, engines_info, engine_classes[batch->name],
ice->priority, &new_exec_queue_id);