Commit graph

1299 commits

Author SHA1 Message Date
Linus Torvalds f42ecb2808 Merge branch 'drm-linus' of 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: (35 commits)
  drm/radeon/kms: add definitions for v4 power tables
  drm/radeon/kms: never combine LVDS with another encoder
  drm/radeon/kms: Check module arguments to be valid V2
  drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
  drm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)
  drm/radeon/kms: add 3DC compression support
  drm/radeon/kms: allow rendering while no colorbuffer is set on r300
  drm/radeon/kms: enable memory clock reading on legacy (V2)
  drm/radeon/kms: prevent parallel AtomBIOS calls
  drm/radeon/kms: set proper default tv standard
  drm/radeon/kms: fix legacy rmx
  drm/radeon/kms/atom: fill in proper defines for digital setup
  drm/kms: silencing a false positive warning.
  drm/mm: fix logic for selection of best fit block
  drm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.
  drm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.
  drm/vmwgfx: Fix unlocked ioctl and add proper access control
  drm/radeon: fix build on 64-bit with some compilers.
  drivers/gpu: Use kzalloc for allocating only one thing
  DRM: Rename clamp variable
  ...
2009-12-23 08:59:32 -08:00
Dave Airlie d94a5108f7 Merge remote branch 'korg/drm-radeon-next' into drm-linus
* korg/drm-radeon-next:
  drm/radeon/kms: add definitions for v4 power tables
  drm/radeon/kms: never combine LVDS with another encoder
  drm/radeon/kms: Check module arguments to be valid V2
  drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
  drm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)
  drm/radeon/kms: add 3DC compression support
  drm/radeon/kms: allow rendering while no colorbuffer is set on r300
  drm/radeon/kms: enable memory clock reading on legacy (V2)
  drm/radeon/kms: prevent parallel AtomBIOS calls
  drm/radeon/kms: set proper default tv standard
  drm/radeon/kms: fix legacy rmx
  drm/radeon/kms/atom: fill in proper defines for digital setup
2009-12-23 11:18:33 +10:00
Alex Deucher 0786201d8c drm/radeon/kms: add definitions for v4 power tables
[airlied: just adding this for completeness to avoid drift between
public atombios.h files]
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:05 +10:00
Alex Deucher f56cd64f5f drm/radeon/kms: never combine LVDS with another encoder
When linking multiple encoders to a connector, make sure
to not link LVDS with another connector.  Some bioses
have the same i2c line for LVDS and VGA.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:05 +10:00
Jerome Glisse 3642133816 drm/radeon/kms: Check module arguments to be valid V2
This patch add a function which check module argument to be
valid. On invalid argument it prints a warning and setback
the default value.

V2: Allow 0 for vram limit & agp mode which are the default
value

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:05 +10:00
Jerome Glisse 0a0c7596c6 drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
Add boolean to record if some part of the driver are initialized or
not this allow to avoid a crash when trying to cleanup uninitialized
structure members.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:04 +10:00
Alex Deucher d2efdf6d6f drm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)
This fixes LVDS on some mac laptops without a panel edid.

