mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
anv: Fixes struct anv_device::info is not initialized with struct anv_physical_device
Refactoring the function anv_device_set_physical out, so that it's can be called in unittests
Fixes: 356a60bd6c ("anv: Do not duplicate intel_device_info memory in each logical device")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7092
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: José Roberto de Souza jose.souza@intel.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17928>
This commit is contained in:
parent
8a78fbb832
commit
12bb9cba8b
8 changed files with 21 additions and 21 deletions
|
|
@ -3146,7 +3146,7 @@ VkResult anv_CreateDevice(
|
|||
INSTRUCTION_STATE_POOL_MIN_ADDRESS;
|
||||
}
|
||||
|
||||
device->physical = physical_device;
|
||||
anv_device_set_physical(device, physical_device);
|
||||
|
||||
/* XXX(chadv): Can we dup() physicalDevice->fd here? */
|
||||
device->fd = open(physical_device->path, O_RDWR | O_CLOEXEC);
|
||||
|
|
@ -3271,8 +3271,6 @@ VkResult anv_CreateDevice(
|
|||
}
|
||||
}
|
||||
|
||||
device->info = &physical_device->info;
|
||||
device->isl_dev = physical_device->isl_dev;
|
||||
|
||||
/* On Broadwell and later, we can use batch chaining to more efficiently
|
||||
* implement growing command buffers. Prior to Haswell, the kernel
|
||||
|
|
|
|||
|
|
@ -1410,6 +1410,14 @@ VkResult anv_device_set_bo_tiling(struct anv_device *device,
|
|||
void anv_device_release_bo(struct anv_device *device,
|
||||
struct anv_bo *bo);
|
||||
|
||||
static inline void anv_device_set_physical(struct anv_device *device,
|
||||
struct anv_physical_device *physical_device)
|
||||
{
|
||||
device->physical = physical_device;
|
||||
device->info = &physical_device->info;
|
||||
device->isl_dev = physical_device->isl_dev;
|
||||
}
|
||||
|
||||
static inline struct anv_bo *
|
||||
anv_device_lookup_bo(struct anv_device *device, uint32_t gem_handle)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@ int main(void)
|
|||
struct anv_physical_device physical_device = {
|
||||
.use_softpin = true,
|
||||
};
|
||||
struct anv_device device = {
|
||||
.physical = &physical_device,
|
||||
};
|
||||
struct anv_device device = {};
|
||||
struct anv_block_pool pool;
|
||||
|
||||
/* Create a pool with initial size smaller than the block allocated, so
|
||||
|
|
@ -40,6 +38,7 @@ int main(void)
|
|||
const uint32_t block_size = 16 * 1024;
|
||||
const uint32_t initial_size = block_size / 2;
|
||||
|
||||
anv_device_set_physical(&device, &physical_device);
|
||||
pthread_mutex_init(&device.mutex, NULL);
|
||||
anv_bo_cache_init(&device.bo_cache, &device);
|
||||
anv_block_pool_init(&pool, &device, "test", 4096, initial_size);
|
||||
|
|
|
|||
|
|
@ -113,11 +113,10 @@ static void run_test()
|
|||
struct anv_physical_device physical_device = {
|
||||
.use_relocations = true,
|
||||
};
|
||||
struct anv_device device = {
|
||||
.physical = &physical_device,
|
||||
};
|
||||
struct anv_device device = {};
|
||||
struct anv_block_pool pool;
|
||||
|
||||
anv_device_set_physical(&device, &physical_device);
|
||||
pthread_mutex_init(&device.mutex, NULL);
|
||||
anv_bo_cache_init(&device.bo_cache, &device);
|
||||
anv_block_pool_init(&pool, &device, "test", 4096, 4096);
|
||||
|
|
|
|||
|
|
@ -36,11 +36,10 @@
|
|||
int main(void)
|
||||
{
|
||||
struct anv_physical_device physical_device = { };
|
||||
struct anv_device device = {
|
||||
.physical = &physical_device,
|
||||
};
|
||||
struct anv_device device = {};
|
||||
struct anv_state_pool state_pool;
|
||||
|
||||
anv_device_set_physical(&device, &physical_device);
|
||||
pthread_mutex_init(&device.mutex, NULL);
|
||||
anv_bo_cache_init(&device.bo_cache, &device);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,11 +35,10 @@
|
|||
int main(void)
|
||||
{
|
||||
struct anv_physical_device physical_device = { };
|
||||
struct anv_device device = {
|
||||
.physical = &physical_device,
|
||||
};
|
||||
struct anv_device device = {};
|
||||
struct anv_state_pool state_pool;
|
||||
|
||||
anv_device_set_physical(&device, &physical_device);
|
||||
pthread_mutex_init(&device.mutex, NULL);
|
||||
anv_bo_cache_init(&device.bo_cache, &device);
|
||||
anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 4096);
|
||||
|
|
|
|||
|
|
@ -56,11 +56,10 @@ static void *alloc_states(void *_job)
|
|||
static void run_test()
|
||||
{
|
||||
struct anv_physical_device physical_device = { };
|
||||
struct anv_device device = {
|
||||
.physical = &physical_device,
|
||||
};
|
||||
struct anv_device device = {};
|
||||
struct anv_state_pool state_pool;
|
||||
|
||||
anv_device_set_physical(&device, &physical_device);
|
||||
pthread_mutex_init(&device.mutex, NULL);
|
||||
anv_bo_cache_init(&device.bo_cache, &device);
|
||||
anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 64);
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ int main(void)
|
|||
struct anv_physical_device physical_device = {
|
||||
.use_softpin = true,
|
||||
};
|
||||
struct anv_device device = {
|
||||
.physical = &physical_device,
|
||||
};
|
||||
struct anv_device device = {};
|
||||
struct anv_state_pool state_pool;
|
||||
|
||||
anv_device_set_physical(&device, &physical_device);
|
||||
pthread_mutex_init(&device.mutex, NULL);
|
||||
anv_bo_cache_init(&device.bo_cache, &device);
|
||||
anv_state_pool_init(&state_pool, &device, "test", 4096, 0, 4096);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue