Commit Graph

159836 Commits

Author SHA1 Message Date
Matt Sealey
be014d2b24 amd-gpu: remove addtimestamp ioctl as it has no userspace users
(except libkgsl which needs kicking to remove the call)
2012-12-03 16:24:51 -06:00
Matt Sealey
e879208842 amd-gpu: mxc_gpu put back for Xorg autoloading support
Sigh.. they actually search for the platform device name..
2012-12-03 15:49:14 -06:00
Matt Sealey
08e694b006 amd-gpu: cut down the "hal" by moving some single-use functions
move kgsl_hal_alloc/freephysical to where they get used..
2012-12-03 15:24:14 -06:00
Matt Sealey
b2eaad12ed amd-gpu: rid ourselves of kgsl_hwaccess.h, gsl_linux_map -> kgsl_mem_entry 2012-12-03 15:15:56 -06:00
Matt Sealey
ea6923ca91 amd-gpu: opencode getfunctable since it's only used once 2012-12-03 14:53:28 -06:00
Matt Sealey
8bf5b2d48f amd-gpu: move cleanup functions into main module
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)
2012-12-03 14:47:58 -06:00
Matt Sealey
6a94632718 amd-gpu: remove waitirq, correct sharedmem_write ioctls 2012-12-03 14:09:27 -06:00
Matt Sealey
c1192667ae amd-gpu: go for a global include so userspace can eventually compile against it
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.
2012-12-03 13:39:34 -06:00
Matt Sealey
a29b1eb475 amd-gpu: correct sharedmem_free copy_to/from_user usage, "unabstract" alloc
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?)
2012-12-03 12:37:48 -06:00
Matt Sealey
ea8899e3ab amd-gpu: correct platform device name for probe and init 2012-12-03 11:01:43 -06:00
Matt Sealey
4c7988293b amd-gpu: clean up properties handling
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
2012-12-02 16:14:58 -06:00
Matt Sealey
7fba1166ae amd-gpu: kgsl_cmdwindow_write -> kgsl_g12_cmdwindow_write et al
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.
2012-12-02 15:19:07 -06:00
Matt Sealey
68cd01d084 amd-gpu: kgsl_cmdwindow.[ch] -> kgsl_g12_cmdwindow.[ch] 2012-12-02 14:54:38 -06:00
Matt Sealey
0d348b26ae amd-gpu: annotate and refine kmod/ioctl functionality
also clean up coding style on open, release, mmap functions
2012-12-02 14:40:57 -06:00
Matt Sealey
1f20c392ed amd-gpu: structure renames in kmod section
struct gsl_kmod_per_fd_data -> struct kgsl_file_private
struct gsl_kmod_alloc_list -> struct kgsl_alloc_list
2012-12-02 14:07:26 -06:00
Matt Sealey
26e414a006 amd-gpu: qualcommize ioctl functionality
Also some function renames and bringing a couple minor changes across (barriers etc.)

