Commit Graph

3359 Commits (e14feafbe0d5c6d64bb6fe4eba928cb57ac9a4c8)

Author SHA1 Message Date
Chris Wilson a8ed0b16a9 drm/i915: Tidy dvo_ch7017 and print out which chip we detect
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-28 23:33:17 +01:00
Chris Wilson b8232e9063 drm/i915: Disable LVDS i2c probing when using GPIO bit banging
This check only appears to succeed when using GMBUS, so we need to skip
it if we have fallen back to using GPIO bit banging.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-28 16:47:00 +01:00
Chris Wilson e0e41598b4 Merge branch 'drm-intel-fixes' into drm-intel-next 2010-09-28 15:48:38 +01:00
Chris Wilson cb8ea7527b drm/i915: Use i2c bit banging instead of GMBUS
There are several reported instances of GMBUS failing to successfully
read the EDID, so revert back to bit banging until the issue is
resolved.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30371
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-28 13:35:47 +01:00
Chris Wilson e957d7720a drm/i915/sdvo: Fix GMBUSification
Besides a couple of bugs when writing more than a single byte along the
GMBUS, SDVO was completely failing whilst trying to use GMBUS, so use
bit banging instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-28 13:29:10 +01:00
Chris Wilson a56ba56c27 Revert "drm/i915: Drop ring->lazy_request"
With multiple rings generating requests independently, the outstanding
requests must also be track independently.

Reported-by: Wang Jinjin <jinjin.wang@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30380
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-28 11:30:52 +01:00
Alex Deucher f36fce0f49 drm/radeon/kms: add quirk for MSI K9A2GM motherboard
Board has no digital connectors

Reported-by: Andy Walls <awalls@md.metrocast.net>
Tested-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-28 09:16:13 +10:00
Alex Deucher e488459a0e drm/radeon/kms: fix potential segfault in r600_ioctl_wait_idle
radeon_gem_wait_idle_ioctl can apparently get called prior to
the vram page being set up or even if accel if false, so make
sure it's valid before using it.

Should fix:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597636
https://bugs.freedesktop.org/show_bug.cgi?id=29834

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-28 09:16:05 +10:00
Chris Wilson 31dfbc9392 drm: Prune GEM vma entries
Hook the GEM vm open/close ops into the generic drm vm open/close so
that the private vma entries are created and destroy appropriately.
Fixes the leak of the drm_vma_entries during the lifetime of the filp.

Reported-by: Matt Mackall <mpm@selenic.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-28 09:14:34 +10:00
Linus Torvalds 381ba329e5 Merge branch 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel
* 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel:
  drm/i915/sdvo: Handle unsupported GET_SUPPORTED_ENHANCEMENTS gracefully
  drm/i915/sdvo: Cleanup connector on error path
  drm/i915: Fix 945GM regression in e259befd
2010-09-27 12:28:19 -07:00
Jesse Barnes d270ae34eb drm/i915: fix GMCH power reporting
The IPS driver needs to know the current power consumption of the GMCH
in order to make decisions about when to increase or decrease the CPU
and/or GPU power envelope.  So fix up the divisions to save the results
so the numbers are actually correct (contrary to some earlier comments
and code, these functions do not modify the first argument and use it
for the result).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
2010-09-27 18:43:45 +01:00
Alex Deucher 73758a5d51 drm/radeon/kms: fix up encoder info messages for DFP6
encoder info was not printed properly on boards using the
DFP6 id.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-27 09:22:23 +10:00
Chris Wilson ced270fa89 drm/i915: Ensure that the mode change flushing is currently uninterruptible
Introduced by 48b956c5, I had thought I had already fixed this. Oh well.

Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-26 22:50:36 +01:00
Chris Wilson 53b2087d21 drm/i915: fix debugging compilation error from previous commit
There is no equivalent to mutex_destroy() for spinlocks so just delete
the code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-26 22:21:10 +01:00
Chris Wilson 1c25595f8d drm/i915: Convert the file mutex into a spinlock
Daniel Vetter pointed out that in this case is would be clearer and
cleaner to use a spinlock instead of a mutex to protect the per-file
request list manipulation. Make it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-26 11:03:27 +01:00
Daniel Vetter 45ff46c54a drm: readd drm_lock_free in drm_unlock
I've accidently killed a little bit too much in

commit 1da3f87ebb
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Aug 23 22:53:24 2010 +0200

    drm: kill kernel_context_switch callbacks

Note to self: Next time also test with AIGLX disabled.

Reported-and-Tested-by: Andy Furniss <lists@andyfurniss.entadsl.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30374
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-26 13:35:49 +10:00
Daniel Vetter 447da18742 drm/i915: kill ring->setup_status_page
It's the same code, essentially, so kill all copies safe one unified
version.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:16 +01:00
Daniel Vetter 79f321b7e6 drm/i915: kill ring->get_active_head
All functions are extremely similar, so fold them into one generic
implementation.

This function isn't used anyway, because there's not yet a bsd ring
error state dumper.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:15 +01:00
Daniel Vetter 3d281d8cca drm/i915: kill per-ring macros
Two macros that use a base address for HWS_PGA were missing, add them.
Also switch the remaining users of *_ACTHD to the ring-base one.
Kill the other ring-specific macros because they're now unused.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ickle: And silence checkpatch whilst in the vicinity]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:15 +01:00
Daniel Vetter bf7e0e1268 drm/i915: fix ACTHD for gen <= 3
This was mixed up in the following patch:

commit a6c45cf013
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Sep 17 00:32:17 2010 +0100

    drm/i915: INTEL_INFO->gen supercedes i8xx, i9xx, i965g

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:14 +01:00
Daniel Vetter 95375b7f9d drm/i915: kill now unnecessary gtt defines from i915_reg.h
Everything is now handled in intel-gtt.h so these defines
are only confusing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:13 +01:00
Chris Wilson 76c1dec197 drm/i915: Make the mutex_lock interruptible on ioctl paths
... and combine it with the wedged completion handler.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:12 +01:00
Chris Wilson 30dbf0c07f drm/i915: Adjust hangcheck EIO semantics
Owain Ainsworth reported an issue between the interaction of the
hangcheck and userspace immediately (and permanently) falling back to
s/w rasterisation. In order to break the mutex and begin resetting the
GPU, we must abort the current operation (usually within the wait) and
climb sufficiently far back up the call chain to drop the mutex. In his
implementation, Owain has a loop within the ioctl handler to detect the
hang and then sleep until the error handler has run. I've chosen to
return to userspace and report an EAGAIN which should trigger the
userspace ioctl handler to repeat the call (simply because it felt less
invasive...). Before hitting a wedged GPU, we then wait upon completion
of the error handler.

Reported-by: Owain G. Ainsworth <zerooa@googlemail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-25 12:23:12 +01:00
Chris Wilson f787a5f59e drm/i915: Only hold a process-local lock whilst throttling.
Avoid cause latencies in other clients by not taking the global struct
mutex and moving the per-client request manipulation a local per-client
mutex. For example, this allows a compositor to schedule a page-flip
(through X) whilst an OpenGL application is monopolising the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 21:03:00 +01:00
Hette Visser 27d64339a8 drm/i915/dp: Wait for PP_CONTROL to take effect.
This patch fixes the black screen bug on Dell e6510, by
adding two delays to give the eDP panel time to turn on before we
continue with the next write.

300ms is rather arbitray and a rather long sleep, we need to find a way
of refining this value.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29278
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-09-24 14:22:13 +01:00
Chris Wilson 5ceb0f9bb7 drm/i915: Parse the eDP link configuration from the vBIOS
First step, lets have a look at the values for troublesome panels and
see if they may be used to improve our link training.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:22:11 +01:00
Chris Wilson 270eea0fd7 drm/i915/lvds: Use the GMBUS pin if specified in VBT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:22:11 +01:00
Chris Wilson e6c3a2a6d3 drm/i915: Use an uninterruptible wait for page-flips during modeset
We need to drain the pending flips prior to disabling the pipe during
modeset, and these need to be done in an uninterruptible fashion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:19:57 +01:00
Chris Wilson d3849eded2 drm/i915: Remove unused dev_priv->panel_wants_dither
This is now private to the DVO connector, remove it from the main device
private.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:19:56 +01:00
Chris Wilson 780f0ca3e0 drm/i915/ringbuffer: Fix sign of ring space.
As we presume space is signed when computing and looking for wrap along,
make it so.

