Commit Graph

111 Commits (c1aa08106e0a7190c7a303ec8a9b6b5339251137)

Author SHA1 Message Date
Eric Anholt b668d6d905 Fix dev->agp->base initialization on BSD, and fix addmap range check on Linux.
With the previous linux commit, an AGP aperture at the end of the address space
would have wrapped to 0 and the test would have failed.
2007-08-15 14:29:31 -07:00
Eric Anholt 3ee211f4f7 Bug #11895: Only add the AGP base to map offset if the caller didn't.
The i830 and newer intel 2D code adds the AGP base to map offsets already,
because it wasn't doing the AGP enable which used to set dev->agp->base.

Credit goes to Zhenyu for finding the issue.
2007-08-13 16:32:32 -07:00
Adrian Bunk 7e6d08f670 drm_rmmap_ioctl(): remove dead code
This patch removes some obviously dead code spotted by the Coverity
checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
2007-07-23 18:15:00 +10:00
Pekka Paalanen 0844c46759 Fix misc ioctl issues, makes Nouveau run.
Debug print fix in drm_release().
Forgotten local variable init in drm_setversion().
Unnecessary put_user() in drm_addmap_ioctl().
ioctl->cmd check broken in drm_ioctl(); workaround.
2007-07-21 23:13:25 +03:00
Eric Anholt 5b38e13416 Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
The data is now in kernel space, copied in/out as appropriate according to the
This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal
with those failures.  This also means that XFree86 4.2.0 support for i810 DRM
is lost.
2007-07-20 18:16:42 -07:00
Eric Anholt c1119b1b09 Replace filp in ioctl arguments with drm_file *file_priv.
As a fallout, replace filp storage with file_priv storage for "unique
identifier of a client" all over the DRM.  There is a 1:1 mapping, so this
should be a noop.  This could be a minor performance improvement, as everything
on Linux dereferenced filp to get file_priv anyway, while only the mmap ioctls
went the other direction.
2007-07-20 13:39:45 -07:00
Dave Airlie 24311d5d82 drm: remove drm_buf_t 2007-07-16 13:42:11 +10:00
Dave Airlie 6dce9e0735 drm: remove hashtab/sman and object typedefs 2007-07-16 12:48:44 +10:00
Dave Airlie 21ee6fbfb8 drm: remove drmP.h internal typedefs 2007-07-16 12:32:51 +10:00
Dave Airlie b95ac8b7b3 drm: detypedef drm.h and fixup all problems 2007-07-16 11:22:15 +10:00
Ben Skeggs 750371cb6e nouveau: separate region_offset into map_handle and offset. 2007-07-12 10:46:57 +10:00
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