compile-tested but not really tested.
2012-11-30 16:56:49 -06:00
Matt Sealey
79f94c6c24 amd-gpu: qualcomm-ize the ioctl structures
* 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.
2012-11-30 14:40:30 -06:00
Matt Sealey
90fc28dc4f amd-gpu: Z160 context rework
* 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?
2012-11-30 13:16:24 -06:00
Matt Sealey
340b0e2ad3 amd-gpu: gsl_drawctxt_t -> struct kgsl_drawctxt, gsl_context_type_t -> uint 2012-11-30 10:21:34 -06:00
Matt Sealey
092d8d9102 amd-gpu: correct some debugging warnings 2012-11-30 10:20:05 -06:00
Matt Sealey
3f4491d9b6 amd-gpu: refine logging
* 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.
2012-11-29 15:36:16 -08:00
Matt Sealey
a41bc9d07d amd-gpu: wean g12 and yamato parts off kgsl_hwaccess
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)
2012-11-29 08:52:51 -08:00
Matt Sealey
7dc4089a61 amd-gpu: err->info since info actually prints out (gah) 2012-11-29 08:44:25 -08:00
Matt Sealey
f99a7bf131 amd-gpu: print kernel version so modules/kernel mismatches can be detected 2012-11-29 08:24:32 -08:00
Matt Sealey
692028e921 amd-gpu: rename module again to mxc_kgsl and remove extra cflags
This means we can unify the kgsl_kmod, kgsl_device, etc. as kgsl.o
just like Qualcomm does without stepping on the module object.
2012-11-29 05:56:50 -08:00
Matt Sealey
5974e44045 amd-gpu: more qualcommizing
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
2012-11-28 16:19:11 -08:00
Matt Sealey
d986b44d2e amd-gpu: port some mmu structures from types to qualcomm names 2012-11-28 15:30:00 -08:00
Matt Sealey
2a39a8c2ad amd-gpu: gsl_sharedmem_t -> struct kgsl_sharedmem 2012-11-28 15:21:35 -08:00
Matt Sealey
c8eb1e2e00 amd-gpu: port from gsl_deviceid_t type to plain enum.
No ABI difference, numbers are identical
2012-11-28 14:57:24 -08:00
Matt Sealey
615baf4f6c amd-gpu: port gsl_flags_t to unsigned int
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;
2012-11-28 14:44:07 -08:00
Matt Sealey
e74c1b6efa amd-gpu: move includes into the driver root directory
* 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)
2012-11-28 14:24:21 -08:00
Matt Sealey
ae6cc482cf 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.
2012-11-28 10:35:08 -08:00
Matt Sealey
a5d27bcb79 amd-gpu: make fine-grained locking optional again (from Kconfig)
Obviously has some serious serialization issues making it not so
useful.
2012-11-28 10:34:34 -08:00
Matt Sealey
ffa3b9a761 amd-gpu: remove kgsl_log.c
Will be replaced with some debugfs loveliness later.

Do NOT enable CONFIG_KGSL_LOGGING or this will explode!
2012-11-28 10:16:28 -08:00
Matt Sealey
7e4caf4f87 amd-gpu: get rid of kgsl_debug_pm4.c as it's unused and not Linuxy
This one will be replaced by some better code based on Qualcomm's
later.
2012-11-28 10:15:18 -08:00
Matt Sealey
9a92b9d5f1 amd-gpu: get rid of tbdump as it's unused and not Linuxy 2012-11-28 10:14:26 -08:00
Matt Sealey
33cffd5fa4 bump kernel version to super-in-development to keep it out of the way 2012-11-28 09:58:55 -08:00
Matt Sealey
64658c3a28 amd-gpu: don't drain the memqueue on uninitialized devices
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.
2012-11-28 09:56:29 -08:00
Matt Sealey
ad604e630a amd-gpu: rename module from "gpu" to "kgsl" partially to prevent loading
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.
2012-11-26 17:22:44 -06:00
Matt Sealey
a5bf892e2c amd-gpu: rename registers in kgsl logging functions
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.
2012-11-26 17:21:53 -06:00
Matt Sealey
6154e640cc amd-gpu: fix G12 FBC mask bit 2012-11-26 14:08:44 -06:00
Matt Sealey
ab75426967 amd-gpu: delete the old register definitions
this commit will serve as a nice cross-reference on github ;)
2012-11-26 12:14:29 -06:00
Matt Sealey
bd2d54da05 amd-gpu: use Qualcomm's register definitions
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.
2012-11-26 12:10:35 -06:00
Matt Sealey
6734683032 amd-gpu: remove conditional build flags where not needed
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.
2012-11-26 10:10:32 -06:00
Matt Sealey
ddc542b6af amd-gpu: reintroduce fine-grained locking
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.
2012-11-26 09:43:27 -06:00
Matt Sealey
380e0fcdf2 renames to be closer to the qualcomm source file names for diffing purposes 2012-11-25 10:16:42 -06:00
Matt Sealey
bccbcd6485 GSL_PAGESIZE => PAGE_SIZE, GSL_PAGESIZE_SHIFT => PAGE_SHIFT
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.
2012-11-25 10:06:19 -06:00
Matt Sealey
b0b0c1b218 experiment: Linuxize the API
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*)&timestamp);

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.
2012-11-25 00:16:01 -06:00
Matt Sealey
9e902b2d15 Merge branch 'remove-bfs', remote-tracking branch 'origin' into amd-gpu 2012-11-25 00:07:41 -06:00
Matt Sealey
f35bfd5125 Merge branch 'amd-gpu' of github.com:genesi/linux-legacy into amd-gpu 2012-11-25 00:02:24 -06:00