Reported-by: Owain G. Ainsworth <zerooa@googlemail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:19:55 +01:00
Chris Wilson 3eee1794ac drm/i915: Remove idle timer debugging messages
These have served their purpose and are now just noise in the debug
stream.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:19:54 +01:00
Chris Wilson 428d2e828c drm/i915/lvds: Probe DDC on creation
Try to validate the panel's connection by writing to address 0xA0.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=18072
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-24 14:19:44 +01:00
Ben Skeggs 5b32165b04 drm/nv50: use pll type rather than register for CRTC PLL
Just in case someone, somewhere, does something difficult.  This also
removes one path that was different between fermi and non-fermi.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:55 +10:00
Ben Skeggs 56edd964e8 drm/nouveau: v3.0 pll limits tables have type<->register mapping too
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:48 +10:00
Francisco Jerez 5c4abd09bd drm/nouveau: Misc cleanup of the PM code.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:41 +10:00
Francisco Jerez 66146da066 drm/nouveau: Add support for I2C hardware monitoring devices.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:36 +10:00
Francisco Jerez 8155cac489 drm/nouveau: Refactor nouveau_temp_get() into engine pointers.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:29 +10:00
Francisco Jerez e829d804d7 drm/nouveau: Double the perf table memory clocks on pre-G71 cards.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:25 +10:00
Francisco Jerez 67e1d4fbae drm/nouveau: Fix parsing of the temperature constant correction.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:19 +10:00
Francisco Jerez d34ec507d4 drm/nouveau: Add sane sensor correction defaults for nv4a.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:14 +10:00
Francesco Marella 4164743c82 drm/nv40: fix reading temp value
Signed-off-by: Francesco Marella <fmarl@paranoici.org>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:06 +10:00
Francisco Jerez 5e6a74436e drm/nouveau: Don't try to parse a GPIO table on early DCBv2.2 BIOSes.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:29:02 +10:00
Francisco Jerez bb338bb6f2 drm/nv10: Don't oops if the card wants to switch to a channel with no grctx.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:56 +10:00
Ben Skeggs 80dad869a3 drm/nouveau: fix panels using straps-based mode detection
nouveau_bios_fp_mode() zeroes the mode struct before filling in relevant
entries.  This nukes the mode id initialised by drm_mode_create(), and
causes warnings from idr when we try to remove the mode.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:50 +10:00
Ben Skeggs 9bb5863ab4 drm/nouveau: fix chipset vs card_type thinko
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:43 +10:00
Ben Skeggs 5220b3c14b drm/nv50: assume smaller tiles for bo moves
Somehow fixes some corruption seen in KDE..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:39 +10:00
Ben Skeggs 5f7d42ece3 drm/nouveau: add debugfs file to forcibly evict everything from vram
Very useful for debugging buffer migration issues.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:33 +10:00
Martin Peres 34e9d85a1a drm/nouveau: Add temperature support (vbios parsing, readings, hwmon)
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:28 +10:00
Ben Skeggs 64d202b4d7 drm/nouveau: correct INIT_DP_CONDITION subcondition 5
Fixes DP output on a GTX 465 board I have.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:16 +10:00
Francisco Jerez 0fbb114af7 drm/nouveau: Parse old style perf tables.
Used on nv17-nv28, they contain memory clocks and timings, only one of
the table entries can actually be used, depending on the RAMCFG
straps, and it's usually higher than the frequency programmed on boot
by the BIOS.

