freedreno/registers: Reintroduce FD_NO_DEPRECATED_PACK

The non-variant reg packers were removed in commit fd6489c026 ("tu:
Drop emitting of deprecated packing."), along with
FD_NO_DEPRECATED_PACK.

Add support to mark the even older reg builders as deprecated, and
re-introduce FD_NO_DEPRECATED_PACK to control this.

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39029>
This commit is contained in:
Rob Clark 2025-12-17 11:30:46 -08:00 committed by Marge Bot
parent 2f3d6119fc
commit 31d757495e
3 changed files with 34 additions and 7 deletions

View file

@ -8,6 +8,8 @@
#include <stdint.h>
#include "util/macros.h"
#include "fd6_hw.h"
/* In order to debug issues with usage of stale reg data we need to have
@ -26,6 +28,9 @@
static inline bool
fd_reg_stomp_allowed(chip CHIP, uint16_t reg)
{
PRAGMA_DIAGNOSTIC_PUSH
PRAGMA_DIAGNOSTIC_IGNORED_CLANG(-W#pragma-messages)
switch (CHIP) {
case A6XX: {
switch (reg) {
@ -77,6 +82,7 @@ fd_reg_stomp_allowed(chip CHIP, uint16_t reg)
default: {
UNREACHABLE("Unknown GPU");
}
PRAGMA_DIAGNOSTIC_POP
}
return true;

View file

@ -121,6 +121,10 @@ def tab_to(name, value):
tab_count = 1
print(name + ('\t' * tab_count) + value)
def define_macro(name, value, has_variants):
if has_variants:
value = "__FD_DEPRECATED " + value
tab_to(name, value)
def mask(low, high):
return ((0xffffffffffffffff >> (64 - (high + 1 - low))) << low)
@ -407,11 +411,13 @@ class Array(object):
print("\t\tdefault: return INVALID_IDX(idx);")
print("\t}\n}")
if proto == '':
tab_to("#define REG_%s_%s" %
(self.domain, self.name), "0x%08x\n" % array_offset)
define_macro("#define REG_%s_%s" %
(self.domain, self.name), "0x%08x\n" % array_offset,
has_variants)
else:
tab_to("#define REG_%s_%s(%s)" % (self.domain, self.name,
proto), "(0x%08x + %s )\n" % (array_offset, strides))
define_macro("#define REG_%s_%s(%s)" % (self.domain, self.name,
proto), "(0x%08x + %s )\n" % (array_offset, strides),
has_variants)
def dump_pack_struct(self, has_variants):
pass
@ -466,10 +472,13 @@ class Reg(object):
strides = indices_strides(self.indices())
offset = self.total_offset()
if proto == '':
tab_to("#define REG_%s" % self.full_name, "0x%08x" % offset)
define_macro("#define REG_%s" % self.full_name, "0x%08x" % offset, has_variants)
elif not has_variants:
print("static CONSTEXPR inline uint32_t REG_%s(%s) { return 0x%08x + %s; }" % (
self.full_name, proto, offset, strides))
depcrstr = ""
if has_variants:
depcrstr = " __FD_DEPRECATED "
print("static CONSTEXPR inline%s uint32_t REG_%s(%s) { return 0x%08x + %s; }" % (
depcrstr, self.full_name, proto, offset, strides))
if self.bitset.inline:
self.bitset.dump(has_variants, self.full_name, self)
@ -980,6 +989,15 @@ def dump_c(args, guard, func):
print("#endif")
print()
# TODO figure out what to do about fd_reg_stomp_allowed()
# vs gcc.. for now only enable the warnings with clang:
print("#if defined(__clang__) && !defined(FD_NO_DEPRECATED_PACK)")
print("#define __FD_DEPRECATED _Pragma (\"GCC warning \\\"Deprecated reg builder\\\"\")")
print("#else")
print("#define __FD_DEPRECATED")
print("#endif")
print()
func(p)
print("#endif /* %s */" % guard)

View file

@ -135,6 +135,9 @@ if freedreno_kmds.contains('virtio')
tu_deps += dep_libdrm
endif
# Temporarily quiet deprecated warnings until turnip is converted:
tu_flags += '-DFD_NO_DEPRECATED_PACK'
tu_tracepoints = custom_target(
'tu_tracepoints.[ch]',
input: 'tu_tracepoints.py',