Commit Graph

100 Commits (234a9062009e48bf7b6c7239564ab95b3bcb06aa)

Author SHA1 Message Date
Dave Airlie 7b48f0022a drm: cleanup use of Linux list handling macros
This makes the drms use of the list handling macros a lot cleaner
and more along the lines of how they should be used.
2007-05-26 04:26:24 +10:00
Christoph Hellwig b147c39263 drm: remove drm_follow_page, and drm_ioremap and ioremapfree
This comes from the Re: [patch] paravirt: isolate module ops on lkml
It needs some testing, please report any regressions caused.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-01-08 11:47:15 +11:00
Thomas Hellstrom 672593f611 Replace vmalloc_32.
The vmalloc_32 function together with the memset to clear
the new pages are replaced with a vmalloc_user.

A pre-2.6.18 compat vmalloc_user is added.

Please replace any breakage on machines with > 1GB of memory.
2006-12-20 14:40:36 +01:00
Thomas Hellstrom 72b5d1507a Security fix. Zero pages before they are handed to user space.
Shared memory areas were not cleared when they are allocated and
handed to user space. Sensitive information may leak.
2006-12-19 23:23:17 +01:00
Dave Airlie 696f2bfbd1 Revert "drm: ioremap balanced with iounmap for drivers/char/drm"
This reverts cc22cd8bde commit.

I put this patch incorrectly in .. will fix now
2006-12-19 16:44:57 +11:00
Dave Airlie cc22cd8bde drm: ioremap balanced with iounmap for drivers/char/drm
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.

Tested (compilation only) to make sure the files are compiling without
any warning/error due to new changes

Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-12-19 16:41:10 +11:00
Thomas Hellstrom e22b04f807 Merging drm-ttm-0-2-branch
Conflicts:

	linux-core/drmP.h
	linux-core/drm_drv.c
	linux-core/drm_irq.c
	linux-core/drm_stub.c
	shared-core/drm.h
	shared-core/i915_drv.h
	shared-core/i915_irq.c
2006-10-18 17:33:19 +02:00
George Sapountzis f3deef730d Bug 6242: [mach64] Use private DMA buffers, part #3.
Add DRM_PCI_BUFFER_RO flag for mapping PCI DMA buffer read-only. An additional
flag is needed, since PCI DMA buffers do not have an associated map.
2006-10-02 22:47:23 +03:00
Thomas Hellstrom d85b99435f Allow for 44 bit user-tokens (or drm_file offsets) 2006-10-02 13:49:43 +02:00
Thomas Hellstrom 4ddabd1562 Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into drm-ttm-0-2-branch
Conflicts:

	linux-core/drmP.h
2006-08-28 09:28:10 +02:00
Dave Airlie 9b984b34e9 drm: lots of small cleanups and whitespace issues fixed up
remove a mach64 warning, align a lot of things from linux kernel
2006-08-28 11:31:43 +10:00
Dave Airlie 60ddaaf2e0 add static function, and remove bad attributions 2006-08-28 11:28:38 +10:00
Thomas Hellstrom ea57099973 Fix previous commit: Only fall back to hashed handles
when there is a duplicate handle error. Not for other errors.
2006-08-23 13:49:13 +02:00
Thomas Hellstrom 8fa43d4b2f Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm into drm-ttm-0-2-branch 2006-08-23 13:31:45 +02:00
Thomas Hellstrom 459b234d79 Allow multiple addMaps with the same 32-bit map offset.
(Reported by Dave Airlie)
2006-08-23 11:31:10 +02:00
Thomas Hellstrom 700bf80ca9 Bring in stripped TTM functionality. 2006-08-22 09:47:33 +02:00
Dave Airlie 18a48a9267 remove all TRUE/FALSE no need for this in the drm, use 0 or 1 2006-08-14 11:49:52 +10:00
Dave Airlie 5cfbd5dbab switch drm to use Linux mutexes instead of semaphore.
I hope the fallback compat code works if not shout at me.
2006-07-24 10:51:27 +10:00
Thomas Hellstrom 126673d62a Keep hashed user tokens, with the following changes:
32-bit physical device addresses are mapped directly to user-tokens. No
    duplicate maps are allowed, and the addresses are assumed to be outside
    of the range 0x10000000 through 0x30000000. The user-token is identical
    to the 32-bit physical start-address of the map.
64-bit physical device addressed are mapped to user-tokens in the range
0x10000000 to 0x30000000 with page-size increments. The user_token should
    not be interpreted as an address.
Other map types, like upcoming TTM maps are mapped to user-tokens in the
    range
0x10000000 to 0x30000000 with page-size increments. The user_token should
    not be interpreted as an address.
This keeps compatibility with buggy drivers, while still implementing a
    hashed map lookup. The SiS and via device driver major bumps are
    reverted.
2006-07-11 14:37:37 +00:00
Thomas Hellstrom a392349691 Change drm Map handles to be arbitrary 32-bit hash tokens in the range
0x10000000 to 0x90000000 in PAGE_SIZE increments.
Implement hashed map lookups.
This potentially breaks both 2D and 3D drivers. If so, the corresponding
2D and 3D driver should be fixed, and it's corresponding drm device driver
    should have its major bumped as soon as possible.
Bump sis and via drm device driver majors.
The SiS and Unichrome 3D drivers are fixed in Mesa CVS HEAD and
    mesa_6_4_branch.
2006-07-10 13:00:21 +00:00
Thomas Hellstrom 264f60ded4 Add missing semaphore release. 2006-07-05 14:39:22 +00:00
Dave Airlie 79e5969172 rip out unneeded back compat code 2006-05-19 04:11:22 +00:00
Dave Airlie 0a211db23c experimental PCI DMA fixes use proper Linux interfaces 2006-02-19 12:08:14 +00:00
Dave Airlie 4791dc8856 major realigment of DRM CVS with kernel code, makes integration much easier 2006-02-18 02:53:36 +00:00
Dave Airlie ff9ecc09f9 Fixup test for memory at end of memory space 2006-02-18 02:34:53 +00:00
Alan Hourihane 3fce085e13 Fix bug #4908 for now. Alternative is highlighted in this bug report as the
better future direction.
2005-11-07 13:17:41 +00:00
Ian Romanick 39615ec06e Converts the remaining drm_agp_foo functions to be a drm_agp_foo and
drm_agp_foo_ioctl pair. Modifies the MGA DRM to use the drm_agp_foo
    functions instead of the drm_foo_agp functions. The drm_foo_agp
    functions are no longer exported by drm.ko.
Ensures that dma->seg_count and dma->page_count are properly set in
    drm_addbufs_{agp,sg,fb}. drm_addbufs_pci was already correct.
Ensures that mga_do_agp_dma_bootstrap correctly sets agp_buffer_token.
At this point PCI DMA is still broken.
Xorg bug: #4797 Reviewed by: Dave Airlie, Eric Anholt Signed-off-by: Ian
    Romanick <idr@us.ibm.com>
2005-11-03 00:38:25 +00:00
Dave Airlie 856bdf0f67 fixup bens fix so it works.. 2005-09-30 03:39:02 +00:00
Dave Airlie 68b4ad3cce Add Bens fix for radeon maps on ppc 2005-09-30 03:14:18 +00:00
Dave Airlie 80ed93c7bf check is the map containing the lock 2005-09-03 02:21:22 +00:00
Dave Airlie 5c4ce6d93c add x86_64 to the list as well 2005-08-20 07:38:11 +00:00
Dave Airlie 2e9bd9ac18 add powerpc64 to the list of archs that this test doesn't make sense on 2005-08-20 07:12:45 +00:00
Dave Airlie 7779659390 revert reversion of a part of a patch from Jon, that I did last night while
checking things in in my sleep
2005-08-17 10:48:38 +00:00
Dave Airlie 7af0186f4c add Egberts 32/64 bit patch (its in kernel already...) 2005-08-16 12:51:57 +00:00
Dave Airlie fcdb53867d remove bus address 2005-08-07 04:38:11 +00:00
Jon Smirl 143622a987 Implement permanent sarea maps 2005-08-04 14:48:43 +00:00
Jon Smirl 28e123eb3a Tighten up AGP security. Verify that all uses of AGP are done inside
buffers that have been allocated from AGP. This includes some new
    capable(CAP_SYS_ADMIN) checks, these functions are also protected by
    the root requirement on the IOCTL macros.
2005-08-04 14:39:25 +00:00
Alan Hourihane 6496c5d1e7 silence warning 2005-06-29 13:00:29 +00:00
Eric Anholt 5d96c74ff1 - Remove drm_initmap and replace its usage with drm_addmap. This reduces
code duplication, and it also hands you the map pointer so you don't
    need to re-find it.
- Remove the permanent maps flag. Instead, for register and framebuffer
    maps, we always check whether there's already a map of that type and
    offset around. Move the Radeon map initialization into presetup (first
    open) so it happens again after every takedown.
- Remove the split cleanup of maps between driver takedown (last close) and
    cleanup (module unload). Instead, always tear down maps on takedown,
    and drivers can recreate them on first open.
- Make MGA always use addmap, instead of allocating consistent memory in
    the PCI case and then faking up a map for it, which accomplished nearly
    the same thing, in a different order. Note that the maps are exposed to
    the user again: we may want to expose a flag to avoid this, but it's
    not a security concern, and saves us a lot of code.
- Remove rmmaps in the MGA driver. Since the function is only called during
    takedown anyway, we can let them die a natural death.
- Make removal of maps happen in one function, which is called by both
    drm_takedown and drm_rmmap_ioctl.
Reviewed by: idr (previous revision) Tested on: mga (old/new/pci dma),
    radeon, savage
2005-06-28 20:58:34 +00:00
Dave Airlie 6397722f19 add compat code from Paul Mackerras 2005-06-28 13:02:20 +00:00
Ian Romanick 72cfc797b5 Adds support for PCI cards to MGA DRM
This patch adds serveral new ioctls and a new query to get_param query to
    support PCI MGA cards.
