aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm
AgeCommit message (Collapse)Author
2009-12-16Merge branch 'drm-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 * 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm/radeon/kms: fix r100->r500 CS checker for compressed textures. (v2) drm/radeon/kms: allow for texture tiling drm/radeon/kms: init pm on all chipsets drm/radeon/kms: HDMI support for R600 KMS drm/radeon/kms: make sure mc is initialized before mapping blit bo drm/radeon/kms: Return to userspace on ERESTARTSYS drm/radeon/gem: don't leak a gem object if reserve fails on get tiling (v2) drm/radeon/kms: don't report allocate failure on ERESTARTSYS drm/radeon/kms: Check if bo we got from ttm are radeon object or not drm/radeon/kms: If no placement is supplied fallback to system drm/ttm: Fix memory type manager debug information printing drm/ttm: Fix printk format & compute bo->mem.size at bo initialization drm/ttm: Fix potential ttm_mem_evict_first races. drm/ttm: Delayed delete fixes. drm/ttm: fix two bugs in new placement routines. drm/ttm: fix incorrect logic in ttm_bo_io path drm/nouveau: remove use of -ERESTART nouveau: Fix endianness with new context program loader drm/nouveau: fix build with CONFIG_AGP=n drm/nouveau: fix ch7006 build
2009-12-16drm/ttm: Fix memory type manager debug information printingJerome Glisse
System memory type doesn't have a drm_mm manager associated to it. This patch avoid trying to call drm_mm_debug on unitialized drm_mm when printing debug info on the system memory manager. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16drm/ttm: Fix printk format & compute bo->mem.size at bo initializationJerome Glisse
Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16drm/ttm: Fix potential ttm_mem_evict_first races.Thomas Hellstrom
1) The function was previously called with a potentially empty LRU list which would have lead to an OOPS or servere corruption. 2) In rare cases, after reservation has succeeded, another process may already have evicted it or even pinned it. We must revalidate the buffer status after releasing the lru lock. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16drm/ttm: Delayed delete fixes.Thomas Hellstrom
1) Remove from lru before reserving so we avoid competing with evicting processes. 2) Avoid calling kref_put() on bo::list_kref while spinlocked. 3) Additional refcounting bug-checking. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16drm/ttm: fix two bugs in new placement routines.Dave Airlie
a) the loops were going to <= not <, leading to illegal memory access b) the busy placement checks were using the placement arrays not the busy placement ones. Acked-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16drm/ttm: fix incorrect logic in ttm_bo_io pathDave Airlie
This path isn't used by radeon yet, but future drivers will want it, so fix it right. Reported-by: Luca Barbieri <luca@luca-barbieri.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-11Merge branch 'drm-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 * 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm/ttm: export some functions useful to drivers using ttm drm/radeon/kms/avivo: fix typo in new_pll module description drm/radeon/kms: Convert radeon to new ttm_bo_init drm/ttm: Convert ttm_buffer_object_init to use ttm_placement
2009-12-10Merge branch 'drm-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 * 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (189 commits) drm/radeon/kms: fix warning about cur_placement being uninitialised. drm/ttm: Print debug information on memory manager when eviction fails drm: Add memory manager debug function drm/radeon/kms: restore surface registers on resume. drm/radeon/kms/r600/r700: fallback gracefully on ucode failure drm/ttm: Initialize eviction placement in case the driver callback doesn't drm/radeon/kms: cleanup structure and module if initialization fails drm/radeon/kms: actualy set the eviction placements we choose drm/radeon/kms: Fix NULL ptr dereference drm/radeon/kms/avivo: add support for new pll selection algo drm/radeon/kms/avivo: fix some bugs in the display bandwidth setup drm/radeon/kms: fix return value from fence function. drm/radeon: Remove tests for -ERESTART from the TTM code. drm/ttm: Have the TTM code return -ERESTARTSYS instead of -ERESTART. drm/radeon/kms: Convert radeon to new TTM validation API (V2) drm/ttm: Rework validation & memory space allocation (V3) drm: Add search/get functions to get a block in a specific range drm/radeon/kms: fix avivo tiling regression since radeon object rework drm/i915: Remove a debugging printk from hangcheck drm/radeon/kms: make sure i2c id matches ...
2009-12-11drm/ttm: export some functions useful to drivers using ttmBen Skeggs
These are functions required by nouveau which will be merged later. Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-11drm/ttm: Convert ttm_buffer_object_init to use ttm_placementJerome Glisse
Convert ttm_buffer_object_init to use struct ttm_placement and rename to ttm_bo_init for consistency with function naming. This allow to give more complex placement at buffer creation. For instance you ask to allocate bo into vram first but if there is not enough vram you can give system as a second possible placement. It also allow to create buffer in a specific range. Also rename ttm_buffer_object_validate to ttm_bo_validate. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10drm/ttm: Print debug information on memory manager when eviction failsJerome Glisse
This add helper function to print information on eviction placements and memory manager status when eviction fails to allocate memory space. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10drm/ttm: Initialize eviction placement in case the driver callback doesn'tJerome Glisse
This would allow to catch driver callback error of not properly setting the eviction placement structure. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-12-10drm/ttm: Have the TTM code return -ERESTARTSYS instead of -ERESTART.Thomas Hellstrom
Return -ERESTARTSYS instead of -ERESTART when interrupted by a signal. The -ERESTARTSYS is converted to an -EINTR by the kernel signal layer before returned to user-space. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-10drm/ttm: Rework validation & memory space allocation (V3)Jerome Glisse
This change allow driver to pass sorted memory placement, from most prefered placement to least prefered placement. In order to avoid long function prototype a structure is used to gather memory placement informations such as range restriction (if you need a buffer to be in given range). Range restriction is determined by fpfn & lpfn which are the first page and last page number btw which allocation can happen. If those fields are set to 0 ttm will assume buffer can be put anywhere in the address space (thus it avoids putting a burden on the driver to always properly set those fields). This patch also factor few functions like evicting first entry of lru list or getting a memory space. This avoid code duplication. V2: Change API to use placement flags and array instead of packing placement order into a quadword. V3: Make sure we set the appropriate mem.placement flag when validating or allocation memory space. [Pending Thomas Hellstrom further review but okay from preliminary review so far]. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-09drm/ttm: fix memory leak noticed by kmemleak.Dave Airlie
If we don't need the zone we need to free it. Acked-By: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-08Merge branch 'drm-core-next' into drm-linusDave Airlie
Bring all core drm changes into 2.6.32 tree and resolve the conflict that occurs. Conflicts: drivers/gpu/drm/drm_fb_helper.c
2009-12-08drm/ttm: fix unreachable code.Dave Airlie
None of the in-tree drivers use user objects yet so this wasn't hitting us. Stanse found unreachable code in ttm_bo_add_ttm: http://decibel.fi.muni.cz/~xslaby/stanse/error.cgi?db=32&id=714#l238 Reported-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07Merge branch 'for-next' into for-linusJiri Kosina
Conflicts: kernel/irq/chip.c
2009-12-07drm/ttm: Export symbols needed for the vmwgfx driver.Thomas Hellstrom
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07drm/ttm: Add TTM execbuf utilities.Thomas Hellstrom
Utilities to reserve, unreserve and fence a list of TTM buffer objects in a deadlock-safe manner. Used by the vmwgfx driver. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07drm/ttm: Add ttm lock functionality.Thomas Hellstrom
This is intended to be used by ttm-aware drivers to 1) Block clients to inactive masters when they try to validate buffers for GPU use. 2) Optionally block clients to the current master when there is thrashing due to GPU memory shortage. Used by the vmwgfx driver. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-07drm/ttm: Add user-space objects.Thomas Hellstrom
Add objects needed for user-space to maintain reference counts on ttm objects. This is used by the vmwgfx driver which allows user-space to maintain map-counts on dma buffers, lock-counts on the ttm lock and ref-counts on gpu surfaces, gpu contexts and dma buffer. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-04tree-wide: fix assorted typos all over the placeAndré Goddard Rosa
That is "success", "unknown", "through", "performance", "[re|un]mapping" , "access", "default", "reasonable", "[con]currently", "temperature" , "channel", "[un]used", "application", "example","hierarchy", "therefore" , "[over|under]flow", "contiguous", "threshold", "enough" and others. Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-04drm/ttm: fix small memory leak in ttm_memory.cDan Carpenter
I moved the allocation until after the check for (si->totalhigh == 0). Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-By: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-11-11Merge branch 'drm-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 * 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (52 commits) drm/kms: Init the CRTC info fields for modes forced from the command line. drm/radeon/r600: CS parser updates drm/radeon/kms: add debugfs for power management for AtomBIOS devices drm/radeon/kms: initial mode validation support drm/radeon/kms/atom/dce3: call transmitter init on mode set drm/radeon/kms: store detailed connector info drm/radeon/kms/atom/dce3: fix up usPixelClock calculation for Transmitter tables drm/radeon/kms/r600: fix rs880 support v2 drm/radeon/kms/r700: fix some typos in chip init drm/radeon/kms: remove some misleading debugging output drm/radeon/kms: stop putting VRAM at 0 in MC space on r600s. drm/radeon/kms: disable D1VGA and D2VGA if enabled drm/radeon/kms: Don't RMW CP_RB_CNTL drm/radeon/kms: fix coherency issues on AGP cards. drm/radeon/kms: fix rc410 suspend/resume. drm/radeon/kms: add quirk for hp dc5750 drm/radeon/kms/atom: fix potential oops in spread spectrum code drm/kms: typo fix drm/radeon/kms/atom: Make card_info per device drm/radeon/kms/atom: Fix DVO support ...
2009-11-04drm/radeon/kms: fix coherency issues on AGP cards.Dave Airlie
When we are evicting from VRAM->RAM we allocate the ttm object, but we don't set the caching policy on it before blitting into it. This means on AGP we end up blitting into cached pages, and the CPU later flushes out on top of them. This was mostly seen as font corruption. The other question is why we don't evict VRAM->GTT in a lot of cases, this would save us some cache transitions since a lot of objects that are evicted from VRAM will probably end up being pulled back in a few operations later, and evicting them to system memory involves 2 unnecessary cache transitions. Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-10-08Merge branch 'drm-next' of ../drm-next into drm-linusDave Airlie
conflict in radeon since new init path merged with vga arb code. Conflicts: drivers/gpu/drm/radeon/radeon.h drivers/gpu/drm/radeon/radeon_asic.h drivers/gpu/drm/radeon/radeon_device.c
2009-10-06drm/ttm: fix refcounting in ttm global code.Dave Airlie
the global refcount wasn't being increased after the first reference. this caused an oops on unload on a multi-gpu card. Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-09-27const: mark struct vm_struct_operationsAlexey Dobriyan
* mark struct vm_area_struct::vm_ops as const * mark vm_ops in AGP code But leave TTM code alone, something is fishy there with global vm_ops being used. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-08-27drm/ttm: consolidate cache flushing code in one place.Dave Airlie
This merges the TTM and drm cache flushing into one file in the drm core. Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20drm/ttm: Fixes for "Memory accounting rework."Thomas Hellstrom
ttm: Fix error paths when kobject_add returns an error. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20drm/ttm: Fixes for "Make parts of a struct ttm_bo_device global"Thomas Hellstrom
ttm: Remove a stray debug printout. Remove a re-init of the lru spinlock at device init. radeon: Fix the size of the bo_global allocation. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-20Merge Linus master to drm-nextDave Airlie
linux-next conflict reported needed resolution. Conflicts: drivers/gpu/drm/drm_crtc.c drivers/gpu/drm/drm_edid.c drivers/gpu/drm/i915/intel_sdvo.c drivers/gpu/drm/radeon/radeon_ttm.c drivers/gpu/drm/ttm/ttm_bo.c
2009-08-19ttm: Make parts of a struct ttm_bo_device global.Thomas Hellstrom
Common resources, like memory accounting and swap lists should be global and not per device. Introduce a struct ttm_bo_global to accomodate this, and register it with sysfs. Add a small sysfs interface to return the number of active buffer objects. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19drm/ttm: Memory accounting rework.Thomas Hellstrom
Use inclusive zones to simplify accounting and its sysfs representation. Use DMA32 accounting where applicable. Add a sysfs interface to make the heuristically determined limits readable and configurable. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-19drm/ttm: Add a virtual ttm sysfs device.Thomas Hellstrom
The device directory will be the base directory of the sysfs representation of other ttm subsystems. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-08-04drm/ttm: Read buffer overflowRoel Kluin
Check whether index is within bounds before grabbing the element. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-04drm/ttm: Fix a sync object leak.Thomas Hellstrom
If there are multiple simultaneous waiters for the same buffer object, a temporary reference to its sync object may be leaked. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-08-04drm/ttm: Fix a potential comparison of structs.Thomas Hellstrom
On some architectures the comparison may cause a compilation failure. Original partial fix Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Pekka Paalanen <pq@iki.fi> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29Merge branch 'drm-radeon-kms' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 * 'drm-radeon-kms' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (35 commits) drm/radeon: set fb aperture sizes for framebuffer handoff. drm/ttm: fix highuser vs dma32 confusion. drm/radeon: Fix size used for benchmarking BO copies. drm/radeon: Add radeon.test parameter for running BO GPU copy tests. drm/radeon/kms: allow interruptible waits for objects. drm/ttm: powerpc: Fix Highmem cache flushing. x86: Export kmap_atomic_prot() needed for TTM. drm/ttm: Fix ttm in-kernel copying of pages with non-standard caching attributes. drm/ttm: Fix an oops and sync object leak. drm/radeon/kms: vram sizing on certain r100 chips needs workaround. drm/radeon: Pay more attention to object placement requested by userspace. drm/radeon: Fall back to evicting BOs with memcpy if necessary. drm/radeon: Don't unreserve twice on failure to validate. drm/radeon/kms: fix bandwidth computation on avivo hardware drm/radeon/kms: add initial colortiling support. drm/radeon/kms: fix hotspot handling on pre-avivo chips drm/radeon/kms: enable frac fb divs on rs600/rs690/rs740 drm/radeon/kms: add PLL flag to prefer frequencies <= the target freq drm/radeon/kms: block RN50 from using 3D engine. drm/radeon/kms: fix VRAM sizing like DDX does it. ...
2009-07-29drm/ttm: fix highuser vs dma32 confusion.Dave Airlie
DMA32 and highmem are sort of exclusive. Noticed by AndrewR on #radeon. Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29drm/ttm: powerpc: Fix Highmem cache flushing.Thomas Hellstrom
Temporarily maps highmem pages while flushing to get a valid virtual address to flush. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29drm/ttm: Fix ttm in-kernel copying of pages with non-standard caching ↵Thomas Hellstrom
attributes. For x86 this affected highmem pages only, since they were always kmapped cache-coherent, and this is fixed using kmap_atomic_prot(). For other architectures that may not modify the linear kernel map we resort to vmap() for now, since kmap_atomic_prot() generally uses the linear kernel map for lowmem pages. This of course comes with a performance impact and should be optimized when possible. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29drm/ttm: Fix an oops and sync object leak.Thomas Hellstrom
The code was potentially dereferencig a NULL sync object pointer. At the same time a sync object reference was potentially leaked. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-29drm/radeon/kms: add initial colortiling support.Dave Airlie
This adds new set/get tiling interfaces where the pitch and macro/micro tiling enables can be set. Along with a flag to decide if this object should have a surface when mapped. The only thing we need to allocate with a mapped surface should be the frontbuffer. Note rotate scanout shouldn't require one, and back/depth shouldn't either, though mesa needs some fixes. It fixes the TTM interfaces along Thomas's suggestions, and I've tested the surface stealing code with two X servers and not seen any lockdep issues. I've stopped tiling the fbcon frontbuffer, as I don't see there being any advantage other than testing, I've left the testing commands in there, just flip the fb_tiled to true in radeon_fb.c Open: Can we integrate endian swapping in with this? Future features: texture tiling - need to relocate texture registers TXOFFSET* with tiling info. This also merges Michel's cleanup surfaces regs at init time patch even though it makes sense on its own, this patch really relies on it. Some PowerMac firmwares set up a tiling surface at the beginning of VRAM which messes us up otherwise. that patch is: Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15drm/ttm/radeon: add dma32 support.Dave Airlie
This add support for using dma32 memory on gpus that really need it. Currently IGPs are left without DMA32 but we might need to change that unless we can fix rs690. Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15ttm: Fix caching mode selection.Thomas Hellstrom
A bug caused a new caching state to be selected on each buffer object validation regardless of the current caching state. Moreover, a caching state could be selected that wasn't supported by the memory type. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-07-15drm/ttm: fix misplaced parenthesesRoel Kluin
Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
2009-06-24drm: remove unused #include <linux/version.h>'sHuang Weiyi
Remove unused #include <linux/version.h>('s) in drivers/gpu/drm/ttm/ttm_bo_util.c drivers/gpu/drm/ttm/ttm_bo_vm.c drivers/gpu/drm/ttm/ttm_tt.c Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>