Commit graph

1137 commits

Author SHA1 Message Date
Ben Skeggs
3b6d83d1b9 drm/nvd0/disp: untested LVDS support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:36 +10:00
Ben Skeggs
c6f2f71dae drm/nvd0/disp: track down fb positioning method
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:32 +10:00
Ben Skeggs
ff8ff50342 drm/nvd0/disp: determine U table config in or_mode_set()
Takes a gamble and presumes that we can safely store something random in
OR_MODE_CTRL+4, the hw doesn't seem to mind...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:29 +10:00
Ben Skeggs
b681993f7a drm/nvd0/disp: dac load detect
VBIOS does more than this, as does nv50/nvc0 driver in nouveau.  Traces
of the NVIDIA binary driver however, show pretty much just this being
done...  Seems to work for me, it'll be fine for the moment.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:22 +10:00
Ben Skeggs
629c1b9207 drm/nvd0/disp: handle sync polarity, kill off some unknown
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:18 +10:00
Ben Skeggs
f3fdc52dd7 drm/nvd0/disp: scaling
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:15 +10:00
Ben Skeggs
a46232ee09 drm/nvd0/disp: push the update button in mode_set_base()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:09 +10:00
Ben Skeggs
8ea0d4aa60 drm/nvd0/disp: fixup clut so it actually works
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:05 +10:00
Ben Skeggs
3a89cd0292 drm/nvd0/disp: initial attempt at modeset irq handling
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:07:01 +10:00
Ben Skeggs
b6d8e7ec38 drm/nvd0/disp: stub dac load detect, prevents oops
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:57 +10:00
Ben Skeggs
8eaa9669f8 drm/nvd0/disp: dac encoder module
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:50 +10:00
Ben Skeggs
a36f04c044 drm/nvd0/disp: extend the init voodoo to cover crtcs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:47 +10:00
Ben Skeggs
c0cc92a115 drm/nvd0/disp: remove lp reordering from vram dmaobj, create fb dmaobjs
Fixes CLUT being messed up.  Mostly.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:44 +10:00
Ben Skeggs
1d6e7a59f7 drm/nvd0/disp: some magic to make evo happeir
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:37 +10:00
Ben Skeggs
2fad3d5e2b drm/nvd0/disp: they moved the linear flag..
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:33 +10:00
Ben Skeggs
438d99e3b1 drm/nvd0/disp: initial crtc object implementation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:30 +10:00
Ben Skeggs
270a574780 drm/nvd0/disp: skeletal handling of modeset interrupts
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:24 +10:00
Ben Skeggs
83fc083cbb drm/nvd0/disp: start on SOR encoder functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:21 +10:00
Ben Skeggs
efd272a7a0 drm/nvd0/disp: setup a couple of dma objects we'll need
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:07 +10:00
Ben Skeggs
4600522a8f drm/nvd0/disp: start on interrupt handling
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:06:01 +10:00
Ben Skeggs
51beb428e4 drm/nvd0/disp: whip up some basic dma handling for the evo channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:57 +10:00
Ben Skeggs
26f6d88b32 drm/nvd0/disp: very initial evo setup
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:54 +10:00
Ben Skeggs
02e4f5877d drm/nouveau/bios: allow passing in crtc to the init table parser
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:48 +10:00
Ben Skeggs
4784e4aa47 drm/nvd0/pm: enable clock/voltage hooks
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:44 +10:00
Ben Skeggs
75139063b7 drm/nouveau/bios: fix INIT_GPIO for new chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:40 +10:00
Ben Skeggs
d7f8172ca9 drm/nvd0/gpio: initial implementation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:36 +10:00
Ben Skeggs
eeb3ca12b4 drm/nvd0/i2c: initial implementation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:24 +10:00
Ben Skeggs
d9f61c2d28 drm/nouveau: initial chipset description for nvdX chipsets
All the non-stubbed functions should be okay for this chipset, the rest
will be added back as they're figured out.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:20 +10:00
Ben Skeggs
03bc9675d3 drm/nouveau: allow modeset module option to select 'headless mode'
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:16 +10:00
Ben Skeggs
1575b3646c drm/nouveau: fixup init/fini sequence to deal with no CRTCs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:09 +10:00
Ben Skeggs
048a88595a drm/nouveau: make general drm modesetting init common
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:05:04 +10:00
Ben Skeggs
2e9733ff7d drm/nvd0: add a card_type for 0xdX chipsets
These are different enough from 0xcX to justify it, half fermi, half
kepler(??)..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:45 +10:00
Martin Peres
f3f2f54e11 drm/nv04/pm: recalibrate timer on nvclk changes
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:42 +10:00
Ben Skeggs
591b06d73b drm/nouveau/tmr: calibrate for ns timestamps on init
We previously assumed (incorrectly a lot of the time) that PTIMER would
be programmed at a frequency which'd give its 64-bit timestamps in
nanoseconds.

By programming PTIMER ourselves, we avoid this problem.

Reviewed-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:36 +10:00
Ben Skeggs
16cd399c65 drm/nvc0/gr: unblacklist nvcf acceleration
Reported to be working.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-09-20 16:04:32 +10:00
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