Commit Graph

2864 Commits

Author SHA1 Message Date
Chris Wilson d97ed33963 drm/i915: Move ringbuffer accounting to begin/advance.
As we check that the ringbuffer will not wrap upon emission, we do not
need to check that incrementing the tail wrapped every time. However, we
do upon advancing just in case the tail is now pointing at the very end
of the ring.

Likewise we can account for the space used during emission in begin()
and avoid decrementing it for every emit.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:31 -07:00
Chris Wilson 1741dd4aa7 drm/i915: Unroll wrapping of the ringbuffer.
The tail is quadword aligned, so we can add two MI_NOOP as a time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:31 -07:00
Chris Wilson ae7d49d879 drm/i915: Emit a backtrace if we attempt to rebind a pinned buffer
This debugging trace was useful for finding the fbcon regression on
i965, and it may prove useful again in future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:30 -07:00
Chris Wilson 87f8ebf309 drm/i915: Disable the cursor for DPMS_OFF
The comments have long desired that we should switch off the cursor
along with the display plane, make it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:30 -07:00
Daniel Vetter 6146b3d619 drm/i915: i8xx also doesn't like multiple oustanding pageflips
My i855GM suffers from a 80k/s interrupt storm without this.
So add 2nd gen to the list of things that don't like more than
one outstanding pageflip request.

Furthermore I've changed the busy loop into a ringbuffer wait.
Busy-loops that don't check whether the chip died are simply evil.
And performance should actually improve, because there's usually
a decent amount of rendering queued on the gpu, hopefully rendering
that MI_WAIT into a noop by the time it's executed.

