Module: Mesa Branch: staging/22.1 Commit: b29e15e5155ec4b58c67e99510ae124a00c72416 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b29e15e5155ec4b58c67e99510ae124a00c72416
Author: Jordan Justen <[email protected]> Date: Sat Oct 30 13:41:38 2021 -0700 intel/dev: Read hwconfig from i915 Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Caio Oliveira <[email protected]> (cherry picked from commit d9ff9ea9c3315e9373a1fbdccd57fce571463cd5) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16231> --- src/intel/dev/intel_device_info.c | 3 +++ src/intel/dev/intel_hwconfig.c | 17 ++++++++++++++++- src/intel/dev/intel_hwconfig.h | 5 ++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c index 9dfa2b308b8..835c11aab6d 100644 --- a/src/intel/dev/intel_device_info.c +++ b/src/intel/dev/intel_device_info.c @@ -31,6 +31,7 @@ #include <xf86drm.h> #include "intel_device_info.h" +#include "intel_hwconfig.h" #include "intel/common/intel_gem.h" #include "util/bitscan.h" #include "util/debug.h" @@ -1891,6 +1892,8 @@ intel_get_device_info_from_fd(int fd, struct intel_device_info *devinfo) return true; } + intel_get_and_process_hwconfig_table(fd, devinfo); + int timestamp_frequency; if (getparam(fd, I915_PARAM_CS_TIMESTAMP_FREQUENCY, ×tamp_frequency)) diff --git a/src/intel/dev/intel_hwconfig.c b/src/intel/dev/intel_hwconfig.c index 0dfbd21cf21..36969810dc7 100644 --- a/src/intel/dev/intel_hwconfig.c +++ b/src/intel/dev/intel_hwconfig.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdlib.h> +#include "drm-uapi/i915_drm.h" #include "intel_device_info.h" #include "intel_hwconfig.h" #include "intel_hwconfig_types.h" @@ -271,7 +272,7 @@ apply_hwconfig_item(struct intel_device_info *devinfo, } } -void +static void intel_apply_hwconfig_table(struct intel_device_info *devinfo, const struct hwconfig *hwconfig, int32_t hwconfig_len) @@ -286,6 +287,20 @@ intel_apply_hwconfig_table(struct intel_device_info *devinfo, } } +void +intel_get_and_process_hwconfig_table(int fd, + struct intel_device_info *devinfo) +{ + struct hwconfig *hwconfig; + int32_t hwconfig_len = 0; + hwconfig = intel_i915_query_alloc(fd, DRM_I915_QUERY_HWCONFIG_BLOB, + &hwconfig_len); + if (hwconfig) { + intel_apply_hwconfig_table(devinfo, hwconfig, hwconfig_len); + free(hwconfig); + } +} + static void print_hwconfig_item(struct intel_device_info *devinfo, const struct hwconfig *item) diff --git a/src/intel/dev/intel_hwconfig.h b/src/intel/dev/intel_hwconfig.h index 654adab819d..20d76abf5ae 100644 --- a/src/intel/dev/intel_hwconfig.h +++ b/src/intel/dev/intel_hwconfig.h @@ -36,9 +36,8 @@ struct hwconfig; struct intel_device_info; void -intel_apply_hwconfig_table(struct intel_device_info *devinfo, - const struct hwconfig *hwconfig, - int32_t hwconfig_len); +intel_get_and_process_hwconfig_table(int fd, + struct intel_device_info *devinfo); void intel_print_hwconfig_table(const struct hwconfig *hwconfig, int32_t hwconfig_len);
