Commit Graph

1152 Commits

Author SHA1 Message Date
Ben Skeggs 0b3b5579e1 drm/nouveau: don't complain for disabled timingset entries
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:29 +10:00
Ben Skeggs e425e0b339 drm/nvc0/gr: copy GPC mpart config from PFFB
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:15 +10:00
Ben Skeggs aa6500964c drm/nvc0/vram: support non-uniform memory size per controller
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:11 +10:00
Ben Skeggs 3c23a7b8bc drm/nvc0/gr: add support for nvcf chipset
untested, written from a trace, accel disabled by default until it is

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:06 +10:00
Ben Skeggs a12036ba2c drm/nouveau: allow a nouveau_mm to be created with holes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:00 +10:00
Ben Skeggs 987eec10dd drm/nouveau: embed nouveau_mm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:03:56 +10:00
Ben Skeggs 52d073318a drm/nv31/mpeg: support for a single class3174 user
Uncertain if/how the hw does multiple PMPEG channels, supporting one is
better than none however.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:03:44 +10:00
Ben Skeggs 323dcac552 drm/nouveau: rename nv40_mpeg to nv31_mpeg
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:03:38 +10:00
Ben Skeggs 9698b9a680 drm/nvc0/pm: more complete parsing of clock domains
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:03:34 +10:00
Ben Skeggs 354d0781e5 drm/nvc0/pm: initial implementation of clocks_get()
Not too certain on memory clock yet, but it gets the right numbers for
each perflvl on my NVC0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:03:16 +10:00
Ben Skeggs d0f67a48f4 drm/nva3/pm: idle graphics engine before changing clocks
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:02:53 +10:00
Ben Skeggs 78e2933d07 drm/nouveau: add function to wait until a callback returns true
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:02:50 +10:00
Ben Skeggs 95f0de3a0a drm/nv50/gr: insert set/clr of a ctxprog flag at start/end of ctxprog
The set will be replaced with a wait on the same flag by a subsequent
commit in order to halt a ctxprog's execution temporarily.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:02:46 +10:00
Ben Skeggs cec2a270db drm/nva3/pm: tidy and add some comments here and there
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:02:40 +10:00
Ben Skeggs 4fd2847e9b drm/nva3/pm: parse/reclock vdec/41a0 clocks
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:02:36 +10:00
Ben Skeggs ca94a71fc4 drm/nva3/pm: rewrite clock_set, and switch to new interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:51 +10:00
Ben Skeggs 77e7da6814 drm/nouveau/pm: add hooks to get/set *all* clocks at once
This is probably better than having to tell the common code about all the
clocks that exist on every chipset.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:45 +10:00
Ben Skeggs 3b0582d31d drm/nva3/pm: rewrite clock readback functions, far more correct now
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:41 +10:00
Ben Skeggs 03ce8d9e63 drm/nouveau/pm: some fermi chipsets still use volt 0x30
Fun, fun.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:37 +10:00
Ben Skeggs da1dc4cfec drm/nouveau/pm: allow voltage-only perflvl set, enable nvc0
Okay, my card didn't blow up.  Lets turn it on!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:30 +10:00
Ben Skeggs 3c71c2330b drm/nvc0/pm: enable voltage_get
I don't have a terribly good reason for not enabling voltage_set too, but,
lets wait and see.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:25 +10:00
Ben Skeggs 93dccbedeb drm/nouveau/pm: show any info we can manage to glean on current perflvl
Previously wouldn't show detected voltage if we couldn't figure out the
clock frequencies..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:21 +10:00
Ben Skeggs 3b5565ddfd drm/nouveau/pm: add support for parsing perflvl voltage on fermi chips
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:14 +10:00
Ben Skeggs a31214ef3e drm/nouveau/pm: add yet another vid gpio tag
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:11 +10:00
Ben Skeggs f60dfb996c drm/nouveau/pm: initial attempt at parsing volt 0x40
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:06 +10:00
Ben Skeggs c3450239c7 drm/nouveau/pm: store voltage in microvolts
Instead of 10s of millivolts, to match fermi vbios.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:01:02 +10:00
Emil Velikov 0e83bb4eee drm/nv04/crtc: Bail out if FB is not bound to crtc
This commit resolves a possible 'NULL pointer dereference'
It uses the same approach as radeon, intel and nouveau/nv50

Fixes bug 'Nouveau: Kernel oops when unplugging external monitor'
https://bugs.freedesktop.org/show_bug.cgi?id=40336

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-09 17:24:21 +10:00
Marcin Slusarz 1bf2706601 drm/nouveau: fix nv04_sgdma_bind on non-"4kB pages" archs
nv04_sgdma_bind binds the same page multiple times on
architectures where PAGE_SIZE != 4096.
Let's fix it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-09 17:24:10 +10:00
Marcin Slusarz 17c8b96093 drm/nouveau: properly handle allocation failure in nouveau_sgdma_populate
Not cleaning after alloc failure would result in crash on destroy,
because nouveau_sgdma_clear assumes "ttm_alloced" to be not null when
"pages" is not null.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-09 17:24:06 +10:00
Ben Skeggs cfd8be088e drm/nouveau: fix oops on pre-semaphore hardware
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-09 17:24:00 +10:00
Emil Velikov ffbc559b06 drm/nv50/crtc: Bail out if FB is not bound to crtc
Fixes possbile NULL pointer dereference
Resolves 'kernel crash in nv50_crtc_do_mode_set_base during shutdown'
https://bugs.freedesktop.org/show_bug.cgi?id=40005

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-09 17:23:56 +10:00
Marek Olšák dfadbbdb57 drm/ttm: add a way to bo_wait for either the last read or last write
Sometimes we want to know whether a buffer is busy and wait for it (bo_wait).
However, sometimes it would be more useful to be able to query whether
a buffer is busy and being either read or written, and wait until it's stopped
being either read or written. The point of this is to be able to avoid
unnecessary waiting, e.g. if a GPU has written something to a buffer and is now
reading that buffer, and a CPU wants to map that buffer for read, it needs to
only wait for the last write. If there were no write, there wouldn't be any
waiting needed.

This, or course, requires user space drivers to send read/write flags
with each relocation (like we have read/write domains in radeon, so we can
actually use those for something useful now).

Now how this patch works:

The read/write flags should passed to ttm_validate_buffer. TTM maintains
separate sync objects of the last read and write for each buffer, in addition
to the sync object of the last use of a buffer. ttm_bo_wait then operates
with one the sync objects.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-08-31 19:25:35 +01:00
Linus Torvalds 757c26b804 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: (135 commits)
  drm/radeon/kms: fix DP training for DPEncoderService revision bigger than 1.1
  drm/radeon/kms: add missing vddci setting on NI+
  drm/radeon: Add a rmb() in IH processing
  drm/radeon: ATOM Endian fix for atombios_crtc_program_pll()
  drm/radeon: Fix the definition of RADEON_BUF_SWAP_32BIT
  drm/radeon: Do an MMIO read on interrupts when not uisng MSIs
  drm/radeon: Writeback endian fixes
  drm/radeon: Remove a bunch of useless _iomem casts
  drm/gem: add support for private objects
  DRM: clean up and document parsing of video= parameter
  DRM: Radeon: Fix section mismatch.
  drm: really make debug levels match in edid failure code
  drm/radeon/kms: fix i2c map for rv250/280
  drm/nouveau/gr: disable fifo access and idle before suspend ctx unload
  drm/nouveau: pass flag to engine fini() method on suspend
  drm/nouveau: replace nv04_graph_fifo_access() use with direct reg bashing
  drm/nv40/gr: rewrite/split context takedown functions
  drm/nouveau: detect disabled device in irq handler and return IRQ_NONE
  drm/nouveau: ignore connector type when deciding digital/analog on DVI-I
  drm/nouveau: Add a quirk for Gigabyte NX86T
  ...
