Commit graph

215 commits

Author SHA1 Message Date
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
Jeff Garzik 24f73c92a9 drm: fix error returns, sysfs error handling
- callers of drm_sysfs_create() and drm_sysfs_device_add() looked for
  errors using IS_ERR(), but the functions themselves only ever returned
  NULL on error.  Fixed.

- unwind from, and propagate sysfs errors

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-10-25 09:40:40 -07:00
Dave Jones 0d960d26c4 fix return code in error case.
The other failure returns in this function are negative, so make
this one do the same.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-10-25 09:40:40 -07:00
Tilman Sauerbeck 958de71b1a drm: mga: set dev_priv_size
fd.o bug 1746

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-10-24 21:52:23 +10:00
Michael Karcher 10eee0fe91 drm: savage: dev->agp_buffer_map is not initialized for AGP DMA on savages
fd.o bug 8662

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-10-24 21:46:55 +10:00
Roland Scheidegger a1aa289703 drm: radeon: only allow specific type-3 packetss through verifier
only allow specific type-3 packets to pass the verifier instead of all for r100/r200 as others might be unsafe (r300 already does this), and add checking for these we need but aren't safe. Check the RADEON_CP_INDX_BUFFER packet on both r200 and r300 as it isn't safe neither.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-10-24 21:45:00 +10:00
David Howells 7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
Michel Daenzer 3e14a2867d drm: Use register writes instead of BITBLT_MULTI packets for buffer swap blits
This takes up two more ring buffer entries per rectangle blitted but makes sure
the blit is performed top to bottom, reducing the likelyhood of tearing.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:34 +10:00
Dave Airlie 54a56ac583 drm: use radeon specific names for radeon flags
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:34 +10:00
Eric Anholt 2f02cc3fb8 drm: add device/vendor id to drm_device_t for compat with FreeBSD drivers
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:34 +10: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
Michel Daenzer 214ff13d9e drm: fd.o Bug #7595: Avoid u32 overflows in radeon_check_and_fixup_offset().
The overflows could cause valid offsets to get rejected under some
circumstances, e.g. when the framebuffer resides at the very end of the card's
address space.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:34 +10:00
Thomas Hellstrom 47cc140931 drm: Fix hashtab implementation leaking illegal error codes to user space.
reported by Dave Airlie

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:34 +10:00
Dave Airlie 9b1a51b69c drm: domain changes broke ppc r200
Freedesktop.org bug #8246

The domain changes regressed on PPC, go back to just using 0,
as X.org's domain support is crap

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Dave Airlie 1f27ce6ab7 drm: fixup setversion return codes..
Frederik Deweerdt <deweerdt@free.fr> noticed some badness in setversion
returns, however just making it work, breaks things... this code is hairy
with backwards compat...

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Dave Airlie 46acbf13fb drm: fixup i915 error codes
Frederik Deweerdt <deweerdt@free.fr> pointed this out, I fixed a missing
DRM error wrapper also.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Dave Airlie b15ec36806 drm: realign sosme radeon code with drm git tree
this applies some minor cleanups for the radeon driver, to use the
3D flush and reset the AGP flags on X recycle

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Dave Airlie d40c8533a5 drm: realign via driver with drm git tree
This just realigns some code/whitespace between the kernel and main tree

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Thomas Hellstrom 1f4eccfdb2 drm: remove hash tables on drm exit
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +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
Denis Vlasenko c7aed17902 drm: i810_dma.c: fix pointer arithmetic for 64-bit target
First warning result from open-coded PTR_ERR,
the rest is caused by code like this:

*(u32 *) ((u32) buf_priv->kernel_virtual + used)

I've also fixed a missing PTR_ERR in i830_dma.c

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:33 +10:00
Thomas Hellstrom 0a0c721dc5 drm: avoid kernel oops in some error paths calling drm_lastclose
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +10:00
Chuck Short bd5af0781a drm: allow detection of new VIA chipsets
Update pci ids.

patch location:
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=c
ommitdiff;h=5195a64a27550a279b2ecaf400066a3823f2d053

Signed-off-by: Chuck Short <zulcss@gmail.com>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +10:00
Andrew Morton 78eca43d03 drm: fix i965 build bug
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +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
Alan Hourihane c29b669caa drm: Add support for Intel i965G chipsets.
This is a patch prepared by Guangdeng Liao based off of Tungsten Graphics's
final code drop.

