Commit Graph

69807 Commits

Author SHA1 Message Date
Matt Sealey
76e264f5ed amd-gpu: huge commit with many, many changes
Just to save work and get it up online. Current status;

GL not working as per usual

VG works - but closing Z160 device locks the driver (seems to be that
device_idle is called after the device is closed and there may be a
driver lock contention going on here).

imxng graphics driver works first run (same as above) but there are
some strange graphical glitches on smaller blits and rectangle fills,
which may be down to some kind of cache coherency problem.

Real (platform device) MMU enable causes the whole thing to explode,
since none of this got updated properly.

Tasks done:
* remove per-process support
* clean up use of device_id -> device since passing the id is a mess
  for some reason 3D device isn't inited properly and some parts of
  the driver call 3D device functions (notably on closing everything)
  possibly because of some off-by-ones
* more global driver locking per qualcomm and to allow below fix
* clean up sharedmem and other APIs which used such semantics e.g.
    kgsl_sharedmem_read -> lock, call kgsl_sharedmem_read0, unlock
  to just use kgsl_sharedmem_read with manual locks before the call
  where required, cleaning up the API a lot
* ditched the requirement for a device argument to sharedmem_alloc
  since it never allocated from a per-device pool anyway. This is
  a weird hack since the MMU setup needs a real device to set up
  on.. Qualcomm's has a much better system and that will be in place
  soon
* fixed the cmdstream_issueibcmds wrapper crap
* added kgsl_ringbuffer_issueibcmds to CMDSTREAM_ISSUEIBCMDS ioctl
  again (no real effect)
* put kgsl_device_active in kgsl_g12_issueibcmds rather than calling
  it manually before executing the function (ensures the autogating
  is turned off before telling the Z160 to run a stream) from ioctl
* lots of ioctl debugging code (mostly commented out)
* function renames everywhere
* locks around suspend/resume
* removed a lot of the finegrained locking stuff as qualcomm doesn't
  use it. That said, cmdwindow needs some locking (qcom uses a
  spinlock) - will be added later
* LOTS of code cleanups/lint/checkpatch fixing
* removed interrupt handler abstraction
* Z160 idle timer update
* move more HAL stuff into the right places to remove the HAL more
* MMU handling cleanups (not complete, lots of it is disabled)
* NOTE: must re-add runpending to sharedmem_alloc? May not be required
  when moving to new sharedmem API
* NOTE: check 3D interrupt enables
2012-12-07 09:44:13 -06:00
Matt Sealey
8b88d1c35d font: getting bored of the vga font, so put the new one in (not gpu related :) 2012-12-06 13:06:29 -06:00
Matt Sealey
0ce30864d2 amd-gpu: cleanup core Z160 functions
Relatively low-impact
2012-12-04 14:47:24 -06:00
Matt Sealey
ee041b073b amd-gpu: clean up Z430 core functions
* move getchipid out of the HAL
* ftbl functions use kgsl_yamato_* directly now
2012-12-04 14:00:51 -06:00
Matt Sealey
bad9f933c7 amd-gpu: clean up kgsl_ringbuffer
* ftbl regread/write/idle => kgsl_yamato_*
* remove some unused debug code (will put it back later but qcom removes it in .35)
* remove unused watchdog code (not referenced by anything)
* remove unused pmodeoff code (it's set to 0 in the function so effectively disabled)
* factor out firmware loading code
* header now ordered like qualcomm's
2012-12-04 12:46:29 -06:00
Matt Sealey
d7191e15c2 amd-gpu: refine power control by moving it out of the hal
While we're at it, since we now directly call kgsl_pwrctrl (which is
formerly kgsl_hal_setpowerstate), there's nothing stopping us from
removing device_setproperty ioctl and all related code.
2012-12-03 19:20:44 -06:00
Matt Sealey
3be1cc03b7 amd-gpu: another comment for further investigation 2012-12-03 18:39:56 -06:00
Matt Sealey
3815edffb9 amd-gpu: add a memory barrier after the sync for z160 command stream
Qualcomm seem to think it is quite important
2012-12-03 18:31:12 -06:00
Matt Sealey
c0bdcfea9e amd-gpu: add a comment for later reference 2012-12-03 18:19:06 -06:00
Matt Sealey
7259f0a3ac amd-gpu: Z160 "addtimestamp" callback excised from driver, no users 2012-12-03 18:16:00 -06:00
Matt Sealey
7d1ee4b1fc amd-gpu: kgsl_intr_isenabled removed since it has no users any more 2012-12-03 18:12:51 -06:00
Matt Sealey
0537b61cf9 amd-gpu: remove kgsl_device_regwrite wrapper and all waitirq traces
Some warnings got added to confirm a configuration change, part of
the "unused path" got converted away from kgsl_device_regwrite and
use yamato since it's ringbuffer-specific.. in case that is actually
the correct configuration
2012-12-03 18:10:07 -06:00
Matt Sealey
ed7734c309 amd-gpu: remove unused-by-userspace properties
KGSL_PROP_SHMEM and KGSL_PROP_SHMEM_APERTURES are not used in the FSL
userspace. So just get rid of them. DMI properties got removed a while
back so remove it's definition from mxc_kgsl.h.

The only two properties it cares about are shadow memory and the
device info, which matches Qualcomm's driver. CAVEAT FOLLOWS.

There is a weird usage of the power property INTERNALLY which is an
odd way to do it and will be coded out eventually. Userspace does
not touch these properties, only the odd internal kernel usage..
2012-12-03 17:54:10 -06:00
Matt Sealey
3cf4914a73 amd-gpu: correct opencoding of hwaccess, correct mmu in shmem init 2012-12-03 17:47:07 -06:00
Matt Sealey
96c73e4f6c amd-gpu: remove kgsl_hal_getshmemconfig by opencoding it's only time use 2012-12-03 17:14:23 -06:00
Matt Sealey
1aa371124b amd-gpu: put read/write file_operations back in 2012-12-03 17:12:58 -06:00
Matt Sealey
e938e6851c amd-gpu: remove device_clock ioctl since there are no userspace users
not even libkgsl, again..
2012-12-03 16:36:13 -06:00
Matt Sealey
89fc02c113 amd-gpu: remove regwrite ioctl as it has no userspace users
Not even libkgsl has this inside so no effect on userspace.
2012-12-03 16:29:30 -06:00
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
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