diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-06-29 12:11:28 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-06-30 23:06:51 +0100 |
commit | 2aa3dc83399a16588ba06ec1718ed709f55bb8d9 (patch) | |
tree | d9b2c4550481d9375298ceb79fe7cf214cae3f08 /lib/intel_device_info.c | |
parent | e63f1544ff033f8b8b5e83e16cb0e60e65a04c7d (diff) |
intel_chipset: Replace lookup of GT size with computation
Instead of a large if-chain for matching devid to GT, we can just
compute it directly from the encoded devid.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/intel_device_info.c')
-rw-r--r-- | lib/intel_device_info.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/intel_device_info.c b/lib/intel_device_info.c index 9e194945..12bce7ea 100644 --- a/lib/intel_device_info.c +++ b/lib/intel_device_info.c @@ -286,3 +286,26 @@ unsigned intel_gen(uint16_t devid) { return ffs(intel_device_info(devid)->gen); } + +/** + * intel_gt: + * @devid: pci device id + * + * Computes the Intel GFX GT size for the given device id. + * + * Returns: + * The GT size. + */ +unsigned intel_gt(uint16_t devid) +{ + unsigned mask = intel_gen(devid); + + if (mask >= 8) + mask = 0xf; + else if (mask >= 6) + mask = 0x3; + else + mask = 0; + + return (devid >> 4) & mask; +} |