Commit d4447848 authored by Lionel Landwerlin's avatar Lionel Landwerlin Committed by Marge Bot
Browse files

genxml: protect _length defines in genX_bits.h

Those defines exist in the packing headers too and some parts of the
code (like mi_builder.h) include both.
Signed-off-by: Lionel Landwerlin's avatarLionel Landwerlin <>
Reviewed-by: Tapani Pälli's avatarTapani Pälli <>
Part-of: <mesa/mesa!13954>
parent e9b58116
......@@ -66,10 +66,16 @@ from operator import itemgetter
#include "dev/intel_device_info.h"
#include "util/macros.h"
<%def name="emit_per_gen_prop_func(item, prop)">
<%def name="emit_per_gen_prop_func(item, prop, protect_defines)">
%if item.has_prop(prop):
% for gen, value in sorted(item.iter_prop(prop), reverse=True):
% if protect_defines:
#ifndef ${gen.prefix(item.token_name)}_${prop}
#define ${gen.prefix(item.token_name)}_${prop} ${value}
% else:
#define ${gen.prefix(item.token_name)}_${prop} ${value}
% endif
% endfor
static inline uint32_t ATTRIBUTE_PURE
......@@ -101,15 +107,15 @@ extern "C" {
/* ${} */
${emit_per_gen_prop_func(container, 'length')}
${emit_per_gen_prop_func(container, 'length', True)}
% for _, field in sorted(container.fields.items(), key=itemgetter(0)):
/* ${}::${} */
${emit_per_gen_prop_func(field, 'bits')}
${emit_per_gen_prop_func(field, 'bits', False)}
${emit_per_gen_prop_func(field, 'start')}
${emit_per_gen_prop_func(field, 'start', False)}
% endfor
% endfor
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment