Commit Graph

1637 Commits

Author SHA1 Message Date
Austin Yuan 110b20c3dd drm/ttm: remove unnecessary save_flags and ttm_flag_masked in ttm_bo_util.c
Signed-off-by: Austin Yuan <shengquan.yuan@gmail.com>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 11:27:25 +10:00
Richard Kennedy dd5fde6041 drm/ttm: remove padding from ttm_ref_object on 64bit builds
Re-order structure ttm_ref_object to remove 8 bytes of alignment padding
on 64 bit builds, so shrinking its size from 72 to 64 bytes allowing it
to fit into a smaller slab.

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 11:24:50 +10:00
Dave Airlie 4b866288be drm/radeon/kms: release agp on error.
if we get an error, release the AGP if we've acquired it already.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 11:22:10 +10:00
John Kacur 2dea2e29b9 drm/kms/radeon/agp: Move the check of the aper_size after drm_acp_acquire and drm_agp_info
First call drm_agp_acquire to check if agp has been acquired.
Second call drm_agp_info to fill in the info data struct, including aper_size.
Finally do the check to see if the aper_size makes sense.

Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 11:19:31 +10:00
John Kacur cdb6e375c3 drm/kms/radeon/agp: Fix warning, format ‘%d’ expects type ‘int’, but argument 4 has type ‘size_t’
- Fix warning by using %zu instead of %d for size_t
- Fix spelling mistake, "to" should be "too".

Signed-off-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 11:19:08 +10:00
Francisco Jerez db78e27de7 drm/ttm: Avoid conflicting reserve_memtype during ttm_tt_set_page_caching.
Fixes errors like:
> reserve_ram_pages_type failed 0x15b7a000-0x15b7b000, track 0x8, req 0x10
when a BO is moved between WC and UC areas.

Reported-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 11:15:37 +10:00
Dave Airlie f28cf33945 drm/kms/radeon: pick digitial encoders smarter. (v3)
booting a Lenovo W500 with LVDS + DP outputs showed up a TODO we had
on our list, to pick a correct digital encoder block. The LVTMA
encoder requires the second digital encoder, all others can use any
encoder at all.

This fixes the digital encoder selection logic to enable LVDS/DP combos
to work okay.

V2: fix silly addition of connector dig_block and cleanup the other
places in the code that pick the encoder.

V3: rename to dig_encoder and clean up further - also fix
the picking algorithm.

tested on Lenovo W500 + desktop 3650 cards.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 10:13:15 +10:00
Dave Airlie 43c33ed87d drm/radeon/kms: use active device to pick connector for encoder
On the W500 we have UNIPHY routed to both DVI and DP, this seems
to always pick the DVI connector which means link training fails.

Switch to using active device to pick the connector, this seems
like it should be safe from a code review, and it fixes things
a bit more here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 10:12:26 +10:00
Dave Airlie 97b94ccb9a drm/radeon/kms: fix incorrect logic in DP vs eDP connector checking.
This makes displayport work again here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-02-01 10:12:17 +10:00
Jesse Barnes 013d5aa2bb drm/i915: page flip support for Ironlake
This patch adds support for page flipping on Ironlake, which uses
different interrupt bits for triggering flip submit IRQs.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: hand-resolved for rebasing off of render power saving patch]
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-29 15:29:47 -08:00
Zhao Yakui f034b12dbb drm/i915: Fix the incorrect DMI string for Samsung SX20S laptop
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reported-by: Philipp Kohlbecher <xt28@gmx.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-29 15:00:37 -08:00
Zhao Yakui 2dd8738388 drm/i915: Add support for SDVO composite TV
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-29 14:35:32 -08:00
Li Peng 643ced9b0b drm/i915: don't trigger ironlake vblank interrupt at irq install
Zhenyu noticed that the ironlake vblank enabling patch has one
issue that it will trigger vblank starting from irq postinstall,
this isn't necessary. This patch addresses this issue by only
adding the vblank into DEIER but mask them in DEIMR, so that it
won't trigger vblank interrupt at irq install.

Signed-off-by: Li Peng <peng.li@intel.com>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-29 14:22:09 -08:00
Chris Wilson 4bdadb9785 drm/i915: Selectively enable self-reclaim
Having missed the ENOMEM return via i915_gem_fault(), there are probably
other paths that I also missed. By not enabling NORETRY by default these
paths can run the shrinker and take memory from the system (but not from
our own inactive lists because our shrinker can not run whilst we hold
the struct mutex) and this may allow the system to survive a little longer
whilst our drivers consume all available memory.

References:
  OOM killer unexpectedly called with kernel 2.6.32
  http://bugzilla.kernel.org/show_bug.cgi?id=14933

v2: Pass gfp into page mapping.
v3: Use new read_cache_page_gfp() instead of open-coding.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-27 09:26:43 -08:00
Jesse Barnes de3f440f8c drm/i915: handle non-flip pending case when unpinning the scanout buffer
The first page flip queued will replace the current front buffer, which
should have a 0 pending flip count.  So at finish time we need to handle
that case (i.e. if the flip count is 0 *or* dec_and_test is 0 we need to
wake the waiters).

Also fix up an error path in the queue function and add some debug
output (only enabled with driver debugging).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-25 22:01:12 -08:00
Linus Torvalds abefedd538 Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (95 commits)
  drm/radeon/kms: preface warning printk with driver name
  drm/radeon/kms: drop unnecessary printks.
  drm: fix regression in fb blank handling
  drm/radeon/kms: make hibernate work on IGPs
  drm/vmwgfx: Optimize memory footprint for DMA buffers.
  drm/ttm: Allow system memory as a busy placement.
  drm/ttm: Fix race condition in ttm_bo_delayed_delete (v3, final)
  drm/nv50: prevent switching off SOR when in use for DVI-over-DP
  drm/nv50: fail auxch transaction if reply count not what we expect
  drm/nouveau: fix failure path if userspace specifies no valid memtypes
  drm/nouveau: report LVDS as disconnected if lid closed
  drm/radeon/kms: fix legacy get_engine/memory clock
  drm/radeon/kms/atom: atom parser fixes
  drm/radeon/kms: clean up atombios pll code
  drm/radeon/kms: clean up pll struct
  drm/radeon/kms/atom: fix crtc lock ordering
  drm/radeon: r6xx/r7xx possible security issue, system ram access
  drm/radeon/kms: r600/r700 don't test ib if ib initialization fails
  drm/radeon/kms: Forbid creation of framebuffer with no valid GEM object
  drm/radeon/kms: r600 handle irq vector ring overflow
  ...
2010-01-25 18:59:47 -08:00
Li Peng 8a6c77d645 drm/i915: Fix the device info of Pineview
Pineview doesn't has CXSR and need GTT-based hardware status page.
It fixes a X boot hung issue on Pinview since commit cfdf1f

Signed-off-by: Li Peng <peng.li@intel.com>
Acked-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-25 09:23:13 -08:00
Li Peng c062df6196 drm/i915: enable vblank interrupt on ironlake
so far vblank interrupt on ironlake is disabled, this would cause
bad gfx performance if userspace calls drm_wait_vblank. This patch
enables vblank interrupt on ironlake and follows vblank get/put
model.

Signed-off-by: Li Peng <peng.li@intel.com>
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-25 09:14:30 -08:00
Chris Wilson 0ce907f891 drm/i915: Prevent use of uninitialized pointers along error path.
X.org hang with [drm:i915_gem_do_execbuffer] *ERROR* in dmesg
  http://bugzilla.kernel.org/show_bug.cgi?id=15114

Matej found he was hitting an error path within i915_gem_do_execbuffer()
that led to the attempt to dereference an uninitialised pointer during
cleanup. This path used to be safe as we used to calloc the object
lists, but this was changed in c8e0f93. Daniel Vetter had also spotted
this error and proposed a similar patch.

[ 6379.732892] [drm:i915_gem_do_execbuffer] *ERROR* Object ffff880098cd6540 appears more than once in object list
[ 6379.740976] [drm:i915_gem_do_execbuffer] *ERROR* Object ffff880098cd6540 appears more than once in object list
[ 6379.740995] BUG: unable to handle kernel NULL pointer dereference at 00000000000000a0
[ 6379.740998] IP: [<ffffffff8122ddb5>] i915_gem_do_execbuffer+0xba5/0x1260
[ 6379.741006] PGD babab067 PUD bb435067 PMD 0
[ 6379.741010] Oops: 0002 [#1] PREEMPT SMP
[ 6379.741014] last sysfs file: /sys/devices/pci0000:00/0000:00:1c.2/0000:06:00.0/ieee80211/phy0/rfkill0/state
[ 6379.741017] CPU 1
[ 6379.741021] Pid: 2186, comm: X Not tainted 2.6.33-rc4-00399-g24bc734 #142 M11D/ESPRIMO Mobile M9400
[ 6379.741023] RIP: 0010:[<ffffffff8122ddb5>] [<ffffffff8122ddb5>] i915_gem_do_execbuffer+0xba5/0x1260
[ 6379.741027] RSP: 0018:ffff8800b9047b78  EFLAGS: 00213206
[ 6379.741029] RAX: 0000000000000000 RBX: 000000000000004f RCX: ffff880098cac800
[ 6379.741032] RDX: ffff880098caca78 RSI: ffff8800b9047c98 RDI: ffff880098cd6540
[ 6379.741034] RBP: ffff8800b9047c78 R08: ffffffff814b96b5 R09: 0000000000000006
[ 6379.741036] R10: 0000000000000000 R11: 0000000000000003 R12: 000000000000004e
[ 6379.741038] R13: 00000000fffffff7 R14: 0000000000000000 R15: 0000000000000001
[ 6379.741041] FS:  0000000000000000(0000) GS:ffff880001900000(0063) knlGS:00000000f72636c0
[ 6379.741043] CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
[ 6379.741041] FS:  0000000000000000(0000) GS:ffff880001900000(0063) knlGS:00000000f72636c0
[ 6379.741043] CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
[ 6379.741045] CR2: 00000000000000a0 CR3: 00000000b9000000 CR4: 00000000000006e0
[ 6379.741048] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 6379.741050] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 6379.741052] Process X (pid: 2186, threadinfo ffff8800b9046000, task ffff8800bb5d8000)
[ 6379.741054] Stack:
[ 6379.741055]  ffffc90023f57000 ffffc90023f56fff ffffc90023f56fff ffffc90023f55000
[ 6379.741059] <0> ffff8800b9047c98 ffff8800bb43c840 ffff8800bf1de800 ffff8800bf1de820
[ 6379.741063] <0> ffff8800b9047bd8 ffff880098cac800 0000000000000000 0000000000000002
[ 6379.741068] Call Trace:
[ 6379.741072]  [<ffffffff8122e6cb>] ?  i915_gem_execbuffer+0x6b/0x370
[ 6379.741077]  [<ffffffff810a5f52>] ? __vmalloc_node+0xa2/0xb0
[ 6379.741080]  [<ffffffff8122e6cb>] ?  i915_gem_execbuffer+0x6b/0x370
[ 6379.741083]  [<ffffffff8122e816>] i915_gem_execbuffer+0x1b6/0x370
[ 6379.741086]  [<ffffffff8120cd55>] drm_ioctl+0x1d5/0x460
[ 6379.741089]  [<ffffffff8122e660>] ?  i915_gem_execbuffer+0x0/0x370
[ 6379.741093]  [<ffffffff81248c35>] i915_compat_ioctl+0x45/0x50
[ 6379.741097]  [<ffffffff810f1659>] compat_sys_ioctl+0xa9/0x1570
[ 6379.741102]  [<ffffffff810b1d5c>] ? vfs_read+0x13c/0x1a0
[ 6379.741106]  [<ffffffff81028424>] sysenter_dispatch+0x7/0x2b
[ 6379.741108] Code: 08 85 c0 74 52 31 db 0f 1f 80 00 00 00 00 48 63 c3 48 8b
8d 68 ff ff ff 48 8d 14 c1 48 8b 02 48 85 c0 74 25 48 8b 80 80 00 00 00 <c7> 80
a0 00 00 00 00 00 00 00 48 8b 3a 48 85 ff 74 0c 48 c7 c6
[ 6379.741142] RIP  [<ffffffff8122ddb5>] i915_gem_do_execbuffer+0xba5/0x1260
[ 6379.741145]  RSP <ffff8800b9047b78>
[ 6379.741147] CR2: 00000000000000a0
[ 6379.741159] ---[ end trace 0598809afa4c31db ]---

Reported-by: Matej Laitl <strohel@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-25 09:00:38 -08:00
Zhenyu Wang eceb784cec drm/i915: disable hotplug detect before Ironlake CRT detect
This tries to fix CRT detect loop hang seen on some Ironlake form
factor, to clear up hotplug detect state before taking CRT detect
to make sure next hotplug detect cycle is consistent.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-25 08:52:54 -08:00
Dave Airlie 7087e16286 drm/radeon/kms: preface warning printk with driver name
This just adds a little more info to the warning for old -ati/mesa
userspaces.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 16:13:55 +10:00
Dave Airlie f2ab3a13d2 drm/radeon/kms: drop unnecessary printks.
These printks aren't required anymore.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 16:13:12 +10:00
Zhenyu Wang 5fd4df4d47 drm: fix regression in fb blank handling
commit 731b5a15a3
Author: James Simmons <jsimmons@infradead.org>
Date:   Thu Oct 29 20:39:07 2009 +0000

    drm/kms: properly handle fbdev blanking

uses DRM_MODE_DPMS_ON for FB_BLANK_NORMAL, but DRM_MODE_DPMS_ON
is actually for turning output on instead of blank.

This makes fb blank broken on my T61, it put LVDS on but leave
pipe disabled which made screen totally white or caused some
'burning' effect.

[airlied: James objects to this but at this point in 2.6.33,
I can't see a patch that will fix this properly like he wants coming
in time and otherwise this is a regression - proper fix for 2.6.34
hopefully.]

Cc: James Simmons <jsimmons@infradead.org>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 16:04:47 +10:00
Dave Airlie d796d8446f drm/radeon/kms: make hibernate work on IGPs
This is the least invasive fix without migrating the radeon driver
to pm_ops from what I can see. We just always migrate VRAM objects
on IGPs for now and we can fix it up later to migrate depending
on STR vs STD.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 16:04:42 +10:00
Thomas Hellstrom 8ba5152a3a drm/vmwgfx: Optimize memory footprint for DMA buffers.
Use VRAM whenever there is free space for DMA buffers,
but use system GMR memory if using VRAM would cause an eviction.

This significantly reduces the guest system memory usage for
VMs with a large amount of VRAM allocated.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 16:04:39 +10:00
Thomas Hellstrom 0eaddb28d3 drm/ttm: Allow system memory as a busy placement.
This is needed to fix a vmwgfx memory usage bug.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 16:04:30 +10:00
Dave Airlie 9299795c6e Merge remote branch 'korg/drm-radeon-next' into drm-linus
* korg/drm-radeon-next:
  drm/radeon/kms: fix legacy get_engine/memory clock
  drm/radeon/kms/atom: atom parser fixes
  drm/radeon/kms: clean up atombios pll code
  drm/radeon/kms: clean up pll struct
  drm/radeon/kms/atom: fix crtc lock ordering
  drm/radeon: r6xx/r7xx possible security issue, system ram access
  drm/radeon/kms: r600/r700 don't test ib if ib initialization fails
  drm/radeon/kms: Forbid creation of framebuffer with no valid GEM object
  drm/radeon/kms: r600 handle irq vector ring overflow
  drm/radeon/kms: r600/r700 don't process IRQ if not initialized
  drm/radeon/kms: r600/r700 disable irq at suspend
  drm/radeon/kms/r4xx: cleanup atom path
  drm/radeon/kms: fix atombios_crtc_set_base
  drm/radeon/kms/atom: upstream parser updates
  drm/radeon/kms/atom: fix some parser bugs
  drm/radeon/kms: fix hardcoded mmio size in register functions
  drm/radeon/kms/r100: fix bug in CS parser
  drm/radeon/kms/r200: fix bug in CS parser
  drm/radeon/kms/r200: fix bug in CS parser
2010-01-25 16:04:21 +10:00
Dave Airlie 8d586fe65a Merge remote branch 'nouveau/for-airlied' of ../drm-nouveau-next into drm-linus
* 'nouveau/for-airlied' of ../drm-nouveau-next:
  drm/nv50: prevent switching off SOR when in use for DVI-over-DP
  drm/nv50: fail auxch transaction if reply count not what we expect
  drm/nouveau: fix failure path if userspace specifies no valid memtypes
  drm/nouveau: report LVDS as disconnected if lid closed
  drm/nv50: prevent accidently turning off encoders we're actually using
  drm/nv50: fix alignment of per-channel fifo cache
  drm/nouveau: Evict buffers in VRAM before freeing sgdma
  drm/nouveau: Acknowledge DMA_VTX_PROTECTION PGRAPH interrupts
  drm/nouveau: fix thinko in nv04_instmem.c
  drm/nouveau: fix a race condition in nouveau_dma_wait()
2010-01-25 16:04:11 +10:00
Luca Barbieri 1a961ce09f drm/ttm: Fix race condition in ttm_bo_delayed_delete (v3, final)
Resending this with Thomas Hellstrom's signoff for merging into 2.6.33

ttm_bo_delayed_delete has a race condition, because after we do:
kref_put(&nentry->list_kref, ttm_bo_release_list);

we are not holding the list lock and not holding any reference to
objects, and thus every bo in the list can be removed and freed at
this point.

However, we then use the next pointer we stored, which is not guaranteed
to be valid.

This was apparently the cause of some Nouveau oopses I experienced.

This patch rewrites the function so that it keeps the reference to nentry
until nentry itself is freed and we already got a reference to nentry->next.

v2 updated by me according to Thomas Hellstrom's feedback.
v3 proposed by Thomas Hellstrom. Commit comment updated by me.

Both updates fixed minor efficiency/style issues only and all three versions
should be correct.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-25 11:43:54 +10:00
Ben Skeggs 162265367a drm/nv50: prevent switching off SOR when in use for DVI-over-DP
Another hack because of us exposing each encoder block's function as
an encoder rather than exposing a single encoder that deals with them
all.

A proper fix will come, it's just rather invasive so this hack will
do until then.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-25 10:35:33 +10:00
Ben Skeggs 0107bae01a drm/nv50: fail auxch transaction if reply count not what we expect
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-25 10:35:25 +10:00
Ben Skeggs 0208843dd5 drm/nouveau: fix failure path if userspace specifies no valid memtypes
We need to add the buffer to the list even if we fail, otherwise the
validate_fini() call won't unreserve + unreference the GEM object,
making TTM very unhappy.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-25 10:35:19 +10:00
Ben Skeggs a1470890f2 drm/nouveau: report LVDS as disconnected if lid closed
Also adds a module option to ignore the status reported via ACPI, in case
we hit systems with broken ACPI.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-25 10:35:13 +10:00
Alex Deucher 38678d3557 drm/radeon/kms: fix legacy get_engine/memory clock
Fix a bad shift in the post div.

Should fix fdo bug 26145

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-24 17:25:38 +10:00
Alex Deucher 947bfc8304 drm/radeon/kms/atom: atom parser fixes
Only reset the reg block on the initial execute
table call; nested calls require the reg block not be
reset on each call.  Also reset the fb window and
io mode.  This matches the upstream parser behavior.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-24 17:25:05 +10:00
Alex Deucher 4eaeca3351 drm/radeon/kms: clean up atombios pll code
- split pll adjust into a separate function
- use a union for SetPixelClock params

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-24 17:24:29 +10:00
Alex Deucher fc10332b8a drm/radeon/kms: clean up pll struct
- add a new flag for fixed post div
- pull the pll flags into the struct

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-24 17:24:23 +10:00
Alex Deucher a348c84d95 drm/radeon/kms/atom: fix crtc lock ordering
This makes crtc_prepare and crtc_commit match.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-24 17:23:38 +10:00
Jerome Glisse c8c15ff1e9 drm/radeon: r6xx/r7xx possible security issue, system ram access
This patch workaround a possible security issue which can allow
user to abuse drm on r6xx/r7xx hw to access any system ram memory.
This patch doesn't break userspace, it detect "valid" old use of
CB_COLOR[0-7]_FRAG & CB_COLOR[0-7]_TILE registers and overwritte
the address these registers are pointing to with the one of the
last color buffer. This workaround will work for old mesa &
xf86-video-ati and any old user which did use similar register
programming pattern as those (we expect that there is no others
user of those ioctl except possibly a malicious one). This patch
add a warning if it detects such usage, warning encourage people
to update their mesa & xf86-video-ati. New userspace will submit
proper relocation.

Fix for xf86-video-ati / mesa (this kernel patch is enough to
prevent abuse, fix for userspace are to set proper cs stream and
avoid kernel warning) :
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=95d63e408cc88b6934bec84a0b1ef94dfe8bee7b
http://cgit.freedesktop.org/mesa/mesa/commit/?id=46dc6fd3ed5ef96cda53641a97bc68c3bc104a9f

Abusing this register to perform system ram memory is not easy,
here is outline on how it could be achieve. First attacker must
have access to the drm device and be able to submit command stream
throught cs ioctl. Then attacker must build a proper command stream
for r6xx/r7xx hw which will abuse the FRAG or TILE buffer to
overwrite the GPU GART which is in VRAM. To achieve so attacker
as to setup CB_COLOR[0-7]_FRAG or CB_COLOR[0-7]_TILE to point
to the GPU GART, then it has to find a way to write predictable
value into those buffer (with little cleverness i believe this
can be done but this is an hard task). Once attacker have such
program it can overwritte GPU GART to program GPU gart to point
anywhere in system memory. It then can reusse same method as he
used to reprogram GART to overwritte the system ram through the
GART mapping. In the process the attacker has to be carefull to
not overwritte any sensitive area of the GART table, like ring
or IB gart entry as it will more then likely lead to GPU lockup.
Bottom line is that i think it's very hard to use this flaw
to get system ram access but in theory one can achieve so.

Side note: I am not aware of anyone ever using the GPU as an
attack vector, nevertheless we take great care in the opensource
driver to try to detect and forbid malicious use of GPU. I don't
think the closed source driver are as cautious as we are.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:49:32 +10:00
Jerome Glisse db96380ea2 drm/radeon/kms: r600/r700 don't test ib if ib initialization fails
If ib initialization failed don't try to test ib as it will result
in an oops (accessing NULL ib buffer ptr).

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:47:01 +10:00
Jerome Glisse 7e71c9e2e7 drm/radeon/kms: Forbid creation of framebuffer with no valid GEM object
This will avoid oops if at later point the fb is use. Trying to create
a framebuffer with no valid GEM object is bogus and should be forbidden
as this patch does.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:46:27 +10:00
Jerome Glisse 7924e5eb8f drm/radeon/kms: r600 handle irq vector ring overflow
In some rare case i faced an irq overflow quickly followed by
a GPU lockup (hard hang) this patch try to deal with irq vector
ring overflow, so far haven't been able to reproduce it with
the patch.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:45:01 +10:00
Jerome Glisse 79c2bbc505 drm/radeon/kms: r600/r700 don't process IRQ if not initialized
In some rare case the wptr returned from the hw wasn't 0 and leaded
to trick r600_process_irq that their were irq to process. Add a
check to bail out if irq hasn't been initialized this will avoid
oops provoqued by the rare wptr != 0 on initialization.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:43:56 +10:00
Jerome Glisse 0c45249f41 drm/radeon/kms: r600/r700 disable irq at suspend
To avoid hw doing anythings after we disabled PCIE GART, fully
disable IRQ at suspend. Also cleanup a bit the ih structure
and process function.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:42:59 +10:00
Alex Deucher 615e0cb679 drm/radeon/kms/r4xx: cleanup atom path
most of radeon_legacy_atom_set_surface() is taken care
of in atombios_set_base(), so remove the duplicate
setup and move the remaining bits (DISP_MERGE setup and
FP2 sync) to atombios_crtc.c where they are used.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:40:08 +10:00
Alex Deucher 54f088a960 drm/radeon/kms: fix atombios_crtc_set_base
Make it call the proper backend depending on the
GPU family.  Right now r4xx cards with atombios modesetting
enabled were using the avivo crtc base code.  This also
allows us to add support for new asics more easily.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:39:02 +10:00
Alex Deucher e2f8e87089 drm/radeon/kms/atom: upstream parser updates
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:20:28 +10:00
Alex Deucher 9f53e79316 drm/radeon/kms/atom: fix some parser bugs
- add support for inline src params
- fix shift_left/shift_right and shl/shr ops
  shift_* ops use inline src params, shl/r use full params
- fix mask op (uses inline params)

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:19:55 +10:00
Alex Deucher 07bec2df01 drm/radeon/kms: fix hardcoded mmio size in register functions
newer asics have large mmio apertures

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:19:42 +10:00
Alex Deucher cf57fc7aa2 drm/radeon/kms/r100: fix bug in CS parser
The first dword of PACKET3_3D_DRAW_IMMD maps to
SE_VTX_FMT so the vertex size is part of the draw
packet.

This patch fixes a possible case where you have a
command buffer that does not contain SE_VTX_FMT
register write, but does contain PACKET3_3D_DRAW_IMMD.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:18:18 +10:00
Andrew Randrianasulu 828153e292 drm/radeon/kms/r200: fix bug in CS parser
Add missing vertex shader regs for r200.

fixed fdo bug 26061

agd5f: use official reg names

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:17:27 +10:00
Andrew Randrianasulu f3d1ccc14f drm/radeon/kms/r200: fix bug in CS parser
The checks for CUBE and 3D textures were inverted.

fixes fdo bug 24159

agd5f: added comments for clarity.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2010-01-21 08:17:13 +10:00
Ben Skeggs 58d65b84de drm/nv50: prevent accidently turning off encoders we're actually using
On most cards the DisplayPort connector is created with 2 encoders sharing
a single SOR (for native DP, and for DVI-over-DP).  The previous logic
for turning off unused encoders didn't take into account that we could
have multiple drm_encoders on a single hw encoder and ended up turning off
encoders that were actually being used still.

This patch fixes that issue.  We probably want to look at something a bit
better later on, and only expose one drm_encoder per hw encoder block.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-18 09:56:27 +10:00
Ben Skeggs 134f248bea drm/nv50: fix alignment of per-channel fifo cache
GPU pointer to the structure is shifted right by 10 bits, so we need to
align to 1024 bytes, not 256.

