aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_fence.c
Commit message (Collapse)AuthorAgeFilesLines
* samsung update 1codeworkx2012-06-021-18/+16
|
* drm/nouveau: initialize chan->fence.lock before useMarcin Slusarz2011-11-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 5e60ee780e792efe6dce97eceb110b1d30bab850 upstream. Fence lock needs to be initialized before any call to nouveau_channel_put because it calls nouveau_channel_idle->nouveau_fence_update which uses fence lock. BUG: spinlock bad magic on CPU#0, test/24134 lock: ffff88019f90dba8, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 Pid: 24134, comm: test Not tainted 3.0.0-nv+ #800 Call Trace: spin_bug+0x9c/0xa3 do_raw_spin_lock+0x29/0x13c _raw_spin_lock+0x1e/0x22 nouveau_fence_update+0x2d/0xf1 nouveau_channel_idle+0x22/0xa0 nouveau_channel_put_unlocked+0x84/0x1bd nouveau_channel_put+0x20/0x24 nouveau_channel_alloc+0x4ec/0x585 nouveau_ioctl_fifo_alloc+0x50/0x130 drm_ioctl+0x289/0x361 do_vfs_ioctl+0x4dd/0x52c sys_ioctl+0x42/0x65 system_call_fastpath+0x16/0x1b It's easily triggerable from userspace. Additionally remove double initialization of chan->fence.pending. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* drm/nouveau: fix assumption that semaphore dmaobj is valid in x-chan syncBen Skeggs2011-06-181-34/+25
| | | | | | | The DDX modifies DMA_SEMAPHORE on nv50 in order to implement sync-to-vblank, things will go very wrong for cross-channel sync after this. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: fix __nouveau_fence_wait performanceMarcin Slusarz2011-03-141-3/+12
| | | | | | | | | | | | | | Commit 21e86c1c8a844bf978f8fc431a59c9f5a578812d ("drm/nouveau: remove cpu_writers lock") turned on lazy waits. Unfortunately __nouveau_fence_wait was not optimized for this case and on HZ=100 kernel wasted up to 10 ms per call. Depending on application, it led to 10-30% FPS regression. Fix it. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Francisco Jerez <currojerez@riseup.net>
* drm/nouveau: remove no_vm/mappable flags from nouveau_boBen Skeggs2011-02-251-1/+1
| | | | | | | | | | 'mappable' isn't really used at all, nor is it necessary anymore as the bo code is capable of moving buffers to mappable vram as required. 'no_vm' isn't necessary anymore either, any places that don't want to be mapped into a GPU address space should allocate the VRAM directly instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50: drop explicit yields in favour of smaller PFIFO timesliceBen Skeggs2011-02-251-46/+6
| | | | | | | | | | | This gives a small, but noticeable performance gain at lower performance levels, and unchanged at the higher ones. With this commit, we're now using the same timeslice size as the NVIDIA binary driver currently does, and dropping an unknown bit that NVIDIA no longer appear to set. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv84: use vm offsets for semaphoresBen Skeggs2011-02-251-5/+17
| | | | | | | | We may well be making more use of semaphores in the future, having the entire VM available makes requiring DMA objects for each and every semaphore block unnecessary. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50: 0x50 needs semaphore yields tooBen Skeggs2011-02-251-4/+17
| | | | | | Evil, evil chipset. Worst of both worlds. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nvc0: implement semaphores for inter-channel syncBen Skeggs2011-02-251-12/+40
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv84: switch to new-style semaphoresBen Skeggs2011-02-251-39/+80
| | | | | | | | | These are the same semaphores nvc0 will use, and they potentially allow us to do much cooler things than our current inter-channel sync impl. Lets switch to them where possible now for some testing. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nvc0: reserve only subc 0 for kernel useBen Skeggs2010-12-301-1/+1
| | | | | | | | | Current 3D driver expects this behaviour. While this could be changed, there's no compelling reason to reserve more than one subchannel for the DRM. If we ever need to use an object other then M2MF, we can just re-bind subchannel 0 as required. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nvc0: implement fencingBen Skeggs2010-12-211-8/+20
| | | | | | Just simple REF_CNT fencing for the moment. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Avoid potential race between nouveau_fence_update() and context ↵Francisco Jerez2010-12-081-8/+11
| | | | | | | takedown. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: fix use of drm_mm_node in semaphore objectBen Skeggs2010-12-081-3/+2
| | | | | | | At some point in the future, this bo won't necessarily be backed by a drm_mm_node, so use the start/size fields of the ttm_mem_reg instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: implicitly insert non-DMA objects into RAMHTBen Skeggs2010-12-081-6/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Spin for a bit in nouveau_fence_wait() before yielding the CPU.Francisco Jerez2010-12-081-1/+2
| | | | | | | | Sleeping doesn't pay off for very short delays in comparison with the minimum granularity of schedule_timeout(). Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: tidy up and extend dma object creation interfacesBen Skeggs2010-12-031-2/+2
| | | | | Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: fix annoying nouveau_fence type issueMarcin Slusarz2010-12-031-11/+11
| | | | | | | | | | | | | | nouveau_fence_* functions are not type safe, which could lead to bugs. Additionally every use of nouveau_fence_unref had to cast struct nouveau_fence to void **. Fix it by renaming old functions and creating static inline functions with new prototypes. We still need old functions, because we pass function pointers to ttm. As we are wrapping functions, drop unused "void *arg" parameter where possible. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: use object class structs more extensivelyBen Skeggs2010-12-031-1/+1
| | | | | | | The structs themselves, as well as the non-sw object creation function are probably very misnamed now. That's a problem for later :) Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Take fence spinlock in nouveau_fence_channel_fini().Francisco Jerez2010-12-031-0/+4
| | | | | | | Without it there's a potential race with nouveau_fence_update(). Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Avoid race in the interchannel sync code.Francisco Jerez2010-12-031-9/+15
| | | | | | | | | It needs a "strong" channel reference because it actually writes to the channel pushbuf, otherwise the corresponding FIFO context could get kicked off in the middle of nouveau_fence_sync(). Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Make fences take a weak channel reference.Francisco Jerez2010-12-031-1/+2
| | | | | | | | | Fences didn't increment the channel reference count, and the fenced channel could go away at any time. Fixes a potential race in nouveau_fence_update(). Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Use lazy fence waits when doing software interchannel sync.Francisco Jerez2010-12-031-2/+2
| | | | | Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: fix thinko in channel locking in semaphore pathBen Skeggs2010-12-031-3/+3
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: add more fine-grained locking to channel list + structuresBen Skeggs2010-12-031-0/+10
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Fix sleep while atomic in the semaphore code.Francisco Jerez2010-11-181-1/+6
| | | | | Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50: Fix large 3D performance regression caused by the interchannel ↵Francisco Jerez2010-10-051-7/+39
| | | | | | | | | | | sync patches. Reported-by: Christoph Bumiller <e0425955@student.tuwien.ac.at> Signed-off-by: Francisco Jerez <currojerez@riseup.net> Tested-by: Maarten Maathuis <madman2003@gmail.com> Tested-by: Xavier Chantry <chantry.xavier@gmail.com> Tested-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Use semaphores to handle inter-channel sync in hardware.Francisco Jerez2010-10-051-1/+194
| | | | | Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Provide a means to have arbitrary work run on fence completion.Francisco Jerez2010-10-051-0/+30
| | | | | Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Minor refactoring/cleanup of the fence code.Francisco Jerez2010-10-051-17/+46
| | | | | | | Mainly to make room for inter-channel sync. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Take fence spinlock before reading the last sequence.Francisco Jerez2010-09-031-2/+4
| | | | | | | | It fixes a race between the TTM delayed work queue and the GEM IOCTLs (fdo bug 29583) uncovered by the BKL removal. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout()Kulikov Vasiliy2010-08-021-2/+2
| | | | | | | | | | set_current_state() is called only once before the first iteration. After return from schedule_timeout() current state is TASK_RUNNING. If we are going to wait again, set_current_state() must be called. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: reduce usage of fence spinlock to when absolutely necessaryBen Skeggs2010-07-131-25/+6
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Use the software object for fencing.Francisco Jerez2010-01-111-1/+1
| | | | | | | | | | | | | This should avoid a race condition on nv0x, if we're doing it with actual PGRAPH objects and a there's a fence within the FIFO DMA fetch area when a context switch kicks in. In that case we get an ILLEGAL_MTHD interrupt as expected, but the values in PGRAPH_TRAPPED_ADDR aren't calculated correctly and they're almost useless (e.g. you can see ILLEGAL_MTHDs for the now inactive channel, with a wrong offset/data pair). Signed-off-by: Francisco Jerez <currojerez@riseup.net>
* drm/nouveau: remove use of -ERESTARTBen Skeggs2009-12-151-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Add DRM driver for NVIDIA GPUsBen Skeggs2009-12-111-0/+262
This adds a drm/kms staging non-API stable driver for GPUs from NVIDIA. This driver is a KMS-based driver and requires a compatible nouveau userspace libdrm and nouveau X.org driver. This driver requires firmware files not available in this kernel tree, interested parties can find them via the nouveau project git archive. This driver is reverse engineered, and is in no way supported by nVidia. Support for nearly the complete range of nvidia hw from nv04->g80 (nv50) is available, and the kms driver should support driving nearly all output types (displayport is under development still) along with supporting suspend/resume. This work is all from the upstream nouveau project found at nouveau.freedesktop.org. The original authors list from nouveau git tree is: Anssi Hannula <anssi.hannula@iki.fi> Ben Skeggs <bskeggs@redhat.com> Francisco Jerez <currojerez@riseup.net> Maarten Maathuis <madman2003@gmail.com> Marcin Kościelnicki <koriakin@0x04.net> Matthew Garrett <mjg@redhat.com> Matt Parnell <mparnell@gmail.com> Patrice Mandin <patmandin@gmail.com> Pekka Paalanen <pq@iki.fi> Xavier Chantry <shiningxc@gmail.com> along with project founder Stephane Marchesin <marchesin@icps.u-strasbg.fr> Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>