pandora-kernel.git
14 years agodrm/radeon/kms: enable memory clock reading on legacy (V2)
Rafał Miłecki [Thu, 17 Dec 2009 12:50:09 +0000 (13:50 +0100)]
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>
14 years agodrm/radeon/kms: prevent parallel AtomBIOS calls
Rafał Miłecki [Wed, 16 Dec 2009 23:00:46 +0000 (00:00 +0100)]
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>
14 years agodrm/radeon/kms: set proper default tv standard
Alex Deucher [Fri, 18 Dec 2009 00:00:29 +0000 (19:00 -0500)]
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>
14 years agodrm/radeon/kms: fix legacy rmx
Alex Deucher [Thu, 17 Dec 2009 06:24:59 +0000 (01:24 -0500)]
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>
14 years agodrm/radeon/kms/atom: fill in proper defines for digital setup
Alex Deucher [Thu, 17 Dec 2009 16:22:01 +0000 (11:22 -0500)]
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>
14 years agodrm/kms: silencing a false positive warning.
Marin Mitov [Sun, 20 Dec 2009 07:03:27 +0000 (09:03 +0200)]
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>
14 years agodrm/mm: fix logic for selection of best fit block
Bob Gleitsmann [Mon, 21 Dec 2009 03:52:09 +0000 (13:52 +1000)]
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>
14 years agodrm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.
Thomas Hellstrom [Tue, 22 Dec 2009 15:53:41 +0000 (16:53 +0100)]
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>
14 years agodrm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.
Thomas Hellstrom [Tue, 8 Dec 2009 11:59:34 +0000 (12:59 +0100)]
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>
14 years agodrm/vmwgfx: Fix unlocked ioctl and add proper access control
Thomas Hellstrom [Tue, 8 Dec 2009 11:57:51 +0000 (12:57 +0100)]
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>
14 years agodrm/radeon: fix build on 64-bit with some compilers.
Dave Airlie [Sun, 20 Dec 2009 06:08:40 +0000 (16:08 +1000)]
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>
14 years agodrivers/gpu: Use kzalloc for allocating only one thing
Julia Lawall [Sat, 19 Dec 2009 07:16:33 +0000 (08:16 +0100)]
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>
14 years agoDRM: Rename clamp variable
Andi Kleen [Mon, 21 Dec 2009 01:24:47 +0000 (02:24 +0100)]
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>
14 years agodrm: convert drm_ioctl to unlocked_ioctl
Arnd Bergmann [Wed, 16 Dec 2009 22:17:09 +0000 (22:17 +0000)]
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>
14 years agoMerge branch 'drm-linus' into drm-core-next
Dave Airlie [Thu, 17 Dec 2009 23:56:49 +0000 (09:56 +1000)]
Merge branch 'drm-linus' into drm-core-next

14 years agoMerge remote branch 'korg/drm-vmware-staging' into drm-core-next
Dave Airlie [Thu, 17 Dec 2009 23:53:50 +0000 (09:53 +1000)]
Merge remote branch 'korg/drm-vmware-staging' into drm-core-next

14 years agodrm/radeon/kms: fix r100->r500 CS checker for compressed textures. (v2)
Dave Airlie [Mon, 7 Dec 2009 03:16:06 +0000 (13:16 +1000)]
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>
14 years agodrm/radeon/kms: allow for texture tiling
Maciej Cencora [Tue, 15 Dec 2009 22:13:08 +0000 (23:13 +0100)]
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>
14 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Wed, 16 Dec 2009 05:58:36 +0000 (15:58 +1000)]
Merge remote branch 'korg/drm-radeon-next' into drm-linus

* korg/drm-radeon-next:
  drm/radeon/kms: init pm on all chipsets

14 years agodrm/radeon/kms: init pm on all chipsets
Rafał Miłecki [Tue, 15 Dec 2009 20:46:58 +0000 (21:46 +0100)]
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>
14 years agoMerge remote branch 'nouveau/for-airlied' of /ssd/git/drm-nouveau-next into drm-linus
Dave Airlie [Wed, 16 Dec 2009 05:52:21 +0000 (15:52 +1000)]
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