The memory timings listed in table version 0x1x are used to init the
0x12xx range but they aren't required for reclocking to work.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:12 +10:00
Ben Skeggs 038b8b2a0d drm/nv50: flush bar1 vm / dma object setup before poking 0x1708
Should fix issues noticed on NVAC (MacBook Pro / ION) since gpuobj
rework.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:28:06 +10:00
Ben Skeggs dc7339df11 drm/nouveau: fix thinko in volt 0x1x parsing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:58 +10:00
Ben Skeggs e49f70f775 drm/nouveau: implement parsing of DCB 2.2 GPIO table
Found on NV3x boards, this should allow voltage modifications to work
on these chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:54 +10:00
Ben Skeggs 07b1266962 drm/nouveau: fix potential accuracy loss when parsing perf 0x1c tables
Reported-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:48 +10:00
Phil Turmel e022878571 drm/nouveau: Fix build regression, undefined reference to `acpi_video_get_edid'
Build breakage:

drivers/built-in.o: In function `nouveau_acpi_edid':
(.text+0x13404e): undefined reference to `acpi_video_get_edid'
make: *** [.tmp_vmlinux1] Error 1

Introduced by:

a6ed76d7ff is the first bad commit
commit a6ed76d7ff
Author: Ben Skeggs <bskeggs@redhat.com>
Date:   Mon Jul 12 15:33:07 2010 +1000

    drm/nouveau: support fetching LVDS EDID from ACPI

    Based on a patch from Matthew Garrett.

    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
    Acked-by: Matthew Garrett <mjg@redhat.com>

It doesn't seem to revert cleanly, but the problem lies in these
two config entries:

CONFIG_ACPI=y
CONFIG_ACPI_VIDEO=m

Adding a select for ACPI_VIDEO appears to be the best solution, and
is comparable to what is done in DRM_I915.  Builds, boots, and appears to
work correctly.

Signed-off-by: Philip J. Turmel <philip@turmel.org>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:40 +10:00
Ben Skeggs 64f1c11a47 drm/nouveau: restore perflvl on resume, and restore boot perflvl on unload
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:35 +10:00
Ben Skeggs 6f876986be drm/nouveau: allow static performance level setting
Guarded by a module parameter for the moment, read the code for the
magic value which enables it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:20 +10:00
Ben Skeggs 442b626ece drm/nv04-nv40: import initial pm backend
Currently just hooked up to the already-existing nouveau_hw, which should
handle all relevant chipsets as well as we currently can.

This will likely be eventually split out and improved into chipset specific
code at a later point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:13 +10:00
Ben Skeggs 02c30ca0a1 drm/nv50: import initial clock get/set routines + hook up pm engine
This will make nouveau_pm attempt to report the card's current performance
level both during bootup, and through sysfs.

This is a very initial implementation, and can be improved a *lot*

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:06 +10:00
Ben Skeggs 330c5988ee drm/nouveau: import initial work on vbios performance table parsing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:27:00 +10:00
Ben Skeggs 4709bff02a drm/nouveau: make bios code easier to use externally
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:56 +10:00
Ben Skeggs 855a95e4fc drm/nouveau: make the behaviour of get_pll_limits() consistent
This replaces all the pll_types definitions for ones that match the types
used in the tables in recent VBIOS versions.

get_pll_limits() will now accept either type or register value as input
across all limits table versions, and will store the actual register ID
that a PLL type refers to in the returned structure.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:49 +10:00
Ben Skeggs f9aafdd30e drm/nv50: fix 100c90 write on nva3
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:41 +10:00
Ben Skeggs b6fd780791 drm/nouveau: zero dummy page
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:35 +10:00
Ben Skeggs 17b20348ea drm/nv50: mark PCIEGART pages non-present rather than using dummy page
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:31 +10:00
Ben Skeggs 24b102d348 drm/nouveau: we can't free ACPI EDID, so make a copy that we can
The rest of the connector code assumes we can kfree() the EDID pointer.
This causes things to blow up with the ACPI EDID pointer we get
passed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:24 +10:00
Ben Skeggs e071f8cd71 drm/nouveau: handle fifo pusher errors better
The most important part of this change is that we now instruct PFIFO to
drop all pending fetches, rather than attempting to skip a single dword
and hope that things would magically sort themselves out - they usually
don't, and we end up with PFIFO being completely hung.

This commit also adds somewhat more useful logging when these exceptions
occur.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:26:02 +10:00
Ben Skeggs e1429b4c3c drm/nouveau: better handling of unmappable vram
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:55 +10:00
Francisco Jerez c16c570762 drm/nouveau: Try to fetch an EDID from OF if DDC fails.
More Apple brain damage, it fixes the modesetting failure on an eMac
G4 (fdo bug 29810).

Reported-by: Zoltan Varnagy <doi@freemail.hu>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:48 +10:00
Francisco Jerez 9f56b1265d drm/nouveau: Simplify tile region handling.
Instead of emptying the caches to avoid a race with the PFIFO puller,
go straight ahead and try to recover from it when it happens. Also,
kill pfifo->cache_flush and tile->lock, we don't need them anymore.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:44 +10:00
Francisco Jerez 4b5c152a79 drm/nouveau: Remove implicit argument from nv_wait().
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:36 +10:00
Francisco Jerez 35fd5b42f0 drm/nouveau: PRAMIN is available from the start on pre-nv50.
This makes sure that RAMHT is cleared correctly on start up.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:28 +10:00
Francisco Jerez de5899bdac drm/nouveau: Add module parameter to override the default AGP rate.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:16 +10:00
Francisco Jerez 71d0618661 drm/nouveau: Don't enable AGP FW on nv18.
FW seems to be broken on nv18, it causes random lockups and breaks
suspend/resume even with the blob.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:10 +10:00
Francisco Jerez 3bc14b4dca drm/nouveau: Don't remove ramht entries from the neighboring channels.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:25:03 +10:00
Francisco Jerez f243423759 drm/nouveau: Break some long lines in the TV-out code.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:24:59 +10:00
Ben Skeggs 8597a1ba37 drm/nv50: fix SOR count for early chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:24:52 +10:00
Ben Skeggs 1da265662d drm/nv50: report BAR access faults
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:24:46 +10:00
Ben Skeggs d96773e7b6 drm/nv50: move vm trap to nv50_fb.c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:24:38 +10:00
Marcin Kościelnicki e69b441882 drm/nv50: demagic grctx, and add NVAF support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:24:00 +10:00
Ben Skeggs 2941482ead drm/nouveau: protect ramht_find() from oopsing if on channel without ramht
This doesn't actually happen now, but there's a test case for an earlier
kernel where a GPU error is signalled on one of nv50's fake channels, and
the ramht lookup by the IRQ handler triggered an oops.

This adds a check for RAMHT's existance on a channel before looking up
an object handle.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:54 +10:00
Ben Skeggs 185abeccab drm/nouveau: remove nouveau_gpuobj_late_takedown
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:46 +10:00
Ben Skeggs e05d7eaeba drm/nouveau: protect gpuobj list + global instmem heap with spinlock
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:41 +10:00
Ben Skeggs eb9bcbdc45 drm/nouveau: fix gpuobj refcount to use atomics
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:34 +10:00
Ben Skeggs dac7900804 drm/nouveau: add spinlock around ramht modifications
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:30 +10:00
Ben Skeggs e05c5a317e drm/nouveau: tidy ram{ht,fc,ro} a bit
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:23:22 +10:00
Ben Skeggs fbd2895e45 drm/nouveau: rework init ordering so nv50_instmem.c can be less bad
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:22:42 +10:00
Ben Skeggs 6c3d7ef25e drm/nv50: calculate vram reordering block size
Will be used at a later point when we plug in an alternative VRAM memory
manager for GeForce 8+ boards.

Based on pscnv code to do the same.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:21:55 +10:00
Ben Skeggs 5125bfd886 drm/nv50: allow gpuobjs that aren't mapped into aperture
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:28 +10:00
Ben Skeggs 43efc9ce25 drm/nouveau: simplify fake gpu objects
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:23 +10:00
Ben Skeggs a8eaebc6c5 drm/nouveau: remove nouveau_gpuobj_ref completely, replace with sanity
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:14 +10:00
Ben Skeggs de3a6c0a3b drm/nouveau: rebase per-channel pramin heap offsets to 0
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:07 +10:00
Ben Skeggs b3beb167af drm/nouveau: modify object accessors, offset in bytes rather than dwords
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:20:00 +10:00
Ben Skeggs 479dcaea09 drm/nouveau: move ramht code out of nouveau_object.c, nothing to see here
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:19:55 +10:00
Ben Skeggs 2a7fdb2bc1 drm/nouveau: have nv_mask return original register value
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:19:15 +10:00
Francisco Jerez 217275d03d drm/nv40: Try to set up CRE_LCD even if it has unknown bits set.
They don't seem to do anything useful, and we really want to program
CRE_LCD if we aren't lucky enough to find the right CRTC binding
already set.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:19:09 +10:00
Francisco Jerez 7314dec95c drm/nv17-nv4x: Fix analog load detection false positive on rare occasions.
On some boards the residual current DAC outputs can draw when they're
disconnected can be high enough to give a false load detection
positive (I've only seen it in the S-video luma output of some cards,
but just to be sure). The output line capacitance is limited and
sampling twice should fix it reliably.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:19:03 +10:00
Ben Skeggs 9d59e8a1fc drm/nouveau: require explicit unmap of kmapped bos
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:18:31 +10:00
Ben Skeggs e694438d2f drm/nouveau: remove second map of notifier bo
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:18:27 +10:00
Ben Skeggs b8a6a8045d drm/nouveau: move check for no-op bo move before memcpy fallback
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:18:20 +10:00
Ben Skeggs f1ab0cc9ba drm/nv50: add new accelerated bo move funtion
Hopefully this one will be better able to cope with moving tiled buffers
around without getting them all scrambled as a result.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:18:16 +10:00
Francisco Jerez 4295f188e8 drm/nv20: Use the nv30 CRTC bandwidth calculation code.
nv2x CRTC FIFOs are as large as in nv3x (4kB it seems), and the FIFO
control registers have the same layout: we can make them share the
same implementation.

Previously we were using the nv1x code, but the calculated FIFO
watermarks are usually too low for nv2x and they cause horrible
scanout artifacts. They've gone unnoticed until now because we've been
leaving one of the bandwidth regs uninitialized (CRE 47, which
contains the most significant bits of FFLWM), so everything seemed to
work fine except in some cases after a cold boot, depending on the
memory bandwidth and pixel clocks used.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:17:59 +10:00
Francisco Jerez 316f60a120 drm/nouveau: Fix suspend on some nv4x AGP cards.
On some nv4x cards (specifically, the ones that use an internal
PCIE->AGP bridge) the AGP controller state isn't preserved after a
suspend/resume cycle, and the AGP control registers have moved from
0x18xx to 0x100xx, so the FW check in nouveau_mem_reset_agp() doesn't
quite work. Check "dev->agp->mode" instead.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-09-24 16:17:52 +10:00
Dave Airlie 4a445f291a Merge remote branch 'origin/master' of /home/airlied/kernel//linux-2.6 into drm-core-next 2010-09-24 15:37:33 +10:00
Daniel J Blueman 201ba4c432 vgaarb: trivial fix
Correct function being needlessly visible outside compilation unit
when the only users are internal.

Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-24 10:13:44 +10:00
Daniel J Blueman 4417d7f602 drm: radeon cleanup fixes...
Fix string interpreted as trigraph and typo.

Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-24 10:12:49 +10:00
Daniel J Blueman d3147e86d7 drm: fix trivial coding errors
Correct function storage class, and correct assignment type.

Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-24 10:10:23 +10:00
Daniel J Blueman 0e57a3cc71 drm: ttm sparse fixes.
Correct allocation flags type and function prototype for ANSI C compliance.

[airlied: whitespace fixed]

Signed-off-by: Daniel J Blueman <daniel.blueman@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-24 10:09:08 +10:00
Ben Skeggs a5d60827a6 drm/nouveau: fix panels using straps-based mode detection
nouveau_bios_fp_mode() zeroes the mode struct before filling in relevant
entries.  This nukes the mode id initialised by drm_mode_create(), and
causes warnings from idr when we try to remove the mode.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-24 10:05:28 +10:00
Chris Wilson cf9a2f3afc drm/i915/sdvo: Handle unsupported GET_SUPPORTED_ENHANCEMENTS gracefully
In the event that the external chipset doesn't implement the
GET_SUPPORTED_ENHANCEMENTS commands, gracefully treat it as having no
enhancments rather than bailing.

Reported-and-tested-by: Woody Suwalski <terraluna977@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=18342
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-23 17:13:51 +01:00
Chris Wilson 123d5c0197 drm/i915/sdvo: Cleanup connector on error path
We weren't unlinking the freed connector from the drm lists, and so
hit some use-after-free if we failed to initialise the connector.

Reported-and-tested-by: Woody Suwalski <terraluna977@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=18342
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-23 17:13:33 +01:00
Joe Perches 40b3be3fca drivers/gpu/drm: Remove unnecessary casts of private_data
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-09-23 13:35:26 +02:00
Chris Wilson 29e1316ab1 drm/i915/tv: Sleep before checking for state changes.
We need to wait for the PLLs to settle prior to detecting the state
changes. The BIOS writers guide suggests waiting for the next vblank.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-23 11:05:44 +01:00
Chris Wilson 20f0cd55f6 drm/i915: Remove the broken flush_ring from page-flip
This is already performed with the pipelined flush, so by the time we
schedule the flush in the page-flip, the ring is NULL and we OOPs
instead.

Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-23 11:02:55 +01:00
Chris Wilson 9b74f7348f drm/i915: Fix 945GM regression in e259befd
A minor typo caused a single fence register to be incorrectly
programmed, resulting in occassional tiling corruption.

Reported-and-tested-by: Hans de Bruin <bruinjm@xs4all.nl>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=18962
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
2010-09-23 10:30:57 +01:00
Chris Wilson 6ec3d0c0e9 drm/i915/crt: Use a DDC probe on 0xA0 before load-detect
The BIOS writer's guide suggests that a VGA connection will ACK a write
to address 0xA0 and that this should be used before doing legacy
load-detection. Considering the extreme cost of load-detection,
performing an extra DDC seems a risk worth taking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-22 18:32:55 +01:00
Chris Wilson a5cad620b3 drm/i915: Disable "disabled FBC" message when a no-op
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-22 13:15:10 +01:00
Chris Wilson 5c12a07e80 drm/i915: Drop ring->lazy_request
We are not currently using it as intended, so remove the complication.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-22 11:58:55 +01:00
Chris Wilson 2896b53975 drm/i915: Don't offset the pin used for crt_ddc
Previously when converting the GMBUS pin to the GPIO reg, we would
offset the pin by one and then use the look-up table. Now that we first
try to use the GMBUS pin, we no longer need the offset and can use the
value from the VBIOS directly.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-22 11:58:33 +01:00
Chris Wilson dfaae392f4 drm/i915: Clear the gpu_write_list on resetting write_domain upon hang
Otherwise we will hit a list handling assertion when moving the object
to the inactive list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-22 10:31:52 +01:00
Francisco Jerez 0fbecd400d drm/ttm: Clear the ghost cpu_writers flag on ttm_buffer_object_transfer.
It makes sense for a BO to move after a process has requested
exclusive RW access on it (e.g. because the BO used to be located in
unmappable VRAM and we intercepted the CPU access from the fault
handler).

If we let the ghost object inherit cpu_writers from the original
object, ttm_bo_release_list() will raise a kernel BUG when the ghost
object is destroyed. This can be reproduced with the nouveau driver on
nv5x.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Tested-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-22 12:40:38 +10:00
Dave Airlie 5222454cf9 drm/radeon: don't allow device to be opened if powered down
If the switcheroo has switched the device off, don't let X open it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-22 12:32:46 +10:00
Chris Wilson 9e0ae53404 drm/i915: Don't overwrite the returned error-code
During i915_gem_create_mmap_offset() if the subsystem reports an error
code, use it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 15:05:24 +01:00
Chris Wilson 4fd21dc8ee drm/i915/lvds: Unlock the PP register when panel-fitting
As we do not wait for the panel to turn off when we need to adjust the
panel-fitting registers we also need to unlock the PLLs as with the
non-pfit update path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 14:22:54 +01:00
Chris Wilson a6b17b4367 drm/i915: Use the correct DPB GMBUS port for GPIOE
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 12:50:13 +01:00
Chris Wilson cdd5998311 drm/i915: Drop crtc->fb pin on disable.
In order to handle disable_functions() where the framebuffer is
decoupled from the crtc we need to unpin the fb in order to prevent a
leak.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29857
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:59:21 +01:00
Chris Wilson 6eecba33f2 drm/i915: Disable output polling across suspend & resume
Suspending (especially hibernating) may take a finite amount of time,
during which a hotplug event may trigger and we will attempt to handle
it with inconsistent state. Disable hotplug polling around suspend and
resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30070
Reported-by: Rui Tiago Matos <tiagomatos@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:57:15 +01:00
Daniel Vetter 0af9e92e77 intel-gtt: clean up gtt size reporting
Consolidate everything in intel-gtt.c and also kill the export
of intel_max_stolen.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:40:06 +01:00
Chris Wilson f13d3f7311 drm/i915: Track pinned objects
Keep a list of pinned objects and display it via debugfs. Now all
objects that exist in the GTT are always tracked on one of the
active, flushing, inactive or pinned lists.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:24:17 +01:00
Chris Wilson 265db9585e drm/i915: Drain any pending flips on the fb prior to unpinning
If we have queued a page flip on the current fb and then request a mode
change, wait until the page flip completes before performing the new
request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:24:17 +01:00
Chris Wilson c78ec30bba drm/i915: Merge ring flushing and lazy requests
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:24:16 +01:00
Chris Wilson 53640e1d07 drm/i915: Track gpu fence usage
Track if the gpu requires the fence for the execution of a batch buffer
and so only wait upon the retirement of the object's last rendering
seqno if the fence is in use by the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:54 +01:00
Chris Wilson ab6f8e3250 drm/i915/ringbuffer: whitespace cleanup
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:06 +01:00
Daniel Vetter a9db5c8fdd drm/i915: drop alignment ringbuffer parameter
Always PAGE_SIZE and only complicates the code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:05 +01:00
Daniel Vetter fa7ed4d206 drm/i915: don't explicitly initialize ringbuffer members to zero
The compiler happily does that for us.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:05 +01:00
Daniel Vetter 7f2ab69913 drm/i915: use new macros to access the ring ctl register
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:04 +01:00
Daniel Vetter 570ef60859 drm/i915: use new macros to access the ring head register
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:03 +01:00
Daniel Vetter 6c0e1c556e drm/i915: use new macros to access the ring start register
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:02 +01:00
Daniel Vetter 870e86ddc2 drm/i915: use new macros to access the ring tail register
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:02 +01:00
Daniel Vetter 333e9fe94d drm/i915: add relative ring register macros
Documentation explicitly mentions that the ring registers are
designed to have the same offsets relative to a base registers.

Use this to fight the code beaurocratic in intel_ringbuffer.c.

No code changes in this patch, just the new definitions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:01 +01:00
Daniel Vetter b8aea0c800 drm/i915: kill duplicated/unneeded register defines
This looks like a copy-paste remnant from the i810. All the regs
that are actually used are already defined somewhere else in i915_reg.h!

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:20:00 +01:00
Chris Wilson c7f9f9a8b8 drm/i915: Use ring->flush() instead of MI_FLUSH
Use the ring abstraction to hide the details of having choose the
appropriate flushing method.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:59 +01:00
Chris Wilson e070868ef2 drm/i915/ringbuffer: Mark the initialisation structs as constant.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:58 +01:00
Xiang, Haihao 881f47b647 drm/i915: add a new BSD ring buffer for Sandybridge
This ring buffer is used for video decoding/encoding on Sandybridge.

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:57 +01:00
Chris Wilson a3f07cd53e drm/i915/ringbuffer: Implement advance using set_tail
As noted by Zhenyu, we can now simply replace the existing advance hook
by calling the new set_tail function pointer directly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:57 +01:00
Xiang, Haihao d46eefa297 drm/i915: add set_tail hook in struct intel_ring_buffer
This is prepared for video codec ring buffer on Sandybridge. It is
needed to read/write more than one register to move the tail pointer of
the video codec ring on Sandybridge.

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:56 +01:00
Xiang, Haihao 5c1143bbec drm/i915: do not export the instances of struct intel_ring_buffer
Introduce intel_init_render_ring_buffer(), intel_init_bsd_ring_buffer
for ring initialization.

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:55 +01:00
Xiang, Haihao 92f49d9cec drm/i915: fix HAS_BSD with a device info flag
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:54 +01:00
Chris Wilson f803aa5532 drm/i915: Clean up bo lists on all hung gpus
Previously we only tidied up the active bo lists for chipsets were we
would attempt to reset the GPU. However, this action is necessary for
the system to continue and reclaim the dead bo for all chipsets.

Pointed out, in passing, by Owain Ainsworth.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:54 +01:00
Chris Wilson 77f0123022 drm/i915: Clear GPU read domains on reset
Clear the GPU read domain for the inactive objects on a reset so that
they are correctly invalidated on reuse.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:53 +01:00
Chris Wilson 9375e446e7 drm/i915: Clear flushing lists on GPU reset
Owain Ainsworth noticed that the reset code failed to clear the flushing
list leaving the driver in an inconsistent state following a hung GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:52 +01:00
Chris Wilson 9220434a87 drm/i915: Only emit a flush request on the active ring.
When flushing the GPU domains,we emit a flush on *both* rings, even
though they share a unified cache. Only emit the flush on the currently
active ring.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:51 +01:00
Chris Wilson b84d5f0c22 drm/i915: Inline i915_gem_ring_retire_request()
Change the semantics to retire any buffer older than the current seqno
rather than repeatedly calling calling the function to retire the
buffer at the head of the list matching the request seqno.

Whilst this should have no semantic impact on the implementation, Daniel
was wondering if there was a bug where we might miss a retirement and so
end up with a continually growing active list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:50 +01:00
Chris Wilson 82690bba37 drm/i915/debug: Dump BSD ring buffers to debugfs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:49 +01:00
Chris Wilson 9fd981413e drm/i915: After a reset perform a forced modeset
On more recent chipsets, restoring the display is not as simple as
writing a few registers, so force a full modeset of the current
configuration in order to retrain the display link.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:49 +01:00
Kenneth Graunke 0573ed4a94 drm/i915: Add support for GPU soft reset on Ironlake.
Ironlake's graphics reset register has to be accessed via the MCHBAR,
rather than via PCI config space, which requires some refactoring.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:48 +01:00
Kenneth Graunke eeccdcac07 drm/i915: Rename graphics reset registers.
The graphics domains are listed as GRDOM in the documentation, and the
GDRST PCI config register (0xc0) is only valid on I965 and GM45.  Newer
chips (like Sandy Bridge) have a different GDRST.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:47 +01:00
Kenneth Graunke f49f058619 drm/i915: Actually set the reset bit in i965_reset.
Previously, it was only being set if passed GDRST_FULL - but the only
caller passed GDRST_RENDER.  So the hardware never actually reset.
The comments also did not match the code.

Instead, just set the reset bit regardless of what flags were passed.
The GPU now resets correctly on my GM45.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:46 +01:00
Chris Wilson a6c45cf013 drm/i915: INTEL_INFO->gen supercedes i8xx, i9xx, i965g
Avoid confusion between i965g meaning broadwater and the gen4+ chipset
families.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:45 +01:00
Chris Wilson 219adae138 drm/i915: Cache LVDS EDID
We assume that the panel is permenantly connected and that the EDID data
is consistent from boot, so simply cache the whole EDID for the panel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-21 11:19:45 +01:00
Chris Wilson e9e5f8e8d3 Merge branch 'drm-intel-fixes' into HEAD
Conflicts:
	drivers/char/agp/intel-agp.c
	drivers/gpu/drm/i915/intel_crt.c
2010-09-21 11:19:32 +01:00
Chris Wilson db8c076b92 Merge remote branch 'linus' into drm-intel-fixes 2010-09-21 09:14:55 +01:00
Chris Wilson af62610313 drm/i915: Hold a reference to the object whilst unbinding the eviction list
During heavy aperture thrashing we may be forced to wait upon several active
objects during eviction. The active list may be the last reference to
these objects and so the action of waiting upon one of them may cause
another to be freed (and itself unbound). To prevent the object
disappearing underneath us, we need to acquire and hold a reference
whilst unbinding.

This should fix the reported page refcount OOPS:

kernel BUG at drivers/gpu/drm/i915/i915_gem.c:1444!
...
RIP: 0010:[<ffffffffa0093026>]  [<ffffffffa0093026>] i915_gem_object_put_pages+0x25/0xf5 [i915]
Call Trace:
 [<ffffffffa009481d>] i915_gem_object_unbind+0xc5/0x1a7 [i915]
 [<ffffffffa0098ab2>] i915_gem_evict_something+0x3bd/0x409 [i915]
 [<ffffffffa0027923>] ? drm_gem_object_lookup+0x27/0x57 [drm]
 [<ffffffffa0093bc3>] i915_gem_object_bind_to_gtt+0x1d3/0x279 [i915]
 [<ffffffffa0095b30>] i915_gem_object_pin+0xa3/0x146 [i915]
 [<ffffffffa0027948>] ? drm_gem_object_lookup+0x4c/0x57 [drm]
 [<ffffffffa00961bc>] i915_gem_do_execbuffer+0x50d/0xe32 [i915]

Reported-by: Shawn Starr <shawn.starr@rogers.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=18902
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-20 20:50:00 +01:00
Chris Wilson f899fc64cd drm/i915: use GMBUS to manage i2c links
Use the GMBUS interface rather than direct bit banging to grab the EDID
over DDC (and for other forms of auxiliary communication with external
display controllers). The hope is that this method will be much faster
and more reliable than bit banging for fetching EDIDs from buggy monitors
or through switches, though we still preserve the bit banging as a
fallback in case GMBUS fails.

Based on an original patch by Jesse Barnes.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-18 15:46:19 +01:00
Chris Wilson 41a5142891 drm/i915,agp/intel: Add second set of PCI-IDs for B43
There is a second revision of B43 (a desktop gen4 part) floating around,
functionally equivalent to the original B43, so simply add the new
PCI-IDs.

Bugzilla: https://bugs.freedesktop.org/show_bugs.cgi?id=30221
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
2010-09-17 08:22:30 +01:00
Chris Wilson e259befd90 drm/i915: Fix Sandybridge fence registers
With 5 places to update when adding handling for fence registers, it is
easy to overlook one or two. Correct that oversight, but fence
management should be improved before a new set of registers is added.

Bugzilla: https://bugs.freedesktop.org/show_bug?id=30199
Original patch by: Yuanhan Liu <yuanhan.liu@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
2010-09-17 08:18:30 +01:00
Chris Wilson 79077319d7 drm/i915/crt: Downgrade warnings for hotplug failures
These are not fatal errors, so do not alarm the user by filling the
logs with *** ERROR ***. Especially as we know that g4x CRT detection
is a little sticky.

On the one hand the errors are valid since they are warning us of a
stall -- we poll the register whilst holding the mode lock so not even
the mouse will update. On the other hand, those stalls were already present
yet nobody complained.

Reported-by: Andi Kleen <andi@firstfloor.org>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=18332
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-17 08:05:28 +01:00
Arnd Bergmann dc880abef7 drm: use noop_llseek
The drm device drivers currently allow seeking on the
character device but never care about the actual
file position.

When we change the default llseek operation to be
no_llseek, calling llseek on a drm device would
return an error condition, which is an API change.

Explicitly setting noop_llseek lets us keep the
current API.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
2010-09-16 10:33:07 +02:00
Chris Wilson 373a3cf744 drm/i915: call drm_encoder_init first
Later initialisation of the encoder often requires that
drm_encoder_init() has already been called, for instance, initialiasing
the DDC buses.

Yet another recent regression, as 819f3fb7 depended upon these fixes
which I missed when cherry-picking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-15 16:45:25 +01:00
Chris Wilson 2f551c8456 drm/i915/sdvo: Mark the status as unknown if attached with EDID
One problem with devices that share the DDC bus between the VGA and
DVI-I connectors is that with two devices attached we cannot know if
there is truly a monitor attached to the DVI connector. In this case, it
is preferrrable to mark the status as unknown, so that the user can
supply the known set of modes and continue to use the output.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-15 10:42:50 +01:00
Chris Wilson ff482d8317 drm/i915/sdvo: Only create the analog encoder as required
We only need to use the analog encoder for rare devices which share the
DDC between the DVI-I and VGA connectors, so only create as needed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-15 10:40:38 +01:00
Alex Deucher fe725d4f22 drm/radeon/kms: only warn on mipmap size checks in r600 cs checker (v2)
The texture base address registers are in units of 256 bytes.
The original CS checker treated these offsets as bytes, so the
original check was wrong.  I fixed the units in a patch during
the 2.6.36 cycle, but this ended up breaking some existing
userspace (probably due to a bug in either userspace texture allocation
or the drm texture mipmap checker).  So for now, until we come
up with a better fix, just warn if the mipmap size it too large.
This will keep existing userspace working and it should be just
as safe as before when we were checking the wrong units.  These
are GPU MC addresses, so if they fall outside of the VRAM or
GART apertures, they end up at the GPU default page, so this should
be safe from a security perspective.

v2: Just disable the warning.  It just spams the log and there's
nothing the user can do about it.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: Jerome Glisse <glisse@freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-15 11:13:09 +10:00
Chris Wilson 819f3fb7fe drm/i915/sdvo: Propagate i2c error from switching DDC control bus.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 21:13:12 +01:00
Chris Wilson 9d1a903d4b drm/i915/sdvo: Tidy intel_sdvo_hdmi_sink_detect
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 21:13:11 +01:00
Chris Wilson 2b6efaa476 drm/i915: Remove unused intel_ringbuffer->ring_flag
This can always be re-added should somebody find a use...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 21:13:00 +01:00
Chris Wilson 890f3359f7 drm/i915/i2c: Track the parent encoder rather than just the dev
The SDVO proxy i2c adapter wants to be able to use information stored in
the encoder, so pass that through intel_i2c rather than iterate over all
known encoders every time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 21:08:36 +01:00
Chris Wilson 2cf34d7b7e drm/i915: Allow get_fence_reg() to be uninterruptible
As we currently may need to acquire a fence register during a modeset,
we need to be able to do so in an uninterruptible manner. So expose that
parameter to the callers of the fence management code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 21:08:36 +01:00
Chris Wilson 48b956c5a8 drm/i915: Push pipelining of display plane flushes to the caller
This ensures that we do wait upon the flushes to complete if necessary
and avoid the visual tears, whilst enabling pipelined page-flips.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 21:08:35 +01:00
Alex Deucher f90087eea4 drm/radeon/kms: force legacy pll algo for RV620 LVDS
There has been periodic evidence that LVDS, on at least some
panels, prefers the dividers selected by the legacy pll algo.
This patch forces the use of the legacy pll algo on RV620
LVDS panels.  The old behavior (new pll algo) can be selected
by setting the new_pll module parameter to 1.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=30029

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-14 20:56:06 +10:00
Dave Airlie b64c115eb2 drm: fix race between driver loading and userspace open.
Not 100% sure this is due to BKL removal, its most likely a combination
of that + userspace timing changes in udev/plymouth. The drm adds the sysfs
device before the driver has completed internal loading, this causes udev
to make the node and plymouth to open it before we've completed loading.

The proper solution is to delay the sysfs manipulation until later in loading
however this causes knock on issues with sysfs connector nodes, so we can use
the global mutex to serialise loading and userspace opens.

Reported-by: Toni Spets (hifi on #radeon)
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-14 20:39:04 +10:00
Chris Wilson 930a9e2835 drm: Use a nondestructive mode for output detect when polling (v2)
v2: Julien Cristau pointed out that @nondestructive results in
double-negatives and confusion when trying to interpret the parameter,
so use @force instead. Much easier to type as well. ;-)

And fix the miscompilation of vmgfx reported by Sedat Dilek.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-14 20:38:48 +10:00
Chris Wilson 0bc23aad3b drm/i915: Fix regression in ba3d8d749b
I pulled the wrong version of the patch from Daniel Vetter which was
missing the read barriers -- and the one that was causing all the trouble
was from i915_gem_object_put_fence_reg(), leading to GPU hangs on gen3.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 10:35:43 +01:00
Chris Wilson 7213342db5 drm/i915: Consolidate flushing the display plane
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 10:34:27 +01:00
Chris Wilson b3b079dbef drm/i915: Reduce hangcheck frequency
By reducing the hangcheck frequency we check less often, conserving
resources, and still detect a lock up quickly. On a fast machine with a
slow GPU (like a Core2 paired with a 945G) it is easy for the hangcheck to
misfire as we check too fast.

Also once hung and if we fail to completely reset the chip, we have a
nasty habit of proclaming a hang many times a second and generating a
strobe-like display.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-14 10:30:10 +01:00
Chris Wilson e2e767abd8 drm/i915: Remove redundant initialisation of crtc->pipe
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 17:04:15 +01:00
Chris Wilson e65d9305f5 drm/i915: Initialize intel_crtc->active
Fix a regression in the previous regression fix...

In order to turn off the pipes entirely upon the first modeset, we
pretend that BIOS (or earlier module incarnation) left them active.
The first task performed by setup_initial_configuration() is to disable
all pipes and so to avoid skipping that step and so to ensure a known
configuration we need to mark all the crtcs as active.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 17:04:14 +01:00
Chris Wilson f7abfe8b28 drm/i915: Fix an overlay regression from 7e7d76c
When separating out the prepare/commit into its own separate functions
we overlooked that the intel_crtc->dpms_mode was being used elsewhere to
check on the actual status of the pipe.

Track that bit of logic separately from the actual dpms mode, so there
is no confusion should we be able to handle multiple dpms modes, nor
any semantic conflict between prepare/commit and dpms.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 14:32:18 +01:00
Chris Wilson 6b383a7f63 drm/i915: Share crtc setup and teardown between dpms and disable/enable
This closes a couple of corner cases where we introduced and forgot
about a couple of routines that need to be called when disabling the
crtc and then re-enabling it. The code needs to be moved again so that
the common bits are shared across generations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 14:26:55 +01:00
Marek Olšák a41ceb1c17 drm/radeon/kms: fix the colorbuffer CS checker for r300-r500
This commit fixes bogus CS rejection if it contains a sequence
of the following operations:

- Set the color buffer 0. track->cb[i].robj becomes non-NULL.
- Render.
- Set a larger zbuffer than the previously-set color buffer.
- Set a larger scissor area as well.
- Set the color channel mask to 0 to do depth-only rendering.
- Render. --> rejected, because track->cb[i].robj remained non-NULL,
  therefore the conditional checking for the color channel mask and
  friends is not performed, and the larger scissor area causes
  the rejection.

This fixes bugs:
- https://bugs.freedesktop.org/show_bug.cgi?id=29762
- https://bugs.freedesktop.org/show_bug.cgi?id=28869
And maybe some others which seem to look the same.

If possible, this commit should go to stable as well.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:30:18 +10:00
Marek Olšák ec00efb72f drm/radeon/kms: increase lockup detection interval to 10 sec for r100-r500
One subtest of mesa/demos/gltestperf takes 9 seconds to complete,
so to prevent an unnecessary gpu reset followed by a hardlock, I am
increasing the interval to 10 seconds after which a GPU is considered
in a locked-up state. This is on RV530. However, with a little slower GPU,
we would surpass the interval easily, so this is not a good fix
for gltestperf.

Nevertheless, this commit also fixes hardlocks in the applications which
render at speed of less than 1 frame per second, where the whole frame
consists of only one command stream. The game Tiny & Big is an example.
This bar is now lowered to 0.1 fps.

Now the question comes down to whether we should (often unsuccessfully)
reset the GPU at all? Once we have stable enough drivers, we won't have to.
Has the time come already?

If possible, this commit should go to stable as well.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:30:02 +10:00
Alex Deucher b741be82cf drm/radeon/kms/evergreen: fix backend setup
This patch fixes rendering errors on some evergreen boards.
Hardcoding the backend map is not an optimal solution, but
a better fix is being worked on.

Similar to the fix for rv740
(6271901d82).

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=29986

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:29:38 +10:00
Chris Wilson 7b334fcb45 drm: Use a nondestructive mode for output detect when polling
Destructive load-detection is very expensive and due to failings
elsewhere can trigger system wide stalls of up to 600ms. A simple
first step to correcting this is not to invoke such an expensive
and destructive load-detection operation automatically.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29536
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16265
Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:29:11 +10:00
Alex Deucher 27849044ca drm/radeon: add some missing copyright headers
Noticed while adding evergreen blit support.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:26:04 +10:00
Chris Wilson 356ad3cd61 drm: Only decouple the old_fb from the crtc is we call mode_set*
Otherwise when disabling the output we switch to the new fb (which is
likely NULL) and skip the call to mode_set -- leaking driver private
state on the old_fb.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29857
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:25:46 +10:00
Alex Deucher e6db0da02e drm/radeon/kms: don't enable underscan with interlaced modes
They aren't compatible.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:25:24 +10:00
Alex Deucher aa74fbb4c9 drm/radeon/kms: add connector table for Mac x800
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=28671

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:21:16 +10:00
Alex Deucher ff32a59dae drm/radeon/kms: fix regression in RMX code (v2)
caused by d65d65b175

need to update the radeon crtc priv native mode before using it.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=30049

v2: integrate v/h copy paste typo

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:21:14 +10:00
Chris Wilson 551402a30e drm: Fix regression in disable polling e58f637
I broke out my trusty i845 and found a new boot failure, which upon
inspection turned out to be a recursion within:

drm_helper_probe_single_connector_modes() -> drm_helper_hpd_irq_event()
-> intel_crt_detect() -> drm_helper_probe_single_connector_modes()

Calling drm_kms_helper_poll_enable() instead performs the desired
re-initialisation of the polling should the user have toggled the
parameter, without the recursive side-effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-09-13 20:21:12 +10:00
Chris Wilson 788319d48d drm/i915/lvds: Move private data to the connector from the device.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 10:27:41 +01:00
Chris Wilson 8aadf70bd7 drm/i915/lvds: Remove incorrect mode locking
One doesn't need to hold the mode lock in order to duplicate a mode.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 10:25:52 +01:00
Chris Wilson e9e331a8ab drm/i915/lvds: Ensure panel is unlocked for Ironlake or the panel fitter
Commit 77d07fd9d7 introduced a regression
where by not waiting for the panel to be turned off, left the panel and
PLL registers locked across the modeset. Thus the panel remaining blank.

As pointed out by Daniel Vetter, when testing LVDS it helps to open the
laptop and look at the actual panel you are purporting to test.

A second issue with the patch was that in order to modify the panel
fitter before gen5, the pipe and the panel must have be completely
powered down. So we wait.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-13 10:25:26 +01:00
Chris Wilson 9277bf4b4f Merge remote branch 'linus' into drm-intel-fixes 2010-09-13 01:02:18 +01:00
Chris Wilson 897493504a drm/i915: Ensure that the crtcinfo is populated during mode_fixup()
This should fix the mysterious mode setting failures reported during
boot up and after resume, generally for i8xx class machines.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16478
Reported-and-tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29413
Tested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
2010-09-12 21:20:41 +01:00
Chris Wilson 6edc3242e3 drm/i915/bios: Prevent NULL dereference after allocation failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-12 17:46:14 +01:00
Chris Wilson b5c616a754 drm/i915/sdvo: Poll command status 5 times without delay on read
The documentation says that an SDVO command takes a maximum of 15us to be
processed by the device, and that it is sufficient to read the status byte
3 times (whilst the command is still in the PENDING state) for the driver
to be confident that sufficient time has elapsed.

We err on the safe side and try 5 times before giving up.

The only question that remains: was the old behaviour derived by
experiments with real hardware?

A look into the murky history of UMS, implies that the behaviour was
accidental and the current retry mechanism was solely designed to catch
the status byte indicating PENDING with no reference to hardware
behaviour. (commit ac9181c014638dbeb334b40b4029d0ccb2b7a0fc in
xf86-video-intel)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-12 13:36:09 +01:00
Chris Wilson ec5da01e23 drm/i915: Use msleep instead of mdelay during wait_vblank_off
Avoid a potentially long busy-wait if we not in the process of
atomically switching to the kdb console.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-12 13:34:08 +01:00
Chris Wilson c9f9ccc150 drm/i915/lvds: Remove busy wait for powering up the panel.
We just assume that it will happen in a timely manner. A variant of this
patch was first written and tested by Arjan van de Van.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-12 13:24:31 +01:00
Chris Wilson 77d07fd9d7 drm/i915/lvds: Remove busy wait for powering down the panel
Just assume that it will turn off...

Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-12 13:24:16 +01:00
Chris Wilson b222f26733 drm/i915/i2c: The bit-banging interface controls the delay, drop ours
Remove our redundant udelay() as the timings are already handled by the
i2c-algo-bit controller.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-11 22:28:13 +01:00
Chris Wilson fe255d0028 drm/i915/dp: Convert a udelay(17000) to a sleep during link-off
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-11 21:37:48 +01:00
Chris Wilson 5eddb70ba2 drm/i915: Use macros to switch between equivalent pipe registers
The purpose is to make the code much easier to read and therefore reduce
the possibility for bugs.

A side effect is that it also makes it much easier for the compiler,
reducing the object size by 4k -- from just a few functions!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-11 19:27:12 +01:00
Chris Wilson 4ed765f966 drm/i915: Tidy Ironlake watermark computation
Refactor the common code into seperate functions and use the MIN(large,
small) buffer calculation for self-refresh watermarks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-11 10:59:57 +01:00
Chris Wilson bed4a6734b drm/i915: Fix updating FBC
We need to track different state on each generation in order to detect
when we need to refresh the FBC registers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-11 10:50:55 +01:00
Jesse Barnes ea056c14a2 drm/i915: enable thermal reporting for IPS
Thermal reporting may not be enabled by default on some machines, so
enable the appropriate bits to allow IPS to get the data it needs from
the CPU thermal device.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-11 10:49:34 +01:00
Chris Wilson 8b3016c4f4 Merge branch 'drm-intel-fixes' into drm-intel-next 2010-09-11 09:49:58 +01:00
Linus Torvalds 3e6dce76d9 Merge branch 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel
* 'drm-intel-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ickle/drm-intel:
  drm/i915: don't enable self-refresh on Ironlake
  drm/i915: Double check that the wait_request is not pending before warning
  Revert "drm/i915: Warn if we run out of FIFO space for a mode"
  Revert "drm/i915: Allow LVDS on pipe A on gen4+"
  Revert "drm/i915: Enable RC6 on Ironlake."
2010-09-10 18:19:43 -07:00
Chris Wilson 021357acc8 drm/i915: Use the real FDI frequency for determining b/w
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:51 +01:00
Chris Wilson 8c4223bee9 drm/i915: Only call udelay() when waiting for clocks to stabilise
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:51 +01:00
Chris Wilson d5e0d2f519 drm/i915: Ensure all PLL registers are flushed before a udelay()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:50 +01:00
Jesse Barnes c64e311e65 drm/i915: set FDI RX TU size to match transmit size
This allows FDI error checking to work.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:49 +01:00
Jesse Barnes de9c27bf70 drm/i915: don't write TU size to N1 reg
TU size is only part of the M1 and M2 regs, not the N regs.  This keeps
us from overwriting a reserved field.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:48 +01:00
Jesse Barnes 0e23b99d25 drm/i915: split Ironlake FDI enable function
Easier to read, and will pair up with a disable function.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:48 +01:00
Jesse Barnes c98e9dcf90 drm/i915: enable PCH PLL, FDI training and transcoder even for eDP
eDP panels require these to be set up prior to panel power sequencing,
or they'll fail to power on due to an "asset not ready" check.  And of
course, eDP panels attached to anything other than DP_A need them
enabled regardless, since they'll be driven from the CPU through FDI out
to the PCH.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:13:47 +01:00
Jesse Barnes 7e7d76c306 drm/i915: use i915 and Ironlake CRTC enable/disable functions in prepare/commit
This will allow us to optimize our prepare/commit paths a bit better.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: minor tweak to handle the cursor across pipe resizing]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 23:12:55 +01:00
Jesse Barnes 4d12fe0b48 drm/i915: don't unlock panel regs
This was just a workaround for some broken Ironlake CRTC code.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 22:23:45 +01:00
Jesse Barnes 0b8765c6e7 drm/i915: split i9xx CRTC enable/disable code
So we can use it for CRTC prepare/commit.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 22:23:45 +01:00
Jesse Barnes 6be4a6078e drm/i915: split Ironlake CRTC enable/disable code
This way we can also use it in CRTC prepare/commit.  Also makes it
easier to split out FDI and other code.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 22:23:44 +01:00
Chris Wilson e642abbf30 drm/i915: Adapt workqueue to new alloc_workqueue interface
create_singlethreaded_workqueue() is being phased out for a new
concurrency managed task infrastructure.

Adapt our workqueue constructor to explicitly create a domain that only
allows the execution of a single task at any time. All the tasks are
expected to require the dev->struct_mutex, so would block concurrency of
other tasks if we allow more than a single i915 task to be run at once.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 16:04:41 +01:00
Jesse Barnes dd8849c8f5 drm/i915: don't enable self-refresh on Ironlake
We don't know how to enable it safely, especially as outputs turn on and
off.  When disabling LP1 we also need to make sure LP2 and 3 are already
disabled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29173
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29082
Reported-by: Chris Lord <chris@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-10 15:11:43 +01:00
Chris Wilson 5ba2aaaaa1 drm/i915/debug: Include Ironlake in self-refresh status
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-09 19:14:06 +01:00
Chris Wilson df0e924883 drm/i915: Make the connector->encoder relationship explicit
Currently we have a exact mapping of a connector onto an encoder for its
whole lifetime. Make this an explicit property of the structure and so
simplify the code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-09-09 17:00:43 +01:00
Chris Wilson f875c15a4f drm/i915: Use the direct mapping of pipe->crtc
Why iterate all the crtcs to find the pipe, when we already know which
crtc is attached to which pipe?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-09-09 17:00:36 +01:00
Chris Wilson 4ef69c7a64 drm/i915: Rename intel_encoder->enc to base for consistency
[Patch is slightly larger than is strictly necessary to fixup
surrounding checkpatch.pl errors.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-09-09 17:00:13 +01:00
Chris Wilson 7839d956fc drm/i915: Double check that the wait_request is not pending before warning
If we are busy, then we may have woken up the wait_request handler but
not yet serviced it before the hang check fires. So in hang check,
double check that the i915_gem_do_wait_request() is still pending the
wake-up before declaring all hope lost.

Fixes regression with e78d73b16b.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30073
Reported-and-tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-09 09:18:00 +01:00
Chris Wilson 1af5fa1b7e drm/i915/dp: Flush the PLL register write before sleeping
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:27 +01:00
Jesse Barnes 2c9d975459 drm/i915: make sure panel is sequenced off when starting a mode set
Otherwise we may not be able to train the DP link.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:27 +01:00
Jesse Barnes 3ba5c569c4 drm/i915: make sure VDD AUX power has time to settle
When turning on or off the VDD AUX bit, we need to give the panel time
to start or stop or AUX transactions may fail.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:26 +01:00
Jesse Barnes 3969c9c927 drm/i915: don't change VDD AUX status in panel power functions
Mode set sequence outlines when the AUX VDD bit should be set and
cleared, and it's separate from the panel power sequence.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:25 +01:00
Jesse Barnes 33a34e4e59 drm/i915: split DP link training across panel power sequencing
Mode set sequence requires that we start training, then enable the
panel, then complete training.  So split the DP training function into
two parts; the first enables the DP port and sets training pattern 1 and
the second completes the training.

As part of this, remove some redundant function args from the various DP
handling functions and use the intel_dp fields everywhere we can.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: removed first ironlake_edp_backlight_on() on advice of jbarnes]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:24 +01:00
Jesse Barnes b2094bbad4 drm/i915: use VDD AUX for panel power around detection and in prepare
Mode setting sequence specifies that we use VDD AUX for configuration
and detection, and early in the mode set sequence.  Only later (after
DP_A has started training) should we actually enable panel power.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: checkpatch.pl complaining about whitespace]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:24 +01:00
Jesse Barnes 6176b8f908 drm/i915: use 125MHz reference clock for PCH attached eDP
Fix the test so we don't try to use the 450MHz refclk on PCH attached
eDP.

References:
  https://bugs.freedesktop.org/show_bug.cgi?id=29141

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:23 +01:00
Jesse Barnes 7eaf5547d0 drm/i915: fix eDP detection
Panel needs to be powered up.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:22 +01:00
Dan Carpenter f4433a8d5d i915: snprintf returns large values
snprintf() returns the number of bytes which would have been used if
there was enough space.  It can be larger than the size of the buffer.
Obviously in this case the buffer is large enough but everyone just
copy and pastes this code so it's better to limit it and set a good
example.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:22 +01:00
Daniel Vetter 1996675432 drm/i915: die, i915_probe_agp, die
Use the detection from intel-gtt.ko instead. Hooray!

Also move the stolen mem allocator to the other gtt stuff in dev_prv->mem.

v2: Chris Wilson noted that my error handling was crap. Fix it. He also
said that this fixes a problem on his i845. Indeed, i915_probe_agp
misses a special case for i830/i845 stolen mem detection.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25476
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:21 +01:00
Daniel Vetter ac622a9cdb drm/i915: drop prealloc_start from i915_dma gtt init
Not used and simply confusing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:20 +01:00
Daniel Vetter 0ade638655 intel-gtt: introduce drm/intel-gtt.h
Add a few definitions to it that are already shared and that will
be shared in the future (like the number of stolen entries).
No functional changes in here.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:07 +01:00
Matthew Garrett 309b1e3ab7 drm/i915: Don't disable panel for modesetting if pfit hasn't changed
It seems to be possible to program a new mode without disabling the panel
if the panel fitter setup doesn't change. Add support for that.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 21:20:05 +01:00
Jesse Barnes 434ed09724 drm/i915: set dither bits on eDP panels too
We really need a macro to test whether a given connector has a panel
attached rather than sprinkling HAS_PCH_SPLIT/IS_eDP/has_edp_encoder
etc all over. In the meantime, fix the bug...

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: tidy up the duplicity in the conditionals]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 12:44:12 +01:00
Jesse Barnes 4f0d1aff79 drm/i915: fix pipeconf dither bit definitions
Make them match the others and add BPP definitions.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 12:38:17 +01:00
Chris Wilson dd2575ffbd drm/i915: Remove impossible error handling from bit17 swizzling
Our usage of kmap() cannot return NULL here, so remove the unnecessary
error handling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 11:30:00 +01:00