freedreno: python fixes

Acked-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: David Heidelberg <david@ixit.cz>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29390>
This commit is contained in:
David Heidelberg 2024-05-24 10:42:11 -07:00 committed by Marge Bot
parent b67218645d
commit 9f5ee44986
2 changed files with 13 additions and 13 deletions

View file

@ -62,20 +62,20 @@ def add_gpus(ids, info):
class GPUId(object):
def __init__(self, gpu_id = None, chip_id = None, name=None):
if chip_id == None:
assert(gpu_id != None)
if chip_id is None:
assert(gpu_id is not None)
val = gpu_id
core = int(val / 100)
val -= (core * 100);
major = int(val / 10);
val -= (core * 100)
major = int(val / 10)
val -= (major * 10)
minor = val
chip_id = (core << 24) | (major << 16) | (minor << 8) | 0xff
self.chip_id = chip_id
if gpu_id == None:
if gpu_id is None:
gpu_id = 0
self.gpu_id = gpu_id
if name == None:
if name is None:
assert(gpu_id != 0)
name = "FD%d" % gpu_id
self.name = name
@ -172,7 +172,7 @@ class A6xxGPUInfo(GPUInfo):
if raw_magic_regs:
self.a6xx.magic_raw = [[int(r[0]), r[1]] for r in raw_magic_regs]
templates = template if type(template) is list else [template]
templates = template if isinstance(template, list) else [template]
for template in templates:
template.apply_props(self)

View file

@ -69,11 +69,11 @@ class Field(object):
raise parser.error("booleans should be 1 bit fields")
elif self.type == "float" and not (high - low == 31 or high - low == 15):
raise parser.error("floats should be 16 or 32 bit fields")
elif not self.type in builtin_types and not self.type in parser.enums:
elif self.type not in builtin_types and self.type not in parser.enums:
raise parser.error("unknown type '%s'" % self.type)
def ctype(self, var_name):
if self.type == None:
if self.type is None:
type = "uint32_t"
val = var_name
elif self.type == "boolean":
@ -252,7 +252,7 @@ class Bitset(object):
def dump(self, is_deprecated, prefix=None):
if prefix == None:
if prefix is None:
prefix = self.name
for f in self.fields:
if f.name:
@ -260,9 +260,9 @@ class Bitset(object):
else:
name = prefix
if not f.name and f.low == 0 and f.shr == 0 and not f.type in ["float", "fixed", "ufixed"]:
if not f.name and f.low == 0 and f.shr == 0 and f.type not in ["float", "fixed", "ufixed"]:
pass
elif f.type == "boolean" or (f.type == None and f.low == f.high):
elif f.type == "boolean" or (f.type is None and f.low == f.high):
tab_to("#define %s" % name, "0x%08x" % (1 << f.low))
else:
tab_to("#define %s__MASK" % name, "0x%08x" % mask(f.low, f.high))
@ -511,7 +511,7 @@ class Parser(object):
return varset
def parse_variants(self, attrs):
if not "variants" in attrs:
if "variants" not in attrs:
return None
variant = attrs["variants"].split(",")[0]
if "-" in variant: