Commit graph

169537 commits

Author SHA1 Message Date
Francisco Jerez 0ed3165e55 drm/nouveau: Fallback to analog load detection when the EDID block is invalid.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-15 09:28:59 +10:00
Xavier Chantry c8ebe27579 drm/nouveau: fix edid memleak in nouveau_connector
This was spotted by kmemleak.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-15 09:28:48 +10:00
Francisco Jerez 3d9aefb8bd drm/nouveau: Break some long lines.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-15 09:28:10 +10:00
Andrea Tacconi b79d8a65d5 drm/nouveau: add NV18 device id to call_lvds_manufacturer_script
This fixes imac black screen (NV18 card)

Signed-off-by: Andrea Tacconi <tacconet@libero.it>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-15 09:28:02 +10:00
Marcin Kościelnicki 716abaa8e5 drm/nv50: Fix typo in PGRAPH initialisation.
This enables streamout functionality.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:49:05 +10:00
Ben Skeggs b0d2de860b drm/nouveau: less magic DCB 1.5 parsing
This in the very least matches the parsing of all the previously known
entries, and hopefully (at least closer to) correct for any we haven't
seen yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:48:59 +10:00
Ben Skeggs ed42f8240c drm/nouveau: assume no nv04 board has a DCB table
There's a report of a TNT2 where the DCB table pointer is *not* NULL
(it contains a part of a VBIOS data string), and we assume this means
a DCB table is present, causing all kinds of hilarity.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:48:52 +10:00
Ben Skeggs 77cb5c75e8 drm/nouveau: remove PRIV0 check in nouveau_mem_close()
We don't setup PRIV0 anymore, so this is unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:48:46 +10:00
Ben Skeggs e147eae80a drm/nouveau: wait on fence after bo move if validating for another channel
Not an ideal solution, but it'll do for the moment for correctness.  We
need to come up with a nicer way to manage inter-channel sync, the hw
is unfortunately a little lacking in this area.

Should fix some resume corruption, as well as corruption that may be seen
while under memory pressure.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:48:38 +10:00
Ben Skeggs 9855e584d2 drm/nouveau: trust init table registers are safe
Apparently the original reason for checking this was there were known
register accesses that caused hangs on some chipsets.  This was more
than likely because of incorrect parsing of previous opcodes, and I
hardly think aborting a script half way through is going to be any
better (in fact, we have had bug reports where this has been the cause
of s/r failures among other things).

This patch (which has been in Fedora 12 for a long time now) removes
all checking for known register ranges, and just leaves the check to
ensure the access is within the mapped aperture to avoid an oops.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:48:31 +10:00
Maarten Maathuis 0a90dc51aa drm/nv50: wait for pgraph to idle before unloading the context
This should fix the problem with gpu hangs people have had when closing
channels.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-14 18:48:21 +10:00
Thomas Hellstrom 354fb52cb6 drm/ttm: Make sure system buffer objects has offset == 0.
This is a convention that the vmwgfx driver has come to rely on.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:20:04 +10:00
Thomas Hellstrom d9f36a0051 drm/vmwgfx: Implement basic pm operations.
Currently we really only support S3, since the device doesn't support
saving of the 3D state.

On S3/S4, move all buffer objects to swappable memory and take down
GMR bindings. We need to do that from a PM notifier since we can't
do persistant memory allocations from the standard PM callbacks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:19:57 +10:00
Thomas Hellstrom e99e1e7893 drm/ttm: Export symbols needed for vmwgfx suspend / resume operations.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:19:50 +10:00
Thomas Hellstrom 476d51dbdb drm/vmwgfx: Implement a swap_notify callback.
Unbind GMR bindings on the buffer about to be swapped out.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:19:01 +10:00
Thomas Hellstrom 3f09ea4ecd drm/ttm: Add a swap_notify callback.
This is needed for a bugfix in the vmwgfx driver.
Drivers may have GPU bindings on buffers that core TTM is not aware of,
and TTM may view those buffers as ordinary system memory buffers.
Add a notifier to such drivers when TTM is about to move the buffer
contents out to swappable memory. The driver must then release any
private GPU bindings on those buffers.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:18:54 +10:00
Thomas Hellstrom effe1105be drm/vmwgfx: Use bo_driver::move_notify to unbind GMRs.
This was previously done explicitly for overlay- and fb buffers.
Now it's done for any buffer leaving the SYSTEM memory region.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:18:43 +10:00
Thomas Hellstrom 7704befbd5 drm/vmwgfx: Make fence sequences continous across a VT switch.
A vt switch in stealth mode would take down the FIFO, and re-
initialize fence sequence numbers. This patch
saves the current state of the fence sequence when the FIFO is
disabled.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:18:02 +10:00
Thomas Hellstrom 50ec3b7c35 drm/vmwgfx: Fix an error path causing an oops.
An error happening before the snooper.image member had been set up
would cause a kfree of an arbitrary pointer. Set up the snooper.image
member early.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:17:56 +10:00
Thomas Hellstrom df1c93bae2 drm/vmwgfx: Don't promote updates from GMR-backed scanouts to fullscreen.
That's unnecessary since partial screen updates from GMRs are fast.
Also fix cliprect pointer dereferencing

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 12:17:44 +10:00
Jerome Glisse 700a0cc088 drm/radeon/kms: Use radeon_agp_disable when disabling AGP
Use same common function to disable agp so we replace the GART
callback by the proper one when we do so. This fix oops if
radeon_agp_init report failure.

This patch also move radeon_agp_init out of *_mc_init for r600
& rv770 so that we can have a similar behavior than for previous
hw, ie if agp_init fails it will fallback to GPU GART and disable
AGP.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 11:53:55 +10:00
Jerome Glisse 0a3f316370 drm/radeon/kms: Disable AGP is aperture size < 32M
radeon KMS need a GART of at least 32M to properly work. This patch
check the AGP aperture size and disable if it's less than 32M. Note
than unlike non KMS path we don't staticaly allocate AGP memory so
we are not wasting memory not used by graphic processing.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 11:53:45 +10:00
Jerome Glisse 30d2d9a54d drm/radeon/kms: Fix r600 blit cleanup path
r600 blit cleanup path need to check if a bo was allocated before
trying to free or unpin it. This patch add this check and avoid
oops when the initialization on r6xx or r7xx hw fails.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 11:53:36 +10:00
Jerome Glisse 6398d42454 drm/radeon/kms: Do not unpin buffer in fb destruction
It's not necessary to unpin buffer in fb destruction. pin/unpin
need to be balanced and we don't pin in fb creation. We pin when
an fb is associated to a crtc and unpin when the fb is disassociated
from the crtc.

Note:
Maybe we should take reference on fb in set_base callback so fb
doesn't disappear until it's unbind from ctrc.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 11:53:21 +10:00
Dave Airlie 7a15cbd401 drm/radeon/kms: fix displayport->dvi connector DDC.
It appears that attempting AUXCH DDC breaks the subsequent attempt
to do DDC over the i2c lines, so use the sink type to determine
if we should be doing AUXCH or i2c DDC.

This fixes my DVI monitor plugged into DP->DVI convertor.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-14 11:51:56 +10:00
Dave Airlie 194fda0dd8 Merge remote branch 'korg/drm-radeon-next' into drm-linus
* korg/drm-radeon-next
  drm/radeon/kms: only evict to GTT if CP is ready
  drm/radeon/kms: Fix crash getting TV info with no BIOS.
  drm/radeon/kms/rv100: reject modes > 135 Mhz on DVI (v2)
  drm/radeon/kms/r6xx+: make irq handler less verbose
  drm/radeon/kms: fix up LVDS handling on macs (v2)
2010-01-13 16:17:41 +10:00
Dave Young ef14587706 drm: change drm set mode messages as DRM_DEBUG
Following drm info repeat 207 times during one hour, it's quite annoying
[ 1266.286747] [drm] TV-19: set mode NTSC 480i 0

