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);
}
}
- 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
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)
{
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
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);
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);
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);
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);
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);
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);