includes kgsl_kmod.c -> kgsl.c and copying all the cleanup stuff in,
will rename it to qualcomm names during further cleanup of cleanup
stuff if necessary.
Missing fix for dst->src in kgsl_sharedmem_write (stashing issue,
sorry)
rename gsl_linux_map_find -> kgsl_sharedmem_find - note, qcom uses
"kgsl_mem_entry" here which is telling.
gsl_linux_map_alloc no longer maps writecombine
we no longer ioremap_wc our memory area (and split some code out)
also refine kgsl_mmap to be more like Qualcomm's (same functionality,
remove writecombining setting, remove a few vars mis/unused)
While we're doing that rationalize some namings. This actually gives us a good
indication of what is used by userspace and what is not - although a few things
like flags in kgsl_types.h may still be referenced, for now we don't move them
(since Qualcomm's driver doesn't expose them to userspace, most of them are
odd power control and/or memdesc definition).
We lose two includes from the main tree (ioctl and properties) since they are
global and for userspace.
Minor cleanups too.
results: tiger works great. es11ex is segfaulting in rb_viewport (rb_state.c)
for some reason now, probably indicative of some data not being copied back
to userspace in an ioctl (context-related?)
remove DMI props as Linux userspace doesn't use them (fix gsl_lib btw)
clean up g12_start and g12_stop and call it directly instead of using
function table while we're at it
Also some minor cleanups and change the prototype to accept a device
pointer instead of a device id, and change a lot of functions to stop
using device ids raw (KGSL_DEVICE_G12) when they have access to the
device pointer.
* mark all non-qualcomm ioctls as NQ
* mark all movements needed to make kgsl_ioctl.h into <linux/mxc_kgsl.h>
* mark all differences between qualcomm and freescale re structure defs
* significantly tidy up kgsl_ioctl.h
kgsl_kmod.c is a horrible mess but the next commit will tidy it somewhat.
* gsl_drawctxt_t -> kgsl_drawctxt (this touches some Z430 stuff too)
* gsl_z1xx_t et al -> kgsl_z1xx
* move some defines to includes
* use symbolic values in addmarker/beginpacket
* remove kgsl_context and opencode it's usage in ioctls etc.
* rename context_* ftbl functions to device_context_* like Qualcomm .35
* add kgsl_g12_cmdstream.c and kgsl_g12_drawctxt.c like Qualcomms .32
but retain functionality from our versions of these functions
behavior change:
* under fbdev, tiger and es11ex work fine most of the time
- es11ex will soft-lockup occasionally
* under imxng, tiger locks occasionally when moving the mouse pointer
- I thought this bug was fixed
* under imxng, es11ex locks after good 30 seconds
- but does NOT hang the system anymore (strange)
Since some gsl_driver.lock usage was moved I wonder if this is the
source of our race condition?
* remove dumpx stuff which was kind of file based
* remove tbdump stuff which was kind of file based
* gsl_driver_t -> struct kgsl_driver since we touched a member
* kgsl_log_write -> KGSL_*_VDBG
This is not identical to the one Qualcomm uses but it's based on
it (include side at least) - debugfs not there, and no proper
setup so in actual fact no debug ever gets printed.
It is also fairly clumsily ported in (kgsl_log_write replacement)
so is just there to keep it compiling and remove some extra code
definitions which were either unused. Refining it will come as
Qualcomm code is ported in.
No side-effects noticed that weren't previously present - the
tiger apps run fine on imxng (which also works fine) and es11ex
still crashes after some frames.
Also while we're at it don't bother using the device table and many
levels of dereference to just call regread/regwrite.
No functional difference, although tiger now is not as happy as it
once was when running on imxng - on fbdev it's absolutely fine (and
marginally faster over 10 runs).
At some point we're going to find this damned race condition :]
As we are poking around, modify the Yamato idle check to use a
timeout just like QCOM do. Also, no functional difference (never
seems to time out)
gsl_ringbuffer_t et al -> struct kgsl_ringbuffer et al
some macros GSL_ -> KGSL_
some macros safer (do/while(0))
some access functions done differently (writel instead of mem access)
some access functions grew barriers
it's used in ioctls but it was
typedef unsigned int gsl_flags_t;
so there is no ABI difference.
Also removed unused types:
typedef unsigned int gsl_devhandle_t;
typedef unsigned int gsl_ctxthandle_t;
* add #include statements where necessary to build. Some of this is a bit hacky.
* fix some things along the way (register defs mmCP_RB_RPTR -> REG_CP_RB_RPTR)
* move klibapi prototypes into the includes for those subsystems
* delete tbdump etc. includes
* delete unreferenced includes that would be touched by userspace using them (not)
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.
Following this crash:
[ 58.297944] [<8032077c>] (mutex_lock+0xc/0x28) from [<7f16c358>] (kgsl_cmdstream_memqueue_drain+0x1c/0x8c [kgsl])
[ 58.308291] [<7f16c358>] (kgsl_cmdstream_memqueue_drain+0x1c/0x8c [kgsl]) from [<7f16d148>] (kgsl_device_runpending+0x40/0x50 [kgsl])
[ 58.320379] [<7f16d148>] (kgsl_device_runpending+0x40/0x50 [kgsl]) from [<7f172db4>] (kgsl_sharedmem_alloc0+0x90/0x384 [kgsl])
[ 58.331869] [<7f172db4>] (kgsl_sharedmem_alloc0+0x90/0x384 [kgsl]) from [<7f16cea8>] (kgsl_device_init+0x118/0x190 [kgsl])
[ 58.343009] [<7f16cea8>] (kgsl_device_init+0x118/0x190 [kgsl]) from [<7f16ed6c>] (kgsl_driver_entry+0xa0/0x1a8 [kgsl])
[ 58.297944] [<8032077c>] (mutex_lock+0xc/0x28) from [<7f16c358>] (kgsl_cmdstream_memqueue_drain+0x1c/0x8c [kgsl])
[ 58.308291] [<7f16c358>] (kgsl_cmdstream_memqueue_drain+0x1c/0x8c [kgsl]) from [<7f16d148>] (kgsl_device_runpending+0x40/0x50 [kgsl])
[ 58.320379] [<7f16d148>] (kgsl_device_runpending+0x40/0x50 [kgsl]) from [<7f172db4>] (kgsl_sharedmem_alloc0+0x90/0x384 [kgsl])
[ 58.331869] [<7f172db4>] (kgsl_sharedmem_alloc0+0x90/0x384 [kgsl]) from [<7f16cea8>] (kgsl_device_init+0x118/0x190 [kgsl])
[ 58.343009] [<7f16cea8>] (kgsl_device_init+0x118/0x190 [kgsl]) from [<7f16ed6c>] (kgsl_driver_entry+0xa0/0x1a8 [kgsl])
It seems device_init allocates memory and THEN sets up the cmdstream. Without
a cmdstream_init call, sharedmem_alloc0 is going to crash because the cmdstream
mutex is not allocated or initialized.
The actual fix is going to be to rethink the way the allocation is done, but
in the meantime I noticed Qualcomm don't do runpending->memqueue_drain unless
the device is initialized. This seems fair, so implement it.
Still chasing that crash.
Some of our userspace scripts autoload gpu on boot and rather than mess
with those, it seems prudent to rename the module to kgsl instead.
This will go awry if we get too close to Qualcomm's code, since they
have a kgsl.c which compiles to kgsl.o which may conflict with the
intermediate module object. Be warned :)
Also makes several changes to the GPU config names to match those in
Qualcomm's driver and remove such config options from gsl_buildconfig.h
which is an obtuse way to configure the driver in the Linux kernel..
Logging is disabled until it can be tested.
Please don't enable per process page tables or mmu page fault stuff since
it will go absolutely batshit.
It still won't work as Qualcomm's register list is much smaller than
the full set. we don't need to print the vast majority in this code
so it'll get stripped down and tested later.
This is a BIG hack.
Logging (as in kgsl_log.c) won't work anymore as it uses some weird
way to define registers based on the old register definitions.
Some FBC interrupt thing is really odd, there are no docs for it..
MMU config may be a little screwy - or not :)
Freescale's kernel driver does some things the Qualcomm driver
doesn't in some registers Qualcomm doesn't use. Odd, but kept the
FSL way since userspace may need to match and it's not worth the
work right now.
GSL_BLD_G12, GSL_BLD_YAMATO should always be turned on. It won't
affect i.MX35 or so (with only a Z160) because the platform device
doesn't initialize that unit and therefore nothing should ever
happen. May need investigating.
Remove IRQTHREAD_POLL stuff too as it was never, ever turned on.
This was removed in the initial stages of moving to a less abstracted
driver since Freescale never enabled it at the time. However, since
that time it's been enabled to improve stability, so we're putting it
back now to match Freescale.
Some of the mutex initialization I think is being done in a slightly
non-standard way (but the same way it's done in the Freescale kernel
since it's taken right from the old abstraction and just opencoded
instead of being a set of defines). Will investigate this later.
According to Qualcomm:
"We will never use a page size that is not the same as the system
page size, so replace KGSL_PAGESIZE, KGSL_PAGEMASK and KGSL_PAGESHIFT
with their system wide cousins."
We don't use the KGSL_PAGEMASK item yet since we do not run the
"new" memory manager.
Rename things and stop using typedefs for no good reason. Qualcomm have
a driver (a more advanced, modern version of the same thing) which the
new definitions have been derived from.
Case in point:
typedef int gsl_timestamp_t
A lot of the time this is case to an int or unsigned int inside the
code anyway to be passed to functions or compared. Example:
GSL_CMDSTREAM_GET_SOP_TIMESTAMP(device, (unsigned int*)×tamp);
Qualcomm's code uses an "unsigned int" in most versions (older code
used uint32_t which is the same thing anyway). It makes no sense to clutter
the code with pointless definitions of structures that hide the fact that
they are structures, or cast special types to the type they are defined
as in the first place, so all this mess gets removed.
So far this patch changes:
gsl_timestamp_t => unsigned int
gsl_device_t => struct kgsl_device
gsl_deviceid_t => unsigned int
gsl_memdesc_t => struct kgsl_memdesc
gsl_cmdwindow_t => enum kgsl_cmdwindow_type
gsl_timestamp_type_t => enum kgsl_timestamp_type
gpuaddr_t => uint32_t (probably should be a physaddr_t ?)
gsl_memregion_t => struct kgsl_memregion
gsl_devinfo_t => struct kgsl_devinfo
gsl_chipid_t => unsigned int
gsl_mmu_t => struct kgsl_mmu
gsl_pagetable_t => struct kgsl_pagetable
gsl_rect_t => struct kgsl_gmem_desc
include/api/gsl_types.h is a good reference for the changes if you
want a better summary.
It also renames some functions in the device tables which had unwieldy
names to the ones Qualcomm uses (device_addtimestamp => addtimestamp and
device_init => init, for example.
None of the contents or sizes of the types or structures has been
changed, so userspace should never notice.
This enables us to essentially look at the Qualcomm code and pull in
fixes or changes or hints (and slowly figure out the userspace
differences) at kernel side, by slowly migrating towards Qualcomm-looking
kernel code.
Such an old version of BFS is not maintained and while it gave us some
noticable benefits, it is not worth dealing with the problems it could
cause.
This reverts commit 469d88e87d.
Such an old version of BFS is not maintained and while it gave us some
noticable benefits, it is not worth dealing with the problems it could
cause.
This reverts commit 4259e4284d.