Reported-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-18 09:56:19 +10:00
Luca Barbieri 7166647501 drm/nouveau: Evict buffers in VRAM before freeing sgdma
Currently, we take down the sgdma engine without evicting all buffers
from VRAM.

The TTM device release will try to evict anything in VRAM to GART
memory, but this will fail since sgdma has already been taken down.

This causes an infinite loop in kernel mode on module unload.
It usually doesn't happen because there aren't any buffer on close.
However, if the GPU is locked up, this condition is easily triggered.

This patch fixes it in the simplest way possible by cleaning VRAM
right before cleaning SGDMA memory.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-18 09:56:13 +10:00
Luca Barbieri d051bbb22e drm/nouveau: Acknowledge DMA_VTX_PROTECTION PGRAPH interrupts
Currently Nouveau is unable to dismiss DMA_VTX_PROTECTION errors,
which results in an infinite loop in the interrupt handler.

These errors are caused both by bugs in the Gallium driver and by
user-specified index buffers with out of bounds indices.

By mmio-tracing the nVidia drivers, I found out how this is done.
On DMA_VTX_PROTECTION, The nVidia driver reads the register 0x402000,
always getting the value 4, and then writes 4 back to 0x402000.

This patch adds that logic by reading 0x402000 and writing the same
value back.
It's unclear what should happen if the value read is not 4, and
the current approach might not be the correct one.

To test this, modify mesa/progs/trivial/vbo-drawrange.c, defining
ELTOBJ to 1 and replacing indices with huge out of bounds integers.

Without this patch, the GPU and/or kernel should lock up.
With this patch, it should misrender as expected but not lock up.

The errors are still logged since they are useful for development.

This has been tested on NV49 and may not work on other cards.

To find out how things work on other cards, run the aforementioned
test using the blob with mmiotrace and grep for a read of the PGRAPH
source register.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-18 09:56:03 +10:00
Ben Skeggs 0d92971dd6 drm/nouveau: fix thinko in nv04_instmem.c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-18 09:55:54 +10:00
Ben Skeggs ba59953d28 drm/nouveau: fix a race condition in nouveau_dma_wait()
Can be triggered easily on certain cards (NV46 and NV50 of mine) by
running "dmesg", the DRM's channel will lockup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-18 09:55:48 +10:00
Linus Torvalds 33f724eb9e 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: enable 36bit physical address for hardware status page
  drm/i915: fix eDP pipe mask
  drm/i915: fix pixel color depth setting on eDP
  drm/i915: parse eDP panel color depth from VBT block
  drm/i915: disable LVDS downclock by default
  drm/i915: Fix the incorrect cursor A bit definition in DSPFW2 register
  drm/i915: Remove chatty execbuf failure message.
  drm/i915: remove loop in Ironlake interrupt handler
  drm/i915: Don't wait interruptible for possible plane buffer flush
  drm/i915: try another possible DDC bus for the SDVO device with multiple outputs
  drm/i915: Read the response after issuing DDC bus switch command
  drm/i915: Don't use the child device parsed from VBT to setup HDMI/DP
  drm/i915: Fix resume regression on MSI Wind U100 w/o KMS
  drm/i915: Fix Ironlake M/N/P ranges to match the spec
  drm/i915: Use find_pll function to calculate DPLL setting for LVDS downclock
  drm/i915: Add HP nx9020/SamsungSX20S to ACPI LID quirk list
  drm/i915: disable TV hotplug status check

Trivial conflicts in drivers/gpu/drm/i915/i915_drv.c due to i915
non-modeset suspend fix with different comment.
2010-01-16 10:44:38 -08:00
Zhenyu Wang 9b974cc171 drm/i915: enable 36bit physical address for hardware status page
This enables possible 36bit address mask on 965G that use physical
address for hw status page.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 14:50:14 -08:00
Zhenyu Wang 6251ec0ae2 drm/i915: fix eDP pipe mask
eDP could be on pipe A or B.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 14:13:18 -08:00
Zhenyu Wang 885a5fb5b1 drm/i915: fix pixel color depth setting on eDP
Original DP mode_valid check didn't take pixel color depth into account,
which made one 1600x900 eDP panel's mode check invalid because of overclock,
but actually this 6bpc panel does can work with x1 lane at 2.7G. This one
trys to take bpp value properly both in mode validation and mode setting.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 14:13:06 -08:00
Zhenyu Wang 500a8cc466 drm/i915: parse eDP panel color depth from VBT block
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 14:12:47 -08:00
Jesse Barnes 33814341f2 drm/i915: disable LVDS downclock by default
Many platform support this feature, and it can provide significant
power savings when the reduced refresh rate is low.  However, on some
platforms a secondary (reduced) timing is provided but not actually
supported by the hardware.  This results in undesirable flicker at
runtime.

So disable the feature by default, but allow users to opt-in to the
reduced clock behavior with a new module parameter, lvds_downclock,
that can be set to 1 to enable the feature.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 14:08:01 -08:00
Zhao Yakui 21bd770b9c drm/i915: Fix the incorrect cursor A bit definition in DSPFW2 register
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 14:06:19 -08:00
Eric Anholt 6036ae7e94 drm/i915: Remove chatty execbuf failure message.
Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org> (in principle)
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 13:05:36 -08:00
Zou Nan hai c7c85101af drm/i915: remove loop in Ironlake interrupt handler
On Ironlake, there is an interrupt master control bit. With the bit
disabled before clearing IIR, we do not need to handle extra interrupt
in a loop. This patch removes the loop in Ironlake interrupt handler.
It fixed irq lost issue on some Ironlake platforms.

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zou Nan hai <Nanhai.zou@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-15 11:23:49 -08:00
Dave Airlie 8471a26b9c Merge remote branch 'korg/drm-radeon-testing' into drm-linus
* korg/drm-radeon-testing:
  drm/radeon/kms: Use radeon_agp_disable when disabling AGP
  drm/radeon/kms: Disable AGP is aperture size < 32M
  drm/radeon/kms: Fix r600 blit cleanup path
  drm/radeon/kms: Do not unpin buffer in fb destruction
  drm/radeon/kms: fix displayport->dvi connector DDC.
