intel/dev: Add engine_class_supported_count to intel_device_info
Next patch will need to frequently get the count of supported engine for compute and copy engines, so to reduce the overhead of doing KMD queries at every call here caching this information into intel_device_info struct. With that ANV and Iris would need to set this information as intel/dev can't depend on intel/common, so here adding a single function to update intel_device_info with all fields filled by intel/common functions. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29899>
This commit is contained in:

committed by
Marge Bot

parent
2f2a0bc083
commit
5b8b4f7878
@@ -51,6 +51,7 @@
|
||||
#include "common/intel_mem.h"
|
||||
#include "c99_alloca.h"
|
||||
#include "dev/intel_debug.h"
|
||||
#include "common/intel_common.h"
|
||||
#include "common/intel_gem.h"
|
||||
#include "dev/intel_device_info.h"
|
||||
#include "drm-uapi/dma-buf.h"
|
||||
@@ -233,7 +234,6 @@ 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;
|
||||
|
||||
@@ -2351,17 +2351,7 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse)
|
||||
iris_bufmgr_get_meminfo(bufmgr, devinfo);
|
||||
bufmgr->kmd_backend = iris_kmd_backend_get(devinfo->kmd_type);
|
||||
|
||||
struct intel_query_engine_info *engine_info;
|
||||
engine_info = intel_engine_get_info(bufmgr->fd, bufmgr->devinfo.kmd_type);
|
||||
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);
|
||||
intel_common_update_device_info(bufmgr->fd, devinfo);
|
||||
|
||||
if (!iris_bufmgr_init_global_vm(bufmgr))
|
||||
goto error_init_vm;
|
||||
@@ -2638,7 +2628,7 @@ iris_bufmgr_use_global_vm_id(struct iris_bufmgr *bufmgr)
|
||||
bool
|
||||
iris_bufmgr_compute_engine_supported(struct iris_bufmgr *bufmgr)
|
||||
{
|
||||
return bufmgr->compute_engine_supported;
|
||||
return bufmgr->devinfo.engine_class_supported_count[INTEL_ENGINE_CLASS_COMPUTE];
|
||||
}
|
||||
|
||||
/**
|
||||
|
30
src/intel/common/intel_common.c
Normal file
30
src/intel/common/intel_common.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2024 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "intel_common.h"
|
||||
|
||||
#include "intel_engine.h"
|
||||
|
||||
/* Updates intel_device_info fields that has dependencies on intel/common
|
||||
* functions.
|
||||
*/
|
||||
void intel_common_update_device_info(int fd, struct intel_device_info *devinfo)
|
||||
{
|
||||
struct intel_query_engine_info *engine_info;
|
||||
enum intel_engine_class klass;
|
||||
|
||||
engine_info = intel_engine_get_info(fd, devinfo->kmd_type);
|
||||
if (!engine_info)
|
||||
return;
|
||||
|
||||
devinfo->has_compute_engine = intel_engines_count(engine_info,
|
||||
INTEL_ENGINE_CLASS_COMPUTE);
|
||||
|
||||
for (klass = 0; klass < INTEL_ENGINE_CLASS_INVALID; klass++)
|
||||
devinfo->engine_class_supported_count[klass] =
|
||||
intel_engines_supported_count(fd, devinfo, engine_info, klass);
|
||||
|
||||
free(engine_info);
|
||||
}
|
10
src/intel/common/intel_common.h
Normal file
10
src/intel/common/intel_common.h
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2024 Intel Corporation
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dev/intel_device_info.h"
|
||||
|
||||
void intel_common_update_device_info(int fd, struct intel_device_info *devinfo);
|
@@ -36,6 +36,8 @@ files_libintel_common = files(
|
||||
'intel_bind_timeline.c',
|
||||
'intel_bind_timeline.h',
|
||||
'intel_buffer_alloc.h',
|
||||
'intel_common.c',
|
||||
'intel_common.h',
|
||||
'intel_compute_slm.c',
|
||||
'intel_compute_slm.h',
|
||||
'intel_debug_identifier.h',
|
||||
|
@@ -461,7 +461,8 @@ Struct("intel_device_info",
|
||||
Member("intel_device_info_urb_desc", "urb"),
|
||||
Member("unsigned", "max_constant_urb_size_kb"),
|
||||
Member("unsigned", "mesh_max_constant_urb_size_kb"),
|
||||
Member("unsigned", "engine_class_prefetch", array="INTEL_ENGINE_CLASS_COMPUTE + 1"),
|
||||
Member("unsigned", "engine_class_prefetch", array="INTEL_ENGINE_CLASS_INVALID"),
|
||||
Member("unsigned", "engine_class_supported_count", array="INTEL_ENGINE_CLASS_INVALID"),
|
||||
Member("unsigned", "mem_alignment"),
|
||||
Member("uint64_t", "timestamp_frequency"),
|
||||
Member("uint64_t", "aperture_bytes"),
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#include "vk_deferred_operation.h"
|
||||
#include "vk_drm_syncobj.h"
|
||||
#include "common/intel_aux_map.h"
|
||||
#include "common/intel_common.h"
|
||||
#include "common/intel_debug_identifier.h"
|
||||
#include "common/intel_uuid.h"
|
||||
#include "perf/intel_perf.h"
|
||||
@@ -2225,20 +2226,14 @@ anv_physical_device_init_queue_families(struct anv_physical_device *pdevice)
|
||||
sparse_supports_non_render_engines;
|
||||
|
||||
if (can_use_non_render_engines) {
|
||||
c_count = intel_engines_supported_count(pdevice->local_fd,
|
||||
&pdevice->info,
|
||||
pdevice->engine_info,
|
||||
INTEL_ENGINE_CLASS_COMPUTE);
|
||||
c_count = pdevice->info.engine_class_supported_count[INTEL_ENGINE_CLASS_COMPUTE];
|
||||
}
|
||||
enum intel_engine_class compute_class =
|
||||
c_count < 1 ? INTEL_ENGINE_CLASS_RENDER : INTEL_ENGINE_CLASS_COMPUTE;
|
||||
|
||||
int blit_count = 0;
|
||||
if (pdevice->info.verx10 >= 125 && can_use_non_render_engines) {
|
||||
blit_count = intel_engines_supported_count(pdevice->local_fd,
|
||||
&pdevice->info,
|
||||
pdevice->engine_info,
|
||||
INTEL_ENGINE_CLASS_COPY);
|
||||
blit_count = pdevice->info.engine_class_supported_count[INTEL_ENGINE_CLASS_COPY];
|
||||
}
|
||||
|
||||
anv_override_engine_counts(&gc_count, &g_count, &c_count, &v_count);
|
||||
@@ -2581,9 +2576,8 @@ anv_physical_device_try_create(struct vk_instance *vk_instance,
|
||||
device->master_fd = master_fd;
|
||||
|
||||
device->engine_info = intel_engine_get_info(fd, device->info.kmd_type);
|
||||
device->info.has_compute_engine = device->engine_info &&
|
||||
intel_engines_count(device->engine_info,
|
||||
INTEL_ENGINE_CLASS_COMPUTE);
|
||||
intel_common_update_device_info(fd, &devinfo);
|
||||
|
||||
anv_physical_device_init_queue_families(device);
|
||||
|
||||
anv_physical_device_init_perf(device, fd);
|
||||
|
Reference in New Issue
Block a user