14 years agodrm/radeon/kms: HDMI support for R600 KMS
Christian Koenig [Sun, 11 Oct 2009 21:49:13 +0000 (23:49 +0200)]
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>
14 years agodrm/radeon/kms: make sure mc is initialized before mapping blit bo
Alex Deucher [Tue, 15 Dec 2009 22:15:07 +0000 (17:15 -0500)]
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>
14 years agodrm/radeon/kms: Return to userspace on ERESTARTSYS
Jerome Glisse [Tue, 15 Dec 2009 17:23:23 +0000 (18:23 +0100)]
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>
14 years agodrm/radeon/gem: don't leak a gem object if reserve fails on get tiling (v2)
Dave Airlie [Wed, 16 Dec 2009 03:10:43 +0000 (13:10 +1000)]
drm/radeon/gem: don't leak a gem object if reserve fails on get tiling (v2)

Not sure it ever happens in practice, spotted during code review.

spare brace snuck in

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: don't report allocate failure on ERESTARTSYS
Dave Airlie [Tue, 15 Dec 2009 00:39:48 +0000 (10:39 +1000)]
drm/radeon/kms: don't report allocate failure on ERESTARTSYS

if we fail with ERESTARTSYS during alloc, we'll get a retry from
userspace so don't report it in dmesg.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Check if bo we got from ttm are radeon object or not
Jerome Glisse [Mon, 14 Dec 2009 20:02:09 +0000 (21:02 +0100)]
drm/radeon/kms: Check if bo we got from ttm are radeon object or not

If they are not radeon object don't do anythings special for them,
this avoid rare oops than can happen in a complex use case.

[airlied: additional fixups]

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: If no placement is supplied fallback to system
Jerome Glisse [Fri, 11 Dec 2009 14:13:22 +0000 (15:13 +0100)]
drm/radeon/kms: If no placement is supplied fallback to system

Do as we did before rework, if no placement is supplied at bo
creation time, fallback to allocating bo from system ram. This
will fix most of the creation failed issue report we got since
the rework get merged.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix memory type manager debug information printing
Jerome Glisse [Thu, 10 Dec 2009 17:07:26 +0000 (18:07 +0100)]
drm/ttm: Fix memory type manager debug information printing

System memory type doesn't have a drm_mm manager associated to
it. This patch avoid trying to call drm_mm_debug on unitialized
drm_mm when printing debug info on the system memory manager.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix printk format & compute bo->mem.size at bo initialization
Jerome Glisse [Thu, 10 Dec 2009 15:15:52 +0000 (16:15 +0100)]
drm/ttm: Fix printk format & compute bo->mem.size at bo initialization

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Fix potential ttm_mem_evict_first races.
Thomas Hellstrom [Wed, 2 Dec 2009 17:33:46 +0000 (18:33 +0100)]
drm/ttm: Fix potential ttm_mem_evict_first races.

1) The function was previously called with a potentially empty
LRU list which would have lead to an OOPS or servere corruption.
2) In rare cases, after reservation has succeeded, another process may
already have evicted it or even pinned it. We must revalidate the
buffer status after releasing the lru lock.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Delayed delete fixes.
Thomas Hellstrom [Wed, 2 Dec 2009 17:33:45 +0000 (18:33 +0100)]
drm/ttm: Delayed delete fixes.

1) Remove from lru before reserving so we avoid competing with
evicting processes.
2) Avoid calling kref_put() on bo::list_kref while spinlocked.
3) Additional refcounting bug-checking.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: fix two bugs in new placement routines.
Dave Airlie [Mon, 14 Dec 2009 04:51:35 +0000 (14:51 +1000)]
drm/ttm: fix two bugs in new placement routines.

a) the loops were going to <= not <, leading to illegal memory access
b) the busy placement checks were using the placement arrays not the
   busy placement ones.

Acked-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: fix incorrect logic in ttm_bo_io path
Dave Airlie [Mon, 14 Dec 2009 22:07:12 +0000 (08:07 +1000)]
drm/ttm: fix incorrect logic in ttm_bo_io path

This path isn't used by radeon yet, but future drivers will want it,
so fix it right.

Reported-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/nouveau: remove use of -ERESTART
Ben Skeggs [Tue, 15 Dec 2009 01:04:25 +0000 (11:04 +1000)]
drm/nouveau: remove use of -ERESTART

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agonouveau: Fix endianness with new context program loader
Benjamin Herrenschmidt [Mon, 14 Dec 2009 03:31:40 +0000 (14:31 +1100)]
nouveau: Fix endianness with new context program loader

When switching to request_firmware() to load the context programs,
some endian fixes need to be applied. This makes it work again on
my quad g5 nvidia 6600.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: fix build with CONFIG_AGP=n
Ben Skeggs [Tue, 15 Dec 2009 00:38:32 +0000 (10:38 +1000)]
drm/nouveau: fix build with CONFIG_AGP=n

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/nouveau: fix ch7006 build
Randy Dunlap [Mon, 14 Dec 2009 19:51:40 +0000 (11:51 -0800)]
drm/nouveau: fix ch7006 build

The ch7006 driver could be built even when nouveau was not enabled,
but the build fails in that case, so make it depend on DRM_NOUVEUA.

Also make the I2c encoder/helper chips menu depend on I2C (no build
error, just visual inspection).

ERROR: "drm_helper_probe_single_connector_modes" [drivers/gpu/drm/i2c/ch7006.ko] undefined!

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 years agodrm/vmwgfx: Add DRM driver for VMware Virtual GPU
Jakob Bornecrantz [Thu, 10 Dec 2009 00:19:58 +0000 (00:19 +0000)]
drm/vmwgfx: Add DRM driver for VMware Virtual GPU

This commit adds the vmwgfx driver for the VWware Virtual GPU aka SVGA.
The driver is under staging the same as Nouveau and Radeon KMS. Hopefully
the 2D ioctls are bug free and don't need changing, so that part of the
API should be stable. But there there is a pretty big chance that the 3D API
will change in the future.

Signed-off-by: Thomas Hellström <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/vmwgfx: Add svga headers for vmwgfx driver
Jakob Bornecrantz [Thu, 10 Dec 2009 00:19:10 +0000 (00:19 +0000)]
drm/vmwgfx: Add svga headers for vmwgfx driver

These headers are shared between multiple place where
different coding standards apply. They will be fixed
up at a later time.

Signed-off-by: Thomas Hellström <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Add more driver type enums
Jakob Bornecrantz [Mon, 14 Dec 2009 22:07:45 +0000 (22:07 +0000)]
drm/ttm: Add more driver type enums

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/nouveau: Add DRM driver for NVIDIA GPUs
Ben Skeggs [Fri, 11 Dec 2009 09:24:15 +0000 (19:24 +1000)]
drm/nouveau: Add DRM driver for NVIDIA GPUs

This adds a drm/kms staging non-API stable driver for GPUs from NVIDIA.

This driver is a KMS-based driver and requires a compatible nouveau
userspace libdrm and nouveau X.org driver.

This driver requires firmware files not available in this kernel tree,
interested parties can find them via the nouveau project git archive.

This driver is reverse engineered, and is in no way supported by nVidia.

Support for nearly the complete range of nvidia hw from nv04->g80 (nv50)
is available, and the kms driver should support driving nearly all
output types (displayport is under development still) along with supporting
suspend/resume.

This work is all from the upstream nouveau project found at
nouveau.freedesktop.org.

The original authors list from nouveau git tree is:
Anssi Hannula <anssi.hannula@iki.fi>
Ben Skeggs <bskeggs@redhat.com>
Francisco Jerez <currojerez@riseup.net>
Maarten Maathuis <madman2003@gmail.com>
Marcin Kościelnicki <koriakin@0x04.net>
Matthew Garrett <mjg@redhat.com>
Matt Parnell <mparnell@gmail.com>
Patrice Mandin <patmandin@gmail.com>
Pekka Paalanen <pq@iki.fi>
Xavier Chantry <shiningxc@gmail.com>
along with project founder Stephane Marchesin <marchesin@icps.u-strasbg.fr>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: export some functions useful to drivers using ttm
Ben Skeggs [Fri, 11 Dec 2009 05:13:00 +0000 (15:13 +1000)]
drm/ttm: export some functions useful to drivers using ttm

These are functions required by nouveau which will be merged later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms/avivo: fix typo in new_pll module description
Alex Deucher [Thu, 10 Dec 2009 00:38:58 +0000 (19:38 -0500)]
drm/radeon/kms/avivo: fix typo in new_pll module description

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Convert radeon to new ttm_bo_init
Jerome Glisse [Thu, 10 Dec 2009 16:16:28 +0000 (17:16 +0100)]
drm/radeon/kms: Convert radeon to new ttm_bo_init

Now bo init use placement structure like bo validation does.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Convert ttm_buffer_object_init to use ttm_placement
Jerome Glisse [Thu, 10 Dec 2009 16:16:27 +0000 (17:16 +0100)]
drm/ttm: Convert ttm_buffer_object_init to use ttm_placement

Convert ttm_buffer_object_init to use struct ttm_placement and
rename to ttm_bo_init for consistency with function naming. This
allow to give more complex placement at buffer creation. For
instance you ask to allocate bo into vram first but if there is
not enough vram you can give system as a second possible
placement. It also allow to create buffer in a specific range.

Also rename ttm_buffer_object_validate to ttm_bo_validate.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix warning about cur_placement being uninitialised.
Dave Airlie [Thu, 10 Dec 2009 05:59:32 +0000 (15:59 +1000)]
drm/radeon/kms: fix warning about cur_placement being uninitialised.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agoMerge remote branch 'korg/drm-radeon-next' of into drm-linus
Dave Airlie [Thu, 10 Dec 2009 05:47:57 +0000 (15:47 +1000)]
Merge remote branch 'korg/drm-radeon-next' of into drm-linus

This merges some TTM overhauls to allow us to do better object placement
for certain radeon GPUs that need scanout+cursor within range of each other,
along with an API change to not return ERESTART to userspace, but to use
ERESTARTSYS properly internally and have it convert to EINTR and catch that
correctly. Also lots of radeon fixes across the board.

14 years agoMerge remote branch 'anholt/drm-intel-next' into drm-linus
Dave Airlie [Thu, 10 Dec 2009 05:44:11 +0000 (15:44 +1000)]
Merge remote branch 'anholt/drm-intel-next' into drm-linus

Pull more Intel changes in, especially one to init the GTT properly

14 years agodrm/ttm: Print debug information on memory manager when eviction fails
Jerome Glisse [Wed, 9 Dec 2009 20:55:10 +0000 (21:55 +0100)]
drm/ttm: Print debug information on memory manager when eviction fails

This add helper function to print information on eviction placements
and memory manager status when eviction fails to allocate memory
space.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Add memory manager debug function
Jerome Glisse [Wed, 9 Dec 2009 20:55:09 +0000 (21:55 +0100)]
drm: Add memory manager debug function

drm_mm_debug_table will print the memory manager state
in table allowing to give a snapshot of the manager at
given point in time. Usefull for debugging.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: restore surface registers on resume.
Dave Airlie [Wed, 9 Dec 2009 04:15:38 +0000 (14:15 +1000)]
drm/radeon/kms: restore surface registers on resume.

On resume on my rv530 laptop surface cntl was left disabled, so
wierd stuff would happen with rendering to a tiled front buffer.

This checks if the surface regs are assigned to bos and reprograms
the surface registers on resume using the same path that clears
them all on init.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms/r600/r700: fallback gracefully on ucode failure
Alex Deucher [Thu, 10 Dec 2009 00:31:44 +0000 (19:31 -0500)]
drm/radeon/kms/r600/r700: fallback gracefully on ucode failure

Sent the wrong patch earlier.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Initialize eviction placement in case the driver callback doesn't
Jerome Glisse [Wed, 9 Dec 2009 21:14:27 +0000 (22:14 +0100)]
drm/ttm: Initialize eviction placement in case the driver callback doesn't

This would allow to catch driver callback error of not properly
setting the eviction placement structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
14 years agodrm/radeon/kms: cleanup structure and module if initialization fails
Jerome Glisse [Wed, 9 Dec 2009 17:21:55 +0000 (18:21 +0100)]
drm/radeon/kms: cleanup structure and module if initialization fails

This would allow us to properly unload others module like TTM if
initialization fails after we initiliazed TTM structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
14 years agodrm/radeon/kms: actualy set the eviction placements we choose
Jerome Glisse [Wed, 9 Dec 2009 20:57:37 +0000 (21:57 +0100)]
drm/radeon/kms: actualy set the eviction placements we choose

Stupid bug, somehow copying the eviction placements into the
result structure was missing.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
14 years agodrm/radeon/kms: Fix NULL ptr dereference
Jerome Glisse [Wed, 9 Dec 2009 16:39:16 +0000 (17:39 +0100)]
drm/radeon/kms: Fix NULL ptr dereference

radeon_atombios_fini might be call while there is not valid
atombios structure allocated, thus test for a not null ptr
before trying to access this structure.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
14 years agodrm/radeon/kms/avivo: add support for new pll selection algo
Alex Deucher [Wed, 9 Dec 2009 22:44:25 +0000 (17:44 -0500)]
drm/radeon/kms/avivo: add support for new pll selection algo

Supported on all AVIVO-based asics.
Can be disabled via the new_pll module parameter:
new_pll=0 - disable
new_pll=1 - enable
enabled by default

[airlied: fixed to use do_div]
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
14 years agodrm/radeon/kms/avivo: fix some bugs in the display bandwidth setup
Alex Deucher [Wed, 9 Dec 2009 19:40:06 +0000 (14:40 -0500)]
drm/radeon/kms/avivo: fix some bugs in the display bandwidth setup

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
14 years agodrm/radeon/kms: fix return value from fence function.
Dave Airlie [Wed, 9 Dec 2009 05:32:23 +0000 (15:32 +1000)]
drm/radeon/kms: fix return value from fence function.

We only want to return here for errors, the wait functions return
a positive timeout otherwise, which gets back to userspace and
causes X to crash here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon: Remove tests for -ERESTART from the TTM code.
Thomas Hellstrom [Mon, 7 Dec 2009 17:36:19 +0000 (18:36 +0100)]
drm/radeon: Remove tests for -ERESTART from the TTM code.

Also sets affected TTM calls up to not wait interruptible, since
that would cause an in-kernel spin until the TTM call succeeds, since
the Radeon code does not return to user-space when a signal is received.

Modifies interruptible fence waits to return -ERESTARTSYS rather than
-EBUSY when interrupted by a signal, since that's the (yet undocumented)
semantics required by the TTM sync object hooks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Have the TTM code return -ERESTARTSYS instead of -ERESTART.
Thomas Hellstrom [Mon, 7 Dec 2009 17:36:18 +0000 (18:36 +0100)]
drm/ttm: Have the TTM code return -ERESTARTSYS instead of -ERESTART.

Return -ERESTARTSYS instead of -ERESTART when interrupted by a signal.
The -ERESTARTSYS is converted to an -EINTR by the kernel signal layer
before returned to user-space.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: Convert radeon to new TTM validation API (V2)
Jerome Glisse [Mon, 7 Dec 2009 14:52:58 +0000 (15:52 +0100)]
drm/radeon/kms: Convert radeon to new TTM validation API (V2)

This convert radeon to use new TTM validation API, it doesn't
really take advantage of it beside in the eviction case.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: Rework validation & memory space allocation (V3)
Jerome Glisse [Tue, 8 Dec 2009 14:33:32 +0000 (15:33 +0100)]
drm/ttm: Rework validation & memory space allocation (V3)

This change allow driver to pass sorted memory placement,
from most prefered placement to least prefered placement.
In order to avoid long function prototype a structure is
used to gather memory placement informations such as range
restriction (if you need a buffer to be in given range).
Range restriction is determined by fpfn & lpfn which are
the first page and last page number btw which allocation
can happen. If those fields are set to 0 ttm will assume
buffer can be put anywhere in the address space (thus it
avoids putting a burden on the driver to always properly
set those fields).

This patch also factor few functions like evicting first
entry of lru list or getting a memory space. This avoid
code duplication.

V2: Change API to use placement flags and array instead
    of packing placement order into a quadword.
V3: Make sure we set the appropriate mem.placement flag
    when validating or allocation memory space.

[Pending Thomas Hellstrom further review but okay
from preliminary review so far].

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: Add search/get functions to get a block in a specific range
Jerome Glisse [Mon, 7 Dec 2009 14:52:56 +0000 (15:52 +0100)]
drm: Add search/get functions to get a block in a specific range

These are required for changes to TTM.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix avivo tiling regression since radeon object rework
Dave Airlie [Tue, 8 Dec 2009 05:45:13 +0000 (15:45 +1000)]
drm/radeon/kms: fix avivo tiling regression since radeon object rework

The object rework moved the tiling flag setup around wrongly,
so tiling we getting setup then overwritten by fb format.

Fixes regression with drm-radeon-next on rv530 laptop tiling test.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/i915: Remove a debugging printk from hangcheck
Chris Wilson [Tue, 8 Dec 2009 22:12:06 +0000 (22:12 +0000)]
drm/i915: Remove a debugging printk from hangcheck

A residual bare printk survived the merger of the hang detector, remove
this debugging left-over.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/radeon/kms: make sure i2c id matches
Alex Deucher [Tue, 8 Dec 2009 19:30:49 +0000 (14:30 -0500)]
drm/radeon/kms: make sure i2c id matches

Entries in the i2c table aren't always ordered
by id.  This allows us to remove some quirks
that are no longer needed.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: make sure ss id matches
Alex Deucher [Tue, 8 Dec 2009 19:07:03 +0000 (14:07 -0500)]
drm/radeon/kms: make sure ss id matches

entries in the ss table aren't always ordered
by id.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: connector fixes
Alex Deucher [Tue, 8 Dec 2009 17:48:20 +0000 (12:48 -0500)]
drm/radeon/kms: connector fixes

- Don't add dac load detection property to DVI-D
- Make sure i2c info is valid before adding DP aux chan bus
- Don't create scaling_mode_property twice
- fix typo that prevented coherent and load detection from working
- add coherent prop to DP (for dp->dvi adapters)

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/ttm: fix memory leak noticed by kmemleak.
Dave Airlie [Tue, 8 Dec 2009 05:58:08 +0000 (15:58 +1000)]
drm/ttm: fix memory leak noticed by kmemleak.

If we don't need the zone we need to free it.

Acked-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm: disable all the possible outputs/crtcs before entering KMS mode
Zhao Yakui [Wed, 9 Dec 2009 03:23:42 +0000 (11:23 +0800)]
drm: disable all the possible outputs/crtcs before entering KMS mode

Sometimes we will use a crtc for integerated LVDS, which is different with
that assigned by BIOS. If we want to get flicker-free transitions,
then we could read out the current state for it and set our current state
accordingly.

But it is true that if we aren't reading current state out, we do need
to turn everything off before modesetting.  Otherwise the clocks can get very
angry and we get things worse than a flicker at boot.
In fact we also do the similar thing in UMS mode. We will disable all the
possible outputs/crtcs for the first modesetting.

So we disable all the possible outputs/crtcs before entering the KMS mode.
Before we configure connector/encoder/crtc, the function of
drm_helper_disable_unused_function can disable all the possible outputs/crtcs.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rafal Milecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/i915: restore render clock gating on resume
Andrew Lutomirski [Sun, 8 Nov 2009 18:49:51 +0000 (13:49 -0500)]
drm/i915: restore render clock gating on resume

Rather than restoring just a few clock gating registers on resume,
just reinitialize the whole thing.