2011-07-26 09:21:09 -07:00
Dave Airlie 603f2e6d37 Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-core-next
* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6:
  drm/nouveau/gr: disable fifo access and idle before suspend ctx unload
  drm/nouveau: pass flag to engine fini() method on suspend
  drm/nouveau: replace nv04_graph_fifo_access() use with direct reg bashing
  drm/nv40/gr: rewrite/split context takedown functions
  drm/nouveau: detect disabled device in irq handler and return IRQ_NONE
  drm/nouveau: ignore connector type when deciding digital/analog on DVI-I
  drm/nouveau: Add a quirk for Gigabyte NX86T
  drm/nouveau: do not leak in nv20_graph_create
  drm/nv50/dp: fix hack to work for macbooks booted via EFI
2011-07-25 10:15:18 +01:00
Ben Skeggs 9962cc6eba drm/nouveau/gr: disable fifo access and idle before suspend ctx unload
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:43:38 +10:00
Ben Skeggs 6c320fef58 drm/nouveau: pass flag to engine fini() method on suspend
It may not be necessary to fail in certain cases (such as failing to idle)
on module unload, whereas on suspend it's important to ensure a consistent
state can be restored on resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:43:22 +10:00
Ben Skeggs 70ad25ab73 drm/nouveau: replace nv04_graph_fifo_access() use with direct reg bashing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:42:27 +10:00
Ben Skeggs 12a30e267c drm/nv40/gr: rewrite/split context takedown functions
It's completely pointless to save the PGRAPH context when destroying a
channel, so don't bother.

This commit should also fix kernel.org bug 39422, where the DRM channel
state was incorrectly being saved because we left PGRAPH FIFO access
enabled while running the ctxprog.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:42:18 +10:00
Ben Skeggs 9717f3d953 drm/nouveau: detect disabled device in irq handler and return IRQ_NONE
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:42:09 +10:00
Ben Skeggs e19b20bbd2 drm/nouveau: ignore connector type when deciding digital/analog on DVI-I
If the connector table is lying, which it often does on the boards of a
particular manufacturer, we may end up doing the wrong thing.  Listen
to the encoder table instead, it's more reliable.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:41:34 +10:00
Emil Velikov f0d07d6e89 drm/nouveau: Add a quirk for Gigabyte NX86T
The connector table lies, the card has DVI-I not HDMI
Fixes bug https://bugs.freedesktop.org/show_bug.cgi?id=35675

v2: Mention the bugreport
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:41:29 +10:00
Jesper Juhl 1541fa8542 drm/nouveau: do not leak in nv20_graph_create
If we return due to an unknown chipset in
drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the
memory allocated to 'pgraph'.

This patch should fix the leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:40:52 +10:00
Ben Skeggs 88c8431cbb drm/nv50/dp: fix hack to work for macbooks booted via EFI
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-07-25 09:40:41 +10:00
Dave Airlie cf056edbbe Merge 3.0-rc7 into drm-core-next
This pulls in all the drm fixes up to this point which are needed
for some -next patches to work.
2011-07-13 08:30:22 +01:00
Jon Mason 58b6542b50 DRM: remove drm_pci_device_is_pcie
drm_pci_device_is_pcie duplicates the funcationality of pci_is_pcie.
Convert callers of the former to the latter.  This has the side benefit
of removing an unnecessary search in the PCI configuration space due to
using a saved PCIe capability offset.

[airlied: update for new callsite]

Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-07-13 08:14:52 +01:00
Jiri Kosina b7e9c223be Merge branch 'master' into for-next
Sync with Linus' tree to be able to apply pending patches that
are based on newer code already present upstream.
2011-07-11 14:15:55 +02:00
Ben Skeggs 6002525170 Revert "drm/nvc0: recognise 0xdX chipsets as NV_C0"
Oh boy.  That was a bad gamble.  PDISP has changed.

This reverts commit cdf81a235f.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-07-02 07:10:20 +10:00
Dan Carpenter 60f7ab0665 drm/nouveau: error paths leak in nvc0_graph_construct_context()
Two of these error paths returned without freeing "ctx".

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-27 09:20:27 +10:00
Younes Manton 3b40d07d8c drm/nouveau: Calculate reserved VRAM for PRAMIN value before use.
'drm/nouveau: rework vram init/fini ordering a little' changed
the order of instmem.init() and nouveau_mem_vram_init() which
resulted in using ramin_rsvd_vram before it was calculated and
failing to init any accel on pre-NV50 cards.

Since it's only used on <NV50 just calculate it where it's needed
and leave it as default 0 for NV50.

Signed-off-by: Younes Manton <younes.m@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-27 09:20:21 +10:00
Marcin Slusarz 8fe198b2c6 drm/nouveau: fix nouveau_vma object leak
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-27 09:20:12 +10:00
Marcin Slusarz 0de53a546b drm/nouveau: fix nouveau_mem object leak
It's a regression from "drm/nouveau: create temp vmas for both src and
dst of bo moves".

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-27 09:20:08 +10:00
Ben Skeggs 9617757fb3 drm/nouveau: fix fetching vbios from above 4GiB vram addresses
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-27 09:20:04 +10:00
Ben Skeggs 9a11dd6587 drm/nouveau: fix off-by-one
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:04:53 +10:00
Emil Velikov 6d13e9c188 drm/nouveau/temp: Add default calibration values for nv67
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:04:48 +10:00
Emil Velikov 40ce4279e1 drm/nouveau/temp: Fix signed/unsigned int logic
Many (all?) of the coefficients related to calculating the
correct temperature are signed integers

This patch correcly parses and stores those values
It also ensures that the default offset is 0 (previously 1)

Affected cards - the original nv50 and the nv40 family

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:04:39 +10:00
Ben Skeggs 0b33c93659 drm/nvc0: push prunk140 irq messages to debug loglevel
We know they happen, we don't know why.  They're annoying, so hide them
from users for the moment.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:04:32 +10:00
Ben Skeggs 63305de75f drm/nouveau: un-blacklist nvce accel
Reported working on IRC.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:04:17 +10:00
Ben Skeggs bf08bcc6b7 drm/nouveau: fix null pointer deref on pre-nv50 chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:04:03 +10:00
Ben Skeggs 24f246ac10 drm/nouveau: rework vram init/fini ordering a little
Commit "drm/nouveau: add some debug output if nouveau_mm busy at destroy time"
revealed an issue where vram mm takedown would actually fail due to there
still being nodes present, causing nouveau to leak a small amount of memory
on module unload.

This splits TTM/nouveau_mm a bit more cleanly and ensures nouveau_mm fini
isn't done until all gpuobjs are also destroyed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:03:46 +10:00
Ben Skeggs 15ba79ad44 drm/nouveau: shut lockdep up if last vm ref needs to destroy pgd
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:01:52 +10:00
Ben Skeggs 06b75e3552 drm/nouveau: fix display takedown order to match reverse init order
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:01:47 +10:00
Ben Skeggs 5de8037ab4 drm/nvc0: enable per-client address spaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:01:41 +10:00
Ben Skeggs ad9ac437a5 drm/nouveau: add some debug output if nouveau_mm busy at destroy time
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:55 +10:00
Ben Skeggs e41f26e7d1 drm/nv50: enable use of per-client gpu address space
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:47 +10:00
Ben Skeggs 2fd3db6f14 drm/nouveau: remove implicit mapping of every bo into chan_vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:42 +10:00
Ben Skeggs 7375c95b34 drm/nouveau: remove 'chan' argument from nouveau_bo_new
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:37 +10:00
Ben Skeggs e758a31119 drm/nouveau: fixup gem_info ioctl to return client-specific bo virtual
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:32 +10:00
Ben Skeggs 3d483d575b drm/nvc0: explicitly map PDISP semaphore buffer into each channel's vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:27 +10:00
Ben Skeggs 9f9f51fcb9 drm/nv50-nvc0: lookup pushbuf virtual address on dma_push
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:22 +10:00
Ben Skeggs d02836b4f5 drm/nv84-nvc0: explicitly map semaphore buffer into channel vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:17 +10:00
Ben Skeggs ce163f6967 drm/nv50-nvc0: explicitly map pushbuf bo into channel vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:09 +10:00
Ben Skeggs 0b7187335f drm/nv50-nvc0: explicitly map notifier bo into channel vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 16:00:04 +10:00
Ben Skeggs 45143cb53c drm/nv50-nvc0: explicitly map fbcon fb into channel vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:59 +10:00
Ben Skeggs fd2871af3d drm/nouveau: initial changes to support multiple VMAs per buffer object
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:53 +10:00
Ben Skeggs a3fcd0a975 drm/nv50-nvc0: completely disable relocs
GPU virtual addresses are constant now so this should never be getting hit
anyway and userspace shouldn't break from them being ignored.