From: Alan Hourihane <alanh@tungstengraphics.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +10:00
Dave Airlie d000b486ea drm: add better explanation for i830/i915
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
Dave Airlie 572225bedf drm: fix return value in auth function
This just fixes up the return value in the drm_auth:remove_magic

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:32 +10:00
Thomas Hellstrom 7981bf7d49 drm: SiS 315 Awareness.
Add support for the SiS 315 to the DRM.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +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 8669cbc5e6 drm: move drm authentication to new generic hash table.
Fix drm_remove_magic potential memory leak / corruption. Move drm
authentication token hashing to new generic hash table implementation.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +10:00
Dave Airlie 3d45dbd611 drm: Add the P4VM800PRO (?) PCI ID.
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +10:00
Thomas Hellstrom ce65a44de0 drm: add drm simple memory manager support for SiS and VIA drivers
This add support to the SiS and VIA drivers for the simple memory manager.
This fixes a lot of problems with the current simple code these drivers used,
including locking and SMP issues.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +10:00
Thomas Hellstrom 3a1bd924f3 drm: add simple DRM memory manager, and hash table
This adds the DRM hashtable and simple memory manager implementations from
Tungsten Graphics, this is NOT the new memory manager, this is a replacement
for the SIS and VIA memory managers.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +10:00
Michel Dänzer b9b603dd1c drm: radeon: Use RADEON_RB3D_DSTCACHE_CTLSTAT instead of RADEON_RB2D_DSTCACHE_CTLSTAT.
The latter seems to be a read-only mirror of the former.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:31 +10:00
Michel Dänzer ae1b1a4816 drm: radeon: fix up bus mastering when writeback is disabled
When writeback isn't used, actually disable it in the hardware.

Not doing this might waste bus bandwidth or even cause memory corruption or
system crashes on systems that check bus transfers. No such incident has been
reported though.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +10:00
Michel Dänzer 8624ecbf68 drm: radeon: implement RADEON_PARAM_SCRATCH_OFFSET getparam
When this succeeds, userspace can read the scratch register contents from th    mapped writeback page directly.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +10:00
Michel Dänzer 9ca941615e drm: radeon: add some debug output when getparam is called with unknown
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +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 332296016e drm: remove the DRM pci domain
This patch removes the pci_domain from the DRM device structure, and
gets it via a macro that either asks the platform or does the alpha special
case. jgarzik asked for this to just use the platform magic, but I've no
alpha experience and I'd rather not just break it and wait for someone to
give out.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +10:00
Dave 242ef0e1e7 drm: remove local copies of pci bus/slot/func
The drm keeps a local copy of these for little use.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +10:00
Dave Airlie 3d77461ecd drm: cleanup old compat code and DRM fns from Linux only code
This patch removes some of the old compatibility macros from the DRM,
and removes use of DRM wrappers from Linux specific code.

Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-09-22 05:32:30 +10:00
Roland Scheidegger 18f2905fce [PATCH] drm: radeon flush TCL VAP for vertex program enable/disable
The radeon requires a VAP state flush when enabling/disabling
vertex programs on the r200 cards.

Signed-off-by: Dave Airlie <airlied@linux.ie>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-30 16:06:14 -07:00
Thomas Gleixner 935f6e3abc [PATCH] irq-flags: drivers/drm: Use the new IRQF_ constants
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-02 13:58:49 -07:00
Jörn Engel 6ab3d5624e Remove obsolete #include <linux/config.h>
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-30 19:25:36 +02:00
Ingo Molnar 34af946a22 [PATCH] spin/rwlock init cleanups
locking init cleanups:

 - convert " = SPIN_LOCK_UNLOCKED" to spin_lock_init() or DEFINE_SPINLOCK()
 - convert rwlocks in a similar manner

this patch was generated automatically.

Motivation:

 - cleanliness
 - lockdep needs control of lock initialization, which the open-coded
   variants do not give
 - it's also useful for -rt and for lock debugging in general

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 17:32:39 -07:00
Dave Airlie c499aeb08c drm: radeon constify radeon microcode
From: Tilman (DRM CVS)
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-06-24 17:37:48 +10:00
Dave Airlie 702880f243 Add i915 ioctls to configure pipes for vblank interrupt.
i915 vblanks can be generated from either pipe a or b, however a disabled
pipe generates no interrupts. This change allows the X server to select
which pipe generates vblank interrupts.

From: Keith Packard <keith.packard@intel.com> via DRM CVS
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-06-24 17:32:58 +10:00
Dave Airlie d6fece051a drm: update radeon to 1.25 add r200 vertex program support
Add support for r200 vertex programs (R200_EMIT_VAP_PVS_CNTL, and new
packet type for making it possible to address whole tcl vector space
and have a larger count)

From: Roland Scheidegger (DRM CVS)
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-06-24 17:32:10 +10:00