Signed-off-by: Andy Lutomirski <luto@mit.edu>
[anholt: Fixed up for RC6 support landed since the patch was written]
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agoMerge remote branch 'korg/drm-radeon-dp' into drm-linus
Dave Airlie [Tue, 8 Dec 2009 04:29:15 +0000 (14:29 +1000)]
Merge remote branch 'korg/drm-radeon-dp' into drm-linus

This merges the radeon KMS DisplayPort and hotplug detect support.

Tested on RV635 DP card with a Dell 2408 monitor.

Conflicts:
drivers/gpu/drm/drm_fb_helper.c

14 years agoMerge remote branch 'korg/drm-radeon-next' into drm-linus
Dave Airlie [Tue, 8 Dec 2009 04:06:07 +0000 (14:06 +1000)]
Merge remote branch 'korg/drm-radeon-next' into drm-linus

This merges all the radeon changes that weren't reliant on core-next.

14 years agoMerge remote branch 'anholt/drm-intel-next' into drm-linus
Dave Airlie [Tue, 8 Dec 2009 04:03:47 +0000 (14:03 +1000)]
Merge remote branch 'anholt/drm-intel-next' into drm-linus

This merges the upstream Intel tree and fixes up numerous conflicts
due to patches merged into Linus tree later in -rc cycle.

Conflicts:
drivers/char/agp/intel-agp.c
drivers/gpu/drm/drm_dp_i2c_helper.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_suspend.c

14 years agoMerge branch 'drm-core-next' into drm-linus
Dave Airlie [Tue, 8 Dec 2009 03:52:41 +0000 (13:52 +1000)]
Merge branch 'drm-core-next' into drm-linus

Bring all core drm changes into 2.6.32 tree and resolve
the conflict that occurs.

Conflicts:
drivers/gpu/drm/drm_fb_helper.c

14 years agodrm/kms: fix fb cmap allocation to use modeset->crtc not crtc
Ben Skeggs [Tue, 8 Dec 2009 01:15:10 +0000 (11:15 +1000)]
drm/kms: fix fb cmap allocation to use modeset->crtc not crtc

crtc may be undefined at this point.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: enable hpd support
Alex Deucher [Fri, 4 Dec 2009 21:56:37 +0000 (16:56 -0500)]
drm/radeon/kms: enable hpd support

This enabled interrupt driven hpd support for all
radeon chips.  Assuming the hpd pin is wired up
correctly, the driver will generate uevents on
digital monitor connect and disconnect and retrain
DP monitors automatically.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add asic callbacks for hpd
Alex Deucher [Fri, 4 Dec 2009 20:26:55 +0000 (15:26 -0500)]
drm/radeon/kms: add asic callbacks for hpd

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add hpd support for r6xx/r7xx/rs780/rs880 asics
Alex Deucher [Fri, 4 Dec 2009 20:12:21 +0000 (15:12 -0500)]
drm/radeon/kms: add hpd support for r6xx/r7xx/rs780/rs880 asics

This just adds the functionality, it's not hooked up
yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add hpd support for r5xx/rs600/rs690/rs740 asics
Alex Deucher [Fri, 4 Dec 2009 20:04:19 +0000 (15:04 -0500)]
drm/radeon/kms: add hpd support for r5xx/rs600/rs690/rs740 asics

This just adds the functionality, it's not hooked up
yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add hpd support for r1xx-r4xx asics
Alex Deucher [Fri, 4 Dec 2009 19:53:41 +0000 (14:53 -0500)]
drm/radeon/kms: add hpd support for r1xx-r4xx asics

This just adds the functionality, it's not hooked up
yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add regs and irq tracking bits for hpd
Alex Deucher [Thu, 3 Dec 2009 18:08:53 +0000 (13:08 -0500)]
drm/radeon/kms: add regs and irq tracking bits for hpd

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: get HPD info for connectors
Alex Deucher [Fri, 4 Dec 2009 19:45:27 +0000 (14:45 -0500)]
drm/radeon/kms: get HPD info for connectors