v2 - Set proper mode type flags
v3 - Note that this is not neceesarily the exact panel mode,
but an approximation based on the cvt formula.  For these
systems we should ideally read the mode info out of the
registers or add a mode table, but this works and is much
simpler.
v4 - Update comments and debug message.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:04 +10:00
Marek Olšák 512889f450 drm/radeon/kms: add 3DC compression support
There are 2 formats:
ATI1N: 64 bits per 4x4 block, one-channel format
ATI2N: 128 bits per 4x4 block, two-channel format

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:04 +10:00
Marek Olšák 46c64d4bfa drm/radeon/kms: allow rendering while no colorbuffer is set on r300
Because hardware cannot disable all colorbuffers directly to do depth-only
rendering, a user should:
- disable reading from a colorbuffer in blending
- disable fastfill
- set the color channel mask to 0 to prevent writing to a colorbuffer

Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:04 +10:00
Rafał Miłecki 5ea597f376 drm/radeon/kms: enable memory clock reading on legacy (V2)
V2: detect IGP cards (which don't have own memory)

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:04 +10:00
Rafał Miłecki c31ad97f18 drm/radeon/kms: prevent parallel AtomBIOS calls
This just adds a mutex around the atombios table execution
so we don't call it from two contexts at once.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:03 +10:00
Alex Deucher d79766fab9 drm/radeon/kms: set proper default tv standard
we were just using 1 before.

reported on irc by soreau

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:03 +10:00
Alex Deucher 310a82c8c5 drm/radeon/kms: fix legacy rmx
This makes 640x480 on my R100 work again, both
in aspect and centered mode.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Tested-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:03 +10:00
Alex Deucher edc664e314 drm/radeon/kms/atom: fill in proper defines for digital setup
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 11:14:03 +10:00
Dave Airlie 44f9e6c6bc Merge remote branch 'nouveau/for-airlied' into drm-linus
* nouveau/for-airlied:
  drm/nouveau: fix bug causing pinned buffers to lose their NO_EVICT flag
  drm/nv50: fix suspend/resume delays without firmware present
  drm/nouveau: prevent all channel creation if accel not available
  drm/nv50: fix two potential suspend/resume oopses
  drm/nv40: implement ctxprog/state generation
  drm/nv10: Add the initial graph context and soft methods needed for LMA.
  drm/nouveau: Fix up buffer eviction, and evict them to GART, if possible.
  drm/nouveau: Add proper error handling to nouveau_card_init
  drm/nv04: Fix NV04 set_operation software method.
  drm/nouveau: Kill global state in BIOS script interpreter
  drm/nouveau: Kill global state in NvShadowBIOS
  drm/nouveau: use drm debug levels
  drm/i2c/ch7006: Fix load detection false positives right after system init.
  drm/nv04-nv40: Fix "conflicting memory types" when saving/restoring VGA fonts.
2009-12-23 10:28:24 +10:00
Marin Mitov 29ebdf925c drm/kms: silencing a false positive warning.
warning: 'width' may be used uninitialized in this function
drivers/gpu/drm/drm_edid.c

Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:09:09 +10:00
Bob Gleitsmann e2108eb1f6 drm/mm: fix logic for selection of best fit block
This is from bug 25728.

[airlied: I'm just forwarding the patch for review, Thomas, ickle?]

Acked-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:08:08 +10:00
Thomas Hellstrom 7a73ba7469 drm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.
Improve the command verifier to catch all occurences of surface handles,
and translate to SIDs.

This way DMA buffers and 3D surfaces share a common handle space,
which makes it possible for the kms code to differentiate.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:06:24 +10:00
Thomas Hellstrom 3d3a5b3290 drm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.
Fixes for TTM API change.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:05:47 +10:00
Thomas Hellstrom e1f7800315 drm/vmwgfx: Fix unlocked ioctl and add proper access control
This fixes up vmwgfx for the unlocked ioctl code to avoid
doing it in the driver. Also adds ioctl flags.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:05:27 +10:00
Dave Airlie 794f3141a1 drm/radeon: fix build on 64-bit with some compilers.
drivers/gpu/drm/radeon/radeon_test.c:45: undefined reference to `__udivdi3'

Reported-by: Mr. James W. Laferriere <babydr@baby-dragons.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:04:02 +10:00
Julia Lawall e265f39e1f drivers/gpu: Use kzalloc for allocating only one thing
Use kzalloc rather than kcalloc(1,...)

The use of the allocated memory that looks like an array is &p->relocs[0],
but this should be the same as p->relocs.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:04:02 +10:00
Andi Kleen 01136acff8 DRM: Rename clamp variable
linux/kernel.h has a "clamp" macro, but r300_cmdbuf also uses a variable
with the same name. Right now it doesn't seem to include the header,
but sooner or later someone will. So better rename the variable
now.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-23 10:04:01 +10:00
Arnd Bergmann ed8b670409 drm: convert drm_ioctl to unlocked_ioctl
drm_ioctl is called with the Big Kernel Lock held,
which shows up very high in statistics on vfs_ioctl.

Moving the lock into the drm_ioctl function itself
makes sure we blame the right subsystem and it gets
us one step closer to eliminating the locked version
of fops->ioctl.

Since drm_ioctl does not require the lock itself,
we only need to hold it while calling the specific
handler. The 32 bit conversion handlers do not
interact with any other code, so they don't need
the BKL here either and can just call drm_ioctl.

As a bonus, this cleans up all the other users
of drm_ioctl which now no longer have to find
the inode or call lock_kernel.

[airlied: squashed the non-driver bits
of the second patch in here, this provides
the flag for drivers to use to select unlocked
ioctls - but doesn't modify any drivers].

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.sourceforge.net
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-18 11:22:31 +10:00
Dave Airlie dcd6dfcfe9 Merge branch 'drm-linus' into drm-core-next 2009-12-18 09:56:49 +10:00
Dave Airlie cbc8cc049a Merge remote branch 'korg/drm-vmware-staging' into drm-core-next 2009-12-18 09:53:50 +10:00
Linus Torvalds 5fa3577b1a Merge branch 'drm-vmware-staging' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-vmware-staging' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/vmwgfx: Add DRM driver for VMware Virtual GPU
  drm/vmwgfx: Add svga headers for vmwgfx driver
  drm/ttm: Add more driver type enums
2009-12-16 13:19:31 -08:00
Linus Torvalds c5113e3d66 Merge branch 'drm-linus' of 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-16 10:30:17 -08:00
Ben Skeggs 37cb3e0885 drm/nouveau: fix bug causing pinned buffers to lose their NO_EVICT flag
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:06:13 +10:00
Ben Skeggs 65ec01a940 drm/nv50: fix suspend/resume delays without firmware present
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:06:05 +10:00
Ben Skeggs 0735f62e11 drm/nouveau: prevent all channel creation if accel not available
Previously, if there was no firmware available, the DRM would just
disable channel creation from userspace, but still use a single
channel for its own purposes.

With a bit of care it should actually be possible to do this, due
to the DRM's very limited use of the engine.  It currently doesn't
work correctly however, resulting in corrupted fbcon and hangs on
a number of cards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:57 +10:00
Ben Skeggs 3c8868d3db drm/nv50: fix two potential suspend/resume oopses
This avoids touching the dummy channel 0/127 we have on nv50.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:50 +10:00
Ben Skeggs 054b93e444 drm/nv40: implement ctxprog/state generation
The context programs are *very* simple compared to the ones used by
the binary driver.  There's notes in nv40_grctx.c explaining most of
the things we don't implement.  If we discover if/why any of it is
required further down the track, we'll handle it then.

The PGRAPH state generated for each chipset should match what NVIDIA
do almost exactly (there's a couple of exceptions).  If someone has
a lot of time on their hands, they could figure out the mapping of
object/method to PGRAPH register and demagic the initial state a little,
it's not terribly important however.

At time of commit, confirmed to be working at least well enough for
accelerated X (and where tested, for 3D apps) on NV40, NV43, NV44, NV46,
NV49, NV4A, NV4B and NV4E.

A module option has been added to force the use of external firmware
blobs if it becomes required.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:39 +10:00
Francisco Jerez 15bee69ee1 drm/nv10: Add the initial graph context and soft methods needed for LMA.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:33 +10:00
Francisco Jerez 22fbd53809 drm/nouveau: Fix up buffer eviction, and evict them to GART, if possible.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:26 +10:00
Marcin Kościelnicki c5804be062 drm/nouveau: Add proper error handling to nouveau_card_init
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:20 +10:00
Marcin Kościelnicki 13c5443b51 drm/nv04: Fix NV04 set_operation software method.
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:13 +10:00
Marcin Kościelnicki 37383650e4 drm/nouveau: Kill global state in BIOS script interpreter
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:05:02 +10:00
Marcin Kościelnicki 657b6245ba drm/nouveau: Kill global state in NvShadowBIOS
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:04:55 +10:00
Maarten Maathuis ef2bb50668 drm/nouveau: use drm debug levels
- Use driver level (0x2) for NV_DEBUG instead of all levels
- Create a NV_DEBUG_KMS for KMS level (0x4) and use them in modesetting code
- Remove a few odd NV_TRACE calls and replace some of them with NV_DEBUG_KMS or
NV_INFO

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:04:48 +10:00
Francisco Jerez dc4a684ae8 drm/i2c/ch7006: Fix load detection false positives right after system init.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:04:45 +10:00
Francisco Jerez 95f158eab4 drm/nv04-nv40: Fix "conflicting memory types" when saving/restoring VGA fonts.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2009-12-16 17:04:23 +10:00
Dave Airlie d785d78bbd drm/radeon/kms: fix r100->r500 CS checker for compressed textures. (v2)
This adds support for compressed textures to the r100->r500 CS
checker, it lets me run openarena and the demos in mesa fine.

Thanks to Maciej Cencora for initial comments.

Changes since v1:
fix calculations with Maciej formulas

Reviewed-by: Maciej Cencora <m.cencora@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16 16:10:45 +10:00
Maciej Cencora 6e7267721f drm/radeon/kms: allow for texture tiling
This adds the relocations for texture tiling for KMS.

Signed-off-by: Maciej Cencora <m.cencora@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16 16:09:19 +10:00
Dave Airlie a392210531 Merge remote branch 'korg/drm-radeon-next' into drm-linus
* korg/drm-radeon-next:
  drm/radeon/kms: init pm on all chipsets
2009-12-16 15:58:36 +10:00
Rafał Miłecki 6234077d6b drm/radeon/kms: init pm on all chipsets
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16 15:56:15 +10:00
Dave Airlie ece84e04e9 Merge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-linus
* 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next:
  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-16 15:52:21 +10:00
Christian Koenig dafc3bd515 drm/radeon/kms: HDMI support for R600 KMS
Adding basic HDMI support for R600 KMS, ported from radeonhd ddx.

[airlied:- checkpatch cleanups]
Signed-off-by: Christian Koenig <deathsimple@vodafone.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16 15:46:48 +10:00
Alex Deucher 7923c615b8 drm/radeon/kms: make sure mc is initialized before mapping blit bo
We need to make sure the the MC is intialized before we map the
blit shader object on r6xx+.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16 15:39:24 +10:00
Jerome Glisse f89551bfe9 drm/radeon/kms: Return to userspace on ERESTARTSYS
radeon_object.h wasn't converted to ERESTARTSYS change. No
each time we got an ERESTARTSYS we return to userspace (ie
we were interrupted by a signal and we let the userspace
reschedule the ioctl).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2009-12-16 15:39:24 +10:00