Two ioctls were added to implement interrupt based waiting. With this
    change, the client-side driver no longer needs to map the primary DMA
    region or the MMIO region. Previously, end-of-frame waiting was done by
    busy waiting in the client-side driver until one of the MMIO registers
    (the current DMA pointer) matched a pointer to the end of primary DMA
    space. By using interrupts, the busy waiting and the extra mappings are
    removed.
A third ioctl was added to bootstrap DMA. This ioctl, which is used by the
    X-server, moves a *LOT* of code from the X-server into the kernel. This
    allows the kernel to do whatever needs to be done to setup DMA buffers.
    The entire process and the locations of the buffers are hidden from
    user-mode.
Additionally, a get_param query was added to differentiate between G4x0
    cards and G550 cards. A gap was left in the numbering sequence so that,
    if needed, G450 cards could be distinguished from G400 cards. According
    to Ville Syrjälä, the G4x0 cards and the G550 cards handle
    anisotropic filtering differently. This seems the most compatible way
    to let the client-side driver know which card it's own. Doing this very
    small change now eliminates the need to bump the DRM minor version
    twice.
http://marc.theaimsgroup.com/?l=dri-devel&m=106625815319773&w=2
A number of ioctl handlers in linux-core were also modified so that they
    could be called in-kernel. In these cases, the in-kernel callable
    version kept the existing name (e.g., drm_agp_acquire) and the ioctl
    handler added _ioctl to the name (e.g., drm_agp_acquire_ioctl).
This patch also replaces the drm_agp_do_release function with
    drm_agp_release. drm_agp_release (drm_core_agp_release in the previous
    patch) is very similar to drm_agp_do_release, and I saw no reason to
    have both.
This commit *breaks the build* on BSD. Eric said that he would make the
    required updates to the BSD side soon.
Xorg bug: 3259 Reviewed by: Eric Anholt
2005-06-14 22:34:11 +00:00
Dave Airlie 805a07714f misc cleanup patch from Adrian Bunk 2005-06-04 06:18:11 +00:00
Eric Anholt 9cad6fb4e0 Bugzilla #3217: Create a new __drm_pci_free which is used internally in
linux-core to free pci memory without freeing the structure. Linux-core
    internals often create pci dma handle structures on the stack due to
    the lack of a drm_local_map_t to store them in properly. Fix the
    original drm_pci_free to actually free the dma handle structure instead
    of leaking it.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
2005-05-28 20:36:22 +00:00
Ian Romanick fced784140 Refactor common, boilerplate ioctl code from drm_addbufs_* functions into
drm_addbufs. This makes the code more like the BSD code, and makes the
    drm_addbufs_* functions callable in-kernel.
Reviewed by: Dave Airlie
2005-05-20 00:17:40 +00:00
Eric Anholt ec111d70fe Convert BSD code to mostly use bus_dma, the dma abstraction for dealing
with IOMMUs and such. There is one usage of the forbidden vtophys()
    left in drm_scatter.c which will be fixed up soon. This required a KPI
    change for drm_pci_alloc/free() to return/use a drm_dma_handle_t that
    keeps track of os-specific bits, rather than just passing around the
    vaddr/busaddr/size.
Submitted by: Tonnerre Lombard (partially) Tested on: FreeBSD: Rage128
    AGP/PCI Linux: Savage4 AGP/PCI
2005-04-26 05:19:11 +00:00
Eric Anholt 080a547d4d - Implement drm_initmap, and extend it with the resource number to help
FreeBSD. Add drm_get_resource_{start|len} so linux-specific stuff
    doesn't need to be in shared code.
- Fix mach64 build by using __DECONST to work around passing a const
    pointer to useracc, which is unfortunately not marked const.
- Get rid of a lot of maplist code by not having dev->maplist be a pointer,
    and by sticking the link entries directly in drm_local_map_t rather
    than having a separate structure for the linked list.
- Factor out map uninit and removal into its own routine, rather than
    duplicating in both drm_takedown() and drm_rmmap().
- Hook up more driver functions, and correct FreeBSD-specific bits of
    radeon_cp.c, making radeon work.
- Baby steps towards using bus_space as we should.
2005-02-05 08:00:14 +00:00
Dave Airlie 354dd17d25 The patch makes drmAddBufs/drmMapBufs can handle buffers in video memory
The attached patch adds a new buffer type DRM_FB_BUFFER. It works like AGP
    memory but uses video memory.
From: austinyuan@viatech.com.cn (fd.o bug 1668) Signed-off-by: Dave Airlie
    <airlied@linux.ie>
2005-01-16 05:40:12 +00:00
Felix Kuehling ed165a2529 Added a new DRM map type _DRM_CONSISTENT for consistent PCI memory. It uses
drm_pci_alloc/free for allocating/freeing the memory. Only implemented
    in the Linux DRM so far.
2005-01-01 20:03:15 +00:00
Jose Fonseca 0d89b19325 Update Doxygen configuration & comments. 2004-10-18 14:16:41 +00:00
Jon Smirl ad70dc676e Breakout heads into their own data structures. 2004-10-12 03:59:17 +00:00