Change from DRM_INFO to DRM_DEBUG

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 16:16:05 +10:00
Dave Airlie 70a94d6a35 drm: fix crtc no modes printf + typo
Toralf Förster pointed out the typo, the fact I forget the if
statement is purely personal fail.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 16:15:11 +10:00
Dave Airlie 9270eb1b49 drm/radeon/kms: only evict to GTT if CP is ready
Testing GTT ready might be more correct but cp.ready
works fine and has been tested on irc by 2-3 ppl.

fixes bug k.org 15035 and fd.o 25733

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 13:25:14 +10:00
Michel Dänzer 11f3b59e36 drm/radeon/kms: Fix crash getting TV info with no BIOS.
Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 13:25:10 +10:00
Alex Deucher 1b24203e51 drm/radeon/kms/rv100: reject modes > 135 Mhz on DVI (v2)
Due to heat issues.  Fixes fdo bug 25992

v2: fix typo noticed by Maarten Maathuis

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 13:25:10 +10:00
Alex Deucher b042589ca0 drm/radeon/kms/r6xx+: make irq handler less verbose
Unhandled vectors can be safely ignored, no need
to spam the kernel log by default.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 13:25:09 +10:00
Alex Deucher 3890ddf56d drm/radeon/kms: fix up LVDS handling on macs (v2)
Based on radeonfb code and recent ddx fix.

v2: minor formatting fix from Michel Dänzer

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Tested-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 13:25:08 +10:00
Dave Airlie f22d6ddaeb Merge branch 'for-airlied' of /ssd/git/drm-nouveau-next into drm-linus
* 'for-airlied' of /ssd/git/drm-nouveau-next: (28 commits)
  drm/nv04: Fix set_operation software method.
  drm/nouveau: initialise DMA tracking parameters earlier
  drm/nouveau: use dma.max rather than pushbuf size for checking GET validity
  drm/nv04: differentiate between nv04/nv05
  drm/nouveau: Fix null deref in nouveau_fence_emit due to deleted fence
  drm/nv50: prevent a possible ctxprog hang
  drm/nouveau: have ttm's fault handler called directly
  drm/nv50: restore correct cache1 get/put address on fifoctx load
  drm/nouveau: create function for "dealing" with gpu lockup
  drm/nouveau: remove unused nouveau_channel_idle() function
  drm/nouveau: fix handling of fbcon colours in 8bpp
  drm/nv04: Context switching fixes.
  drm/nouveau: Use the software object for fencing.
  drm/nouveau: Allocate a per-channel instance of NV_SW.
  drm/nv50: make the blocksize depend on vram size
  drm/nouveau: better alignment of bo sizes and use roundup instead of ALIGN
  drm/nouveau: Don't skip card take down on nv0x.
  drm/nouveau: Implement nv42-nv43 TV load detection.
  drm/nouveau: Clean up the nv17-nv4x load detection code a bit.
  drm/nv50: fix fillrect color
  ...
2010-01-11 14:43:16 +10:00
Dave Airlie 0c9d2c418a Merge remote branch 'korg/drm-radeon-next' into drm-linus
* korg/drm-radeon-next:
  drm/radeon/kms: add additional safe regs for r4xx/rs6xx and r5xx
  drm/radeon/kms: Don't try to enable IRQ if we have no handler installed
  drm: Avoid calling vblank function is vblank wasn't initialized
  drm/radeon: mkregtable.c: close a file before exit
  drm/radeon/kms: Make sure we release AGP device if we acquired it
  drm/radeon/kms: Schedule host path read cache flush through the ring V2
  drm/radeon/kms: Workaround RV410/R420 CP errata (V3)
  drm/radeon/kms: detect sideport memory on IGP chips
  drm/radeon: fix a couple of array index errors
  drm/radeon/kms: add support for eDP (embedded DisplayPort)
  drm: Add eDP connector type
  drm/radeon/kms: pull in the latest upstream ObjectID.h changes
  drm/radeon/kms: whitespace changes to ObjectID.h
  drm/radeon/kms: fix typo in atom connector type handling
