freedreno: Small dev_id_compare() cleanup

We don't really treat the two arguments identically, so rename them to
make it clear which one is the device id coming from kernel, and which
one is the reference id from the fd_dev_recs table.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14506>
This commit is contained in:
Rob Clark 2021-12-16 11:33:34 -08:00 committed by Marge Bot
parent 0a82a26a18
commit 9176e27dd2
1 changed files with 11 additions and 8 deletions

View File

@ -36,22 +36,25 @@ struct fd_dev_rec {
#include "freedreno_devices.h"
/**
* Compare device 'id' against reference id ('ref') from gpu table.
*/
static bool
dev_id_compare(const struct fd_dev_id *a, const struct fd_dev_id *b)
dev_id_compare(const struct fd_dev_id *ref, const struct fd_dev_id *id)
{
if (a->gpu_id && b->gpu_id) {
return a->gpu_id == b->gpu_id;
if (ref->gpu_id && id->gpu_id) {
return ref->gpu_id == id->gpu_id;
} else {
assert(a->chip_id && b->chip_id);
assert(ref->chip_id && id->chip_id);
/* Match on either:
* (a) exact match
* (b) device table entry has 0xff wildcard patch_id and core/
* major/minor match
*/
return (a->chip_id == b->chip_id) ||
(((a->chip_id & 0xff) == 0xff) &&
((a->chip_id & UINT64_C(0xffffff00)) ==
(b->chip_id & UINT64_C(0xffffff00))));
return (ref->chip_id == id->chip_id) ||
(((ref->chip_id & 0xff) == 0xff) &&
((ref->chip_id & UINT64_C(0xffffff00)) ==
(id->chip_id & UINT64_C(0xffffff00))));
}
}