The current code holds dev->struct_mutex while executing this loop,
hence stalling all other gem activity anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@kernel.org
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: resolved against conflict]
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:30 -07:00
Daniel Vetter 69d0b96c09 drm/i915: fixup pageflip ringbuffer commands for i8xx
Add a new path for 2nd gen chips that uses the commands for i81x
chips (where public docs do exist) augmented with the plane bits
from i915. It seems to work and doesn't result in a black screen
like before.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@kernel.org
[anholt: resolved against conflict]
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:30 -07:00
Chris Wilson 0be555b66a drm/i915: report all active objects as busy
Incorporates a similar patch by Daniel Vetter, the alteration being to
report the current busy state after retiring.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:30 -07:00
Chris Wilson 403c89ff39 drm/i915: Mark the static memory latency tables const.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:29 -07:00
Chris Wilson 88f356b725 drm/i915: Only emit flushes on active rings.
This avoids the excess flush and requests on idle rings (and spamming
the debug log ;-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:29 -07:00
Chris Wilson e044218a8e drm/i915/sdvo: Add dot crawl property
This property is slightly unusual in that it is a boolean and so has no
GET_MAX command.

Reference:

  Bug 28636 - missing TV parameter "Dot Crawl freeze"
  https://bugs.freedesktop.org/show_bug.cgi?id=28636

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:29 -07:00
Chris Wilson c55217064e drm/i915/sdvo: Add missing TV filters
Reference:

  Bug 28634 - missing TV parameter "Flicker Filter"
  https://bugs.freedesktop.org/show_bug.cgi?id=28634

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:29 -07:00
Chris Wilson fcc8d6721c drm/i915/sdvo: Check for allocation failure when constructing properties
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:29 -07:00
Chris Wilson 400397506f drm/i915/sdvo: Use an integer mapping for supported tv format modes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:29 -07:00
Chris Wilson 32aad86fe8 drm/i915/sdvo: Propagate errors from reading/writing control bus.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:28 -07:00
Chris Wilson 615fb93f6d drm/i915: Subclass intel_connector.
Make the code that tiny bit clearer by reducing the pointer dance.

2 files changed, 130 insertions(+), 147 deletions(-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:28 -07:00
Chris Wilson ea5b213ad4 drm/i915: Subclass intel_encoder.
Subclass intel_encoder to reduce the pointer dance through
intel_encoder->dev_priv.

10 files changed, 896 insertions(+), 997 deletions(-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:28 -07:00
Chris Wilson 94113cecae drm/i915: Do not clobber the contents of TRANS_DP_CTL when enabling.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:28 -07:00
Chris Wilson 3e33d94df7 drm/i915: Remove useless message when disabling "Big FIFO" on PineView
As we already have appropriate debug and warnings when we activate and
deactivate the self-refresh FIFO, having a further INFO is just annoying.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-09 11:24:27 -07:00
Tejun Heo 9a919c46df drm: fix fallouts from slow-work -> wq conversion
Commit 991ea75c (drm: use workqueue instead of slow-work), which made
drm to use wq instead of slow-work, didn't account for the return
value difference between delayed_slow_work_enqueue() and
queue_delayed_work().  The former returns 0 on success and -errno on
failures while the latter never fails and only uses the return value
to indicate whether the work was already pending or not.

This misconversion triggered spurious error messages.  Remove the now
unnecessary return value check and error message.

Markus: caught another incorrect conversion in drm_kms_helper_poll_enable()

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
2010-08-09 12:18:44 +02:00
Ben Skeggs 2dc5d2ec05 drm/nvc0: fix typo in PRAMIN flush
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-09 15:18:44 +10:00
Francisco Jerez 27d50fcc9a drm/nouveau: Fix DCB TMDS config parsing.
Thinko caused by 43bda05428a3d2021f3c12220073e0251c65df8b.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-08-09 15:17:02 +10:00
Francisco Jerez 4d1defd724 drm/nv30: Fix PFB init for nv31.
Fixes a regression introduced by 58bbb63720c8997e0136fe1884101e7ca40d68fd
(fdo bug 29324).

Reported-by: Johannes Obermayr <johannesobermayr@gmx.de>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-09 15:16:37 +10:00
Francisco Jerez 0746b5da53 drm/nv04: Fix up SGRAM density detection.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-09 15:16:30 +10:00
Francisco Jerez c93ebb4021 drm/i2c/ch7006: Don't use POWER_LEVEL_FULL_POWER_OFF on early chip versions.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-09 15:16:23 +10:00
Francisco Jerez 1849719ef8 drm/nouveau: Init dcb->or on cards that have no usable DCB table.
We need a valid OR value because there're a few nv17 cards with DCB v1.4.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-09 15:16:15 +10:00
Linus Torvalds 3b7433b8a8 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (55 commits)
  workqueue: mark init_workqueues() as early_initcall()
  workqueue: explain for_each_*cwq_cpu() iterators
  fscache: fix build on !CONFIG_SYSCTL
  slow-work: kill it
  gfs2: use workqueue instead of slow-work
  drm: use workqueue instead of slow-work
  cifs: use workqueue instead of slow-work
  fscache: drop references to slow-work
  fscache: convert operation to use workqueue instead of slow-work
  fscache: convert object to use workqueue instead of slow-work
  workqueue: fix how cpu number is stored in work->data
  workqueue: fix mayday_mask handling on UP
  workqueue: fix build problem on !CONFIG_SMP
  workqueue: fix locking in retry path of maybe_create_worker()
  async: use workqueue for worker pool
  workqueue: remove WQ_SINGLE_CPU and use WQ_UNBOUND instead
  workqueue: implement unbound workqueue
  workqueue: prepare for WQ_UNBOUND implementation
  libata: take advantage of cmwq and remove concurrency limitations
  workqueue: fix worker management invocation without pending works
  ...

Fixed up conflicts in fs/cifs/* as per Tejun. Other trivial conflicts in
include/linux/workqueue.h, kernel/trace/Kconfig and kernel/workqueue.c
2010-08-07 12:42:58 -07:00
Linus Torvalds fc1caf6eaf Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (204 commits)
  agp: intel-agp: do not use PCI resources before pci_enable_device()
  agp: efficeon-agp: do not use PCI resources before pci_enable_device()
  drm: kill BKL from common code
  drm/kms: Simplify setup of the initial I2C encoder config.
  drm,io-mapping: Specify slot to use for atomic mappings
  drm/radeon/kms: only expose underscan on avivo chips
  drm/radeon: add new pci ids
  drm: Cleanup after failing to create master->unique and dev->name
  drm/radeon: tone down overchatty acpi debug messages.
  drm/radeon/kms: enable underscan option for digital connectors
  drm/radeon/kms: fix calculation of h/v scaling factors
  drm/radeon/kms/igp: sideport is AMD only
  drm/radeon/kms: handle the case of no active displays properly in the bandwidth code
  drm: move ttm global code to core drm
  drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.
  drm/radeon/kms: make sure HPD is set to NONE on analog-only connectors
  drm/radeon/kms: make sure rio_mem is valid before unmapping it
  drm/agp/i915: trim stolen space to 32M
  drm/i915: Unset cursor if out-of-bounds upon mode change (v4)
  drm/i915: Unreference object not handle on creation
  ...
2010-08-05 16:02:01 -07:00
Linus Torvalds 9779714c8a Merge branch 'kms-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb
* 'kms-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
  kgdb,docs: Update the kgdb docs to include kms
  drm_fb_helper: Preserve capability to use atomic kms
  i915: when kgdb is active display compression should be off
  drm/i915: use new fb debug hooks
  drm: add KGDB/KDB support
  fb: add hooks to handle KDB enter/exit
  kgdboc: Add call backs to allow kernel mode switching
  vt,console,kdb: automatically set kdb LINES variable
  vt,console,kdb: implement atomic console enter/leave functions
2010-08-05 16:00:44 -07:00
Ben Skeggs 54bf67dee9 drm/nouveau: reduce severity of some "error" messages
There's some known configurations where the lack of these tables/scripts
is perfectly normal, reduce visibilty of complaint messages to debug.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:36:00 +10:00
Ben Skeggs 147cad0936 drm/nvc0: backup bar3 channel on suspend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:54 +10:00
Marcin Kościelnicki b715d64028 drm/nouveau: implement init table opcodex 0x5e and 0x9a
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
2010-08-06 08:35:50 +10:00
Marcin Kościelnicki e3a1924f3e drm/nouveau: implement init table op 0x57, INIT_LTIME
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
2010-08-06 08:35:46 +10:00
Ben Skeggs 1ac7b528a0 drm/nvc0: implement crtc pll setting
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:40 +10:00
Ben Skeggs 0165d15dba drm/nvc0: fix evo dma object so we display something
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:35 +10:00
Ben Skeggs 68b83a939c drm/nvc0: rudimentary instmem support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:31 +10:00
Ben Skeggs c556d98903 drm/nvc0: implement memory detection
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:24 +10:00
Ben Skeggs 080feda59c drm/nvc0: allow INIT_GPIO
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:21 +10:00
Ben Skeggs 4b223eefe4 drm/nvc0: starting point for GF100 support, everything stubbed
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:17 +10:00
Francisco Jerez 2d14e35c95 drm/nv30: Workaround dual TMDS brain damage.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:11 +10:00
Francisco Jerez bfe9dbcfc6 drm/nouveau: No need to set slave TV encoder configs explicitly.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:35:06 +10:00
Francisco Jerez 4a9f822fe1 drm/nv17-nv4x: Attempt to init some external TMDS transmitters.
sil164 and friends are the most common, usually they just need to be
poked once because a fixed configuration is enough for any modes and
clocks, so they worked without this patch if the BIOS had done a good
job on POST. Display couldn't survive a suspend/resume cycle though.
Unfortunately, BIOS scripts are useless here.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:34:59 +10:00
Francisco Jerez d2f4e89254 drm/nv10: Fix up switching of NV10TCL_DMA_VTXBUF.
Not very nice, but I don't think there's a simpler workaround.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:34:51 +10:00
Francisco Jerez 308dcebac7 drm/nouveau: Ack the context switch interrupt before switching contexts.
Leaving the IRQ unack'ed while switching contexts makes the switch
fail randomly on some nv1x.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:34:50 +10:00
Francisco Jerez 3c9b25349e drm/nouveau: Fix the INIT_CONFIGURE_PREINIT BIOS opcode.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:34:50 +10:00
Francisco Jerez 0bf9b0e0ce drm/nouveau: Don't pass misaligned offsets to io_mapping_map_atomic_wc().
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:34:50 +10:00
Dan Carpenter a0d069ea2c drm/nouveau: unwind on load errors
nouveau_load() just returned directly if there was an error instead of
releasing resources.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:33:41 +10:00
Francisco Jerez 2b495268fc drm/nouveau: Fix AGP reset when AGP FW is already enabled on init.
Previously nouveau_mem_reset_agp() was only disabling AGP fast writes
when coming back from suspend. However, the "locked out of the card
because of FW" problem can also be reproduced on init if you
unload/reload nouveau.ko several times. This patch makes the AGP code
reset FW on init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:33:41 +10:00
Ben Skeggs 0d3470d218 drm/nouveau: remove unused ttm bo list
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:33:41 +10:00
Ben Skeggs c020c9a8ca drm/nv50: use custom i2c algo for dp auxch
This makes it easier to see how this is working, and lets us transfer the
EDID in blocks of 16 bytes.

The primary reason for this change is because debug logs are rather hard
to read with the hundreds of single-byte auxch transactions that occur.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-06 08:33:40 +10:00
Jason Wessel f90ebd9e98 drm_fb_helper: Preserve capability to use atomic kms
Commit 5349ef3127 (drm/fb: fix
FBIOGET/PUT_VSCREENINFO pixel clock handling) changed the logic of
when a pixclock was valid vs invalid.

The atomic kernel mode setting used by the kernel debugger relies upon
the drm_fb_helper_check_var() to always return -EINVAL.  Until a
better solution exists, this behavior will be restored.

CC: David Airlie <airlied@linux.ie>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
2010-08-05 09:22:32 -05:00
Jason Wessel c924b934d0 i915: when kgdb is active display compression should be off
If the HW compression is left on, the call backs from the HW will
crash the kernel.  The only time this code is called is when kernel
mode setting is in use with kgdb and the kdb shell.

The atomic display pipe handler callback will reset everything when
kgdb restores kernel to the run state.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: David Airlie <airlied@linux.ie>
2010-08-05 09:22:32 -05:00
Jesse Barnes 81255565db drm/i915: use new fb debug hooks
Implement atomic kernel mode settings using the fb layer's debug hook
system for supporting debugger interaction.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
2010-08-05 09:22:31 -05:00
Jesse Barnes 1a7aba7f4e drm: add KGDB/KDB support
Implement the callbacks for KDB entry/exit via the drm helpers.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
2010-08-05 09:22:31 -05:00
Arnd Bergmann 58374713c9 drm: kill BKL from common code
This restricts the use of the big kernel lock to the i830 and i810
device drivers. The three remaining users in common code (open, ioctl
and release) get converted to a new mutex, the drm_global_mutex,
making the locking stricter than the big kernel lock.

This may have a performance impact, but only in those cases that
currently don't use DRM_UNLOCKED flag in the ioctl list and would
benefit from that anyway.

The reason why i810 and i830 cannot use drm_global_mutex in their
mmap functions is a lock-order inversion problem between the current
use of the BKL and mmap_sem in these drivers. Since the BKL has
release-on-sleep semantics, it's harmless but it would cause trouble
if we replace the BKL with a mutex.

Instead, these drivers get their own ioctl wrappers that take the
BKL around every ioctl call and then set their own handlers as
DRM_UNLOCKED.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-05 11:54:40 +10:00
Francisco Jerez a1e09b6259 drm/kms: Simplify setup of the initial I2C encoder config.
In most use cases the driver will be using the same static config all
the time: interpreting i2c_board_info::platform_data as the default
config we can can save the GPU driver a redundant set_config() call.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-05 09:37:45 +10:00
Chris Wilson fca3ec01e0 drm,io-mapping: Specify slot to use for atomic mappings
This is required should we ever attempt to use an io-mapping where
KM_USER0 is verboten, such as inside an IRQ context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-05 08:48:53 +10:00
Alex Deucher 430f70d59d drm/radeon/kms: only expose underscan on avivo chips
R4xx also uses the atom add connector function, but underscan is only
supported on avivo chips.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-05 08:47:40 +10:00
Chris Wilson 3fb688fdc1 drm: Cleanup after failing to create master->unique and dev->name
v2: Userspace (notably xf86-video-{intel,ati}) became confused when
drmSetInterfaceVersion() started returning -EBUSY as they used a second
call (the first done in drmOpen()) to check their master credentials.
Since userspace wants to be able to repeatedly call
drmSetInterfaceVersion() allow them to do so.

v3: Rebase to drm-core-next.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-05 08:42:19 +10:00
Jiri Kosina d790d4d583 Merge branch 'master' into for-next 2010-08-04 15:14:38 +02:00
Dave Airlie dc77de12dd drm/radeon: tone down overchatty acpi debug messages.
On non laptop systems we'll see these the whole time, so make them
less important.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-04 11:16:56 +10:00
Alex Deucher 5b1714d386 drm/radeon/kms: enable underscan option for digital connectors
This connector attribute allows you to enable or disable underscan
on a digital output to compensate for panels that automatically
overscan (e.g., many HDMI TVs).  Valid values for the attribute are:

off - forces underscan off
on - forces underscan on
auto - enables underscan if an HDMI TV is connected, off otherwise

default value is auto.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-04 10:03:50 +10:00
Alex Deucher d65d65b175 drm/radeon/kms: fix calculation of h/v scaling factors
Prior to this patch the code was dividing the src_v by the dst_h
and vice versa, rather than src_v/dst_v and src_h/dst_h.

This could lead to problems in the calculation of the display
watermarks.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-04 10:03:47 +10:00
Dave Airlie fa0a6024da Merge remote branch 'intel/drm-intel-next' of /ssd/git/drm-next into drm-core-next
* 'intel/drm-intel-next' of /ssd/git/drm-next: (230 commits)
  drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.
  drm/agp/i915: trim stolen space to 32M
  drm/i915: Unset cursor if out-of-bounds upon mode change (v4)
  drm/i915: Unreference object not handle on creation
  drm/i915: Attempt to uncouple object after catastrophic failure in unbind
  drm/i915: Repeat unbinding during free if interrupted (v6)
  drm/i915: Refactor i915_gem_retire_requests()
  drm/i915: Warn if we run out of FIFO space for a mode
  drm/i915: Round up the watermark entries (v3)
  drm/i915: Typo in (unused) register mask for overlay.
  drm/i915: Check overlay stride errata for i830 and i845
  drm/i915: Validate the mode for eDP by using fixed panel size
  drm/i915: Always use the fixed panel timing for eDP
  drm/i915: Enable panel fitting for eDP
  drm/i915: Add fixed panel mode parsed from EDID for eDP without fixed mode in VBT
  drm/i915/sdvo: Set sync polarity based on actual mode
  drm/i915/hdmi: Set sync polarity based on actual mode
  drm/i915/pch: Set transcoder sync polarity for DP based on actual mode
  drm/i915: Initialize LVDS and eDP outputs before anything else
  drm/i915/dp: Correctly report eDP in the core connector type
  ...
2010-08-04 09:51:27 +10:00
Alex Deucher 4c70b2eae3 drm/radeon/kms/igp: sideport is AMD only
Intel variants don't support it.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-04 09:49:35 +10:00
Alex Deucher e06b14ee91 drm/radeon/kms: handle the case of no active displays properly in the bandwidth code
Logic was:
if (mode0 && mode1)
else if (mode0)
else

Should be:
if (mode0 && mode1)
else if (mode0)
else if (mode1)

Otherwise we may end up calculating the priority regs with
unitialized values.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=16492

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-04 09:49:20 +10:00
Dave Airlie ba4420c224 drm: move ttm global code to core drm
I wrote this for the prime sharing work, but I also noticed other external
non-upstream drivers from a large company carrying a similiar patch, so I
may as well ship it in master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-04 09:46:06 +10:00
Eric Anholt 7b824ec2e5 drm/i915: Clear the Ironlake dithering flags when the pipe doesn't want it.
My fine DisplayPort output was getting ST dithering forever after
having had the LVDS enabled at one point.

Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-03 16:23:58 -07:00
Alex Deucher 2581afccad drm/radeon/kms: make sure HPD is set to NONE on analog-only connectors
HPD is digital only.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 14:23:57 +10:00
Alex Deucher e0a2ca7375 drm/radeon/kms: make sure rio_mem is valid before unmapping it
If we were not able to map the io bar in device init, don't attempt
to unmap it in device fini.  All radeons should have a io bar, so
I doubt this would ever trigger, but just to be on the safe side...

Pointed out by: Alberto Milone <alberto.milone@canonical.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 14:21:37 +10:00
Jesse Barnes d1d6ca73ef drm/agp/i915: trim stolen space to 32M
Some BIOSes will claim a large chunk of stolen space.  Unless we
reclaim it, our aperture for remapping buffer objects will be
constrained.  So clamp the stolen space to 32M and ignore the rest.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15469 among others.

Adding the ignored stolen memory back into the general pool using the
memory hotplug code is left as an exercise for the reader.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.com>
Tested-by: Artem S. Tashkinov <t.artem@mailcity.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:58:57 -07:00
Chris Wilson cda4b7d3a5 drm/i915: Unset cursor if out-of-bounds upon mode change (v4)
The docs warn that to position the cursor such that no part of it is
visible on the pipe is an undefined operation. Avoid such circumstances
upon changing the mode, or at any other time, by unsetting the cursor if
it moves out of bounds.

"For normal high resolution display modes, the cursor must have at least a
single pixel positioned over the active screen.” (p143, p148 of the hardware
registers docs).

Fixes:

  Bug 24748 - [965G] Graphics crashes when resolution is changed with KMS
              enabled
  https://bugs.freedesktop.org/show_bug.cgi?id=24748

v2: Only update the cursor registers if they change.
v3: Fix the unsigned comparision of x,y against width,height.
v4: Always set CUR.BASE or else the cursor may become corrupt.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Christian Eggers <ceggers@gmx.de>
Cc: Christopher James Halse Rogers  <chalserogers@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:58:28 -07:00
Chris Wilson 86f100b136 drm/i915: Unreference object not handle on creation
When creating an object, we create the handle by which it is known to
the process and which own the reference to the object. That reference to
the new handle is what we want to transfer to the process, not the lost
reference to the object; so free the local object reference *not* the
process's handle reference.

This brings i915_gem_object_create_ioctl() into line with
drm_gem_open_ioctl()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:58:06 -07:00
Chris Wilson 8dc1775dce drm/i915: Attempt to uncouple object after catastrophic failure in unbind
If we fail to flush outstanding GPU writes but return the memory to the
system, we risk corrupting memory should the GPU recovery and complete
those writes. On the other hand, if we bail early and free the object
then we have a definite use-after-free and real memory corruption.
Choose the lesser of two evils, since in order to recover from the hung
GPU we need to completely reset it, those pending writes should
never happen.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:56:29 -07:00
Chris Wilson be72615bcf drm/i915: Repeat unbinding during free if interrupted (v6)
If during the freeing of an object the unbind is interrupted by a system
call, which is quite possible if we have outstanding GPU writes that
must be flushed, the unbind is silently aborted. This still leaves the
AGP region and backing pages allocated, and perhaps more importantly,
the object remains upon the various lists exposing us to memory
corruption.

I think this is the cause behind the use-after-free, such as

  Bug 15664 - Graphics hang and kernel backtrace when starting Azureus
              with Compiz enabled
  https://bugzilla.kernel.org/show_bug.cgi?id=15664

v2: Daniel Vetter reminded me that kernel space programming is never easy.
We cannot simply spin to clear the pending signal and so must deferred
the freeing of the object until later.
v3: Run from the top level retire requests.
v4: Tested with P(return -ERESTARTSYS)=.5 from i915_gem_do_wait_request()
v5: Rebase against Eric's for-linus tree.
v6: Refactor, split and add a comment about avoiding unbounded recursion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:53:24 -07:00
Chris Wilson b09a1feca6 drm/i915: Refactor i915_gem_retire_requests()
Combine the iteration over active render rings into a common function.
This is in preparation for reusing the idle function to also retire
deferred free requests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:52:57 -07:00
Chris Wilson b9421ae8f3 drm/i915: Warn if we run out of FIFO space for a mode
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:47:59 -07:00
Chris Wilson 8de9b311bc drm/i915: Round up the watermark entries (v3)
Even though "we have enough padding that it should be ok", round up the
watermark entries to the next unit to be on the safe side...

v2: Use the DIV_ROUND_UP macro
v3: Spotted a few more missing round-ups.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:47:37 -07:00
Chris Wilson d79613643b drm/i915: Typo in (unused) register mask for overlay.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:46:39 -07:00
Chris Wilson a1efd14a99 drm/i915: Check overlay stride errata for i830 and i845
Apparently i830 and i845 cannot handle any stride that is not a multiple
of 256, unlike their brethren which do support 64 byte aligned strides.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:46:16 -07:00
Zhao Yakui 7de56f43e0 drm/i915: Validate the mode for eDP by using fixed panel size
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:40:38 -07:00
Zhao Yakui 0d3a1beecf drm/i915: Always use the fixed panel timing for eDP
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:40:30 -07:00
Zhao Yakui 1fc7947898 drm/i915: Enable panel fitting for eDP
When trying to set other display mode besides the fixed panel mode, the
panel fitting should be enabled. This is similar to LVDS.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:40:11 -07:00
Zhao Yakui b9efc4804b drm/i915: Add fixed panel mode parsed from EDID for eDP without fixed mode in VBT
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:40:00 -07:00
Adam Jackson 81a14b4684 drm/i915/sdvo: Set sync polarity based on actual mode
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:38:12 -07:00
Adam Jackson b599c0bca1 drm/i915/hdmi: Set sync polarity based on actual mode
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:38:08 -07:00
Adam Jackson d6d952689a drm/i915/pch: Set transcoder sync polarity for DP based on actual mode
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:38:04 -07:00
Adam Jackson cb0953d734 drm/i915: Initialize LVDS and eDP outputs before anything else
This makes them sort to the front in X, which makes them likely to be
the primary outputs if you haven't specified a preference in your DE,
which is likely to be what you want.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:38:00 -07:00
Adam Jackson b329530ca7 drm/i915/dp: Correctly report eDP in the core connector type
Do this for both real eDP and for PCH_DP_D when used as the eDP
connection.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:37:51 -07:00
Adam Jackson f091737978 drm/i915/dp: Rename has_edp to is_pch_edp to reflect its real meaning
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:37:46 -07:00
Chris Wilson 49be663f99 drm/i915: Refactor panel fitting on the LVDS. (v2)
Move the common routines into separate functions to not only increase
readability, but also throwaway surplus code.

In doing so, we review the calculation of the aspect preserving scaling
and avoid the use of fixed-point until we need to calculate the accurate
scale factor.

v2: Improve comments as suggested by Jesse.

1 files changed, 105 insertions(+), 194 deletions(-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:35:17 -07:00
Chris Wilson 7167704335 drm/i915: Remove the redundant check for a fixed_panel_mode
We already checked just a couple of lines above that we have found a
fixed_panel_mode for the LVDS, so remove the surplus check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:35:16 -07:00
Jesse Barnes 4f44407170 drm/i915: apply DP bandwidth workaround for PCH eDP as well
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29141 though the
workaround itself is still a bit of a mystery.

Tested-by: Adam Hill <sidepipeuk@yahoo.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:35:15 -07:00
Eric Anholt 2bd34f6ca8 Merge remote branch 'origin/master' into drm-intel-next
This resolves the conflict in the EDP code, which has been rather
popular to hack on recently.

Conflicts:
	drivers/gpu/drm/i915/intel_dp.c
2010-08-01 19:34:47 -07:00
Chris Wilson 6103da0d03 drm/i915: Include any alternate names by which the device is known.
When trying to keep track of features between the kernel, the 2D driver,
mesa and the specs, it helps to list any other name by which the device
is referred to.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:47 -07:00
Chris Wilson 534843dabf drm/i915: Use 128k alignment for untiled display surface on i965 (v2)
The original i965, including the revised G35 and Q35, requires an
alignment of 128K for the display surface with linear memory, so
increase the requirement from 64k for these chipsets. For the later
chipsets in the i965 family, only a 4k alignment is required. (So
long as we do not start performing asynchronous flips.)

Note the impact of this should be slight as on i965 we should be using a
tiled frontbuffer for anything up to a 4096x4096 display.

v2: compilation fixes and note that the docs do not exclude the G35 from
the extra alignment.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:47 -07:00
Adam Jackson e1a4474349 drm/i915/pch: Cosmetic fix to FDI link training
Unmask the bits for link training reporting before starting link
training.  If stage 1 training finished before we unmask them, then we'd
spin around in a loop a few times until smashing on through.  Which is
harmless, since training _did_ succeed, it just looks ugly in dmesg.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:47 -07:00
Dan Carpenter 2991196fbc drm/i915: cleanup: use ARRAY_SIZE()
NUM_TV_MODES is the same as ARRAY_SIZE(tv_modes).  In the end, I
decided it was cleaner to remove NUM_TV_MODES and just use
ARRAY_SIZE(tv_modes) through out.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:46 -07:00
Chris Wilson cbb465e72a drm/i915: Include instdone[1] in hangcheck
References:

  Bug 26691 - Spurious hangcheck whilst executing a long shader over a
              large vertex buffer
  https://bugs.freedesktop.org/show_bug.cgi?id=26691

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:46 -07:00
Chris Wilson 0b3400040d drm/i915: Remove the WARN when failing to set tiling.
We generally issue an error message at the point of failure, and so this
warning with a fairly pointless stacktrace is superfluous and ugly.
Needless to say, the common trigger for this WARN happens to be EIO
where this is pure noise.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:46 -07:00
Jesse Barnes 2377b741ab drm/i915: fix FDI frequency check
Since mode->clock is in kHz we should be checking against 2700000
instead of just 27000.  This patch gets my x201s working again (well
working as well as it ever was anyway).

When looking for this I also noticed we set link_bw to 270000, but the
calculation is different.  Does it also need to use kHz or we using
10kHz internally?

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:46 -07:00
Chris Wilson 3ca87e8283 drm/i915: Sparse warning about invalid value for burst_ena in tv_modes
drivers/gpu/drm/i915/intel_tv.c|479 col 16| warning: cast truncates bits
from constant value (8 becomes 0)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:46 -07:00
Chris Wilson d312ec2517 drm/i915: Sparse warns about the incorrect sign for storing bit17
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:45 -07:00
Chris Wilson b4b78d12d7 drm/i915: Silence sparse over non-static local structure.
drivers/gpu/drm/i915/i915_drv.c|485 col 25| warning: symbol 'i915_pm_ops' was not declared. Should it be static?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:45 -07:00
Chris Wilson 2d3fa0de68 drm/i915: Silence sparse over duplicate members in static initializer
drivers/gpu/drm/i915/i915_drv.c|100 col 18| warning: Initializer entry defined twice
drivers/gpu/drm/i915/i915_drv.c|101 col 3| also defined here
drivers/gpu/drm/i915/i915_drv.c|117 col 18| warning: Initializer entry defined twice
drivers/gpu/drm/i915/i915_drv.c|118 col 3| also defined here

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:45 -07:00
Chris Wilson 11824e8c4e drm/i915: Silence sparse complaints over insufficient bitfield int types.
drivers/gpu/drm/i915/i915_drv.h|676 col 19| warning: dubious bitfield without explicit `signed' or `unsigned'
drivers/gpu/drm/i915/i915_drv.h|712 col 19| warning: dubious bitfield without explicit `signed' or `unsigned'

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:45 -07:00
Chris Wilson 2dafb1e082 drm/i915: Propagate error from i915_gem_object_flush_gpu_write_domain()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:44 -07:00
Chris Wilson 96b099fd6d drm/i915: Propagate error from drm_vblank_get() during page-flipping.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:44 -07:00
Chris Wilson 5f35308bab drm/i915: Propagate error from drm_install_irq() during EnterVT
Simple fix for error propagation along the old UMS path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:44 -07:00
Nicolas Kaiser 7aa69d2ee7 drm/i915: Typo in #define
checkpatch complains about this define:

WARNING: space prohibited between function name and open parenthesis '('
+#define   GEN6_RENDER TIMEOUT_COUNTER_EXPIRED		(1 << 6)

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:44 -07:00
Zhao Yakui b52eb4dcab drm/i915: Add frame buffer compression support on Ironlake mobile
About 0.2W power can be saved on one HP laptop.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:44 -07:00
Zhao Yakui c936f44d1b drm/i915: Calculate cursor watermark under non-SR state for Ironlake
The hardware team suggest that the "large buffer" method should be
used to calculate the cursor watermark under non-SR state as well,
which is to avoid the flicker when FBC is enabled on Ironlake.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:43 -07:00
Zhao Yakui 4fe5e61180 drm/i915: Apply self-refresh watermark calculation for cursor plane
In SR mode cursor plane watermark calculation uses same formula
like display plane. This one fixes the case for 965G and G45.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:43 -07:00
Zhao Yakui 1b07e04e9c drm/i915: Fix fifo size for self-refresh watermark on 965G
The total self-refresh fifo entry size for display plane is 512
instead of 128 for 965G. Also fix WM value mask for 965G.

About 1.0W power can be saved on one T61 laptop after the self-refresh
watermark is configured correctly.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhenyu wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:43 -07:00
Zhao Yakui fa143215b1 drm/i915: Fix watermark calculation in self-refresh mode
For self-refresh mode WM calculation's "line time" should use
mode's htotal instead of hdisplay. "surface width" is the hdisplay
for display plane and 64 for cursor plane.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:43 -07:00
Zhao Yakui 36e83a187c drm/i915: Add the support of eDP on DP-D for Ibex/CPT
This one adds support for eDP that connected on PCH DP-D port
instead of CPU DP-A port, and only DP-D port could be used for eDP.

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

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Jan-Hendrik Zab <jan@jhz.name>
Tested-by: Templar <templar@rshc.de>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:43 -07:00
Jesse Barnes d874bcff79 drm/i915: remove duplicate PIPE*STAT bit definitions
Having two sets has made me think I caught a bug more than once now.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:42 -07:00
Jesse Barnes e25e660109 drm/i915: remove unused vblank_enable var from i915_driver_irq_handler
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:42 -07:00
Chris Wilson 43b27f40eb drm/i915: Explosion following OOM in do_execbuffer.
Oops, when merging the extra details following an OOM, I missed that
driver_private is now NULL and the correct way to convert from the
drm_gem_object into the drm_i915_gem_object is to use to_intel_bo().

BUG: unable to handle kernel NULL pointer dereference at 00000069
IP: [<c11a4a02>] i915_gem_do_execbuffer+0x71f/0xbb6
*pde = 00000000
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/virtual/vc/vcsa3/uevent

Pid: 10993, comm: X Not tainted 2.6.35-rc2+ #67 /
EIP: 0060:[<c11a4a02>] EFLAGS: 00213202 CPU: 0
EIP is at i915_gem_do_execbuffer+0x71f/0xbb6
EAX: f647e8a8 EBX: 00000000 ECX: 00000003 EDX: 00000000
ESI: 00424000 EDI: 00000000 EBP: f6508e48 ESP: f6508dd4
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process X (pid: 10993, ti=f6508000 task=f6432880 task.ti=f6508000)
Stack:
 f6508de0 f7130000 00000001 00000000 00000000 f647e8a8 00000000 f64f8480
<0> f7974414 00000000 00000006 00000000 00000000 f6578000 00000008 00000006
<0> f6797880 00400000 00000000 ffffffe4 f7974400 000000d0 000000d0 000001c0
Call Trace:
 [<c11a4f3a>] ? i915_gem_execbuffer2+0xa1/0xe7
 [<c118ab96>] ? drm_ioctl+0x22c/0x2fa
 [<c11a4e99>] ? i915_gem_execbuffer2+0x0/0xe7
 [<c107e88c>] ? do_sync_read+0x8f/0xca
 [<c1088cbd>] ? vfs_ioctl+0x2c/0x96
 [<c118a96a>] ? drm_ioctl+0x0/0x2fa
 [<c10891f4>] ? do_vfs_ioctl+0x429/0x45a
 [<c107e5c9>] ? fsnotify_access+0x54/0x5f
 [<c107ee1c>] ? vfs_read+0x9a/0xae
 [<c1089258>] ? sys_ioctl+0x33/0x4d
 [<c1002610>] ? sysenter_do_call+0x12/0x26
Code: d0 89 4d c4 31 c9 89 45 d8 eb 44 8b 45 cc 8b 14 88 8b 42 50 89 45
bc 8b 45 a0 8b 52 38 89 55 d0 31 d2 f6 40 20 01 74 0d 8b 55 bc <f6> 42
69 30 0f 95 c2 0f b6 d2 8b 45 d0 c7 45 d4 00 00 00 00 89
EIP: [<c11a4a02>] i915_gem_do_execbuffer+0x71f/0xbb6 SS:ESP 0068:f6508dd4
CR2: 0000000000000069
---[ end trace 3f1d514b34d39381 ]---

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:42 -07:00
Thomas Bächler 0544edfdc3 gpu/drm/i915: Add a blacklist to omit modeset on LID open
On some machines (currently only the Toshiba Tecra A11 is known), the GPU
locks up when modeset is forced on LID open. This patch adds a new DMI
blacklist and omits modesetting for all matches.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15550

Signed-off-by: Thomas Bächler <thomas@archlinux.org>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-08-01 19:03:41 -07:00
Dave Airlie ab9e1f5966 drm/radeon: add basic zmask/hiz support (v4)
This interface allows userspace to request hyperz support, it probably
needs more locking, and really reporting that you can have hyperz is racy
since someone else might get it before you do.

v2: modify so we pass 0 valued packets to let DDX/r300c keep working.
also fixed incorrect 0x4f1c reference.

v3: fixup zb_bw_cntl so older drivers keep working

v4: add locking, fixup SC_HYPERZ_EN - patch stream to disable hiz

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 11:54:26 +10:00
Dave Airlie d9fdaafbe9 drm/radeon/kms: move a bunch of modesetting debug to correct debug usage.
This migrates a bunch of DRM_DEBUG->DRM_DEBUG_KMS so we can get more modesetting related info without all the other ioctl handling easily.

Also the PM code moves to DRM_DEBUG_DRIVER mostly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:47:07 +10:00
Dave Airlie d6486813d2 Merge remote branch 'nouveau/for-airlied' of ../drm-nouveau-next into drm-core-next
* 'nouveau/for-airlied' of ../drm-nouveau-next: (77 commits)
  drm/nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout()
  drm/nv50: fix some not-error error messages
  drm/nouveau: introduce gpio engine
  drm/nv50: correct wait condition for instmem flush
  drm/nouveau: Fix TV-out detection on unposted cards lacking a usable DCB table.
  drm/nouveau: Get rid of the remaining VGA CRTC locking.
  drm/nouveau: Move display init to a new nouveau_engine.
  drm/nouveau: Put back the old 2-messages I2C slave test.
  drm/nouveau: Reset AGP before running the init scripts.
  drm/nv30: Init the PFB+0x3xx memory timing regs.
  drm/nouveau: disable hotplug detect around DP link training
  drm/nv50: add function to control GPIO IRQ reporting
  drm/nouveau: add nv_mask register accessor
  drm/nouveau: fix build without CONFIG_ACPI
  drm/nouveau: Reset CRTC owner to 0 before BIOS init.
  drm/nouveau: No need to lock/unlock the VGA CRTC regs all the time.
  drm/nouveau: Remove useless CRTC_OWNER logging.
  drm/nouveau: Add some generic I2C gadget detection code.
  drm/i2c/ch7006: Don't assume that the specified config points to static memory.
  drm/nv04-nv3x: Implement init-compute-mem.
  ...

Conflicts:
	drivers/gpu/drm/nouveau/nouveau_bios.c
2010-08-02 10:31:47 +10:00
Dave Airlie 7827627107 Merge branch 'drm-radeon-next' of ../drm-radeon-next into drm-core-next
* 'drm-radeon-next' of ../drm-radeon-next: (333 commits)
  drm/radeon/kms: trivial code style fixes for audio
  drm/radeon: remove viewport transform from r6xx/r7xx blit emit
  drm/radeon: group r6xx/r7xx newly sequential blit state
  drm/radeon: reorder r6xx/r7xx blit state emit to make more regs sequential
  drm/radeon: r6xx/r7xx move vport clipping to a single packet
  drm/radeon: group r6xx/r7xx sequential blit state
  drm/radeon: remove duplicate state emit in r6xx/r7xx blit
  drm/radeon: add comments to r6xx/r7xx blit state
  drm/radeon/kms/r7xx: add workaround for hw issue with HDP flush
  drm/radeon/kms: remove rs4xx gart limit
  drm: radeon: fix sign bug
  drm/radeon/kms: check/restore sanity before doing anything else with GPU.
  drm/radeon: fall back to GTT if bo creation/validation in VRAM fails.
  drm/radeon/kms: add ioport register access
  drm/radeon/kms: enable HDMI audio on RS600/RS690/RS740
  drm/radeon/kms: track audio engine state, do not use not setup timer
  drm/radeon/kms/r6xx+: add query for tile config (v2)
  drm/radeon/kms: fix CS alignment checking for tiling (v2)
  drm/radeon/kms: add tiling support to the cs checker for r6xx/r7xx
  drm/radeon/kms: Add crtc tiling setup support for evergreen
  ...
2010-08-02 10:24:46 +10:00
Francisco Jerez e190bfe568 drm: Import driver for the sil164 I2C TMDS transmitter.
sil164 transmitters are used for DVI outputs on Intel/nvidia and ATI setups.

So far only nouveau can use this driver.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Patrice Mandin <patmandin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:21:13 +10:00
Nicolas Kaiser a7b98b6748 drm/sis: fixed brace and spacing coding style issues
Fixed brace and spacing coding style issues.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:18:17 +10:00
Nicolas Kaiser bc5e9d6a22 drm/r128: fixed brace and spacing coding style issues
Fixed brace and spacing coding style issues.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:17:48 +10:00
Nicolas Kaiser f2b2cb790e drm/mga: fixed brace, macro and spacing coding style issues
Fixed brace, macro and spacing coding style issues.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:17:36 +10:00
Nicolas Kaiser 58c1e85af3 drm/via: fixed coding style issues, simplified return
Fixed brace, macro and spacing coding style issues.
Simplified
 -if (ret) return ret;
 -return 0;
 +return ret;

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:17:23 +10:00
Rafał Miłecki 219de62a16 drm/radeon/kms: trivial code style fixes for audio
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:17:10 +10:00
Nicolas Kaiser 5649911316 drm/i830: fixed brace and spacing coding style issues
Fixed brace and spacing coding style issues.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:15:54 +10:00
Nicolas Kaiser aca791c28a drm/i810: fixed coding style issues
Fixed brace, macro and spacing coding style issues, and a C99 comment.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:15:41 +10:00
Chris Wilson 6e35023ffa drm: Free devname along with master->unique
The device name is tightly coupled and created at the same time as the
master->unique address, so we need to free it with the master. Currently
we overwrite it each time we create a new master:

unreferenced object 0xe32c54b0 (size 32):
  comm "Xorg", pid 1455, jiffies 4294721798 (age 3196.879s)
  hex dump (first 32 bytes):
    69 39 31 35 40 70 63 69 3a 30 30 30 30 3a 30 30  i915@pci:0000:00
    3a 30 32 2e 30 00 6b 6b 6b 6b 6b 6b 6b 6b 6b a5  :02.0.kkkkkkkkk.
  backtrace:
    [<c04e5657>] create_object+0x124/0x1f1
    [<c07cf0f0>] kmemleak_alloc+0x4c/0x90
    [<c04db84c>] __kmalloc+0x155/0x175
    [<f8316665>] drm_setversion+0x11d/0x1b1 [drm]
    [<f83148d4>] drm_ioctl+0x29a/0x356 [drm]
    [<c04f27c4>] vfs_ioctl+0x33/0x91
    [<c04f31cf>] do_vfs_ioctl+0x46b/0x496
    [<c04f3240>] sys_ioctl+0x46/0x66
    [<c040325f>] sysenter_do_call+0x12/0x38
    [<ffffffff>] 0xffffffff

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:14:30 +10:00
Chris Wilson ddd3d069c0 drm: Free the idr layers before calling idr_destroy()
/* A typical clean-up sequence for objects stored in an idr tree, will
 * use idr_for_each() to free all objects, if necessary, then
 * idr_remove_all() to remove all ids, and idr_destroy() to free
 * up the cached idr_layers.
 */

We were missing the vital idr_rmove_all() step and so were leaking
the used layers for every dri client:

unreferenced object 0xf32133c0 (size 148):
  comm "plymouthd", pid 131, jiffies 4294678490 (age 2308.030s)
  hex dump (first 32 bytes):
    04 00 00 00 00 00 00 00 00 00 00 00 00 40 19 f3  .............@..
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<c04e5657>] create_object+0x124/0x1f1
    [<c07cf100>] kmemleak_alloc+0x4c/0x90
    [<c04db6a9>] kmem_cache_alloc+0xee/0x13c
    [<c05c3d25>] idr_pre_get+0x24/0x61
    [<f8315c9c>] drm_gem_handle_create+0x27/0x7f [drm]
    [<f89925b2>] i915_gem_create_ioctl+0x4f/0x71 [i915]
    [<f83148ac>] drm_ioctl+0x272/0x356 [drm]
    [<c04f27c4>] vfs_ioctl+0x33/0x91
    [<c04f31cf>] do_vfs_ioctl+0x46b/0x496
    [<c04f3240>] sys_ioctl+0x46/0x66
    [<c040325f>] sysenter_do_call+0x12/0x38
    [<ffffffff>] 0xffffffff

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15803

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:13:56 +10:00
Kulikov Vasiliy 05991110cf drm/nouveau: set TASK_(UN)INTERRUPTIBLE before schedule_timeout()
set_current_state() is called only once before the first iteration.
After return from schedule_timeout() current state is TASK_RUNNING. If
we are going to wait again, set_current_state() must be called.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-08-02 10:12:26 +10:00
Chris Wilson c39721c775 drm/vmgfx: operation on ‘par->dirty.y1’ may be undefined
Trivial fix to set y1 = y2 = 0.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:12:21 +10:00
Alex Deucher b417cc117a drm/radeon: remove viewport transform from r6xx/r7xx blit emit
We aren't using it, so no need.  Save additional dwords.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:07:48 +10:00
Alex Deucher 43a7d2d104 drm/radeon: group r6xx/r7xx newly sequential blit state
group state that is emitted sequentially into fewer packets.
This saves a number of dwords.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:07:39 +10:00
Alex Deucher d0623a3e74 drm/radeon: reorder r6xx/r7xx blit state emit to make more regs sequential
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:07:24 +10:00
Alex Deucher 363c6a16e3 drm/radeon: r6xx/r7xx move vport clipping to a single packet
Saves lots of dwords in blit emit

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:07:09 +10:00
Alex Deucher eb544433c3 drm/radeon: group r6xx/r7xx sequential blit state
group state that is emitted sequentially into fewer packets.
This saves a number of dwords.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:06:55 +10:00
Alex Deucher 7fc8878c33 drm/radeon: remove duplicate state emit in r6xx/r7xx blit
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:06:44 +10:00
Alex Deucher 8c119e9c3b drm/radeon: add comments to r6xx/r7xx blit state
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:06:32 +10:00
Alex Deucher 812d046915 drm/radeon/kms/r7xx: add workaround for hw issue with HDP flush
Use of HDP_*_COHERENCY_FLUSH_CNTL can cause a hang in certain
situations.  Add workaround.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:06:18 +10:00
Alex Deucher 833ee5c4ab drm/radeon/kms: remove rs4xx gart limit
We used to limit the rs4xx gart aperture to 32 MB, but I suspect
that was due to not meeting the alignment requirements of the
aperture.  This patch should only be applied after:
"drm/radeon/kms: fix gtt MC base alignment on rs4xx/rs690/rs740 asics"
has been applied.

This patch should probably soak for a bit in d-r-t.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:06:01 +10:00
Dave Airlie d656ae53f6 Merge tag 'v2.6.35-rc6' into drm-radeon-next
Need this to avoid conflicts with future radeon fixes
2010-08-02 10:05:24 +10:00
Dan Carpenter 167ffc44ca drm: radeon: fix sign bug
The "error" variable is unsigned so it's never less than zero.  I
changed it to check if (freq < current_freq) directly.

"best_error" is also unsigned so "best_error - 100" could be a large
number instead of a negative.  Since "error" is unsigned it is never
less than a negative and so the cases where "best_error" is less than or
equal to 100 are false.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:10 +10:00
Dave Airlie 4c712e6c7e drm/radeon/kms: check/restore sanity before doing anything else with GPU.
On systems using kexec, the new kernel is booted straight from the old kernel, without any warning to the graphics driver. So the GPU is basically left as-is in a running state, however the CPU side is completly reset.

Without stating the saneness of anyone using kexec on live systems, we should at least try not to crash the GPU. This patch resets 3 registers to 0 that could cause bad things to happen to the running system.

This allows kexec to work on a Power6/RN50 system.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:09 +10:00
Michel Dänzer e376573f72 drm/radeon: fall back to GTT if bo creation/validation in VRAM fails.
This fixes a problem where on low VRAM cards we'd run out of space for validation.

[airlied: Tested on my M7, Thinkpad T42, compiz works with no problems.]

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:08 +10:00
Alex Deucher 351a52a241 drm/radeon/kms: add ioport register access
This is required for the NB_MISC regs on rs780/rs880 which
means HDMI/DVI/DP ports using PCIEPHY won't work without
it. It might also help with s/r (asic init) issues on other
atombios cards.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=28774
and similar issues reported by Alberto Milone.

[airlied: Squash io fix patch]

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Tested-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:07 +10:00
Rafał Miłecki fe50ac78a6 drm/radeon/kms: enable HDMI audio on RS600/RS690/RS740
We will need method of selecting encoder that should receive HDMI block. For
now we assign HDMI block to first enabled encoder. Hopefully there are not many
RS6x0 chips with two digital encoders.

[airlied: add RS740 checks as per Alex suggestion.]

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:06 +10:00
Rafał Miłecki 7eea7e9eea drm/radeon/kms: track audio engine state, do not use not setup timer
This is needed to enable audio support on devices using polling. In case user
decides to disable audio (module parameter) we still will try to use timer in
r600_audio_enable_polling. This would lead to BUG in kernel/timer.c.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:06 +10:00
Alex Deucher e7aeeba6a8 drm/radeon/kms/r6xx+: add query for tile config (v2)
Userspace needs this information to access tiled
buffers via the CPU.

v2: rebased on evergreen accel changes

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:05 +10:00
Alex Deucher 40e2a5c15d drm/radeon/kms: fix CS alignment checking for tiling (v2)
Covers depth, cb, and textures. Hopefully I got this right.

v2: - fix bugs:
      https://bugs.freedesktop.org/show_bug.cgi?id=28327
      https://bugs.freedesktop.org/show_bug.cgi?id=28381
    - use ALIGNED(), IS_ALIGNED() macros

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:04 +10:00
Alex Deucher 7f81337720 drm/radeon/kms: add tiling support to the cs checker for r6xx/r7xx
Check for relocs for DB_DEPTH_INFO, CB_COLOR*_INFO, and texture
resources.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:03 +10:00
Alex Deucher 97d6632853 drm/radeon/kms: Add crtc tiling setup support for evergreen
Needed for scanning out of a tiled buffer.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:02 +10:00
Alex Deucher 40c4ac1c19 drm/radeon/kms: Add crtc tiling setup support for r6xx/r7xx
Needed for scanning out of a tiled buffer.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:01 +10:00
Alex Deucher 21a8122ad3 drm/radeon/kms: add support for internal thermal sensors (v3)
rv6xx/rv7xx/evergreen families supported; older asics did
not have an internal thermal sensor.

Note, not all oems use the internal thermal sensor, so it's
only exposed in cases where it is used.

Note also, that most laptops use an oem specific ACPI solution for
GPU thermal information rather than using the internal thermal
sensor directly.

v2: export millidegrees celsius, use hwmon device properly.
v3: fix Kconfig

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 10:00:00 +10:00
Alberto Milone d7a2952f1a drm/radeon: Add support for the ATIF ACPI method to the radeon driver
By calling the ATIF method in the radeon driver we can make sure
that hotkeys such as the video switch key emit ACPI events when
pressed.

agd5f: fix warning

Signed-off-by: Alberto Milone <alberto.milone@canonical.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 09:59:59 +10:00
Alex Deucher 9bd7ef5f5a drm/radeon/kms/atom: bump atom loop timeout from 1 sec to 5 secs
Some tables have delays that can cause the timeout to hit
even when not intended.

Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=27744
and related bugs.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 09:59:58 +10:00
Alex Deucher 4ce9198ecf drm/radeon/kms: minor driver cleanups
- Make the logic in r100_pll_errata_after_index() match the other
errata functions
- Use rdev->family rather than rdev->flags & RADEON_FAMILY_MASK for kms
- replace rn50 check using ids with ASIC_IS_RN50 convenience macro

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-08-02 09:59:57 +10:00
Adam Jackson a4967de6cb drm/edid: Fix the HDTV hack sync adjustment
We're adjusting horizontal timings only here, moving vsync was just a
slavish translation of a typo in the X server.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-29 16:14:43 +10:00
Daniel J Blueman 12e27be852 drm/radeon/kms: fix radeon mid power profile reporting
Fix incorrectly reporting 'default' power profile, when it is set to 'mid'.

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-07-29 15:22:35 +10:00
Jesse Barnes 5620ae29f1 drm/i915: make sure we shut off the panel in eDP configs
Fix error from the last pull request.  Making sure we shut the panel off
is more correct and saves power.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-07-26 15:34:16 -07:00
Linus Torvalds 225aa01173 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel:
  drm/i915: add pipe A force quirks to i915 driver
  drm/i915: Fix panel fitting regression since 734b4157
  drm/i915: fix deadlock in fb teardown
  drm/i915: don't free non-existent compressed llb on ILK+
  agp/intel: Use the correct mask to detect i830 aperture size.
  drm/i915: disable FBC when more than one pipe is active
  drm/i915: Use the correct scanout alignment for fbcon.
  drm/i915: make sure eDP panel is turned on
  drm/i915: add PANEL_UNLOCK_REGS definition
  drm/i915: Make G4X-style PLL search more permissive
  drm/i915: Clear any existing dither mode prior to enabling spatial dithering
  drm/i915: handle shared framebuffers when flipping
  drm/i915: Explosion following OOM in do_execbuffer.
  gpu/drm/i915: Add a blacklist to omit modeset on LID open
2010-07-26 13:04:25 -07:00
Jesse Barnes b690e96cf9 drm/i915: add pipe A force quirks to i915 driver
Ported over from the old UMS list.  Unfortunately they're still
necessary especially on older laptop platforms.

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

Tested-by: Xavier <shiningxc@gmail.com>
Tested-by: Diego Escalante Urrelo <diegoe@gnome.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 12:00:43 -07:00
Chris Wilson 0cc4d4300c drm/i915: Fix panel fitting regression since 734b4157
The crtc mode fixup is run after the encoders adjust the mode to fit on
their output, so don't reset the mode!

Fixes:

  Bug 29057 - display corruption under 800x600 on netbook
              (1024x600) with 'Full Aspect' scaling
  https://bugs.freedesktop.org/show_bug.cgi?id=29057

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Xun Fang <xunx.fang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 12:00:30 -07:00
Jesse Barnes fbd41a7e58 drm/i915: fix deadlock in fb teardown
At module unload time we'll tear down the fbdev state.  We do so under
the struct mutex, so we shouldn't try to use the unlocked variant of
the GEM object unreference function or we may deadlock.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:46 -07:00
Jesse Barnes aebf0dafee drm/i915: don't free non-existent compressed llb on ILK+
We should only free the compressed llb if we allocated it in the first
place otherwise we'll panic at unload time.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:07 -07:00
Jesse Barnes 9c928d168d drm/i915: disable FBC when more than one pipe is active
We're really supposed to do this to avoid trouble with underflows when
multiple planes are active.

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

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: fangxun <xunx.fang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:06 -07:00
Chris Wilson 127bd2ac91 drm/i915: Use the correct scanout alignment for fbcon.
This fixes a potential modesetting error during boot with plymouth on
Broadwater and Crestline introduced with 9df47c. The framebuffer was
hard-coding an alignment of 64K, but the modesetting code required the
documented alignment of 128K. The result was that we would attempt to
unbind the pinned fbcon buffer, triggering an ERROR and ultimately
failing the mode change.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:05 -07:00
Jesse Barnes 9934c13298 drm/i915: make sure eDP panel is turned on
When enabling the eDP port, we need to make sure the panel is turned on
after training the link.  If we don't, it likely won't come back after
suspend or may not come up at all.

For unknown reasons, unlocking the panel regs before initiating a power
on sequence is necessary.  There are known bugs in the PCH panel
sequencing logic, apparently this is one possible workaround.

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

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: "Paulo J. S. Silva" <pjssilva@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:04 -07:00
Jesse Barnes 4a655f0431 drm/i915: add PANEL_UNLOCK_REGS definition
In some cases, unlocking the panel regs is safe and can help us avoid a
flickery, full mode set sequence.  So define the unlock key and use it.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:03 -07:00
Adam Jackson 6ba770dc5c drm/i915: Make G4X-style PLL search more permissive
Fixes an Ironlake laptop with a 68.940MHz 1280x800 panel and 120MHz SSC
reference clock.

More generally, the 0.488% tolerance used before is just too tight to
reliably find a PLL setting.  I extracted the search algorithm and
modified it to find the dot clocks with maximum error over the valid
range for the given output type:

http://people.freedesktop.org/~ajax/intel_g4x_find_best_pll.c

This gave:

Worst dotclock for Ironlake DAC refclk is 350000kHz (error 0.00571)
Worst dotclock for Ironlake SL-LVDS refclk is 102321kHz (error 0.00524)
Worst dotclock for Ironlake DL-LVDS refclk is 219642kHz (error 0.00488)
Worst dotclock for Ironlake SL-LVDS SSC refclk is 84374kHz (error 0.00529)
Worst dotclock for Ironlake DL-LVDS SSC refclk is 183035kHz (error 0.00488)
Worst dotclock for G4X SDVO refclk is 267600kHz (error 0.00448)
Worst dotclock for G4X HDMI refclk is 334400kHz (error 0.00478)
Worst dotclock for G4X SL-LVDS refclk is 95571kHz (error 0.00449)
Worst dotclock for G4X DL-LVDS refclk is 224000kHz (error 0.00510)

Signed-off-by: Adam Jackson <ajax@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 11:27:02 -07:00
Chris Wilson a392a10367 drm/i915: Clear any existing dither mode prior to enabling spatial dithering
We cannot the initial configuration set by the BIOS not to have a dither
mode enabled which conflicts with our enabling the Spatial Temporal 1
dither mode for PCH. In particular, the BIOS may either enable temporal
dithering or the Spatial Temporal 2 with the result that we enable pure
temporal dithering. Temporal dithering looks bad and is perceived as a
flicker.

Fixes:

  Bug 29248 - [Arrandale] Annoying flicker on internal panel, goes away
              after suspend to RAM
  https://bugs.freedesktop.org/show_bug.cgi?id=29248

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 10:46:07 -07:00
Jesse Barnes be9a3dbf65 drm/i915: handle shared framebuffers when flipping
If a framebuffer is shared across CRTCs, the x,y position of one of them
is likely to be something other than the origin (e.g. for extended
desktop configs).  So calculate the offset at flip time so such
configurations can work.

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

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Thomas M. <tmezzadra@gmail.com>
Tested-by: fangxun <xunx.fang@intel.com>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-07-26 10:45:55 -07:00
Ben Skeggs 0ccb3a75fe drm/nv50: fix some not-error error messages
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:44:02 +10:00
Ben Skeggs ee2e013131 drm/nouveau: introduce gpio engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:57 +10:00
Ben Skeggs bf563a6b7c drm/nv50: correct wait condition for instmem flush
Reported-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:52 +10:00
Francisco Jerez c04c5b1da1 drm/nouveau: Fix TV-out detection on unposted cards lacking a usable DCB table.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:48 +10:00
Francisco Jerez 946fd35f88 drm/nouveau: Get rid of the remaining VGA CRTC locking.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:43 +10:00
Francisco Jerez c88c2e0631 drm/nouveau: Move display init to a new nouveau_engine.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:36 +10:00
Francisco Jerez f1feda70b5 drm/nouveau: Put back the old 2-messages I2C slave test.
I was hoping we could detect I2C devices at a given address without
actually writing data into them, but apparently some DDC slaves get
confused with 0-bytes transactions. Put the good old test back.

Reported-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:31 +10:00
Francisco Jerez e04d8e829d drm/nouveau: Reset AGP before running the init scripts.
BIOS scripts usually make an attempt to reset the AGP controller,
however on some nv4x cards doing it properly involves switching FW off
and on: if we do that without updating the AGP bridge settings
accordingly (e.g. with the corresponding calls to agp_enable()) we
will be locking ourselves out of the card MMIO space. Do it from
nouveau_mem_reset_agp() before the init scripts are executed.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:25 +10:00
Francisco Jerez 8bded18955 drm/nv30: Init the PFB+0x3xx memory timing regs.
Fixes the randomly flashing vertical lines seen on some nv3x after a
cold-boot.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:15 +10:00
Ben Skeggs b01f06085e drm/nouveau: disable hotplug detect around DP link training
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:43:06 +10:00
Ben Skeggs d0875edd93 drm/nv50: add function to control GPIO IRQ reporting
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:59 +10:00
Ben Skeggs 49eed80ad0 drm/nouveau: add nv_mask register accessor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:55 +10:00
Ben Skeggs 5620ba4680 drm/nouveau: fix build without CONFIG_ACPI
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:51 +10:00
Francisco Jerez 45d60d1bfc drm/nouveau: Reset CRTC owner to 0 before BIOS init.
Fixes suspend+multihead on some boards that also use BIOS scripts for
modesetting.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:47 +10:00
Francisco Jerez 03cd06ca90 drm/nouveau: No need to lock/unlock the VGA CRTC regs all the time.
Locking only makes sense in the VBIOS parsing code as it's executed
before CRTC init.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:42 +10:00
Francisco Jerez d06ab841d1 drm/nouveau: Remove useless CRTC_OWNER logging.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:34 +10:00
Francisco Jerez 6d416d80f7 drm/nouveau: Add some generic I2C gadget detection code.
Clean up and move the external TV encoder detection code to
nouveau_i2c.c, it's also going to be useful for external TMDS and DDC
detection.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:30 +10:00
Francisco Jerez 6d6a413aa2 drm/i2c/ch7006: Don't assume that the specified config points to static memory.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:25 +10:00
Francisco Jerez 67eda20e6b drm/nv04-nv3x: Implement init-compute-mem.
Init-compute-mem was the last piece missing for nv0x-nv3x card
cold-booting. This implementation is somewhat lacking but it's been
reported to work on most chipsets it was tested in. Let me know if it
breaks suspend to RAM for you.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Patrice Mandin <patmandin@gmail.com>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Tested-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:21 +10:00
Francisco Jerez 3c7066bca9 drm/nouveau: Add some PFB register defines.
Also collect all the PFB registers in a single place and remove some
duplicated definitions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:13 +10:00
Francisco Jerez 20b2400592 drm/nouveau: Add another Zotac FX5200 TV-out quirk.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:09 +10:00
Francisco Jerez a5afb7758f drm/nouveau: Don't pick an interlaced mode as the panel native mode.
Rescaling interlaced modes isn't going to work correctly, and even if
it did, come on, interlaced flat panels? are you pulling my leg?

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:04 +10:00
Francisco Jerez eae6192a9d drm/nouveau: Fix a sparse warning.
It doesn't like variable length arrays.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:42:00 +10:00
Ben Skeggs c58754703c drm/nv50: fix regression that break LVDS in some places
A previous commit started additionally using the SOR link when trying to
match the correct output script.  However, we never fill in this field
for LVDS so we can never match a script at all.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:41:50 +10:00
Ben Skeggs a6ed76d7ff 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>
2010-07-26 11:41:45 +10:00
Ben Skeggs 03639b5038 drm/nouveau: remove quirk to fabricate DVI-A output on DCB 1.5 boards
There's a report of this quirk breaking modesetting on at least one board.
After discussion with Francisco Jerez, we've decided to remove it:

<darktama> it's not worth limiting the quirk to just where we know it can
           work?  i'm happy either way really :)
<curro> hmm, don't think so, most if not all DCB15 cards have just one DAC
<curro> and with that quirk there's no way to tell if the load comes from
        the VGA or DVI port

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Francisco Jerez <currojerez@riseup.net>
2010-07-26 11:41:41 +10:00
Ben Skeggs 734ee8357a drm/nv50: use correct PRAMIN flush register on original nv50
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-26 11:41:36 +10:00
Tejun Heo 991ea75cb1 drm: use workqueue instead of slow-work
Workqueue can now handle high concurrency.  Convert drm_crtc_helper to
use system_nrt_wq instead of slow-work.  The conversion is mostly
straight forward.  One difference is that drm_helper_hpd_irq_event()
no longer blocks and can be called from any context.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
2010-07-22 23:18:20 +02:00
Linus Torvalds 84d4db0e22 Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/radeon/kms: add quirk to make HP DV5000 laptop resume
  drm/radeon/kms: fix RADEON_INFO_CRTC_FROM_ID info ioctl
  Fix ttm_page_alloc.c build breakage
  drm/radeon/kms: fix legacy LVDS dpms sequence
  drm/radeon/kms: drop taking lock around crtc lookup.
2010-07-22 11:45:57 -07:00
Alex Deucher 52fa2bbc8e drm/radeon/kms: add quirk to make HP DV5000 laptop resume
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=29062

Reported-by:  Andres Cimmarusti <acimmarusti@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-22 14:13:52 +10:00
Alex Deucher 0baf2d8fe4 drm/radeon/kms: fix RADEON_INFO_CRTC_FROM_ID info ioctl
Return the crtc_id, not the counter value.  They are not
necessarily the same.

Cc: Jerome Glisse <glisse@freedesktop.org>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-22 10:03:55 +10:00
Luck, Tony d667865114 Fix ttm_page_alloc.c build breakage
The commit 1e8655f873
    drm/ttm: Fix build on architectures without AGP

looks at TTM_HAS_AGP before it has been set in ttm_bo_driver.h

Move the conditional inclusion of <asm/agp.h> *after* we have included
ttm_bo_driver.h

Signed-of-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-22 10:02:32 +10:00
Alex Deucher 15cb02c0a0 drm/radeon/kms: fix legacy LVDS dpms sequence
Add delay after turning off the LVDS encoder.

Fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=16389

Tested-by: Jan Kreuzer <kontrollator@gmx.de>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-22 10:01:40 +10:00
Dave Airlie 29508eb66b drm/radeon/kms: drop taking lock around crtc lookup.
We only add/remove crtcs at driver load, you cannot remove when
the GPU is running a CS packet since the fd is open, when
GPU hotplugging on radeons actually is needed all this locking
needs a review and I've started re-working kms core locking to deal
with this better. But for now avoid long delays in CS processing when
hotplug detect is happening in a different thread.

this fixes a regression introduced with hotplug detection.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-22 09:57:13 +10:00
Dave Chinner 567c7b0ede mm: add context argument to shrinker callback to remaining shrinkers
Add the shrinkers missed in the first conversion of the API in
commit 7f8275d0d6 ("mm: add context argument to
shrinker callback").

Signed-off-by: Dave Chinner <dchinner@redhat.com>
2010-07-21 15:33:01 +10:00
Linus Torvalds f4b23cc2d5 Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/r600: fix possible NULL pointer derefernce
  drm/radeon/kms: add quirk for ASUS HD 3600 board
  include/linux/vgaarb.h: add missing part of include guard
  drm/nouveau: Fix crashes during fbcon init on single head cards.
  drm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch
  drm/radeon/kms: fix shared ddc harder
  drm/i915: enable low power render writes on GEN3 hardware.
  drm/i915: Define MI_ARB_STATE bits
  vmwgfx: return -EFAULT if copy_to_user fails
  fb: handle allocation failure in alloc_apertures()
  drm: radeon: check kzalloc() result
  drm/ttm: Fix build on architectures without AGP
  drm/radeon/kms: fix gtt MC base alignment on rs4xx/rs690/rs740 asics
  drm/radeon/kms: fix possible mis-detection of sideport on rs690/rs740
  drm/radeon/kms: fix legacy tv-out pal mode
2010-07-20 18:29:25 -07:00
Alex Deucher 37f9003bd3 drm/radeon/kms/atom: add crtc disable function
Disables the crts as per dpms and also disables the ppll
associated with the crtc.  This should save additional power.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 11:27:21 +10:00
Chris Wilson 90c1efdd12 drm: Return EBUSY if the framebuffer is unbound when flipping.
It looks like there is a race condition between unbinding a framebuffer
on a hotplug event and user space trying to flip:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
IP: [<ffffffffa008c7d3>] intel_crtc_page_flip+0xc9/0x39c [i915]
PGD 114724067 PUD 1145bd067 PMD 0
Oops: 0000 [#1] SMP
Pid: 10954, comm: X Not tainted 2.6.35-rc5_stable_20100714+ #1
P5Q-EM/P5Q-EM
RIP: 0010:[<ffffffffa008c7d3>]  [<ffffffffa008c7d3>]
intel_crtc_page_flip+0xc9/0x39c [i915]
RSP: 0018:ffff880114927cc8  EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff88012df48320 RCX: ffff88010c945600
RDX: ffff880001a109c8 RSI: ffff88010c945840 RDI: ffff88012df48320
RBP: ffff880114927d18 R08: ffff88012df48280 R09: ffff88012df48320
R10: 0000000003c2e0b0 R11: 0000000000003246 R12: ffff88010c945840
R13: ffff88012df48000 R14: 0000000000000060 R15: ffff88012dbb8000
FS:  00007f9e6078e830(0000) GS:ffff880001a00000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000058 CR3: 00000001177a8000 CR4: 00000000000406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process X (pid: 10954, threadinfo ffff880114926000, task
ffff88012a4a1690)
Stack:
 ffff88010c945600 ffff880115b176c0 ffff88012db10000 0000000000000246
<0> fffffff40006101c ffff88010c945600 00000000ffffffea ffff88010c945600
<0> ffff88012df48320 ffff88011b4b6780 ffff880114927d78 ffffffffa003bd0e
Call Trace:
 [<ffffffffa003bd0e>] drm_mode_page_flip_ioctl+0x1bc/0x214 [drm]
 [<ffffffffa00311fc>] drm_ioctl+0x25e/0x35e [drm]
 [<ffffffffa003bb52>] ? drm_mode_page_flip_ioctl+0x0/0x214 [drm]
 [<ffffffff810f1c3c>] vfs_ioctl+0x2a/0x9e
 [<ffffffff810f227e>] do_vfs_ioctl+0x531/0x565
 [<ffffffff810f2307>] sys_ioctl+0x55/0x77
 [<ffffffff810e56d6>] ? sys_read+0x47/0x6f
 [<ffffffff81002a2b>] system_call_fastpath+0x16/0x1b
Code: 45 d4 f4 ff ff ff 0f 84 e0 02 00 00 48 8b 4d b0 49 8d 9d 20 03 00 00 48
89 df 49 89 4c 24 38 49 8b 07 49 89 44 24 20 49 8b 47 20 <48> 8b 40 58 49 c7 04
24 00 00 00 00 49 c7 44 24 18 a9 a5 08 a0
RIP  [<ffffffffa008c7d3>] intel_crtc_page_flip+0xc9/0x39c [i915]
 RSP <ffff880114927cc8>
CR2: 0000000000000058

References:

  Bug 28811 - [page-flipping] GPU hang when modeset after unplugging
              another monitor (under compiz)
  https://bugs.freedesktop.org/show_bug.cgi?id=28811

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 11:26:07 +10:00
Ben Skeggs 92897b5c66 drm: add "auto" dithering method
There's no convenient/reliable way for drivers to both obey the dithering
mode property, and to be able to attempt to provide a good default in all
cases.

This commit adds an "auto" method to the property which drivers can default
to if they wish, whilst still allowing the user to override the choice as
they do now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 11:19:45 +10:00
Alex Deucher c42750b026 drm/r600: fix possible NULL pointer derefernce
Reported-by: Alexander Y. Fomichev <git.user@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 10:29:32 +10:00
Alex Deucher e153b70b89 drm/radeon/kms: add quirk for ASUS HD 3600 board
Connector is actually DVI rather than HDMI.

Reported-by: trapDoor <trapdoor6@gmail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 09:51:20 +10:00
Francisco Jerez 7173aeff02 drm/nouveau: Fix crashes during fbcon init on single head cards.
this fixes a regression since the fbcon rework.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 08:40:05 +10:00
Ben Skeggs 14d7ec11d1 drm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch
On nv50 it became impossible to attempt a PCI ROM shadow of the VBIOS,
which will break some setups.

This patch also removes the different ordering of shadow methods for
pre-nv50 chipsets.  The reason for the different ordering was paranoia,
but it should hopefully be OK to try shadowing PRAMIN first.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 08:39:48 +10:00
Alex Deucher 42f14c4b45 drm/radeon/kms: fix shared ddc harder
This fixes a regression caused by b2ea4aa67b
due to the way shared ddc with multiple digital connectors was handled.

You generally have two cases where DDC lines are shared:
- HDMI + VGA
- HDMI + DVI-D

HDMI + VGA is easy to deal with because you can check the EDID for the
to see if the attached monitor is digital.  A shared DDC line with two
digital connectors is more complex.  You can't use the hdmi bits in the
EDID since they may not be there with DVI<->HDMI adapters.  In this case
all we can do is check the HPD pins to see which is connected as we have
no way of knowing using the EDID.

Reported-by: trapdoor6@gmail.com
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-21 08:37:25 +10:00
Kulikov Vasiliy 04ad327f27 drm: i915: use ARRAY_SIZE
Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-07-20 17:14:25 +02:00
Kulikov Vasiliy 3c58141165 drm: drm_edid: use ARRAY_SIZE
Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-07-20 17:05:47 +02:00
Dave Airlie 944001201c drm/i915: enable low power render writes on GEN3 hardware.
A lot of 945GMs have had stability issues for a long time, this manifested as X hangs, blitter engine hangs, and lots of crashes.

one such report is at:
https://bugs.freedesktop.org/show_bug.cgi?id=20560

along with numerous distro bugzillas.

This only took a week of digging and hair ripping to figure out.

Tracked down and tested on a 945GM Lenovo T60,
previously running
x11perf -copypixwin500
or
x11perf -copywinpix500
repeatedly would cause the GPU to wedge within 4 or 5 tries, with random busy bits set.

After this patch no hangs were observed.

cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-20 15:24:18 +10:00
Keith Packard 45503ded96 drm/i915: Define MI_ARB_STATE bits
The i915 memory arbiter has a register full of configuration
bits which are currently not defined in the driver header file.

Signed-off-by: Keith Packard <keithp@keithp.com>
cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-20 15:24:12 +10:00
Dan Carpenter 4ede00c966 vmwgfx: return -EFAULT if copy_to_user fails
copy_to_user() returns the number of bytes remaining to be copied, but
we want to return a negative error code.  This gets copied to user
space.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-20 15:24:11 +10:00
Kulikov Vasiliy bbb642f9c9 drm: radeon: check kzalloc() result
If kzalloc() fails exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-20 15:24:08 +10:00
Ben Hutchings 1e8655f873 drm/ttm: Fix build on architectures without AGP
Make inclusion of <asm/agp.h> conditional on TTM_HAS_AGP.  The use
of the functions declared in it is already conditional.

Reported-by: Geert Stappers <stappers@stappers.nl>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Geert Stappers <stappers@stappers.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-20 15:24:06 +10:00
Dave Chinner 7f8275d0d6 mm: add context argument to shrinker callback
The current shrinker implementation requires the registered callback
to have global state to work from. This makes it difficult to shrink
caches that are not global (e.g. per-filesystem caches). Pass the shrinker
structure to the callback so that users can embed the shrinker structure
in the context the shrinker needs to operate on and get back to it in the
callback via container_of().

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-07-19 14:56:17 +10:00
Linus Torvalds cd9f040df6 drm/i915: add 'reclaimable' to i915 self-reclaimable page allocations
The hibernate issues that got fixed in commit 985b823b91 ("drm/i915:
fix hibernation since i915 self-reclaim fixes") turn out to have been
incomplete.  Vefa Bicakci tested lots of hibernate cycles, and without
the __GFP_RECLAIMABLE flag the system eventually fails to resume.

With the flag added, Vefa can apparently hibernate forever (or until he
gets bored running his automated scripts, whichever comes first).

The reclaimable flag was there originally, and was one of the flags that
were dropped (unintentionally) by commit 4bdadb9785 ("drm/i915:
Selectively enable self-reclaim") that introduced all these problems,
but I didn't want to just blindly add back all the flags in commit
985b823b91, and it looked like __GFP_RECLAIM wasn't necessary.  It
clearly was.

I still suspect that there is some subtle reason we're missing that
causes the problems, but __GFP_RECLAIMABLE is certainly not wrong to use
in this context, and is what the code historically used.  And we have no
idea what the causes the corruption without it.

Reported-and-tested-by: M. Vefa Bicakci <bicave@superonline.com>
Cc: Dave Airlie <airlied@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-07-18 09:44:37 -07:00
Alex Deucher 8d369bb196 drm/radeon/kms: fix gtt MC base alignment on rs4xx/rs690/rs740 asics
The asics in question have the following requirements with regard to
their gart setups:

1. The GART aperture size has to be in the form of 2^X bytes, where X is from 25 to 31
2. The GART aperture MC base has to be aligned to a boundary equal to the size of the
aperture.
3. The GART page table has to be aligned to the boundary equal to the size of the table.
4. The GART page table size is: table_entry_size * (aperture_size / page_size)
5. The GART page table has to be allocated in non-paged, non-cached, contiguous system
memory.

This patch takes care 2.  The rest should already be handled properly.

This fixes a regression noticed by: Torsten Kaiser <just.for.lkml@googlemail.com>

Tested-by: Torsten Kaiser <just.for.lkml@googlemail.com>
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-16 11:27:01 +10:00
Jerome Glisse 9440106b46 drm: unify crtc,connector,encoder,fb debug printing
Unify debug printing so it easier to track what's happening
while debugging.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-16 11:25:02 +10:00
Alex Deucher 5099fa7f23 drm/radeon/kms: fix possible mis-detection of sideport on rs690/rs740
Check ulBootUpMemoryClock on AMD IGPs.

Fix regression noticed by Torsten Kaiser <just.for.lkml@googlemail.com>

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-14 09:08:36 +10:00
Alex Deucher ff3f011cd8 drm/radeon/kms: fix legacy tv-out pal mode
fixes fdo bug 26915

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-07-13 11:02:49 +10:00
Francisco Jerez 0edeb0c024 drm/i2c/ch7006: Fix up suspend/resume.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:20:24 +10:00
Ben Skeggs 047d1d3cae drm/nouveau: reduce usage of fence spinlock to when absolutely necessary
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:14:04 +10:00
Ben Skeggs ca6adb8a21 drm/nv50: fix RAMHT size
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:14:02 +10:00
Ben Skeggs 41090eb424 drm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch
On nv50 it became impossible to attempt a PCI ROM shadow of the VBIOS,
which will break some setups.

This patch also removes the different ordering of shadow methods for
pre-nv50 chipsets.  The reason for the different ordering was paranoia,
but it should hopefully be OK to try shadowing PRAMIN first.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:14:01 +10:00
Francisco Jerez dad9acff50 drm/nv04: Enable context switching on PFIFO init.
Fixes a lockup when coming back from suspend.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:14:00 +10:00
Francisco Jerez 112d20ad5c drm/nouveau: Disable PROM access on init.
On older cards (<nv17) scanout gets blocked when the ROM is being
accessed. PROM access usually comes out enabled from suspend, switch
it off.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:58 +10:00
Francisco Jerez 77144554de drm/nouveau: Fix crashes during fbcon init on single head cards.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:57 +10:00
Ben Skeggs e88efe056d drm/nouveau: initialise display before enabling interrupts
In some situations it's possible we can receive a spurious hotplug IRQ
before we're ready to handle it, leading to an oops.

Calling the display init before enabling interrupts should clear any
pending IRQs on the GPU and prevent this from happening.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:56 +10:00
Ben Skeggs 271f29e7b5 drm/nv50: move dp_set_tmds() function to happen in the last display irq
It seems on some chipsets that doing this from the 0x20 handler causes the
display engine to not ever signal the final 0x40 stage.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:54 +10:00
Ben Skeggs baf8035edb drm/nouveau: fix mtrr cleanup path
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:53 +10:00
Ben Skeggs 946cbc825a drm/nv50: fix dp_set_tmds to work on the right OR
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:51 +10:00
Ben Skeggs c50a5681e7 drm/nv20-nv30: move context table object out of dev_priv
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:50 +10:00
Ben Skeggs ac94a343c7 drm/nv50: cleanup nv50_fifo.c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:49 +10:00
Ben Skeggs 3b569e0f2b drm/nouveau: remove unused fbdev_info
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:47 +10:00
Ben Skeggs 816544b21b drm/nouveau: allocate fixed amount of PRAMIN per channel on all chipsets
Previously only done on nv50+

This commit also switches unknown NV2x/NV3x chipsets to noaccel mode.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:44 +10:00
Ben Skeggs ec91db269e drm/nouveau: remove ability to use external firmware
This was always really a developer option, and if it's really necessary we
can hack this in ourselves.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:43 +10:00
Ben Skeggs 631872155f drm/nv50: move tlb flushing to a helper function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:41 +10:00
Ben Skeggs f56cb86f9a drm/nouveau: add instmem flush() hook
This removes the previous prepare_access() and finish_access() hooks, and
replaces it with a much simpler flush() hook.

All the chipset-specific code before nv50 has its use removed completely,
as it's not required there at all.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-07-13 10:13:40 +10:00