This populates the connectors with HPD (Hot Plug Detect)
information.  This will be used in subsequent patches
for automatic digital monitor connect/disconnect handling.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: clean up DP debugging
Alex Deucher [Fri, 27 Nov 2009 18:14:37 +0000 (13:14 -0500)]
drm/radeon/kms: clean up DP debugging

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: fix DP detect
Alex Deucher [Fri, 27 Nov 2009 18:01:46 +0000 (13:01 -0500)]
drm/radeon/kms: fix DP detect

only return connected if there is actually a
monitor connected.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: drop unused array to fix warning.
Dave Airlie [Wed, 25 Nov 2009 22:57:23 +0000 (08:57 +1000)]
drm/radeon/kms: drop unused array to fix warning.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: do dp link training at dpms on time not mode set.
Dave Airlie [Wed, 25 Nov 2009 22:56:35 +0000 (08:56 +1000)]
drm/radeon/kms: do dp link training at dpms on time not mode set.

This moves the radeon DP link training call to happen when we
dpms on the encoder not when we set the mode.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: make displayport work by reorganising vsemph setup.
Dave Airlie [Wed, 25 Nov 2009 22:55:18 +0000 (08:55 +1000)]
drm/radeon/kms: make displayport work by reorganising vsemph setup.

This fix reorganises the initial DP link training slightly, and
actually makes DP work under kms here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms/dp: fix return in dpcd retrival.
Dave Airlie [Wed, 25 Nov 2009 22:49:17 +0000 (08:49 +1000)]
drm/radeon/kms/dp: fix return in dpcd retrival.

Not returning here caused us to get a display port version of 0 for everything
this caused power up to not get sent which ends up in a black screen.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: free aux channel i2c adapter on destroy
Alex Deucher [Tue, 24 Nov 2009 21:13:23 +0000 (16:13 -0500)]
drm/radeon/kms: free aux channel i2c adapter on destroy

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: add support for DP modesetting
Alex Deucher [Tue, 24 Nov 2009 18:32:59 +0000 (13:32 -0500)]
drm/radeon/kms: add support for DP modesetting

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: handle dp sinks in atom encoder/transmitter tables
Alex Deucher [Mon, 23 Nov 2009 23:40:40 +0000 (18:40 -0500)]
drm/radeon/kms: handle dp sinks in atom encoder/transmitter tables

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: store sink type in atom dig connector
Alex Deucher [Mon, 23 Nov 2009 23:02:35 +0000 (18:02 -0500)]
drm/radeon/kms: store sink type in atom dig connector

This will be used laster when the encoder and transmitters
are set up.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: i2c reorg
Alex Deucher [Mon, 23 Nov 2009 22:39:28 +0000 (17:39 -0500)]
drm/radeon/kms: i2c reorg

- keep the atom i2c id in the i2c rec
- fix gpio regs for GPIO and MDGPIO on pre-avivo chips
- track whether the i2c line is hw capable
- track whether the i2c line uses the multimedia i2c block

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: DP fixes and cleanup from the ddx
Alex Deucher [Sat, 21 Nov 2009 00:40:13 +0000 (19:40 -0500)]
drm/radeon/kms: DP fixes and cleanup from the ddx

- dpcp -> dpcd
- fix up dig encoder routing
- aux transaction table takes delay in 10 usec units

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/radeon/kms: initial radeon displayport porting
Dave Airlie [Mon, 7 Dec 2009 21:07:28 +0000 (07:07 +1000)]
drm/radeon/kms: initial radeon displayport porting

This is enough to retrieve EDID and DPCP.

Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agodrm/i915: Set the error code after failing to insert new offset into mm ht.
Chris Wilson [Wed, 2 Dec 2009 15:15:30 +0000 (15:15 +0000)]
drm/i915: Set the error code after failing to insert new offset into mm ht.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
14 years agodrm/i915: Report purgeable status in buffer lists.
Chris Wilson [Wed, 2 Dec 2009 16:48:57 +0000 (16:48 +0000)]
drm/i915: Report purgeable status in buffer lists.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>