intel/common: Add intel_engines_supported_count()
This function is intented to check for KMD, platform or debug options and return the number of engines that can actually be used. Next patches will implement i915/xe_engines_is_guc_semaphore_functional() functions. 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:

committed by
Marge Bot

parent
ffca423472
commit
fe2982278f
@@ -96,3 +96,10 @@ i915_engine_get_info(int fd)
|
||||
free(i915_engines_info);
|
||||
return intel_engines_info;
|
||||
}
|
||||
|
||||
bool
|
||||
i915_engines_is_guc_semaphore_functional(int fd, const struct intel_device_info *info)
|
||||
{
|
||||
/* TODO */
|
||||
return false;
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "common/intel_engine.h"
|
||||
|
||||
#include "drm-uapi/i915_drm.h"
|
||||
@@ -31,3 +33,6 @@ enum drm_i915_gem_engine_class
|
||||
intel_engine_class_to_i915(enum intel_engine_class intel);
|
||||
struct intel_query_engine_info *
|
||||
i915_engine_get_info(int fd);
|
||||
|
||||
bool
|
||||
i915_engines_is_guc_semaphore_functional(int fd, const struct intel_device_info *info);
|
||||
|
@@ -75,3 +75,41 @@ intel_engines_class_to_string(enum intel_engine_class engine_class)
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
is_guc_semaphore_functional(int fd, const struct intel_device_info *info)
|
||||
{
|
||||
switch (info->kmd_type) {
|
||||
case INTEL_KMD_TYPE_I915:
|
||||
return i915_engines_is_guc_semaphore_functional(fd, info);
|
||||
case INTEL_KMD_TYPE_XE:
|
||||
return xe_engines_is_guc_semaphore_functional(fd, info);
|
||||
default:
|
||||
unreachable("Missing");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
intel_engines_supported_count(int fd, const struct intel_device_info *info,
|
||||
const struct intel_query_engine_info *engine_info,
|
||||
enum intel_engine_class engine_class)
|
||||
{
|
||||
bool supported;
|
||||
|
||||
/* check if user set the force enabled engine with run-time parameter */
|
||||
switch (engine_class) {
|
||||
case INTEL_ENGINE_CLASS_COMPUTE:
|
||||
supported = debug_get_bool_option("INTEL_ENGINE_CLASS_COMPUTE", false);
|
||||
supported |= is_guc_semaphore_functional(fd, info);
|
||||
break;
|
||||
case INTEL_ENGINE_CLASS_COPY:
|
||||
supported = debug_get_bool_option("INTEL_ENGINE_CLASS_COPY", true);
|
||||
break;
|
||||
default:
|
||||
/* There is no restrictions or parameters for other engines */
|
||||
supported = true;
|
||||
}
|
||||
|
||||
return supported ? intel_engines_count(engine_info, engine_class) : 0;
|
||||
}
|
||||
|
@@ -44,3 +44,12 @@ intel_engine_get_info(int fd, enum intel_kmd_type type);
|
||||
int intel_engines_count(const struct intel_query_engine_info *info,
|
||||
enum intel_engine_class engine_class);
|
||||
const char *intel_engines_class_to_string(enum intel_engine_class engine_class);
|
||||
|
||||
/* Taking into consideration KMD, platform and debug options check for
|
||||
* restrictions and return the number of engines of giving engine class
|
||||
* can actually be used.
|
||||
*/
|
||||
int
|
||||
intel_engines_supported_count(int fd, const struct intel_device_info *info,
|
||||
const struct intel_query_engine_info *engine_info,
|
||||
enum intel_engine_class engine_class);
|
||||
|
@@ -102,3 +102,10 @@ error_free_xe_engines:
|
||||
free(xe_engines);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
xe_engines_is_guc_semaphore_functional(int fd, const struct intel_device_info *info)
|
||||
{
|
||||
/* TODO */
|
||||
return false;
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "common/intel_engine.h"
|
||||
@@ -31,3 +32,6 @@ struct intel_query_engine_info *
|
||||
xe_engine_get_info(int fd);
|
||||
|
||||
uint16_t intel_engine_class_to_xe(enum intel_engine_class intel);
|
||||
|
||||
bool
|
||||
xe_engines_is_guc_semaphore_functional(int fd, const struct intel_device_info *info);
|
||||
|
Reference in New Issue
Block a user