2010-01-15 15:40:39 +10:00
Jerome Glisse 79b7dcb2af drm: EDID accept separate sync video mode
X is accepting such video mode, do the same. Pointed out by Joshua Roys
on IRC. Fix https://bugzilla.redhat.com/show_bug.cgi?id=540024

[fix printf to use composite not integrated :- airlied]

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-15 13:29:52 +10:00
Dave Airlie 1c974dc218 Merge remote branch 'nouveau/for-airlied' of ../drm-nouveau-next into drm-linus
* 'nouveau/for-airlied' of ../drm-nouveau-next: (44 commits)
  drm/nouveau: check pushbuffer bounds in ioctl
  drm/nouveau: reserve VGA area for the moment
  drm/nouveau: Unset the EDID connector property when the EDID block goes away.
  drm/nouveau: Fallback to analog load detection when the EDID block is invalid.
  drm/nouveau: fix edid memleak in nouveau_connector
  drm/nouveau: Break some long lines.
  drm/nouveau: add NV18 device id to call_lvds_manufacturer_script
  drm/nv50: Fix typo in PGRAPH initialisation.
  drm/nouveau: less magic DCB 1.5 parsing
  drm/nouveau: assume no nv04 board has a DCB table
  drm/nouveau: remove PRIV0 check in nouveau_mem_close()
  drm/nouveau: wait on fence after bo move if validating for another channel
  drm/nouveau: trust init table registers are safe
  drm/nv50: wait for pgraph to idle before unloading the context
2010-01-15 13:25:38 +10:00
Luca Barbieri 12f735b79f drm/nouveau: check pushbuffer bounds in ioctl
Currently there is no check that the pushbuffer request bounds are inside
the TTM BO.

This allows to instruct the kernel to do relocations on user-selected
addresses, since the relocation bounds checking relies on the request
bounds.

This can oops the kernel accidentally and is easily exploitable.

This patch adds bound checking and alignment checking for ->offset and
->nr_dwords.

It also makes some variables unsigned, which should have no effect,
but prevents possible bounds checking problems.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-15 09:56:50 +10:00
Ben Skeggs ac8fb975e8 drm/nouveau: reserve VGA area for the moment
This is to prevent things such as GART tables and other important GPU
structures being allocated there before we take over fbcon ourselves.

This is more of a workaround for the moment, a better solution will
require some more invasive changes, but it'll be done at some point.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Change from DRM_INFO to DRM_DEBUG

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

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 16:15:11 +10:00
Dave Chinner 2c761270d5 lib: Introduce generic list_sort function
There are two copies of list_sort() in the tree already, one in the DRM
code, another in ubifs.  Now XFS needs this as well.  Create a generic
list_sort() function from the ubifs version and convert existing users
to it so we don't end up with yet another copy in the tree.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-01-12 21:02:00 -08:00
Dave Airlie 9270eb1b49 drm/radeon/kms: only evict to GTT if CP is ready
Testing GTT ready might be more correct but cp.ready
works fine and has been tested on irc by 2-3 ppl.

fixes bug k.org 15035 and fd.o 25733

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

v2: fix typo noticed by Maarten Maathuis

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

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

v2: minor formatting fix from Michel Dänzer

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Tested-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-13 13:25:08 +10:00
Zhenyu Wang b9241ea31f drm/i915: Don't wait interruptible for possible plane buffer flush
When we setup buffer for display plane, we'll check any pending
required GPU flush and possible make interruptible wait for flush
complete. But that wait would be most possibly to fail in case of
signals received for X process, which will then fail modeset process
and put display engine in unconsistent state. The result could be
blank screen or CPU hang, and DDX driver would always turn on outputs
DPMS after whatever modeset fails or not.

So this one creates new helper for setup display plane buffer, and
when needing flush using uninterruptible wait for that.

This one should fix bug like https://bugs.freedesktop.org/show_bug.cgi?id=24009.
Also fixing mode switch stress test on Ironlake.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-12 15:07:34 -08:00
Zhao Yakui 7c3f0a2726 drm/i915: try another possible DDC bus for the SDVO device with multiple outputs
There exist multiple DDC buses for the SDVO cards with multiple outputs.
When we can't get the EDID by using the select DDC bus, we can try the other
possible DDC bus to see whether the EDID can be obtained.

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

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Sebastien Caty <sebastien.caty@mrnf.gouv.qc.ca>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-12 14:54:07 -08:00
Zhao Yakui 6a304caf0b drm/i915: Read the response after issuing DDC bus switch command
For some SDVO cards based on conexant chip, we can't read the EDID if
we don't read the response after issuing SDVO DDC bus switch
command.

From the SDVO spec once when another I2C transaction is finished after
completing the I2C transaction of issuing the bus switch command, it
will be switched back to the SDVO internal state again. So we can't
initiate a new I2C transaction to read the response after issuing the
DDC bus switch command. Instead we should issue DDC bus switch command
and read the response in the same I2C transaction.

https://bugs.freedesktop.org/show_bug.cgi?id=23842
https://bugs.freedesktop.org/show_bug.cgi?id=24458
https://bugs.freedesktop.org/show_bug.cgi?id=24522
https://bugs.freedesktop.org/show_bug.cgi?id=24282

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Sebastien Caty <sebastien.caty@mrnf.gouv.qc.ca>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-12 14:52:38 -08:00
Zhao Yakui 6207937d4f drm/i915: Don't use the child device parsed from VBT to setup HDMI/DP
On some boxes the BIOS will report different child device arrays when
the system is booted with/without the dock. In such case the HDMI/DP
port can't be setup correctly.  So revert two commits
(fc816655236cd9da162356e96e74c7cfb0834d92/
6e36595a21) that use the child device
parsed from VBT to setup HDMI/DP.

http://bugzilla.kernel.org/show_bug.cgi?id=14854
http://bugzilla.kernel.org/show_bug.cgi?id=14860

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Sean Young <sean@mess.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
2010-01-12 14:40:03 -08:00
Rafael J. Wysocki d8e292093a drm/i915: Fix resume regression on MSI Wind U100 w/o KMS
Commit cbda12d77e (drm/i915: implement
new pm ops for i915), among other things, removed the .suspend and
.resume pointers from the struct drm_driver object in i915_drv.c,
which broke resume without KMS on my MSI Wind U100.

Fix this by reverting that part of commit cbda12d77e.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
2010-01-11 14:41:10 +10:00
Maarten Maathuis c2b82924bd drm/nouveau: better alignment of bo sizes and use roundup instead of ALIGN
- Aligning to block size should ensure that the extra size is enough.
- Using roundup, because not all sizes are powers of two.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
2010-01-11 14:41:10 +10:00
Francisco Jerez 8f71c29e44 drm/nouveau: Don't skip card take down on nv0x.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:09 +10:00
Francisco Jerez b7f7e41b89 drm/nouveau: Implement nv42-nv43 TV load detection.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:08 +10:00
Francisco Jerez 02076da97a drm/nouveau: Clean up the nv17-nv4x load detection code a bit.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:08 +10:00
Marcin Slusarz e55ca7e68e drm/nv50: fix fillrect color
struct fb_fillrect->color is not a color, but index into pseudo_palette
array

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:07 +10:00
Ben Skeggs fbe36a7a06 drm/nv50: ignore vbios table's claim to the contrary if EDID says >8bpc
Should fix dim panel issues reported on Dell M6400/M6500.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 14:41:07 +10:00
Francisco Jerez aeca15e596 drm/nouveau: Drop redundant placement initialization.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:06 +10:00
Francisco Jerez 69a18c328b drm/nouveau: No need to force evict=true when swapping evicted BOs back in.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:05 +10:00
Francisco Jerez c6af6053be drm/nouveau: Fix "general protection fault" in the flipd/flips eviction path.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:05 +10:00
Francisco Jerez 73cb9276fd drm/i2c/ch7006: Drop build time dependency to nouveau.
This partially reverts e4b41066, as this driver is intended to be
useful with any KMS driver for suitable hardware. The missing build
dependency that commit workarounded was DRM_KMS_HELPER.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:04 +10:00
Francisco Jerez 287c153214 drm/nouveau: Make the MM aware of pre-G80 tiling.
This commit has also the following 3 bugfix commits squashed into it from
the nouveau git tree:

drm/nouveau: Fix up the tiling alignment restrictions for nv1x.
drm/nouveau: Fix up the nv2x tiling alignment restrictions.
drm/nv50: fix align typo for g9x

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:03 +10:00
Francisco Jerez 0d87c10031 drm/nouveau: Pre-G80 tiling support.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:03 +10:00
Francisco Jerez 617e234b01 drm/nouveau: Add cache_flush/pull fifo engine functions.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2010-01-11 14:41:02 +10:00
Dave Airlie 94fd163d86 drm: reduce WARN_ON to a printk.
Lots of ppl keep thinking this is an oops, it was just a warning for
me to see, just make it a printk now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-11 14:36:09 +10:00
Dave Airlie 509c7d83c3 drm/kms/fb: check for depth changes from userspace for resizing.
If userspace (plymouth in this case) asks for a deeper depth,
refuse it as well due to lack of resizing.

This fixes an issue since < 32MB cards went to 8bpp and plymouth
crashes on startup.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-11 14:36:09 +10:00
David John 89347bb8ef drm: Keep disabled outputs disabled after suspend / resume
With the current DRM code, an output that has been powered off
from userspace will automatically power back on when resuming
from suspend. This patch fixes this behaviour.

Tested only with the Intel i915 driver on an Intel GM45 Express
chipset.

Signed-off-by: David John <davidjon@xenontk.org>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-11 14:36:08 +10:00
Alex Deucher 804c7559e9 drm/radeon/kms: add additional safe regs for r4xx/rs6xx and r5xx
- r4xx/rs6xx: add support for extended pixel shader
instruction/temp regs
- r5xx: add SM3 regs

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2010-01-11 13:42:27 +10:00
Marcin Kościelnicki fe5a64acbf drm/nv04: Fix set_operation software method.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 09:06:53 +10:00
Ben Skeggs 75c99da6cd drm/nouveau: initialise DMA tracking parameters earlier
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-01-11 09:06:45 +10:00