2010-01-11 14:42:58 +10:00
Marcin Kościelnicki 40c2298bdc drm/nv04: Fix set_operation software method.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:19 +10:00
Ben Skeggs c63834e1db drm/nouveau: initialise DMA tracking parameters earlier
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:18 +10:00
Ben Skeggs 400f14ac4e drm/nouveau: use dma.max rather than pushbuf size for checking GET validity
Some upcoming G80 DMA changes will depend on this, but it's split out for
bisectibility just in case it causes some unexpected issues.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:18 +10:00
Ben Skeggs cc6e496587 drm/nv04: differentiate between nv04/nv05
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:17 +10:00
Luca Barbieri d6126c5c8b drm/nouveau: Fix null deref in nouveau_fence_emit due to deleted fence
Currently Nouveau will unvalidate all buffers if it is forced to wait on
one, and then start revalidating from the beginning.  While doing so, it
destroys the operation fence, causing nouveau_fence_emit to crash.

This patch fixes this bug by taking the fence object out of validate_op
and creating it just before emit.  The fence pointer is initialized to 0
and unref'ed unconditionally.

In addition to fixing the bug, this prevents its reintroduction and
simplifies the code.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:17 +10:00
Ben Skeggs dc8d76cac9 drm/nv50: prevent a possible ctxprog hang
The below is mainly an educated guess at what's going on, docs would
sure be handy...  NVIDIA? :P

It appears it's possible for a ctxprog to run even while a GPU exception
is pending.  The GF8 and up ctxprogs appear to have a small snippet of
code which detects this, and stalls the ctxprog until it's been handled,
which essentially looks like:

	if (r2 & 0x00008000) {
		r0 |= 0x80000000;
		while (r0 & 0x80000000) {}
	}

I don't know of any way that flag would get cleared unless the driver
intervenes (and indeed, in the cases I've seen the hang, nothing steps
in to automagically clear it for us).  This patch causes the driver to
clear the flag during the PGRAPH IRQ handler.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:16 +10:00
Ben Skeggs 1959ca80e1 drm/nouveau: have ttm's fault handler called directly
There's no good reason for us to have our own anymore, this is left over
from an early port to these TTM interfaces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:15 +10:00
Ben Skeggs a908b96c22 drm/nv50: restore correct cache1 get/put address on fifoctx load
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:15 +10:00
Marcin Slusarz c03ec7f91f drm/nouveau: create function for "dealing" with gpu lockup
It's mostly a cleanup, but in nv50_fbcon_accel_init gpu lockup
message was printed, but HWACCEL_DISBALED flag was not set.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:14 +10:00
Ben Skeggs e9dd8e11ed drm/nouveau: remove unused nouveau_channel_idle() function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:13 +10:00
Ben Skeggs 7de3643f93 drm/nouveau: fix handling of fbcon colours in 8bpp
Depending on the visual, the colours handed to us in fillrect() can either be
an actual colour, or an index into the pseudo-palette.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:13 +10:00
Francisco Jerez ea911a1cf4 drm/nv04: Context switching fixes.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:12 +10:00
Francisco Jerez a5027ccd3c drm/nouveau: Use the software object for fencing.
This should avoid a race condition on nv0x, if we're doing it with
actual PGRAPH objects and a there's a fence within the FIFO DMA fetch
area when a context switch kicks in.

In that case we get an ILLEGAL_MTHD interrupt as expected, but the
values in PGRAPH_TRAPPED_ADDR aren't calculated correctly and they're
almost useless (e.g. you can see ILLEGAL_MTHDs for the now inactive
channel, with a wrong offset/data pair).

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:12 +10:00
Francisco Jerez ca4362adb4 drm/nouveau: Allocate a per-channel instance of NV_SW.
It will be useful for various synchronization purposes, mostly stolen
from "[PATCH] drm/nv50: synchronize user channel after buffer object
move on kernel channel" by Maarten Maathuis.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:11 +10:00
Maarten Maathuis 0a2d090f99 drm/nv50: make the blocksize depend on vram size
- This should be better than what we have now.
- I'm less sure about the non power of two path.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
2010-01-11 14:41:10 +10:00