This is being done in preference to teaching the code how to deal with BOs
that exist at different virtual addresses within separate VMs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:49 +10:00
Ben Skeggs 180cc30637 drm/nouveau: convert bo.mem.start usage to bo.offset
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:44 +10:00
Ben Skeggs 07533ea549 drm/nouveau: convert some bo.offset use to vma.offset
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:39 +10:00
Ben Skeggs d2f96666c5 drm/nouveau: create temp vmas for both src and dst of bo moves
Greatly simplifies a number of things, particularly once per-client GPU
address spaces are involved.

May add this back later once I know what things'll look like.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:34 +10:00
Ben Skeggs f91bac5bf6 drm/nouveau: store bo's page size in nouveau_bo
Was previously assuming a page size of 4KiB unless a VMA was present to
override it.  Eventually, a buffer won't necessarily have a VMA at all at
some stages of its life, so we need to store this info elsewhere.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:27 +10:00
Ben Skeggs 111af5c100 drm/nouveau: skip move_notify() if bo does not have a vma attached
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:22 +10:00
Ben Skeggs 6e32fedc8b drm/nouveau: will need to specify channel for vm-ful gpuobj allocations
Abuses existing gpuobj_new() chan argument for this, which in turn forces
all NVOBJ_FLAG_VM allocations to be done from the global heap, not
suballocated from the channel's private heap.  Not a problem though in
practise.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:18 +10:00
Ben Skeggs dd6a46cc92 drm/nouveau: initialise any vm for a channel before pushbuf/ntfy
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:12 +10:00
Ben Skeggs b7cb6c01ee drm/nouveau: modify gpuobj/ntfy takedown ordering
gpuobj really needs splitting into channel/gpuobj code instead...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:07 +10:00
Ben Skeggs 639212d011 drm/nouveau/gem: implement stub hooks for GEM object open/close
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:59:02 +10:00
Ben Skeggs f6d4e62145 drm/nouveau: remove 'chan' argument from nouveau_gem_new
Userspace hasn't passed us a channel_hint for a long long time now, and
there isn't actually a need to do so anymore anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:56 +10:00
Ben Skeggs 0320d7910b drm/nv50-nvc0/chan: inherit vm from fpriv, rather than chan_vm directly
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:52 +10:00
Ben Skeggs fe32b16e79 drm/nv50-nvc0/vm: take client reference on shared channel vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:46 +10:00
Ben Skeggs b79181cbad drm/nv50-nvc0/vm: don't touch chan_vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:40 +10:00
Ben Skeggs d359d51cba drm/nouveau: no need to update bo.offset from vma after validate
On chipsets using nouveau_vm, the virtual address stays constant, so
the value set at bo creation time is fine.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:32 +10:00
Ben Skeggs e8a863c10f drm/nouveau: store a per-client channel list
Removes the need to disable IRQs to lookup channel struct on every pushbuf
ioctl, among others.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:25 +10:00
Ben Skeggs f8656f0baa drm/nouveau: use NULL file_priv for DRM-created channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:20 +10:00
Ben Skeggs 3f0a68d8f8 drm/nouveau: allocate structure to store per-client data
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:15 +10:00
Ben Skeggs 1562ffde94 drm/nouveau: silence error for missing dac loadval table
There's lots of boards (all recent ones) that don't have this anymore, so
punt the message to debug loglevel.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:10 +10:00
Ben Skeggs e540afc325 drm/nv50: DCB table quirks for another busted XFX board
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:04 +10:00
Ben Skeggs ad830d23d3 drm/nouveau: log if accel is disabled by default on a chipset
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:58:00 +10:00
Ben Skeggs 752ab0a092 drm/nvc0/gr: fill in some more data for 0xc1/0xc8/0xce
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:56 +10:00
Ben Skeggs 2b6f1c5f17 drm/nvc0/gr: fix typo in class9197 init
Reported-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:51 +10:00
Ben Skeggs 066d65db11 drm/nvc0/gr: calculate magicgpc918 ourselves
Not a clue what it is yet, but we get the same numbers as NVIDIA now.

My 465 didn't seem to care to greatly *what* I bashed into these registers..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:48 +10:00
Ben Skeggs a219997a3b drm/nvc0/gr: add some missing magics for 0xc1/0xc8/0xce
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:43 +10:00
Ben Skeggs 0411de8548 drm/nvc0/gr: import and use our own fuc by default
The ability to use NVIDIA's fuc has been retained *temporarily* in order
to better debug any issues that may be lingering in our initial attempt
at writing this ucode.  Once I'm fairly confident we're okay, it'll be
removed.

There's a number of things not implemented by this fuc currently, but
most of it is sets of state that our context setup would not have used
anyway.  No doubt we'll find out what they're for at some point, and
implement it if required.

This has been tested on 0xc0/0xc4 thus far, and from what I could tell
it worked as well as NVIDIA's.  It's also been tested on 0xc1, but even
with NVIDIA's fuc that chipset doesn't work correctly with nouveau yet.

0xc3/0xc8/0xce should in theory be supported too, but I don't have the
hardware to check that.

There's no doubt numerous bugs to squash yet, please report any!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:38 +10:00
Ben Skeggs f8522fc80f drm/nvc0: fix suspend/resume of PGRAPH/PCOPYn
We need the physical VRAM address in vinst, even for objects mapped into
a vm, as the gpuobj suspend/resume code uses PMEM to access the object.

Previously, vinst was overloaded to mean "VRAM address" for !VM objects,
and "VM address" for VM objects, causing the wrong data to be accessed
during suspend/resume.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:33 +10:00
Ben Skeggs aba99a8400 drm/nouveau: default to noaccel on 0xc1/0xc8/0xce for now
Until we know these should work properly, would much rather default to
noaccel than risk giving people corruption/hangs out of the box..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:28 +10:00
Ben Skeggs d4409cc7e2 drm/nvc1/gr: switch on acceleration support
There's issues with certain 3D apps still, unknown whether this is a kernel
issue or not.. It does appear that it may be in the 3D driver however.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:25 +10:00
Ben Skeggs b53a2d0649 drm/nvc0/gr: enable 0xc8/0xce support, no idea if it works or not..
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:20 +10:00
Ben Skeggs e1b89b1ca5 drm/nvc0/gr: some initial state modifications
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:16 +10:00
Ben Skeggs 6f376460e4 drm/nvc0/gr: 0x9197/0x9297 state init
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:11 +10:00
Ben Skeggs 847adea2c7 drm/nvc0/gr: macro to determine fermi class, will use it in a few places
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:07 +10:00
Ben Skeggs 068da16198 drm/nvc0/fifo: fix typos in unload_context
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:57:03 +10:00
Ben Skeggs 310ff414b3 drm/nvc0/fb: allocate page for some unknown PFFB object
Fixes DMAR faults during accel, more than likely a similar problem to what
was solved on nv50 previously.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:56:59 +10:00
Martin Peres 74cfad188b drm/nvc0: Read temperature on Fermi like we do on nv84+
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-23 15:56:52 +10:00
Vitaliy Ivanov e44ba033c5 treewide: remove duplicate includes
Many stupid corrections of duplicated includes based on the output of
scripts/checkincludes.pl.

Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-06-20 16:08:19 +02:00
Dave Airlie 4ee1c57fca drm/nouveau: drop leftover debugging
this printk isn't really useful, just drop it for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-06-20 15:27:18 +10:00
Ben Skeggs b16a5a18ff drm/nouveau: fix assumption that semaphore dmaobj is valid in x-chan sync
The DDX modifies DMA_SEMAPHORE on nv50 in order to implement sync-to-vblank,
things will go very wrong for cross-channel sync after this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-18 14:56:24 +10:00
Ben Skeggs f66b3d5540 drm/nv50/disp: fix gamma with page flipping overlay turned on
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-18 14:38:45 +10:00
Emil Velikov 2905544073 drm/nouveau/pm: Prevent overflow in nouveau_perf_init()
While parsing the perf table, there is no check if
the num of entries read from the vbios is less than
the currently allocated number.

