util/drirc_gen: enable validation for a specific driver

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41664>
This commit is contained in:
Lionel Landwerlin 2026-05-20 14:20:04 +03:00 committed by Marge Bot
parent 73382c8126
commit 61267c69db

View file

@ -194,15 +194,24 @@ ${driver_prefix}_parse_dri_options(struct ${driver_prefix}_drirc *drirc,
}
"""
def drirc_validate(conf_paths, sections):
def drirc_validate(conf_paths, sections, driver=None):
declared = {opt.name for section in sections for opt in section.options}
conf_names = set()
for conf_path in conf_paths:
tree = ET.parse(conf_path)
for option in tree.iter('option'):
name = option.get('name')
if name:
conf_names.add(name)
if driver is None:
for option in tree.iter('option'):
name = option.get('name')
if name:
conf_names.add(name)
else:
for device in tree.iter('device'):
if device.get('driver') != driver:
continue
for option in device.iter('option'):
name = option.get('name')
if name:
conf_names.add(name)
missing = conf_names - declared
if missing:
print('ERROR: options used in conf but not declared:', file=sys.stderr)