Commit Graph

51 Commits

Author SHA1 Message Date
Jesse Barnes ba8bbcf6ff i915: add suspend/resume support
Add suspend/resume support to the i915 driver.  Moves some of the
initialization into the driver load routine, and fixes up places where we
assumed no dev_private existed in some of the cleanup paths.  This allows
us to suspend/resume properly even if X isn't running.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2008-02-07 15:09:38 +10:00
Dave Airlie bc5f4523f7 drm: run cleanfile across drm tree
Signed-off-by: Dave Airlie <airlied@linux.ie>
2008-02-07 15:09:38 +10:00
Pavel Emelyanov ba25f9dcc4 Use helpers to obtain task pid in printks
The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.

The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.

[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:43 -07:00
Eric Anholt c153f45f9b drm: 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 t
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 DR
is lost.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-10-15 10:38:20 +10:00
Eric Anholt 6c340eac02 drm: 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 everyth
on Linux dereferenced filp to get file_priv anyway, while only the mmap ioct
went the other direction.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-10-15 10:38:20 +10:00
Scott Thompson 0769d39c99 drm: ioremap return value checks
Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-08-25 18:17:49 +10:00
Adrian Bunk 7ea4d4bd5e 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>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-23 18:29:41 +10:00
Dave Airlie e0be428e66 drm: detypedef the hashtab and more of sman
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-12 10:26:44 +10:00
Dave Airlie 55910517af drm: detypedeffing continues...
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-11 16:53:40 +10:00
Dave Airlie cdd55a294c drm: detypef waitlist/freelist/buf_entry/device_dma/drm_queue structs
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-11 16:32:08 +10:00
Dave Airlie 056219e2fa drm: drop drm_buf_t typedef
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-11 16:17:42 +10:00
Dave Airlie 84b1fd103d drm: remove drm_file_t, drm_device_t and drm_head_t typedefs
some drivers still todo.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-11 15:53:27 +10:00
Dave Airlie c60ce623bd drm: remove a bunch of typedefs on the userspace interface
This moves a bunch of typedefs into a !defined __KERNEL__ to keep userspace
API compatiblity, it changes all internal usages to structs/enum/unions.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-11 15:27:12 +10:00
Dave Airlie bd1b331fae 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 and uses them
in some more places.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-07-11 11:58:02 +10:00
Dave Airlie 54ba2f76e2 drm: bring bufs code from git tree.
This checks the AGP mappings are in a valid place and also fixes the size
check in the vm..

Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-03-11 12:07:17 +11:00
Thomas Hellstrom 1545085a28 drm: Allow for 44 bit user-tokens (or drm_file offsets) 2007-02-08 16:14:05 +11:00
Christoph Hellwig 004a772742 drm: remove drm_ioremap and drm_ioremapfree
hch originally submitted this for paravirt ops work, airlied took it
and cleaned up a lot of unused code caused by using this.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-02-08 13:24:26 +11:00
Thomas Hellstrom f239b7b0ca drm: use vmalloc_user instead of vmalloc_32 for DRM_SHM
Signed-off-by: Dave Airlie <airlied@linux.ie>
2007-02-08 13:24:25 +11:00
George Sapountzis 3417f33e76 drm: add flag for mapping PCI DMA buffers read-only.
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.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-12-07 15:53:31 +11:00
Amol Lad 85abb3f950 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-10-25 09:55:34 -07:00
Thomas Hellstrom e08870c87a drm: allow multiple addMaps with the same 32-bit map offsset.
Reported on -mm kernels.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:34 +10:00
Adrian Bunk fb41e54be4 drm: cleanups
This patch contains the following cleanups:
- make 3 needlessly global functions static
- sis_mm.c: fix compile warnings with CONFIG_FB_SIS=y

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Andrew Morton a1d0fcf5a1 drm: remove FALSE/TRUE that snuck in with simple memory manager changes.
Thanks to Andrew Morton for pointing these out, I've fixed a few his patch
missed.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +10:00
Dave Airlie c2604ce058 drm: remove a tab that snuck in
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +10:00
Thomas Hellstrom 8d153f7107 drm: update user token hashing and map handles
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.

Implement hashed map lookups.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +10:00
Thomas Hellstrom 7a3f1f216b drm: missing mutex unlock
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +10:00
Dave Airlie 5d23fafb1b drm: possible cleanups
This patch contains the following possible cleanups:
- make the following needlessly global function static:
 - drm_bufs.c: drm_addbufs_fb()
- remove the following unused EXPORT_SYMBOL's:
 - drm_agpsupport.c: drm_agp_bind_memory
 - drm_bufs.c: drm_rmmap_locked
 - drm_bufs.c: drm_rmmap
 - drm_stub.c: drm_get_dev

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-04-23 18:26:40 +10:00
Dave Airlie ddf19b973b drm: fixup PCI DMA support
This patch makes the PCI support use the correct Linux interfaces finally.
Tested in DRM CVS on PCI MGA card.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-03-19 18:56:12 +11:00
Dave Airlie 30e2fb1881 sem2mutex: drivers/char/drm/
From: Arjan van de Ven <arjan@infradead.org>

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-02-02 19:37:46 +11:00
Dave Airlie 8d2ea62581 drm: fixup drm bufs being just under the EOM
If the mapping was just under the end of memory it would fail.
Lets DRM start on my PCI card.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-01-11 20:48:09 +11:00
Dave Airlie d985c10881 drm: major update from CVS for radeon and core
This patch pull in a lot of changes from CVS to the main core DRM,
and updates the radeon driver to 1.21.0 that supports r300 texrect
and radeon card type ioctl.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-01-02 21:32:48 +11:00
Dave Airlie 67e1a014fb drm: fix warning on 64-bit platforms..
This looks ugly, but it is the only thing that makes sense that doesn't
change the API.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-10-24 18:41:39 +10:00
Dave Airlie b3a8363989 drm: fix all sparse warning on 32-bit x86
Finally cleaned up the sparse warnings for the drm.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-09-30 18:37:36 +10:00
Dave Airlie 13e4a9c851 drm: cast handle to a pointer to avoid warning
Andrew reported a warning on this line, just case to void *.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-09-25 14:30:09 +10:00
Dave Airlie b5e89ed53e drm: lindent the drm directory.
I've been threatening this for a while, so no point hanging around.
This lindents the DRM code which was always really bad in tabbing department.
I've also fixed some misnamed files in comments and removed some trailing
whitespace.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-09-25 14:28:13 +10:00
Dave Airlie f210973bb6 drm: small cleanups
This patch contains the following small cleanups:
- make two needlessly global functions static
- drm_sysfs.c: every file should #include the header with the prototypes
              of the global functions it is offering

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-09-05 21:33:44 +10:00
Dave Airlie 89625eb186 drm: fix issue with handle lookup for a 0 handle
On 32-bit PPC a 0 handle is valid for AGP space, the 32/64 lookup
doesn't handle 0 correctly.

From: Ben Herrenschmidt <benh@kernel.crashing.org> and Paul Mackerras <paulus@samba.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-09-05 21:23:23 +10:00
Dave Airlie 88f399cd0a drm: fixes for powerpc
Remove a bogus check on whether an area is memory (we need a better interface)
also change pgprot flags for powerpc
don't check on x86-64 either

From: Paul Mackerras <paulus@samba.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-08-20 17:43:33 +10:00
Dave Airlie d27c9b548a drm: remove version.h and any version checks..
This patch removes all the drm kernel conditionals from the kernel DRM tree.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-08-07 15:19:58 +10:00
Dave Airlie d1f2b55ad2 drm: updated DRM map patch for 32/64 bit systems
I basically combined Paul's patches with additions that I had made
for PCI scatter gather.
I also tried more carefully to avoid problems with the same token
assigned multiple times while trying to use the base address in the
token if possible to gain as much backward compatibility as possible
for broken DRI clients.

From: Paul Mackerras <paulus@samba.org> and Egbert Eich <eich@suse.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-08-05 22:11:22 +10:00
Dave Airlie 836cf0465c drm: cleanup buffer/map code
This is a patch from DRM CVS that cleans up some code that was in CVS
that I never moved to the kernel, this patch produces the result of the
cleanups and puts it into the kernel drm.

From: Eric Anholt <anholt@freebsd.org>, Jon Smirl, Dave Airlie
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 19:27:04 +10:00
Dave Airlie ceb9c27aa7 drm: destatic exported function.
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 17:07:23 +10:00
Dave Airlie d84f76d37c drm: export symbols for use by drivers
This just exports symbols for use in drivers.

From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 17:04:22 +10:00
Dave Airlie 7ab984012a drm: update some function so a driver can call them
This patch splits some ioctl functions so that they can be called
in-kernel by a DRM driver. The driver will use them later.

From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 16:56:52 +10:00
Dave Airlie 9c8da5ebbf drm: update support for drm pci buffers
The DRM needs to change the drm_pci interface for FreeBSD compatiblity,
this patch introduces the drm_dma_handle_t and uses it in the Linux code.

From: Tonnerre Lombard, Eric Anholt, and Sergey Vlasov
Signed-off-by: David Airlie <airlied@linux.ie>
2005-07-10 15:38:56 +10:00
Dave Airlie d59431bf96 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.

From: Ian Romanick <idr@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 15:00:06 +10:00
Dave Airlie b84397d639 drm: add framebuffer maps
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: Austin Yuan <austinyuan@viatech.com.cn>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-10 14:46:12 +10:00
Dave Airlie 2d0f9eaff8 drm: add _DRM_CONSISTENT map type
Added a new DRM map type _DRM_CONSISTENT for consistent PCI memory. It
uses drm_pci_alloc/free for allocating/freeing the memory.

From: Felix Kuhling <fxkuehl@gmx.de>
Signed-off-by: David Airlie <airlied@linux.ie>
2005-07-10 14:34:13 +10:00
Dave Airlie c94f702985 drm: misc cleanup
This patch contains the following cleanups:
- make needlessly global functions static
- remove the following unused global functions:
 - drm_fops.c: drm_read
 - i915_dma.c: i915_do_cleanup_pageflip

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-07-07 21:03:38 +10:00
Dave Airlie 9a18664506 drm: 32/64-bit DRM ioctl compatibility patch
The patch is against a 2.6.11 kernel tree.  I am running this with a
32-bit X server (compiled up from X.org CVS as of a couple of weeks
ago) and 32-bit DRI libraries and clients.  All the userland stuff is
identical to what I am using under a 32-bit kernel on my G4 powerbook
(which is a 32-bit machine of course).  I haven't tried compiling up a
64-bit X server or clients yet.

In the compatibility routines I have assumed that the kernel can
safely access user addresses after set_fs(KERNEL_DS).  That is, where
an ioctl argument structure contains pointers to other structures, and
those other structures are already compatible between the 32-bit and
64-bit ABIs (i.e. they only contain things like chars, shorts or
ints), I just check the address with access_ok() and then pass it
through to the 64-bit ioctl code.  I believe this approach may not
work on sparc64, but it does work on ppc64 and x86_64 at least.

One tricky area which may need to be revisited is the question of how
to handle the handles which we pass back to userspace to identify
mappings.  These handles are generated in the ADDMAP ioctl and then
passed in as the offset value to mmap.  However, offset values for
mmap seem to be generated in other ways as well, particularly for AGP
mappings.

The approach I have ended up with is to generate a fake 32-bit handle
only for _DRM_SHM mappings.  The handles for other mappings (AGP, REG,
FB) are physical addresses which are already limited to 32 bits, and
generating fake handles for them created all sorts of problems in the
mmap/nopage code.

This patch has been updated to use the new compatibility ioctls.

From: Paul Mackerras <paulus@samba.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2005-06-23 21:29:18 +10:00