In case of a buggy vbios this will cause overwriting
of kernel memory, causing aditional problems.

Add a simple check in order to prevent the case

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-18 14:38:38 +10:00
Ben Skeggs 0897554cdd drm/nouveau: fix big-endian switch
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-18 14:38:27 +10:00
Ben Skeggs 4cff3ce5fe drm/nv40: fall back to paged dma object for the moment
PCI(E)GART isn't quite stable it seems, fall back to old method until I get
the time to sort it out properly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-07 09:23:03 +10:00
Ben Skeggs 960bdba08e drm/nouveau: fix leak of gart mm node
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-07 09:22:51 +10:00
Ben Skeggs 73c337e70e drm/nouveau: fix vram page mapping when crossing page table boundaries
Hopefully the cause of nvc0 "page jumping" issue.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-07 09:22:48 +10:00
Francisco Jerez c1003d9c90 drm/nv17-nv40: Fix modesetting failure when pitch == 4096px (fdo bug 35901).
Reported-by: Mario Bachmann <grafgrimm77@gmx.de>
Tested-by: Greg Turner <gmturner007@ameritech.net>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-07 09:22:29 +10:00
Ben Skeggs 18b54c4d58 drm/nouveau: don't create accel engine objects when noaccel=1
Fixes various potential oopses.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-07 09:22:03 +10:00
Ben Skeggs cdf81a235f drm/nvc0: recognise 0xdX chipsets as NV_C0
Should hopefully get modesetting at least from this, it appears these are
GF119 chipsets.  Accel will come eventually, once I order a board.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-06-07 09:21:13 +10:00
Linus Torvalds 98b98d3163 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: (169 commits)
  drivers/gpu/drm/radeon/atom.c: fix warning
  drm/radeon/kms: bump kms version number
  drm/radeon/kms: properly set num banks for fusion asics
  drm/radeon/kms/atom: move dig phy init out of modesetting
  drm/radeon/kms/cayman: fix typo in register mask
  drm/radeon/kms: fix typo in spread spectrum code
  drm/radeon/kms: fix tile_config value reported to userspace on cayman.
  drm/radeon/kms: fix incorrect comparison in cayman setup code.
  drm/radeon/kms: add wait idle ioctl for eg->cayman
  drm/radeon/cayman: setup hdp to invalidate and flush when asked
  drm/radeon/evergreen/btc/fusion: setup hdp to invalidate and flush when asked
  agp/uninorth: Fix lockups with radeon KMS and >1x.
  drm/radeon/kms: the SS_Id field in the LCD table if for LVDS only
  drm/radeon/kms: properly set the CLK_REF bit for DCE3 devices
  drm/radeon/kms: fixup eDP connector handling
  drm/radeon/kms: bail early for eDP in hotplug callback
  drm/radeon/kms: simplify hotplug handler logic
  drm/radeon/kms: rewrite DP handling
  drm/radeon/kms/atom: add support for setting DP panel mode
  drm/radeon/kms: atombios.h updates for DP panel mode
  ...
2011-05-24 12:06:40 -07:00
Randy Dunlap fb0b760605 drm: fix nouveau_acpi build
Fix build errors when CONFIG_ACPI is enabled but MXM_WMI is not enabled
by selecting both MXM_WMI and ACPI_WMI (the latter just for kconfig
dependencies):

nouveau_acpi.c:(.text+0x2400c8): undefined reference to `mxm_wmi_call_mxmx'
nouveau_acpi.c:(.text+0x2400cf): undefined reference to `mxm_wmi_call_mxds'
nouveau_acpi.c:(.text+0x2400fe): undefined reference to `mxm_wmi_call_mxmx'
nouveau_acpi.c:(.text+0x2402ba): undefined reference to `mxm_wmi_supported

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-16 11:57:20 +10:00
Marcin Slusarz b4fa9d0f65 drm/nouveau: make cursor_set implementation consistent with other drivers
When xorg state tracker wants to hide the cursor it calls set_cursor
with NULL buffer_handle and size=0x0, but nouveau refuses to hide it
because size is not 64x64... which is a bit odd. Both radeon and intel
check buffer_handle before validating size of cursor, so make nouveau
implementation consistent with them.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:51:05 +10:00
Ben Skeggs 52eba8dd5e drm/nva3/clk: better pll calculation when no fractional fb div available
The core/mem/shader clocks don't support the fractional feedback divider,
causing our calculated clocks to be off by quite a lot in some cases.  To
solve this we will switch to a search-based algorithm when fN is NULL.

For my NVA8 at PL3, this actually generates identical cooefficients to
the binary driver.  Hopefully that's a good sign, and that does not
break VPLL calculation for someone..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:59 +10:00
Ben Skeggs 96d1fcf8b5 drm/nouveau/pm: translate ramcfg strap through ram restrict table
Hopefully this is how we're supposed to correctly handle when the RAMCFG
strap is above the number of entries in timing-related tables.

It's rather difficult to confirm without finding a configuration where
the ram restrict table doesn't map 8-15 back onto 0-7 anyway.  There's
not a single vbios in the repo which is configured differently..

