mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +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>
(cherry picked from commit a71702d342)
This commit is contained in:
parent
e25c4095e5
commit
f878028d18
2 changed files with 23 additions and 13 deletions
|
|
@ -1424,7 +1424,7 @@
|
|||
"description": "intel/dev: Simplify DEVINFO_HWCONFIG_KV by adding should_apply_hwconfig_item()",
|
||||
"nominated": true,
|
||||
"nomination_type": 4,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -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