amd-gpu: initialize the command stream before allocating any sharedmem

Move some code up like Qualcomm's so that the command stream is initialized
before any sharedmem is allocated. This only causes a panic when fine
grained locking is enabled, but it showed up a big difference in code order.

A little research shows the different order in the code path makes no
difference whatsoever (cmdstream does not depend on the memstore pointer)
but it does solve that first panic.

To solve: similar problem with Z160 regwrite call from device_init which
assumes cmdwindow is all set up when it isn't.. Qualcomm's code is MUCH
simpler in this regard and may solve it by simply being so.
This commit is contained in:
Matt Sealey
2012-11-28 10:35:08 -08:00
parent a5d27bcb79
commit ae6cc482cf

View File

@@ -100,6 +100,21 @@ kgsl_device_init(struct kgsl_device *device, unsigned int device_id)
status = GSL_FAILURE_NOTINITIALIZED;
}
// init memqueue
device->memqueue.head = NULL;
device->memqueue.tail = NULL;
// init cmdstream
status = kgsl_cmdstream_init(device);
if (status != GSL_SUCCESS)
{
kgsl_device_stop(device->id);
return (status);
}
// Create timestamp wait queue
init_waitqueue_head(&device->timestamp_waitq);
// allocate memory store
status = kgsl_sharedmem_alloc0(device->id, GSL_MEMFLAGS_ALIGNPAGE | GSL_MEMFLAGS_CONPHYS, sizeof(struct kgsl_devmemstore), &device->memstore);
@@ -117,21 +132,6 @@ kgsl_device_init(struct kgsl_device *device, unsigned int device_id)
}
kgsl_sharedmem_set0(&device->memstore, 0, 0, device->memstore.size);
// init memqueue
device->memqueue.head = NULL;
device->memqueue.tail = NULL;
// init cmdstream
status = kgsl_cmdstream_init(device);
if (status != GSL_SUCCESS)
{
kgsl_device_stop(device->id);
return (status);
}
// Create timestamp wait queue
init_waitqueue_head(&device->timestamp_waitq);
//
// Read the chip ID after the device has been initialized.
//