In any case, this is probably still better than potentially reading
outside of the bounds of various tables..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:57 +10:00
Ben Skeggs bfb61f43b3 drm/nva3/pm: allow use of divisor 16
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:52 +10:00
Ben Skeggs 047d2df54c drm/nvc0/pm: parse clock for pll 0x0a (0x137020) from perf table
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:47 +10:00
Ben Skeggs 40f6193b8f drm/nvc0/pm: correct core/mem/shader perflvl parsing
We need to parse some of these other entries still, but I've yet to
determine exactly which PLLs the rest map to.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:42 +10:00
Ben Skeggs 730673b665 drm/nouveau/pm: remove memtiming support check when assigning to perflvl
Really not necessary here, we want to be able to see if/how we managed to
match a timingset to a performance level, even if we can't currently
program it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:38 +10:00
Ben Skeggs fcfc768806 drm/nva3: support for memory timing map table
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:33 +10:00
Martin Peres e614b2e7ca drm/nouveau: Associate memtimings with performance levels on cards <= nv98
v2 (Ben Skeggs): fix ramcfg strap, and remove bogus handling of perf 0x40

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:30 +10:00
Ben Skeggs dac55b5825 drm/nva3/pm: initial pass at set_clock() hook
I still discourage anyone from actually doing this yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:25 +10:00
Ben Skeggs aa58c40563 drm/nvc0/gr: calculate some more of our magic numbers
Again, doesn't quite match NVIDIA's, but not sure it really matters.  This
will however, match the same rules we use to calculate the other related
grctx magics.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:22 +10:00
Ben Skeggs b23b9e7109 drm/nv50: respect LVDS link count from EDID on SPWG panels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:16 +10:00
Ben Skeggs 8c3f6bb970 drm/nouveau: recognise DCB connector type 0x41 as LVDS
After looking at a number of different logs, it appears 0x41 likely
indicates the presense of an LVDS panel following the SPWG spec
(http://www.spwg.org/)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:13 +10:00
Ben Skeggs eea55c89e5 drm/nouveau: fix uninitialised variable warning
Looks like a false positive to me, but, anyways!

Reported-by: Jimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:07 +10:00
Jimmy Rentz 976661093d drm/nouveau: Fix a crash at card takedown for NV40 and older cards
NV40 and older cards (pre NV50) reserve a vram bo for the vga memory at
card init. This bo is then freed at card shutdown.  The problem is that
the ttm bo vram manager was already freed. So a crash occurs when the
vga bo is freed. The fix is to free the vga bo prior to freeing the ttm
bo vram manager. There might be other solutions but this seemed the
simplest to me.

Signed-off-by: Jimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:50:04 +10:00
Jimmy Rentz 2abdb057e4 drm/nouveau: Free nv04 instmem ramin heap at card takedown
Add a missing nv04 instmem ramin heap shutdown call.

Signed-off-by: Jimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:58 +10:00
Ben Skeggs 215f902e15 drm/nva3: somewhat improve clock reporting
Definitely not 100% correct, but, for the configurations I've seen used
it'll read back the correct clocks now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:54 +10:00
Ben Skeggs ce521846b9 drm/nouveau: pull refclk from vbios on limits 0x40 boards
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:50 +10:00
Ben Skeggs 3acf67f66e drm/nv40/gr: oops, fix random bits getting set in engine obj
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:47 +10:00
Emil Velikov 619d4f7e21 drm/nv50: improve nv50_pm_get_clock()
Many of the nv50 cards have their shader and/or memory pll
disabled at some stage.
This patch addresses those cases, so that the function
returns the correct frequency.

When the shader pll is disabled, the blob reports 2*core clock
Whereas for memory, the data stored in the vbios. This action
is incorrect as some vbioses store a clock value that is less
than the refference clock of the pll.

Thus we are reporting the reff_clk as it is the frequency the
pll actually operates

v2 - Convert NV_INFO() messages to NV_DEBUG()
Provide more information in the actuall message

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:41 +10:00
Martin Peres 1f962797fb drm/nouveau/pm: fix compilation failure when CONFIG_POWER_SUPPLY is not set
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Reported-by: Stratos Psomadakis <psomas@ece.ntua.gr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:34 +10:00
Ben Skeggs 1233bd8d31 drm/nvc0/fifo: stick user area into a gpuobj rather than a bo
Contents will now be preserved across a suspend, unlike a pinned bo

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:30 +10:00
Ben Skeggs 1d97f4acd3 drm/nvc0/gr: no need to store context in graph_fini()
PFIFO kickoff should have handled this for us.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:26 +10:00
Ben Skeggs 0638df425f drm/nvc0/fifo: restore context table on resume
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:22 +10:00
Ben Skeggs 7a5c23de36 drm/nvc0/fifo: kick channels off during suspend
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:17 +10:00
Ben Skeggs fe799114e2 drm/nvc0/gr: better handling of fuc firmware
Allows per-chipset firmware to be installed, and keeps a copy in memory
for suspend/resume purposes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:13 +10:00
Ben Skeggs 9548258fbc drm/nv50: support PMPEG on original nv50
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:08 +10:00
Ben Skeggs 93187450fa drm/nv50: rename nv84_mpeg to nv50_mpeg
In preparation for adding 0x50 support.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:49:04 +10:00
Ben Skeggs c0924326c8 drm/nv84: add support for PMPEG
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:59 +10:00
Ben Skeggs a02ccc7f97 drm/nv40/vpe: add support for PMPEG
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:56 +10:00
Ben Skeggs d5a27370b5 drm/nvc0: implement support for copy engines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:53 +10:00
Ben Skeggs 7ff5441e55 drm/nva3: implement support for copy engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:48 +10:00
Ben Skeggs a82dd49f14 drm/nouveau: remove remnants of nouveau_pgraph_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:45 +10:00
Ben Skeggs 92abe74992 drm/nouveau: fix suspend failure path to reinitialise all engines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:42 +10:00
Ben Skeggs 39a654d5b9 drm/nouveau: remove remnants of nouveau_pgraph_engine from nouveau_channel
The nouveau_wait_for_idle() call should hopefully not have been actually
necessary, we *do* wait for the channel to go idle already.  If it's
an issue somehow, the chipset-specific hooks can wait for idle themselves
before taking the lock.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:37 +10:00
Ben Skeggs 96c5008290 drm/nouveau: move set_tile_region to nouveau_exec_engine
In the very least VPE (PMPEG and friends) also has this style of tile
region regs, lets make them just work if/when they get added.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:33 +10:00
Ben Skeggs 4976986bd4 drm/nv04/gr: move to exec engine interfaces
Like nv10-nv50, needs cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:27 +10:00
Ben Skeggs d11db27901 drm/nv10/gr: move to exec engine interfaces
Like nv20-nv50, needs cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:24 +10:00
Ben Skeggs a0b1de84fe drm/nv20-nv30/gr: move to exec engine interface
A bit of cleanup done along the way, but, like nv40/nv50, needs more.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:18 +10:00
Ben Skeggs 39c8d36827 drm/nv40/gr: move to exec engine interfaces
Like nv50, this needs a good cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:14 +10:00
Ben Skeggs 7a45cd19c9 drm/nvc0/gr: move to exec engine interfaces
Much nicer to do that nv50, the code was pretty much written to expect
such a change in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:09 +10:00
Ben Skeggs 2703c21a82 drm/nv50/gr: move to exec engine interfaces
This needs a massive cleanup, but to catch bugs from the interface changes
vs the engine code cleanup, this will be done later.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:06 +10:00
Ben Skeggs 6dfdd7a61e drm/nouveau: working towards a common way to represent engines
There's lots of more-or-less independant engines present on NVIDIA GPUs
these days, and we generally want to perform the same operations on them.
Implementing new ones requires hooking into lots of different places,
the aim of this work is to make this simpler and cleaner.

NV84:NV98 PCRYPT moved over as a test.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:48:01 +10:00
Ben Skeggs 2d7b919c9b drm/nouveau: remove some unused members from dev_priv
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:55 +10:00
Ben Skeggs 4ea52f8974 drm/nouveau: move engine object creation into per-engine hooks
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:52 +10:00
Ben Skeggs 475feffabe drm/nouveau: use static vidshift of 2 on volt 0x30 tables
Explanation is in the commit.  If anyone has an example of where this is
*not* the case, please report it!

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:47 +10:00
Roy Spliet 50066f8117 drm/nouveau: improve memtiming table parsing
Improves the parsing of the memory timing table on NV50-NV98revA1 chipsets.

Added stepping to drm_nouveau_private to make sure newer NV98 (105M) is
zero rather than incorrect.

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:43 +10:00
Ben Skeggs 7795bee0c4 drm/nvc0: decode gpc/hubclient on vm fault
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:37 +10:00
Ben Skeggs e2966632ae drm/nvc0: more vm fault reasons
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:34 +10:00
Ben Skeggs 7a31347362 drm/nvc0: more vm fault engines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:28 +10:00
Emil Velikov 0b89a072f9 drm/nouveau: Fix missing whitespace checkpatch.pl errors.
This patch fixes messages such as
ERROR: space required after that ','
ERROR: spaces required around that '='

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2011-05-16 10:47:25 +10:00
Emil Velikov f9ec8f6c8d drm/nouveau: Fix brace placement checkpatch.pl errors.
Fix 'ERROR: that open brace { should be on the previous line'
Fix 'ERROR: else should follow close brace }'

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2011-05-16 10:47:19 +10:00
Emil Velikov f212949ced drm/nouveau: Clean up trailing whitespace and C99-style comments.
Fix 'ERROR: trailing whitespace',
Fix 'ERROR: do not use C99 // comments'

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2011-05-16 10:47:17 +10:00
Emil Velikov 71298e2f0b drm/nouveau: Fix indentation-related checkpatch.pl error messages.
Fix 'ERROR: code indent should use tabs where possible'
Fix 'ERROR: space required before the open parenthesis ('

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2011-05-16 10:47:10 +10:00
Martin Peres 01e542c65d drm/nouveau: name the boot perflvl "boot"
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-16 10:47:07 +10:00
Dave Airlie 03a8066534 drm/radeon/nouveau: fix build regression on alpha due to Xen changes.
The Xen changes were using DMA_ERROR_CODE which isn't defined on a few
platforms, however we reverted the Xen patch that caused use to try and
use this code path earlier in 2.6.39 cycle, so for now lets just force
the code to never take this path and allow it to build again on alpha.

The proper long term answer is probably to store if the dma_addr has
been assigned to alongside the dma_addr in the higher level code,
though I think Thomas wanted to rewrite most of this anyways properly.

Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-11 13:08:02 +10:00
Dave Airlie 0eacdba3a1 drm/mxm: fix Kconfig options for when to build MXM WMI driver.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-09 14:37:10 +10:00
Dave Airlie 000703f44c mxm/wmi: add MXMX interface entry point.
The MXMX method appears to be a mutex of some sort.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-09 11:40:38 +10:00
Jimmy Rentz 7a7b94ad8c drm/nouveau: Fix a crash at card takedown for NV40 and older cards
NV40 and older cards (pre NV50) reserve a vram bo for the vga memory at
card init. This bo is then freed at card shutdown.  The problem is that
the ttm bo vram manager was already freed. So a crash occurs when the
vga bo is freed. The fix is to free the vga bo prior to freeing the ttm
bo vram manager. There might be other solutions but this seemed the
simplest to me.

Signed-off-by: Jimmy Rentz <jb17bsome@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-05-09 08:42:49 +10:00
Dave Airlie f19467c509 nouveau: add optimus detection to DSM code.
optimus has another DSM GUID, so we check for its existance,
also allow the BIOS stuff is we find it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-04 13:39:24 +10:00
Dave Airlie 8116188fde nouveau/acpi: hook up to the MXM method for mux switching.
this hooks up nouveau to the MXM mux switching method.

With this in place I can switch the LVDS MUX on my T410s,
I expect we need a bit more work for other laptops.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-05-04 13:38:46 +10:00
Marcin Slusarz e4ac93bf3c drm/nouveau: fix allocation of notifier object
Commit 73412c3854 ("drm/nouveau: allocate
kernel's notifier object at end of block") intended to align end of
notifier block to page boundary, but start of block was miscalculated
to be off by -16 bytes. Fix it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-20 08:51:34 +10:00
Marcin Slusarz a18d89ca02 drm/nouveau: fix notifier memory corruption bug
nouveau_bo_wr32 expects offset to be in words, but we pass value in bytes,
so after commit 73412c3854 ("drm/nouveau: allocate
kernel's notifier object at end of block") we started to overwrite some memory
after notifier buffer object (previously m2mf_ntfy was always 0, so it didn't
matter it was a value in bytes).

Reported-by: Dominik Brodowski <linux@dominikbrodowski.net>
Reported-by: Nigel Cunningham <lkml@nigelcunningham.com.au>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Pekka Paalanen <pq@iki.fi>
Cc: stable@kernel.org    [2.6.38]
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-20 08:51:31 +10:00
Ben Skeggs 11dea1a214 drm/nouveau: fix pinning of notifier block
Problem introduced with commit 6ba9a68317

Reported-by: Bob Gleitsmann <rjgleits@bellsouth.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-20 08:51:23 +10:00
Ben Skeggs 8706398bf8 drm/nouveau: populate ttm_alloced with false, when it's not
Caught with kmemcheck on unrelated business.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-20 08:50:40 +10:00
Ben Skeggs 01d153326e drm/nouveau: fix nv30 pcie boards
Wasn't aware they even existed, apparently they do!  They're actually
AGP chips with a bridge as far as I can tell, which puts them in the
same boat as nv40/nv45.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-20 08:50:37 +10:00
Ben Skeggs 04eb34a43c drm/nouveau: split ramin_lock into two locks, one hardirq safe
Fixes a possible lock ordering reversal between context_switch_lock
and ramin_lock.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2011-04-20 08:50:14 +10:00
Dave Airlie d85023a3cd Merge remote branch 'nouveau/drm-nouveau-fixes' of /ssd/git/drm-nouveau-next into drm-fixes
* 'nouveau/drm-nouveau-fixes' of /ssd/git/drm-nouveau-next:
  drm/nvc0: improve vm flush function
  drm/nv50-nvc0: remove some code that doesn't belong here
  drm/nv50: use "nv86" tlb flush method on everything except 0x50/0xac
  drm/nouveau: quirk for XFX GT-240X-YA
  drm/nv50-nvc0: work around an evo channel hang that some people see
  drm/nouveau: implement init table opcode 0x5c
  drm/nouveau: fix oops on unload with disabled LVDS panel
  nv30: Fix parsing of perf table
  drm/nouveau: correct memtiming table parsing for nv4x
2011-04-11 15:26:01 +10:00
Linus Torvalds 42933bac11 Merge branch 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6
* 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6:
  Fix common misspellings
2011-04-07 11:14:49 -07:00
Ben Skeggs a719726f4c drm/nvc0: improve vm flush function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:38:12 +10:00
Ben Skeggs e61e51f134 drm/nv50-nvc0: remove some code that doesn't belong here
Not sure how this snuck in...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:38:09 +10:00
Ben Skeggs 2b4cebe4e1 drm/nv50: use "nv86" tlb flush method on everything except 0x50/0xac
It has been reported that this greatly improves (and possibly fixes
completely) the stability of NVA3+ chipsets.  In traces of my NVA8,
NVIDIA now appear to be doing this too.

The most recent traces of 0x50 and 0xac I could find don't show NVIDIA
checking PGRAPH status on these flushes, so for now, we won't either.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:38:02 +10:00
Ben Skeggs c0929b499f drm/nouveau: quirk for XFX GT-240X-YA
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:07:21 +10:00
David Dillow 59197c0262 drm/nv50-nvc0: work around an evo channel hang that some people see
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:07:16 +10:00
Ben Skeggs ec64a40868 drm/nouveau: implement init table opcode 0x5c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:07:13 +10:00
Marcin Slusarz fb522ee1aa drm/nouveau: fix oops on unload with disabled LVDS panel
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=35135
BUG: unable to handle kernel NULL pointer dereference at 000002d8
IP: [<f83694af>] nv04_dfp_restore+0x7f/0xd0 [nouveau]
(...)
Call Trace:
 [<f8372208>] nv04_display_destroy+0xa8/0x140 [nouveau]
 [<f830344a>] nouveau_unload+0x2a/0x160 [nouveau]
 [<f80d98fb>] drm_put_dev+0xbb/0x1b0 [drm]
 [<f8301025>] nouveau_pci_remove+0x15/0x20 [nouveau]
 [<c1292ad4>] pci_device_remove+0x44/0xf0
 [<c13339d1>] __device_release_driver+0x51/0xb0
 [<c133401f>] driver_detach+0x8f/0xa0
 [<c13338a3>] bus_remove_driver+0x63/0xa0
 [<c13340a9>] driver_unregister+0x49/0x80
 [<c1182f84>] ? sysfs_remove_file+0x14/0x20
 [<c1292bb2>] pci_unregister_driver+0x32/0x90
 [<c109b1da>] ? __stop_machine+0x5a/0x70
 [<f80d3f93>] drm_exit+0x83/0x90 [drm]
 [<f837875d>] nouveau_exit+0x1b/0x8be [nouveau]
 [<c1087b5b>] sys_delete_module+0x13b/0x1f0
 [<c1104c3e>] ? do_munmap+0x1fe/0x280
 [<c1104780>] ? arch_unmap_area_topdown+0x0/0x20
 [<c15096f4>] syscall_call+0x7/0xb

Reported-by: Francesco Marella <francesco.marella@gmail.com>
Tested-by: Francesco Marella <francesco.marella@gmail.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
[ currojerez@riseup.net: No need to spam the logs in that case, an
  unbound LVDS encoder is not an error. ]
Signed-off-by: Francisco Jerez <currojerez@riseup.net>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:07:05 +10:00
Emil Velikov b251d1a488 nv30: Fix parsing of perf table
Perf tables v 1.2 and 1.3 (seen on Geforce FX/ 5) are not long enough
to store the voltage label/id

v2 - Remove comment from the code

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-04-05 11:06:14 +10:00
Roy Spliet ac5c15fa58 drm/nouveau: correct memtiming table parsing for nv4x
In line with envytools, verified on 4 or 5 BIOS'es.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
2011-04-05 11:06:11 +10:00
Jan Engelhardt 5df23979bc drm: fix "persistant" typo
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-04-05 10:22:23 +10:00
Lucas De Marchi 25985edced Fix common misspellings
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-31 11:26:23 -03:00
Matthew Garrett 7eae3efa13 nouveau: change the backlight parent device to the connector, not the PCI dev
We may eventually end up with per-connector backlights, especially with
ddcci devices.  Make sure that the parent node for the backlight device is
the connector rather than the PCI device.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-22 17:43:59 -07:00
Matthew Garrett bb7ca747f8 backlight: add backlight type
There may be multiple ways of controlling the backlight on a given
machine.  Allow drivers to expose the type of interface they are
providing, making it possible for userspace to make appropriate policy
decisions.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Airlie <airlied@linux.ie>
Cc: Alex Deucher <alexdeucher@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-22 17:43:59 -07:00
Dave Airlie 38f1cff086 Merge commit '5359533801e3dd3abca5b7d3d985b0b33fd9fe8b' into drm-core-next
This commit changed an internal radeon structure, that meant a new driver
in -next had to be fixed up, merge in the commit and fix up the driver.

Also fixes a trivial nouveau merge.

Conflicts:
	drivers/gpu/drm/nouveau/nouveau_mem.c
2011-03-16 11:34:41 +10:00
Dave Airlie 235b87afbc Merge remote branch 'nouveau/drm-nouveau-next' of ../drm-nouveau-next into drm-core-next
* 'nouveau/drm-nouveau-next' of ../drm-nouveau-next:
  drm/nouveau: fix __nouveau_fence_wait performance
  drm/nv40: attempt to reserve just enough vram for all 32 channels
  drm/nv50: check for vm traps on every gr irq
  drm/nv50: decode vm faults some more
  drm/nouveau: add nouveau_enum_find() util function
  drm/nouveau: properly handle pushbuffer check failures
  drm/nvc0: remove vm hack forcing large/small pages to not share a PDE
2011-03-15 09:59:31 +10:00
Marcin Slusarz bd35fe5a79 drm/nouveau: fix __nouveau_fence_wait performance
Commit 21e86c1c8a ("drm/nouveau: remove
cpu_writers lock") turned on lazy waits. Unfortunately
__nouveau_fence_wait was not optimized for this case and on HZ=100
kernel wasted up to 10 ms per call.

Depending on application, it led to 10-30% FPS regression.

Fix it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
2011-03-14 16:35:16 +10:00
Ben Skeggs 459ca7e528 drm/nv40: attempt to reserve just enough vram for all 32 channels
This also makes the fact we're giving 512MiB of GART space to all PCIE
boards explicit, although the vast majority (if not all) of them will
now have a ramin_rsvd_vram larger than 2MiB anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-14 16:35:16 +10:00
Ben Skeggs 6fdb383e81 drm/nv50: check for vm traps on every gr irq
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-14 16:32:30 +10:00
Ben Skeggs 312d1d5fe9 drm/nv50: decode vm faults some more
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-14 16:32:29 +10:00
Ben Skeggs bb9b18a390 drm/nouveau: add nouveau_enum_find() util function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-14 16:31:50 +10:00
Marcin Slusarz 7fa0cba2b2 drm/nouveau: properly handle pushbuffer check failures
When "buffer in list" check does not pass, don't free validation lists - they were
not initialized yet.

Fixes this oops:

[drm] nouveau 0000:02:00.0: push 105 buffer not in list
BUG: unable to handle kernel NULL pointer dereference at 000000000000057c
IP: [<ffffffff81236aa4>] do_raw_spin_lock+0x14/0x13c
PGD 1ac6cb067 PUD 1aaa52067 PMD 0
CPU 0
Modules linked in: nouveau ttm drm_kms_helper snd_hda_codec_realtek snd_hda_intel snd_hda_codec

Pid: 6265, comm: OilRush_x86 Not tainted 2.6.38-rc6-nv+ #632 System manufacturer System Product Name/P6T SE
RIP: 0010:[<ffffffff81236aa4>]  [<ffffffff81236aa4>] do_raw_spin_lock+0x14/0x13c
(...)
Process OilRush_x86 (pid: 6265, threadinfo ffff8801a6aee000, task ffff8801a26c0000)
 0000000000000000 ffff8801ac74c618 0000000000000000 0000000000000578
 0000000000000000 ffff8801ac74c618 0000000000000000 ffff8801bd9d0000
 [<ffffffff81417f78>] _raw_spin_lock+0x1e/0x22
 [<ffffffffa00a2746>] nouveau_bo_fence+0x2e/0x60 [nouveau]
 [<ffffffffa00a540b>] validate_fini_list+0x35/0xeb [nouveau]
 [<ffffffffa00a54d3>] validate_fini+0x12/0x31 [nouveau]
 [<ffffffffa00a6386>] nouveau_gem_ioctl_pushbuf+0xe94/0xf6b [nouveau]
 [<ffffffff8141ac56>] ? sub_preempt_count+0x9e/0xb2
 [<ffffffff81417e94>] ? _raw_spin_unlock_irqrestore+0x30/0x4d
 [<ffffffff8105dea2>] ? __wake_up+0x3f/0x48
 [<ffffffff812aebb4>] drm_ioctl+0x289/0x361
 [<ffffffff8141ac56>] ? sub_preempt_count+0x9e/0xb2
 [<ffffffffa00a54f2>] ? nouveau_gem_ioctl_pushbuf+0x0/0xf6b [nouveau]
 [<ffffffff8141ac56>] ? sub_preempt_count+0x9e/0xb2
 [<ffffffffa010caa2>] nouveau_compat_ioctl+0x16/0x1c [nouveau]
 [<ffffffff81142c0d>] compat_sys_ioctl+0x1c8/0x12d7
 [<ffffffff814179ca>] ? trace_hardirqs_off_thunk+0x3a/0x6c
 [<ffffffff81058099>] sysenter_dispatch+0x7/0x30
 [<ffffffff8141798e>] ? trace_hardirqs_on_thunk+0x3a/0x3c
RIP  [<ffffffff81236aa4>] do_raw_spin_lock+0x14/0x13c
 RSP <ffff8801a6aefb88>
---[ end trace 0014d5d93e6147e1 ]---

Additionally, don't call validate_fini twice in case of validation failure.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-14 16:31:45 +10:00
Ben Skeggs b84f30e65c drm/nvc0: remove vm hack forcing large/small pages to not share a PDE
Appears to be fixed with commit:

"drm/nv50-nvc0: make sure vma is definitely unmapped when destroying bo"

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-03-14 16:31:38 +10:00
Dave Airlie 34db18abd3 Merge remote branch 'intel/drm-intel-next' of ../drm-next into drm-core-next
* 'intel/drm-intel-next' of ../drm-next: (755 commits)
  drm/i915: Only wait on a pending flip if we intend to write to the buffer
  drm/i915/dp: Sanity check eDP existence
  drm/i915: Rebind the buffer if its alignment constraints changes with tiling
  drm/i915: Disable GPU semaphores by default
  drm/i915: Do not overflow the MMADDR write FIFO
  Revert "drm/i915: fix corruptions on i8xx due to relaxed fencing"
  drm/i915: Don't save/restore hardware status page address register
  drm/i915: don't store the reg value for HWS_PGA
  drm/i915: fix memory corruption with GM965 and >4GB RAM
  Linux 2.6.38-rc7
  Revert "TPM: Long default timeout fix"
  drm/i915: Re-enable GPU semaphores for SandyBridge mobile
  drm/i915: Replace vblank PM QoS with "Interrupt-Based AGPBUSY#"
  Revert "drm/i915: Use PM QoS to prevent C-State starvation of gen3 GPU"
  drm/i915: Allow relocation deltas outside of target bo
  drm/i915: Silence an innocuous compiler warning for an unused variable
  fs/block_dev.c: fix new kernel-doc warning
  ACPI: Fix build for CONFIG_NET unset
  mm: <asm-generic/pgtable.h> must include <linux/mm_types.h>
  x86: Use u32 instead of long to set reset vector back to 0
  ...

Conflicts:
	drivers/gpu/drm/i915/i915_gem.c
2011-03-14 14:15:13 +10:00
Ben Skeggs 6f70a4c3d1 drm/nv50-nvc0: prevent multiple vm/bar flushes occuring simultanenously
The per-vm mutex doesn't prevent this completely, a flush coming from the
BAR VM could potentially happen at the same time as one for the channel
VM.  Not to mention that if/when we get per-client/channel VM, this will
happen far more frequently.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-03-08 07:03:08 +10:00
Ben Skeggs ef1b287169 drm/nouveau: fix regression causing ttm to not be able to evict vram
TTM assumes an error condition from man->func->get_node() means that
something went horribly wrong, and causes it to bail.

The driver is supposed to return 0, and leave mm_node == NULL to
signal that it couldn't allocate any memory.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-03-08 07:03:01 +10:00
Ben Skeggs 73412c3854 drm/nouveau: allocate kernel's notifier object at end of block
The nv30/nv40 3d driver is about to start using DMA_FENCE from the 3D
object which, it turns out, doesn't like its DMA object to not be
aligned to a 4KiB boundary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-03-04 11:07:19 +10:00
Ben Skeggs 7db2662325 drm/nv50-nvc0: make sure vma is definitely unmapped when destroying bo
Somehow fixes a misrendering + hang at GDM startup on my NVA8...

My first guess would have been stale TLB entries laying around that a new
bo then accidentally inherits.  That doesn't make a great deal of sense
however, as when we mapped the pages for the new bo the TLBs would've
gotten flushed anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-28 15:00:16 +10:00
Ben Skeggs 562af10c67 drm/nv50: flesh out ZCULL init and match nvidia on later chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:46:10 +10:00
Ben Skeggs 8f7286f8e4 drm/nv50: support for compression
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:46:07 +10:00
Ben Skeggs 26c0c9e33a drm/nv50-nvc0: delay GART binding until move_notify time
The immediate benefit of doing this is that on NV50 and up, the GPU
virtual address of any buffer is now constant, regardless of what
memtype they're placed in.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:46:01 +10:00
Ben Skeggs d5f423947a drm/nouveau: rename nouveau_vram to nouveau_mem
This structure will also be used for GART in the near future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:55 +10:00
Ben Skeggs b5e2f0769a drm/nvc0: allow creation of buffers with any non-compressed memtype
This adds a table of known nvc0 memtypes, and modifies the validity check
to allow any non-compressed type.  Support for Z compression will come at
a later point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:52 +10:00
Ben Skeggs 3425df486c drm/nv50-nvc0: unmap buffers from the vm when they're evicted
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:49 +10:00
Ben Skeggs a4154bbffd drm/nv50-nvc0: move vm bind/unbind to move_notify hook
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:46 +10:00
Ben Skeggs db5c8e299a drm/nv50-nvc0: restrict memtype to those specified at creation time
Upcoming patches are going to enable full support for buffers that keep
a constant GPU virtual address whenever they're validated for use by
the GPU.

In order for this to work properly while keeping support for large pages,
we need to know if it's ever going to be possible for a buffer to end
up in GART, and if so, disable large pages for the buffer's VMA.

This is a new restriction that's not present in earlier kernel's, but
should not break userspace as the current code never attempts to validate
buffers into a memtype other than it was created with.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:43 +10:00
Ben Skeggs 6ba9a68317 drm/nouveau: pass domain rather than ttm flags to gem_new()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:40 +10:00
Ben Skeggs a670478834 drm/nv50: simplify bo moves now that they're all through the vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:37 +10:00
Ben Skeggs d550c41e4f drm/nouveau: remove no_vm/mappable flags from nouveau_bo
'mappable' isn't really used at all, nor is it necessary anymore as the
bo code is capable of moving buffers to mappable vram as required.

'no_vm' isn't necessary anymore either, any places that don't want to be
mapped into a GPU address space should allocate the VRAM directly instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:34 +10:00
Benjamin Franzke 2503c6fa3e drm/nouveau: Fix pageflip event
Assign correct event when initializing nouveau_page_flip_state.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:31 +10:00
Ben Skeggs a589e87fe7 drm/nouveau/vbios: parse more gpio tag bits from connector table
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:28 +10:00
Marcin Slusarz 3248421670 drm/nouveau: decode PFIFO DMA_PUSHER error codes
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:26 +10:00
Marcin Slusarz 4dcf905c84 drm/nv50: fix typos in CCACHE error reporting
The code was supposed to print registers around 0x405018 (which is read
earlier), not 0x405818.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:23 +10:00
Ben Skeggs bd2f2037a4 drm/nvc0: support for sw methods + enable page flipping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:20 +10:00
Ben Skeggs d7117e0d4e drm/nv50: enable page flipping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:17 +10:00
Ben Skeggs 1d3fac0c2a drm/nv50-nvc0: activate/update ds channel's framebuffer on modesets
The hw doesn't really appear to be designed to be used the way we have to
use it due to DRI2's design.  This leads us to having to keep the flipped
fb support active at all times.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:14 +10:00
Ben Skeggs cdccc70eff drm/nv50-nvc0: initialise display sync channels
Also imports a couple of helper functions that'll be used to implement
page flipping in the following commits..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:11 +10:00
Ben Skeggs 45c4e0aae9 drm/nv50-nvc0: precalculate some fb state when creating them
Just a cleanup, to avoid duplicating parts of nv50_crtc.c's code in
the page flipping routines.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:08 +10:00
Ben Skeggs 292deb7a3b drm/nv50-nvc0: tidy evo object creation some more
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:05 +10:00
Ben Skeggs 60f60bf1bc drm/nv50-nvc0: request and wait on notification of modeset completion
This should prevent a number of races from occuring, the most obvious of
which will be exposed when we start making use of the "display sync" evo
channel for page flipping.  The DS channel will reject any command stream
that doesn't completely agree with the current "master" state.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:02 +10:00
Ben Skeggs f13e435c59 drm/nv50-nvc0: switch to tasklet for display isr bh
We need to be able to have the bh run while possibly spinning waiting for
the EVO notifier to signal.  This apparently happens in some circumstances
with preempt disabled, so our workqueue was never being run.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:59 +10:00
Ben Skeggs c7ca4d1b6b drm/nouveau: make vbios parser runnable from an atomic context
The nv50 display isr bh needs to be converted to a tasklet, which means
we can't sleep anymore.  The places we execute vbios init tables are
rare, and not in any way performance critical, so this isn't a huge
problem.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:56 +10:00
Ben Skeggs 8348f36d89 drm/nv50-nvc0: include nv50_display in evo debugging
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:53 +10:00
Ben Skeggs 33f409df1e drm/nv50-nvc0: tidy evo init failure paths
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:51 +10:00
Ben Skeggs 961b6e686e drm/nv50-nvc0: fix ramht entries for multiple evo channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:48 +10:00
Ben Skeggs 30d81817a2 drm/nv50-nvc0: disp channels have fixed purposes, don't "allocate" them
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:45 +10:00
Ben Skeggs 59c0f5780f drm/nv50-nvc0: rename disp->evo to disp->master
More appropriate, and we're about to be using more than just the master
EVO channel.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:42 +10:00
Ben Skeggs ef8389a84b drm/nv50-nvc0: move non-sharable display state into private structure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:39 +10:00