mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
intel/dev: Simplify DEVINFO_HWCONFIG_KV by adding should_apply_hwconfig_item()
Backport-to: 24.2 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31692>
This commit is contained in:
parent
b4df9658f5
commit
a71702d342
1 changed files with 22 additions and 12 deletions
|
|
@ -33,12 +33,6 @@
|
|||
|
||||
#include "util/log.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define DEBUG_BUILD false
|
||||
#else
|
||||
#define DEBUG_BUILD true
|
||||
#endif
|
||||
|
||||
struct hwconfig {
|
||||
uint32_t key;
|
||||
uint32_t len;
|
||||
|
|
@ -160,6 +154,25 @@ apply_hwconfig(const struct intel_device_info *devinfo)
|
|||
return devinfo->verx10 >= 125;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
should_apply_hwconfig_item(const struct intel_device_info *devinfo,
|
||||
const char *devinfo_name, uint32_t devinfo_val,
|
||||
const uint32_t hwconfig_key, uint32_t hwconfig_val)
|
||||
{
|
||||
if (apply_hwconfig(devinfo))
|
||||
return true;
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (devinfo_val != hwconfig_val) {
|
||||
mesa_logw("%s (%u) != devinfo->%s (%u)",
|
||||
key_to_name(hwconfig_key), hwconfig_val, devinfo_name,
|
||||
devinfo_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* If apply_hwconfig(devinfo) is true, then we apply the
|
||||
* hwconfig value to the devinfo field, ``F``.
|
||||
*
|
||||
|
|
@ -170,12 +183,9 @@ apply_hwconfig(const struct intel_device_info *devinfo)
|
|||
*/
|
||||
#define DEVINFO_HWCONFIG_KV(F, K, V) \
|
||||
do { \
|
||||
if (apply_hwconfig(devinfo)) \
|
||||
devinfo->F = V; \
|
||||
else if (DEBUG_BUILD && devinfo->F != (V)) \
|
||||
mesa_logw("%s (%u) != devinfo->%s (%u)", \
|
||||
key_to_name(K), (V), #F, \
|
||||
devinfo->F); \
|
||||
if (should_apply_hwconfig_item(devinfo, #F, devinfo->F, (K), \
|
||||
(V))) \
|
||||
devinfo->F = (V); \
|
||||
} while (0)
|
||||
|
||||
#define DEVINFO_HWCONFIG(F, I) DEVINFO_HWCONFIG_KV(F, (I)->key, (I)->val[0])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue