358 lines
14 KiB
Diff
358 lines
14 KiB
Diff
Index: mesa-26.0.0-rc1/src/nouveau/headers/class_parser.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/nouveau/headers/class_parser.py
|
|
+++ mesa-26.0.0-rc1/src/nouveau/headers/class_parser.py
|
|
@@ -14,6 +14,16 @@ from mako.template import Template
|
|
import util
|
|
|
|
|
|
+def removeprefix(s, prefix):
|
|
+ if s.startswith(prefix):
|
|
+ return s[len(prefix):]
|
|
+ return s
|
|
+
|
|
+def removesuffix(s, suffix):
|
|
+ if s.endswith(suffix):
|
|
+ return s[:-len(suffix)]
|
|
+ return s
|
|
+
|
|
METHOD_ARRAY_SIZES = {
|
|
'BIND_GROUP_CONSTANT_BUFFER' : 16,
|
|
'CALL_MME_DATA' : 256,
|
|
@@ -560,7 +570,7 @@ def parse_header(nvcl, f):
|
|
state = 1
|
|
elif teststr in list[1]:
|
|
if not SKIP_FIELD[0] in list[1]:
|
|
- curfield.add_def(list[1].removeprefix(teststr), list[2])
|
|
+ curfield.add_def(removeprefix(list[1],teststr), list[2])
|
|
else:
|
|
state = 1
|
|
|
|
@@ -570,7 +580,7 @@ def parse_header(nvcl, f):
|
|
if ("0x" in list[2]):
|
|
state = 1
|
|
else:
|
|
- field = list[1].removeprefix(teststr)
|
|
+ field = removeprefix(list[1], teststr)
|
|
bitfield = list[2].split(":")
|
|
f = Field(field, bitfield[1], bitfield[0])
|
|
curmthd.fields.append(f)
|
|
@@ -590,13 +600,13 @@ def parse_header(nvcl, f):
|
|
is_array = 0
|
|
if (':' in list[2]):
|
|
continue
|
|
- name = list[1].removeprefix(teststr)
|
|
+ name = removeprefix(list[1], teststr)
|
|
if name.endswith("(i)"):
|
|
is_array = 1
|
|
- name = name.removesuffix("(i)")
|
|
+ name = removesuffix(name, "(i)")
|
|
if name.endswith("(j)"):
|
|
is_array = 1
|
|
- name = name.removesuffix("(j)")
|
|
+ name = removesuffix(name, "(j)")
|
|
|
|
curmthd = Method(name, list[2], is_array)
|
|
methods[name] = curmthd
|
|
@@ -605,8 +615,8 @@ def parse_header(nvcl, f):
|
|
return (version, methods)
|
|
|
|
def nvcl_for_filename(name):
|
|
- name = name.removeprefix("cl")
|
|
- name = name.removesuffix(".h")
|
|
+ name = removeprefix(name, "cl")
|
|
+ name = removesuffix(name, ".h")
|
|
return "NV" + name.upper()
|
|
|
|
def main():
|
|
@@ -636,7 +646,7 @@ def main():
|
|
if args.prev_in_h is not None:
|
|
prev_clheader = os.path.basename(args.prev_in_h)
|
|
prev_nvcl = nvcl_for_filename(prev_clheader)
|
|
- prev_mod = prev_clheader.removesuffix(".h")
|
|
+ prev_mod = removesuffix(prev_clheader, ".h")
|
|
with open(args.prev_in_h, 'r', encoding='utf-8') as f:
|
|
(prev_version, prev_methods) = parse_header(prev_nvcl, f)
|
|
|
|
Index: mesa-26.0.0-rc1/src/compiler/nir/nir_algebraic.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/compiler/nir/nir_algebraic.py
|
|
+++ mesa-26.0.0-rc1/src/compiler/nir/nir_algebraic.py
|
|
@@ -39,6 +39,11 @@ class TestStatus(Enum):
|
|
UNSUPPORTED = 2,
|
|
|
|
|
|
+def removeprefix(s, prefix):
|
|
+ if s.startswith(prefix):
|
|
+ return s[len(prefix):]
|
|
+ return s
|
|
+
|
|
# This should be the same as NIR_SEARCH_MAX_COMM_OPS in nir_search.c
|
|
nir_search_max_comm_ops = 8
|
|
|
|
@@ -432,8 +437,8 @@ class Expression(Value):
|
|
self.ninf = cond.pop('ninf', False)
|
|
self.contract = cond.pop('contract', False)
|
|
self.swizzle = - \
|
|
- 1 if m.group('swizzle') is None else swizzles[m.group(
|
|
- 'swizzle').removeprefix('.')]
|
|
+ 1 if m.group('swizzle') is None else \
|
|
+ swizzles[removeprefix(m.group('swizzle'), '.')]
|
|
|
|
assert len(cond) <= 1
|
|
self.cond = cond.popitem()[0] if cond else None
|
|
Index: mesa-26.0.0-rc1/src/nouveau/headers/nv_push_class_dump_h.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/nouveau/headers/nv_push_class_dump_h.py
|
|
+++ mesa-26.0.0-rc1/src/nouveau/headers/nv_push_class_dump_h.py
|
|
@@ -5,6 +5,11 @@ from collections import defaultdict
|
|
from mako.template import Template
|
|
import util
|
|
|
|
+def removeprefix(s, prefix):
|
|
+ if s.startswith(prefix):
|
|
+ return s[len(prefix):]
|
|
+ return s
|
|
+
|
|
TEMPLATE_H = Template(
|
|
"""\
|
|
#pragma once
|
|
@@ -129,7 +134,7 @@ def main():
|
|
classes_per_eng = defaultdict(list)
|
|
|
|
for cl in classes:
|
|
- class_id = int(cl.removeprefix("cl"), 16)
|
|
+ class_id = int(removeprefix(cl,"cl"), 16)
|
|
engine_id = class_id_to_engine_id(class_id)
|
|
|
|
classes_per_eng[engine_id].append(class_id)
|
|
Index: mesa-26.0.0-rc1/src/vulkan/util/vk_physical_device_features_gen.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/vulkan/util/vk_physical_device_features_gen.py
|
|
+++ mesa-26.0.0-rc1/src/vulkan/util/vk_physical_device_features_gen.py
|
|
@@ -34,6 +34,11 @@ import mako
|
|
from mako.template import Template
|
|
from vk_extensions import Requirements, get_all_required, filter_api
|
|
|
|
+def removeprefix(s, prefix):
|
|
+ if s.startswith(prefix):
|
|
+ return s[len(prefix):]
|
|
+ return s
|
|
+
|
|
RENAMED_FEATURES = {
|
|
# See https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17272#note_1446477 for details
|
|
('BufferDeviceAddressFeaturesEXT', 'bufferDeviceAddressCaptureReplay'): 'bufferDeviceAddressCaptureReplayEXT',
|
|
@@ -151,7 +156,7 @@ for (feature_structs, features) in KNOWN
|
|
RENAMED_FEATURES[rename] = flag
|
|
|
|
def get_renamed_feature(c_type, feature):
|
|
- return RENAMED_FEATURES.get((c_type.removeprefix('VkPhysicalDevice'), feature), feature)
|
|
+ return RENAMED_FEATURES.get((removeprefix(c_type, 'VkPhysicalDevice'), feature), feature)
|
|
|
|
@dataclass
|
|
class FeatureStruct:
|
|
@@ -514,12 +519,12 @@ def get_feature_structs_from_xml(xml_fil
|
|
if renamed_flag not in features:
|
|
features[renamed_flag] = f.c_type
|
|
else:
|
|
- a = features[renamed_flag].removeprefix('VkPhysicalDevice')
|
|
- b = f.c_type.removeprefix('VkPhysicalDevice')
|
|
+ a = removeprefix(features[renamed_flag], 'VkPhysicalDevice')
|
|
+ b = removeprefix(f.c_type, 'VkPhysicalDevice')
|
|
if (a, flag) not in RENAMED_FEATURES or (b, flag) not in RENAMED_FEATURES:
|
|
diagnostics.append(f'{a} and {b} both define {flag}')
|
|
|
|
- unused_renames.pop((f.c_type.removeprefix('VkPhysicalDevice'), flag), None)
|
|
+ unused_renames.pop((removeprefix(f.c_type, 'VkPhysicalDevice'), flag), None)
|
|
|
|
for rename in unused_renames:
|
|
diagnostics.append(f'unused rename {rename}')
|
|
Index: mesa-26.0.0-rc1/src/vulkan/util/vk_physical_device_spirv_caps_gen.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/vulkan/util/vk_physical_device_spirv_caps_gen.py
|
|
+++ mesa-26.0.0-rc1/src/vulkan/util/vk_physical_device_spirv_caps_gen.py
|
|
@@ -14,6 +14,11 @@ import xml.etree.ElementTree as et
|
|
import mako
|
|
from mako.template import Template
|
|
|
|
+def removeprefix(s, prefix):
|
|
+ if s.startswith(prefix):
|
|
+ return s[len(prefix):]
|
|
+ return s
|
|
+
|
|
TEMPLATE_C = Template(COPYRIGHT + """
|
|
/* This file generated from ${filename}, don't edit directly. */
|
|
|
|
@@ -71,13 +76,13 @@ def process_enable(enab):
|
|
else:
|
|
return f"(p->{attrib['member']} & {attrib['value']})"
|
|
elif 'extension' in attrib:
|
|
- return f"e->{attrib['extension'].removeprefix('VK_')}"
|
|
+ return f"e->{removeprefix(attrib['extension'], 'VK_')}"
|
|
elif 'feature' in attrib:
|
|
feat = get_renamed_feature(attrib['struct'], attrib['feature'])
|
|
return f"f->{feat}"
|
|
else:
|
|
version = attrib['version']
|
|
- return f"(api_version >= VK_API_{version.removeprefix('VK_')})"
|
|
+ return f"(api_version >= VK_API_{removeprefix(version,'VK_')})"
|
|
|
|
def get_capabilities(doc, beta):
|
|
caps = {}
|
|
Index: mesa-26.0.0-rc1/src/amd/vulkan/layers/radv_annotate_layer_gen.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/amd/vulkan/layers/radv_annotate_layer_gen.py
|
|
+++ mesa-26.0.0-rc1/src/amd/vulkan/layers/radv_annotate_layer_gen.py
|
|
@@ -14,6 +14,11 @@ import xml.etree.ElementTree as et
|
|
import mako
|
|
from mako.template import Template
|
|
|
|
+def removesuffix(s, suffix):
|
|
+ if s.endswith(suffix):
|
|
+ return s[:-len(suffix)]
|
|
+ return s
|
|
+
|
|
sys.path.append(os.path.join(sys.path[0], '../../../vulkan/util/'))
|
|
|
|
from vk_entrypoints import get_entrypoints_from_xml
|
|
@@ -68,7 +73,7 @@ def main():
|
|
if not e.name.startswith('Cmd') or e.alias or e.return_type != "void":
|
|
continue
|
|
|
|
- stripped_name = e.name.removesuffix('EXT').removesuffix('KHR').removesuffix('2')
|
|
+ stripped_name = removesuffix(removesuffix(removesuffix(e.name, 'EXT'), 'KHR'), '2')
|
|
if stripped_name in commands_names or stripped_name in EXCLUDED_COMMANDS:
|
|
continue
|
|
|
|
Index: mesa-26.0.0-rc1/src/nouveau/compiler/latencies/lat_rs_gen.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/nouveau/compiler/latencies/lat_rs_gen.py
|
|
+++ mesa-26.0.0-rc1/src/nouveau/compiler/latencies/lat_rs_gen.py
|
|
@@ -13,6 +13,11 @@ import sys
|
|
|
|
from mako import template
|
|
|
|
+def removesuffix(s, suffix):
|
|
+ if s.endswith(suffix):
|
|
+ return s[:-len(suffix)]
|
|
+ return s
|
|
+
|
|
TEMPLATE_RS = template.Template(text="""\
|
|
// Copyright 2024 Red Hat Inc.
|
|
// SPDX-License-Identifier: MIT
|
|
@@ -106,7 +111,7 @@ class Fld(object):
|
|
self.pred_val = part[1]
|
|
elif " & sb" in line:
|
|
self.scoreboard = True
|
|
- self.value = line.removesuffix(" & sb");
|
|
+ self.value = removesuffix(line, " & sb");
|
|
else:
|
|
self.scoreboard = False
|
|
self.value = line.strip()
|
|
@@ -186,7 +191,7 @@ def main():
|
|
|
|
file_cats = {}
|
|
for csv_file in args.csv_files[0]:
|
|
- split = os.path.basename(csv_file).removesuffix('.csv').split('_')
|
|
+ split = removesuffix(os.path.basename(csv_file), '.csv').split('_')
|
|
assert len(split) == 2
|
|
reg_file = split[0]
|
|
latcat = split[1]
|
|
Index: mesa-26.0.0-rc1/src/nouveau/headers/lib_rs_gen.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/nouveau/headers/lib_rs_gen.py
|
|
+++ mesa-26.0.0-rc1/src/nouveau/headers/lib_rs_gen.py
|
|
@@ -16,6 +16,10 @@ from mako.template import Template
|
|
|
|
import util
|
|
|
|
+def removesuffix(s, suffix):
|
|
+ if s.endswith(suffix):
|
|
+ return s[:-len(suffix)]
|
|
+ return s
|
|
|
|
TEMPLATE_RS = Template("""\
|
|
// Copyright © 2024 Collabora Ltd. and Red Hat Inc.
|
|
@@ -103,7 +107,7 @@ def main():
|
|
for f in args.class_files[0]:
|
|
f = os.path.basename(f)
|
|
assert f.endswith('.rs')
|
|
- f = f.removesuffix('.rs')
|
|
+ f = removesuffix(f, '.rs')
|
|
|
|
mod_path = f.split('_')
|
|
assert mod_path[0] == 'nvh'
|
|
Index: mesa-26.0.0-rc1/src/nouveau/headers/struct_parser.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/nouveau/headers/struct_parser.py
|
|
+++ mesa-26.0.0-rc1/src/nouveau/headers/struct_parser.py
|
|
@@ -13,6 +13,10 @@ from mako.template import Template
|
|
|
|
import util
|
|
|
|
+def removesuffix(s, suffix):
|
|
+ if s.endswith(suffix):
|
|
+ return s[:-len(suffix)]
|
|
+ return s
|
|
|
|
TEMPLATE_RS = Template("""\
|
|
// Copyright © 2024 Collabora Ltd. and Red Hat Inc.
|
|
@@ -144,7 +148,7 @@ def parse_header(nvcl, file):
|
|
hi = int(mw_arr.group('hi'))
|
|
stride = int(mw_arr.group('stride'))
|
|
assert name.endswith('(i)')
|
|
- struct.add_field(name.removesuffix('(i)'), lo, hi, stride)
|
|
+ struct.add_field(removesuffix(name, '(i)'), lo, hi, stride)
|
|
else:
|
|
for f in struct.fields:
|
|
if name.startswith(f.name + '_'):
|
|
Index: mesa-26.0.0-rc1/src/vulkan/util/vk_physical_device_properties_gen.py
|
|
===================================================================
|
|
--- mesa-26.0.0-rc1.orig/src/vulkan/util/vk_physical_device_properties_gen.py
|
|
+++ mesa-26.0.0-rc1/src/vulkan/util/vk_physical_device_properties_gen.py
|
|
@@ -36,6 +36,11 @@ from mako.template import Template
|
|
|
|
from vk_extensions import get_all_required, filter_api
|
|
|
|
+def removeprefix(s, prefix):
|
|
+ if s.startswith(prefix):
|
|
+ return s[len(prefix):]
|
|
+ return s
|
|
+
|
|
# Some extensions have been promoted to core, their properties are renamed
|
|
# in the following hashtable.
|
|
# The hashtable takes the form:
|
|
@@ -297,7 +302,7 @@ def get_property_structs(doc, api, beta)
|
|
if "STRUCTURE_TYPE" in str(elem.attrib):
|
|
s_type = elem.attrib.get("values")
|
|
|
|
- name = full_name.removeprefix("VkPhysicalDevice")
|
|
+ name = removeprefix(full_name, "VkPhysicalDevice")
|
|
|
|
# collect a list of properties
|
|
properties = []
|
|
diff -u -r mesa-26.0.0-rc3/src.orig/asahi/isa/isa.py mesa-26.0.0-rc3/src/asahi/isa/isa.py
|
|
--- mesa-26.0.0-rc3/src.orig/asahi/isa/isa.py 2026-02-04 20:59:25.293967127 +0100
|
|
+++ mesa-26.0.0-rc3/src/asahi/isa/isa.py 2026-02-04 21:02:29.593753170 +0100
|
|
@@ -122,7 +122,7 @@
|
|
if el.tag != 'zero':
|
|
text = substitute(el.text, subst)
|
|
bits = parse_bitstring(text)
|
|
- assert(len(text) == self.mask.bit_count())
|
|
+ assert(len(text) == bin(self.mask).count("1"))
|
|
else:
|
|
self.mask = 0
|
|
|
|
diff -u -r mesa-26.0.0-rc3/src.orig/asahi/isa/test/disasm.py mesa-26.0.0-rc3/src/asahi/isa/test/disasm.py
|
|
--- mesa-26.0.0-rc3/src.orig/asahi/isa/test/disasm.py 2026-02-04 20:59:25.293967127 +0100
|
|
+++ mesa-26.0.0-rc3/src/asahi/isa/test/disasm.py 2026-02-04 21:01:26.308452985 +0100
|
|
@@ -46,7 +46,7 @@
|
|
if count == 0:
|
|
count = 4
|
|
if 'mask' in desc:
|
|
- count = desc['mask'].bit_count()
|
|
+ count = bin(desc['mask']).count("1")
|
|
if 'zx' in desc:
|
|
desc['sx'] = desc['zx'] ^ 1
|
|
|