anv: Add a use_relocations physical device bit

This is more the bit of information we want to be carrying around
long-term.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13610>
This commit is contained in:
Jason Ekstrand 2021-11-03 07:23:22 -05:00 committed by Marge Bot
parent cbcb10320f
commit 2eb9057de0
3 changed files with 13 additions and 9 deletions

View File

@ -852,8 +852,10 @@ anv_physical_device_try_create(struct anv_instance *instance,
goto fail_base;
}
if (device->info.ver >= 8 &&
device->info.platform != INTEL_PLATFORM_CHV &&
device->use_relocations = device->info.ver < 8 ||
device->info.platform == INTEL_PLATFORM_CHV;
if (!device->use_relocations &&
!anv_gem_get_param(fd, I915_PARAM_HAS_EXEC_SOFTPIN)) {
result = vk_errorf(device, VK_ERROR_INITIALIZATION_FAILED,
"kernel missing softpin");
@ -894,9 +896,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
if (result != VK_SUCCESS)
goto fail_base;
device->use_softpin = device->info.ver >= 8 &&
device->info.platform != INTEL_PLATFORM_CHV;
assert(device->use_softpin == device->supports_48bit_addresses);
assert(device->supports_48bit_addresses == !device->use_relocations);
device->use_softpin = !device->use_relocations;
device->has_context_isolation =
anv_gem_get_param(fd, I915_PARAM_HAS_CONTEXT_ISOLATION);

View File

@ -907,6 +907,7 @@ struct anv_physical_device {
bool has_userptr_probe;
uint64_t gtt_size;
bool use_relocations;
bool use_softpin;
bool always_use_bindless;
bool use_call_secondary;
@ -1254,18 +1255,18 @@ anv_use_relocations(const struct anv_physical_device *pdevice)
{
#if defined(GFX_VERx10) && GFX_VERx10 >= 90
/* Sky Lake and later always uses softpin */
assert(pdevice->use_softpin);
assert(!pdevice->use_relocations);
return false;
#elif defined(GFX_VERx10) && GFX_VERx10 < 80
/* Haswell and earlier never use softpin */
assert(!pdevice->use_softpin);
assert(pdevice->use_relocations);
return true;
#else
/* If we don't have a GFX_VERx10 #define, we need to look at the physical
* device. Also, for GFX version 8, we need to look at the physical
* device because Broadwell softpins but Cherryview doesn't.
*/
return !pdevice->use_softpin;
return pdevice->use_relocations;
#endif
}

View File

@ -110,7 +110,9 @@ static void validate_monotonic(int32_t **blocks)
static void run_test()
{
struct anv_physical_device physical_device = { };
struct anv_physical_device physical_device = {
.use_relocations = true,
};
struct anv_device device = {
.physical = &physical_device,
};