summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_channel.c
Commit message (Collapse)AuthorAgeFilesLines
* drm/nouveau: remove 'chan' argument from nouveau_bo_newBen Skeggs2011-06-231-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50-nvc0: explicitly map pushbuf bo into channel vmBen Skeggs2011-06-231-1/+8
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: convert bo.mem.start usage to bo.offsetBen Skeggs2011-06-231-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: convert some bo.offset use to vma.offsetBen Skeggs2011-06-231-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: initialise any vm for a channel before pushbuf/ntfyBen Skeggs2011-06-231-66/+48
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: modify gpuobj/ntfy takedown orderingBen Skeggs2011-06-231-1/+3
| | | | | | gpuobj really needs splitting into channel/gpuobj code instead... Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: store a per-client channel listBen Skeggs2011-06-231-20/+22
| | | | | | | Removes the need to disable IRQs to lookup channel struct on every pushbuf ioctl, among others. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: remove remnants of nouveau_pgraph_engineBen Skeggs2011-05-161-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: remove remnants of nouveau_pgraph_engine from nouveau_channelBen Skeggs2011-05-161-11/+0
| | | | | | | | | The nouveau_wait_for_idle() call should hopefully not have been actually necessary, we *do* wait for the channel to go idle already. If it's an issue somehow, the chipset-specific hooks can wait for idle themselves before taking the lock. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50/gr: move to exec engine interfacesBen Skeggs2011-05-161-1/+2
| | | | | | | This needs a massive cleanup, but to catch bugs from the interface changes vs the engine code cleanup, this will be done later. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: working towards a common way to represent enginesBen Skeggs2011-05-161-3/+5
| | | | | | | | | | | There's lots of more-or-less independant engines present on NVIDIA GPUs these days, and we generally want to perform the same operations on them. Implementing new ones requires hooking into lots of different places, the aim of this work is to make this simpler and cleaner. NV84:NV98 PCRYPT moved over as a test. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* Fix common misspellingsLucas De Marchi2011-03-311-2/+2
| | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* drm/nouveau: remove no_vm/mappable flags from nouveau_boBen Skeggs2011-02-251-2/+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/nouveau: silence some compiler warningsBen Skeggs2011-02-251-1/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: create grctx on the fly on all chipsetsBen Skeggs2011-01-071-10/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nvc0: reserve only subc 0 for kernel useBen Skeggs2010-12-301-8/+14
| | | | | | | | | 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/nouveau: Validate channel indices passed from userspace.Michel Hermier2010-12-271-0/+3
| | | | | | | | | | | | When hacking the libdrm for improvements, I triggered a kernel crash related to the fact that the NOUVEAU_NOTIFIEROBJ_ALLOC ioctl calls nouveau_channel_get with an unchecked channel index. The patch ensures that the channel index is an unsigned and validates its value in nouveau_channel_get. Signed-off-by: Michel Hermier <hermier@frugalware.org> Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nvc0: fix channel dma init pathsBen Skeggs2010-12-211-4/+16
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50: implement global channel address space on new VM codeBen Skeggs2010-12-081-1/+1
| | | | | | | As of this commit, it's guaranteed that if an object is in VRAM that its GPU virtual address will be constant. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: make fifo.create_context() responsible for mapping control regsBen Skeggs2010-12-081-21/+1
| | | | | | | | The regs belong to PFIFO, they're different for pretty much the same generations we need different PFIFO control for, and NVC0 is going to be even more different than the rest. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Synchronize with the user channel before GPU object destruction.Francisco Jerez2010-12-081-14/+22
| | | | | | | | | | | | | | There have been reports of PFIFO cache errors during context take down (fdo bug 31637). They are caused by some GPU objects being taken out while the channel is still potentially processing commands. Make sure that all the previous rendering has landed before releasing a GPU object. Reported-by: Grzesiek Sójka <pld@pfu.pl> Reported-by: Patrice Mandin <patmandin@gmail.com> Signed-off-by: Francisco Jerez <currojerez@riseup.net> Acked-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: tidy up and extend dma object creation interfacesBen Skeggs2010-12-031-12/+11
| | | | | Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Implement the pageflip ioctl.Francisco Jerez2010-12-031-0/+1
| | | | | | | nv0x-nv4x should be mostly fine, nv50 doesn't work yet. Signed-off-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-2/+2
| | | | | | | | | | | | | | 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/nv50: create graph and crypt contexts on demandBen Skeggs2010-12-031-9/+2
| | | | | | | | This really needs cleaning up somehow, and probably investigate what's needed to do this on earlier generations. NVIDIA do something similar there too. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv84: add support for the PCRYPT engineBen Skeggs2010-12-031-0/+12
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Implement weak channel references.Francisco Jerez2010-12-031-15/+40
| | | | | | | | | nouveau_channel_ref() takes a "weak" channel reference that doesn't prevent the hardware channel resources from being released, it just keeps the channel data structure alive. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Add unlocked variants of nouveau_channel_get/put.Francisco Jerez2010-12-031-13/+23
| | | | | Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Fix race condition in channel refcount handling.Francisco Jerez2010-12-031-3/+2
| | | | | | | | | | nouveau_channel_put() can be executed after the 'refcount == 0' check in nouveau_channel_get() and before the channel reference count is incremented. In that case CPU0 will take the context down while CPU1 thinks it owns the channel and 'refcount == 1'. Signed-off-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Refactor context destruction to avoid a lock ordering issue.Francisco Jerez2010-12-031-18/+6
| | | | | | | | | | | | | | | | The destroy_context() engine hooks call gpuobj management functions to release the channel resources, these functions use HARDIRQ-unsafe locks whereas destroy_context() is called with the HARDIRQ-safe context_switch_lock held, that's a lock ordering violation. Push the engine-specific channel destruction logic into destroy_context() and let the hardware-specific code lock and unlock when it's actually needed. Change the engine destruction order to avoid a race in the small gap between pgraph and pfifo context uninitialization. Reported-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: switch to unlocked ioctlsBen Skeggs2010-12-031-12/+12
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: add more fine-grained locking to channel list + structuresBen Skeggs2010-12-031-76/+110
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: add per-channel mutex, use to lock access to drm's channelBen Skeggs2010-12-031-0/+1
| | | | | | | | | | | | | | | This fixes a race condition between fbcon acceleration and TTM buffer moves. To reproduce: - start X - switch to vt and "while (true); do dmesg; done" - switch to another vt and "sleep 2 && cat /path/to/debugfs/dri/0/evict_vram" - switch back to vt running dmesg We don't make use of this on any other channel yet, they're currently protected by drm_global_mutex. This will change in the near future. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/ttm: restructure to allow driver to plug in alternate memory managerBen Skeggs2010-10-051-3/+3
| | | | | | | | | Nouveau will need this on GeForce 8 and up to account for the GPU reordering physical VRAM for some memory types. Reviewed-by: Jerome Glisse <jglisse@redhat.com> Acked-by: Thomas Hellström <thellstrom@vmware.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Minor refactoring/cleanup of the fence code.Francisco Jerez2010-10-051-2/+2
| | | | | | | 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: remove nouveau_gpuobj_ref completely, replace with sanityBen Skeggs2010-09-241-9/+3
| | | | | Reviewed-by: Francisco Jerez <currojerez@riseup.net> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: require explicit unmap of kmapped bosBen Skeggs2010-09-241-0/+1
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm: block userspace under allocating buffer and having drivers overwrite it ↵Dave Airlie2010-08-171-12/+12
| | | | | | | | | | | | | | | | (v2) With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory. This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation. Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau. v2: fix nouveau pushbuf arg (thanks to Ben for pointing it out) Reported-by: Linus Torvalds <torvalds@linuxfoundation.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/nouveau: reduce usage of fence spinlock to when absolutely necessaryBen Skeggs2010-07-131-2/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: remove dev_priv->init_state and friendsBen Skeggs2010-07-131-3/+0
| | | | | | | Nouveau will no longer load at all if card initialisation fails, so all these checks are unnecessary. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm: Remove drm_resource wrappersJordan Crouse2010-06-011-1/+2
| | | | | | | | | | | Remove the drm_resource wrappers and directly use the actual PCI and/or platform functions in their place. [airlied: fixup nouveau properly to build] Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Reviewed-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/nouveau: remove some unused members from drm_nouveau_privateBen Skeggs2010-04-091-2/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: new gem pushbuf interface, bump to 0.0.16Ben Skeggs2010-02-251-5/+8
| | | | | | | | | | | | | | | | This commit breaks the userspace interface, and requires a new libdrm for nouveau to operate again. The multiple GEM_PUSHBUF ioctls that were present in 0.0.15 for compatibility purposes are now gone, and replaced with the new ioctl which allows for multiple push buffers to be submitted (necessary for hw index buffers in the nv50 3d driver) and relocations to be applied on any buffer. A number of other ioctls (CARD_INIT, GEM_PIN, GEM_UNPIN) that were needed for userspace modesetting have also been removed. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Francisco Jerez <currojerez@riseup.net>
* drm/nv50: make pushbuf dma object cover entire vmBen Skeggs2010-02-251-4/+9
| | | | | | | This allows us to submit push buffers from any memtype to the hardware. We'll need this ability for VRAM index buffers at some point. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: protect channel create/destroy and irq handler with a spinlockMaarten Maathuis2010-02-251-1/+12
| | | | | | | | | The nv50 pgraph handler (for example) could reenable pgraph fifo access and that would be bad when pgraph context is being unloaded (we need the guarantee a ctxprog isn't running). Signed-off-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nv50: avoid unloading pgraph context when ctxprog is runningMaarten Maathuis2010-02-101-4/+3
| | | | | | | | | | | - We need to disable pgraph fifo access before checking the current channel, otherwise we could still hit a running ctxprog. - The writes to 0x400500 are already handled by pgraph->fifo_access and are therefore redundant, moreover pgraph fifo access should not be reenabled before current context is set as invalid. So remove them altogether. Signed-off-by: Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: initialise DMA tracking parameters earlierBen Skeggs2010-01-111-0/+2
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: remove unused nouveau_channel_idle() functionBen Skeggs2010-01-111-41/+0
| | | | Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
* drm/nouveau: Allocate a per-channel instance of NV_SW.Francisco Jerez2010-01-111-1/+3
| | | | | | | | It will be useful for various synchronization purposes, mostly stolen from "[PATCH] drm/nv50: synchronize user channel after buffer object move on kernel channel" by Maarten Maathuis. Signed-off-by: Francisco Jerez <currojerez@riseup.net>
* drm/nouveau: Add DRM driver for NVIDIA GPUsBen Skeggs2009-12-111-0/+468
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>
OpenPOWER on IntegriCloud