History log of /drivers/gpu/drm/nouveau/nouveau_drv.h
Revision Date Author Comments
68455a43debe26dd1d2a42c0b67dd5697c201420 04-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nve0: initial modesetting support for kepler chipsets

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f887c425f9eeed8ffbca64c8be45da62b07096c0 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: bump version to 1.0.0

The time has come to get a proper version number that we can change to
indicate new features etc, rather than the lock-step 0.0.XX that we
previously had.

libdrm has recognised this version as compatible with 0.0.16 since 2.4.22,
so hopefully any breakage people see should be very minimal.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
27100ac95a8eee0b083e46bfa67b229ac641d28c 16-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: oops, increase channel dispc_vma to 4

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
48aca13f0167ae78c28c6b48d82a157a6692eecb 17-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove m2mf creation on userspace channels

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d5316e251230c4e54a157349a362229c3d4daa32 21-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nvc0-/disp: reimplement flip completion method as fifo method

Removes need for M2MF subchannel usage on NVC0+.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b5b2e5988bd18a2f6e3f192adf7439599de00d3f 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove subchannel names from places where it doesn't matter

These are FIFO methods, it doesn't matter what subchannel is being used.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
accf94969f226ddfe7dd3a6a76ce093ace839b26 15-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/ttm: always do buffer moves on kernel channel

There was once good reasons for wanting the drm to be able to use M2MF etc
on user channels, but they're not relevant anymore. For the general
buffer move case, we've already lost by transferring between vram/sysmem
already so the context switching overhead is minimal in comparison.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2f5394c3ed573de2ab18cdac503b8045cd16ac5e 12-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: map first page of mmio early and determine chipset earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8663bc7cde00c8e832d985354f8a6d57a52f7d92 09-Mar-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dp: move all nv50/sor-specific code out of nouveau_dp.c

Off-chip encoders (which we don't support yet anyway), and newer chipsets
(such as NVD9...), will need their own code for this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
df26bc9c320602539b1b5b3d85786e4c8de7bf43 21-Jan-2012 Christoph Bumiller <e0425955@student.tuwien.ac.at> drm/nv50/display: expose color vibrance control

Signed-off-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
990449c77cafb77e7468722262c049675ab03e30 12-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0/vm: support unsnooped system memory

v2 (Emil Velikov <emil.l.velikov@gmail.com>):
- Fixed a regression on certain nv50 IGP due to not passing the correct
target type to nv50_vm_addr()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Johannes Obermayr <johannesobermayr@gmx.de>
25c53c1068a804c6b51f86e937cebab6274dc056 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: extend profile interface for destroy/init/fini

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
8d7bb400638906075c38cb07891993cf95076aa7 24-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: rework to allow selecting separate profiles for ac/battery

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
085028ce3bf7136c5ab2eeb8bf012024d88905c8 18-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: embed timings into perflvl structs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
fd99fd6100d3b7aaa8dc76888a38bbb15e8041bc 17-Jan-2012 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: calculate memory timings at perflvl creation time

Statically generating the PFB register and MR values for each timing set
turns out to be insufficient. There's at least one (so far) known piece
of information which effects MR values which is stored in the perflvl
entry on some chipsets (and in another table on later ones), which is
disconnected from the timing table entries.

After this change we will generate a timing set based on an input clock
frequency instead, and have this data stored in the performance level
data.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
c7c039fd31be82ecb8d48477955e76badd38141a 09-Jan-2012 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: implement DDR2/DDR3/GDDR3/GDDR5 MR generation and validation

Roy Spliet:
- Implement according to specs
- Simplify
- Make array for mc latency registers

Martin Peres:
- squash and split all the commits from Roy
- rework following Ben Skeggs comments
- add a form of timings validation
- store the initial timings for later use

Ben Skeggs
- merge slightly modified tidy-up patch with this one
- remove perflvl-dropping logic for the moment

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
bfb314652430ceca302bae0981d00903f055eee4 25-Nov-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: improve memory timing generation

- Rename several VBIOS entries to closer match the real world
- Add the missing 0x100238 and 0x100240 register values
- Parse bit 14 of the VBIOS timing table
- "Magic value" -> tCWL, fixing some minor bugs in the process
- Also name a few more by their name rather than their number.
- Some values seem to be dependent on the memory type. Fix

Edits by Martin Peres <martin.peres@labri.fr>:
- this is a squash commit
- reworked for fixing some style issues

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b1aa5531cc74ea023ad35e9cf5872112a15b4f70 20-Aug-2011 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau: move pwm_divisor to the nouveau_pm_fan struct

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
bc6389e4fa1a6535021ffc4d3b37d48f9a0542e2 07-Oct-2011 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau/pm: restore fan speed after suspend

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ddb2005516949dc50d117cb8381d7a3f8f0614b0 17-Dec-2011 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau/pm: style fixes

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c70c41e89f0481f26749d8264aebc594566c2a6d 13-Dec-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50: hopefully handle the DDR2/DDR3 memtype detection somewhat better

M version 2 appears to have a table with some form of memory type info
available.

NVIDIA appear to ignore the table information except for this DDR2/DDR3
case (which has the same value in 0x100714). My guess is this is due to
some of the supported memory types not being represented in the table.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ff92a6cda74c0a51cb723f5e224124cf74e62f25 12-Dec-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv20-nv40: add memory type detection

NV20/NV30 is partially educated guesswork at this point, based on any
information around about available memory types and a horribly unspeakable
amount of vbios image scouring. I'm not entirely certain the GDDR3 define
is correct, I have not spotted a single vbios with that value yet (though
it is mentioned in some 1218-using nv4x vbios), but there are reports that
some nv3x did use it..

NV40(100914) confirmed by switching an NV49 to DDR1/DDR2 values and making
sure that the binary driver behaviour showed it had detected DDR1/DDR2
instead of GDDR3 before dying horribly.

NV40(100474) confirmed by doing much the same task as above on an NV44,
except this was *much* easier as changing the values didn't seem to have
any noticable effect on the memory controller aside from changing the
binary driver's behaviour.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d81c19e312a22bdcebef1370f3af30a146670787 12-Dec-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv20: split PFB code out of nv10_fb.c

Most functions were quite different between NV10/NV20 already, and they're
about to get even more so.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7ad2d31cb692597f7918fce2f52a4c1949fbcf8d 10-Dec-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: move vram detection funcs to chipset-specific fb code

Also, display detected memory type in logs - though, we don't even try to
detect this yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d099230cc355c485e556121c034b1fca5a5fd18b 17-Dec-2011 Peter Lekensteyn <lekensteyn@gmail.com> nouveau: Support Optimus models for vga_switcheroo

Newer nVidia cards with Optimus do not support/use the DSM switching functions.
Instead, it require a DSM function to be called prior to bringing a device into
D3 state. No other _DSM calls are necessary before/after enabling/disabling a
device. Switching between discrete and integrated GPU is not supported by
this Optimus _DSM call, therefore return on the switching method.

Signed-off-by: Peter Lekensteyn <lekensteyn@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
4e03b4af6dd3cff445fc0455805b43b101647bfc 19-Nov-2011 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Fix pushbufs over the 4GB mark.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a0b25635515ef5049f93b032a1e37f18b16e0f6f 21-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/gpio: reimplement as nouveau_gpio.c, fixing a number of issues

- moves out of nouveau_bios.c and demagics the logical state definitions
- simplifies chipset-specific driver interface
- makes most of gpio irq handling common, will use for nv4x hpd later
- api extended to allow both direct gpio access, and access using the
logical function states
- api extended to allow for future use of gpio extender chips
- pre-nv50 was handled very badly, the main issue being that all GPIOs
were being treated as output-only.
- fixes nvd0 so gpio changes actually stick, magic reg needs bashing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
675aac033e089833e763ea4fbabae66883d10574 21-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: just pass gpio line to pwm_*, not entire gpio struct

We don't need more than the line id to determine the PWM controller, and
the GPIO interfaces are about to change somewhat.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b4c26818aeb4159dd537eff6453ae5ebf7a69723 12-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/mxm: initial implementation of dcb sanitisation

The DCB table provided by the VBIOS on most MXM chips has a number of
entries which either need to be disabled, or modified according to the
MXM-SIS Output Device Descriptors.

The x86 vbios code usually takes care of this for us, however, with the
large number of laptops now with switchable graphics or optimus, a lot
of the time nouveau is responsible for POSTing the card instead - leaving
some fun situations like, plugging in a monitor and having nouveau decide
3 connectors actually just got plugged in..

No MXM-SIS fetching methods implemented yet.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
486a45c2a6c19b159602d044ab601a92cd81f524 11-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/i2c: do parsing of i2c-related vbios info in nouveau_i2c.c

Not much point parsing the vbios data into a struct which is only used once
to parse the data into another struct, go directly from vbios to
nouveau_i2c_chan.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6b5a81a2e783f26a69fc262b3c393f0b391c8613 10-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/bios: start refactoring dcb routines

This primary reason for this was mostly to avoid duplication of some of
this stuff by the MXM-SIS parser. However, some other cleanups will also
follow this as a result.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3376ee374d2318d311bd3aa7b9bb0186f64ccca5 12-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvd0/disp: add support for page flipping

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f62b27db6b5479efe376b408802a081a834ef50e 09-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: shutdown display on suspend/hibernate

Known to fix some serious issues with hibernate on a couple of systems.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2a44e4997c5fee8e1da1589ff57e0bd1c53f03ce 09-Nov-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/disp: introduce proper init/fini, separate from create/destroy

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ff2b6c6e587cf2add3071b3a9a5c61abbbaf4677 27-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: remove the older interfaces completely

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f3fbaf34e2b1459eab248c5f0180928e7861120b 26-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50/pm: rewrite clock management, and switch to the new pm hooks

This area is horrifically complicated on these chipsets, and it's likely we
will need at least a few more tweaks yet.

Oh yes, and it's completely disabled on IGPs for the moment. From traces,
things look potentially different there yet again. Sigh...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
dd1da8de172057b36860f427777ecfa293bb8f6c 10-Jul-2011 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau/pm: make clocks_set return an error code clocks_set can fail.

Reporting an error is better than silently refusing to reclock.

V2: Use the same logic on nv40

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
de69185573586302ada2e59ba41835df36986277 16-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: improve dithering properties, and implement proper auto mode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b29caa5885e85bbda7c84ea55721b9e79718583a 06-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add overscan compensation connector properties

Exposes the same connector properties as the Radeon implementation, however
their behaviour isn't exactly the same. The primary difference being that
unless both hborder/vborder have been defined by the user, the driver will
keep the aspect ratio of the overscanned area the same as the mode the
display is programmed for.

Enabled for digital outputs on GeForce 8 and up, excluding GF119.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
27d5030a235d89842ed70e18d924f017b34a496d 05-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: move master modesetting init to nouveau_display

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
25575b414c2137a16b313bdfdeab570b70080f37 05-Oct-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/hdmi: build ELD from EDID, notify audio driver of its presence

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
35bb5089cc74e6d64cf0171b55c93e1bf8b8198d 27-Sep-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50/pm: s/unk05/vdec/

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1e05415733b0d4668fbce92856fafabfa1a33333 16-Sep-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: remove defunct fanspeed_set/get from pm table

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a175094cd8f3d46060d8e3510bdca57eb2369a86 16-Sep-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: introduce generic handler for on-chip fan controller

The handling of the internal pwm fan controller is similar enough between
current chipsets that it makes sense to share the logic, and bugfixes :)

No hw backends converted yet, will automatically fall-through to the
"old" per-chipset fanspeed hooks for now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3f8e11e4b606a050007cd1020d59e7b74c68d088 15-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50/pm: mostly nailed down fan pwm frequency selection

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
11b7d895216f7f954c6cfa0c23b76dccb7a890c1 15-Aug-2011 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau/pm: manual pwm fanspeed management for nv40+ boards

Exposes the following sysfs entries:
- fan0_input: read the rotational speed of the fan (poll a bit during 250ms)
- pwm0: set the pwm duty cycle
- pwm0_min/max: set the minimum/maximum pwm value

v2 (Ben Skeggs):
- nv50 pwm controller code removed in favour of other more complete code
- FAN_RPM -> FAN_SENSE
- merged FAN_SENSE readout into common code, not at all nv50-specific
- protected fanspeed changes with perflvl_wr
- formatting tidying
- added some comments where things are shaky

v3 (Martin Peres)
- ensure duty min/max from thermal table are sane

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
8f27c54342dffbfbafbddd6e43f011e6cb16d285 11-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/vdec: implement stub modules for the known engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0c101461e267850925218d6a6872c379f2498b16 28-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40/pm: parse fan pwm divisor from vbios tables

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
649bf3ca77343e3be1e0af8e21356fa569b1abd9 02-Nov-2011 Jerome Glisse <jglisse@redhat.com> drm/ttm: merge ttm_backend and ttm_tt V5

ttm_backend will only exist with a ttm_tt, and ttm_tt
will only be of interest when bound to a backend. Merge them
to avoid code and data duplication.

V2 Rebase on top of memory accounting overhaul
V3 Rebase on top of more memory accounting changes
V4 Rebase on top of no memory account changes (where/when is my
delorean when i need it ?)
V5 make sure ttm is unbound before destroying, change commit
message on suggestion from Tormod Volden

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
33dbc27f1ab3a37d04a8d226327fb3d384870e43 30-Sep-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add dumb ioctl support

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
59ef9742f6b24d1f3062b975ec959512519f8987 12-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40/pm: execute memory reset script from vbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5f1800bd8a774f773e3be71702da7ec77188b283 05-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dp: return master dp table pointer too when looking up encoder

Will need to be able to distinguish 2.0/2.1 from 3.0 soon. Also, move
the vbios parsing to nouveau_dp where it belongs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
721b0821ad8fea80ea1b6b84cb9646881959e662 05-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/bios: simplify U/d table hash matching func to just match

The caller is now responsible for parsing its own lists (or whatever) of
possible encoders.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
27a4598737f8b315ba7827cb84578ba38c9b883c 04-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dp: restructure link training code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a002feceb7852964af579ece784b0123869f1e3f 04-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dp: pass in required datarate to link training

Not used currently, but it will be used in preference to pre-determined
lane/bandwidth numbers at a later point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10b461e40a5a5522fe996805a0625c9cd4e5c1a7 02-Aug-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50/backlight: take the sor into account when bashing regs

I'm sure that out there somewhere, someone will need this. We currently
haven't seen an example of LVDS being on a non-0 SOR so far though.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
46959b7790e3609e795c3b5e70e58dcd22c9e207 01-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dp: remove reliance on vbios for native displayport

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
43720133888f3713b534aec520783498f1bf5db3 20-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/dp: rewrite auxch transaction routines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f2cbe46f14427914bdd191795da998588dee4b8c 21-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: determine timing crystal freq from straps

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2228c6fe04ddc303e90c05dd9430539fbcd8fa18 14-Jul-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: Document and expose CL and WR for 0x1002Cx

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
9a7824887690836448eb73ccf0d8232da2e5bee3 09-Jul-2011 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau/pm: add initial NV3x/NVCx memtiming support, improve other cards

NV30: Create framework for memtm
NV50: Improve reg creation,
NV50: Use P.version instead of card codename/stepping,
NVC0: Initial memtiming code for Fermi,
Renamed regs for consistency,
Overall redesign to improve readability,
Avoid kfree on null-pointer

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
26f6d88b32706058866a74ecd6600b84fb82d09a 04-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvd0/disp: very initial evo setup

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
02e4f5877dc7b963b3dd2beaf9664cf29c12d728 06-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/bios: allow passing in crtc to the init table parser

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d7f8172ca93b61135d6db293c6440b2e97fc87ee 02-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvd0/gpio: initial implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
03bc9675d358ded9db07ba966f2f3f3c2fba2a9c 04-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: allow modeset module option to select 'headless mode'

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
048a88595a66526f68636b51b1cdb5842bc0f28c 04-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: make general drm modesetting init common

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2e9733ff7d4f1c7185bea16041f532d6142ca40a 02-Jul-2011 Ben Skeggs <bskeggs@redhat.com> 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>
987eec10dd76624d0edacdc7ecc7e1a6fc877373 24-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: embed nouveau_mm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
323dcac552b39884cdeff26a38d5dd80854795a1 23-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: rename nv40_mpeg to nv31_mpeg

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9698b9a680e9aee124b1cd752abf1c672ea24c03 21-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvc0/pm: more complete parsing of clock domains

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
78e2933d07124ea28593a1bdadc546294f77a504 18-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add function to wait until a callback returns true

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4fd2847e9bfa592ef8f76d5ec8a5c809682c323d 17-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nva3/pm: parse/reclock vdec/41a0 clocks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
77e7da6814623927cc4435d992bef9c84075594c 17-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
03ce8d9e63199fd5983129941a6694123b885753 10-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: some fermi chipsets still use volt 0x30

Fun, fun.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3b5565ddfd8fe71f6470a5d240a6bb50ba90d4ff 09-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: add support for parsing perflvl voltage on fermi chips

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c3450239c78a4ef6c10da13dfc18831f43dbe0c5 09-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/pm: store voltage in microvolts

Instead of 10s of millivolts, to match fermi vbios.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6c320fef5835240bf414b54e697e517a160663f4 20-Jul-2011 Ben Skeggs <bskeggs@redhat.com> 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>
70ad25ab735a016c48183875f657d90d592b773d 20-Jul-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: replace nv04_graph_fifo_access() use with direct reg bashing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
40ce4279e17e99bb98d02b8746fcf20abff8185b 22-Jun-2011 Emil Velikov <emil.l.velikov@gmail.com> 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>
24f246ac10ae6a6ae873045387d4501498869f74 10-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
2fd3db6f1457050bdebf97e45147ce6827e1742a 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove implicit mapping of every bo into chan_vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7375c95b343aa575940704a38482a334ea87ac6c 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove 'chan' argument from nouveau_bo_new

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3d483d575bfba52eae04bf2575239642c26c355a 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: explicitly map PDISP semaphore buffer into each channel's vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d02836b4f5c24d2a38b3bdc10f05251e1f6e111d 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv84-nvc0: explicitly map semaphore buffer into channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ce163f6967121d77e3983aa06d416afacf3070c2 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0: explicitly map pushbuf bo into channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0b7187335fc2f38691cc169b202ff436abbefd68 07-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0: explicitly map notifier bo into channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fd2871af3d2dad4e07df84941128b0813b5dd34b 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: initial changes to support multiple VMAs per buffer object

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d2f96666c56a501c5b74c645d81918b7805d46ce 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
f91bac5bf694e8060b7473fb0aefb8de09aa9595 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
6e32fedc8b50d3571bdec4e9849e45659ac96599 03-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
639212d01157266d9ee0b904fbc9f4a556e1c711 03-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau/gem: implement stub hooks for GEM object open/close

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f6d4e62145b597c6249c1dc9c1c3ecd66ba165f0 06-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
fe32b16e7998bae28209834c0f7c21766d7524ec 03-Jun-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0/vm: take client reference on shared channel vm

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e8a863c10f4ca47e942886dddf70c35e3c2d5dd6 01-Jun-2011 Ben Skeggs <bskeggs@redhat.com> 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>
3f0a68d8f8ba9d6c0cd9df948fbba90944c3da62 31-May-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: allocate structure to store per-client data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0411de854898a2402cf4bd915bed7ec9a6b76f9a 25-May-2011 Ben Skeggs <bskeggs@redhat.com> 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>
f8522fc80f2e0392fc44b069f61721bd25907270 25-May-2011 Ben Skeggs <bskeggs@redhat.com> 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>
aba99a8400e0b1ca9e6306e3a71013cc7a25bc29 25-May-2011 Ben Skeggs <bskeggs@redhat.com> 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>
52eba8dd5e830a836425e92d002bc51e42d3280e 27-Apr-2011 Ben Skeggs <bskeggs@redhat.com> 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>
047d2df54cb866f13014cb566eac61449bf89a29 20-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvc0/pm: parse clock for pll 0x0a (0x137020) from perf table

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e614b2e7ca9f9946cede13b34c950b92af6fa7ef 14-Apr-2011 Martin Peres <martin.peres@free.fr> 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>
93187450fade03e5de977af9a879683edda64a97 12-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50: rename nv84_mpeg to nv50_mpeg

In preparation for adding 0x50 support.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c0924326c8306249aaae27016b80f3c07bb51705 04-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv84: add support for PMPEG

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a02ccc7f97d9e9121aa641aca33ba2a2978aef31 04-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40/vpe: add support for PMPEG

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d5a27370b507be810bd32a01fe493adef7ad85d9 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: implement support for copy engines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7ff5441e55feb1f6f38c39f32f31aa8a0e8f4b69 18-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nva3: implement support for copy engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a82dd49f14742e2529f79feb6360e0993277e788 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove remnants of nouveau_pgraph_engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
96c50082904c7cefa3b01356f62268ee6d9e9f38 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> 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>
4976986bd4f51368890f57b964176ec532972543 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv04/gr: move to exec engine interfaces

Like nv10-nv50, needs cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d11db279014e881da9f5259c963501b33a413929 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv10/gr: move to exec engine interfaces

Like nv20-nv50, needs cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a0b1de84fed49a055a3ecbfab67ff9cdea81aa6f 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com> 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>
39c8d368273bca9b5f309f9feadfc8575c9fd993 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40/gr: move to exec engine interfaces

Like nv50, this needs a good cleanup.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7a45cd19c95a383d81a7b2f5297958c0c16b5a08 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> 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>
2703c21a82301f5c31ba5679e2d56422bd4cd404 01-Apr-2011 Ben Skeggs <bskeggs@redhat.com> 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>
6dfdd7a61e8fc25552d9de1cb25272324dfc4c13 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com> 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>
2d7b919c9b0ca3df1da2498bb0cede25ddd97e00 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove some unused members from dev_priv

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4ea52f8974392b39ffb192fd31de80dc65b52657 31-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: move engine object creation into per-engine hooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
50066f8117d79163b96d3bf778c41961be1fe5cd 27-Mar-2011 Roy Spliet <r.spliet@student.tudelft.nl> 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>
0b89a072f942412c45d00f74e7e789e019e5de2c 20-Mar-2011 Emil Velikov <emil.l.velikov@gmail.com> 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>
71298e2f0b6fb6dce9f2b2e999652edf1f643d9e 20-Mar-2011 Emil Velikov <emil.l.velikov@gmail.com> 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>
04eb34a43ce5168e05e2748bd46a62a09289cdde 06-Apr-2011 Ben Skeggs <bskeggs@redhat.com> 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>
2b4cebe4e165b0ef30a138e4cf602538dea15583 29-Mar-2011 Ben Skeggs <bskeggs@redhat.com> 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>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
7eae3efa13c5d1c8e7d8dd0504ad524963b8add1 23-Mar-2011 Matthew Garrett <mjg@redhat.com> 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>
6fdb383e81a644a244299d635de5eb30ed401278 08-Mar-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50: check for vm traps on every gr irq

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
73412c3854c877e5f37ad944ee8977addde4d35a 04-Mar-2011 Ben Skeggs <bskeggs@redhat.com> 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>
8f7286f8e4e80f7b868ba3d117ae900f0d207cbe 14-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50: support for compression

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
26c0c9e33a2eb44b345d22d5928d5c8b7b261226 09-Feb-2011 Ben Skeggs <bskeggs@redhat.com> 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>
d5f423947a11103c43ad26ebb680d049c2d8edd6 09-Feb-2011 Ben Skeggs <bskeggs@redhat.com> 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>
3425df486ca247d9e8487be06a6cd0763ba38180 10-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0: unmap buffers from the vm when they're evicted

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
db5c8e299a30db48a3a60dadc676cf05d19d268d 10-Feb-2011 Ben Skeggs <bskeggs@redhat.com> 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>
6ba9a68317781537d6184d3fdb2d0f20c97da3a4 10-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: pass domain rather than ttm flags to gem_new()

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d550c41e4ff11fe69b5f92868157253d27937d1f 15-Feb-2011 Ben Skeggs <bskeggs@redhat.com> 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>
f13e435c59573aa0ac398210777cc0406c476593 03-Feb-2011 Ben Skeggs <bskeggs@redhat.com> 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>
ef8389a84bbd80daaf6c60a5534461d82ba22c0a 01-Feb-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv50-nvc0: move non-sharable display state into private structure

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d82f8e6c802bb1244ce590d3877f7c66a8fb0ff0 26-Jan-2011 Tejun Heo <tj@kernel.org> drm/nouveau: use system_wq instead of dev_priv->wq

With cmwq, there's no reason for nouveau to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead. Each work item is sync
flushed when the containing structure is unregistered/destroyed.

Note that this change also makes sure that nv50_gpio_handler is not
freed while the contained work item is still running.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7948758d27be1b69b6a79ed4f3f22e36a3b95965 11-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40: implement support for on-chip PCIEGART

v2. moved nv44 pciegart table back to instmem, where it's not
accessible by userspace clients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
58e6c7a9183071b89b0ac94862f369ed55775a7a 11-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: introduce new gart type, and name _SGDMA more appropriately

In preparation for the addition of a new nv40 backend, we'll need to be
able to distinguish between a paged dma object and the on-chip GART.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1c2a679aa99d4b9d01004863d72d818534d4ac54 18-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove dead function definition

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c906ca0fbf237b77ba2101a2fa9050317137fde8 14-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: enable protection of system-use-only structures in vm

Somehow missed this in the original merge of the nvc0 code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c693931d93facab671bafdcebf515520663c22fc 11-Jan-2011 Ben Skeggs <bskeggs@redhat.com> drm/nv40: make detection of 0x4097-ful chipsets available everywhere

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5bcf719b7db0f9366cedaf102b081f99b1c325ae 07-Dec-2010 Dave Airlie <airlied@redhat.com> drm/switcheroo: track state of switch in drivers.

We need to track the state of the switch in drivers, so that after s/r
we don't resume the card we've explicitly switched off before. Also
don't allow a userspace open to occur if we've switched the gpu off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6effe39364f1212aa57e1b5f0bd0f388ebfe9b24 30-Dec-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: sync up gr data error names with rnn, use for nvc0 also

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
966a5b7daa15e152bc2e1f0407939cc721fb5995 24-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: implement pgraph engine hooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b2b099388fa76f0be25431794d369d251a4002dd 24-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: implement pfifo engine hooks

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8984e046153eb1d6b0b24626169f9c6e58232e1b 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: initial vm implementation, use for bar1/bar3 management

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4c74eb7ff276813ee73943a3756b295675fb2865 10-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: import initial vm backend

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fd70b6cd780742b97f525415bf5e4fb24a4bb6d8 08-Dec-2010 Francisco Jerez <currojerez@riseup.net> drm/nv04-nv40: Fix up PCI(E) GART DMA object bus address calculation.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
60d2a88ae896ae51c76f8b15c2f4b762d5b00864 06-Dec-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: kick vram functions out into an "engine"

NVC0 will be able to share some of nv50's paths this way. This also makes
it the card-specific vram code responsible for deciding if a given set
of tile_flags is valid, rather than duplicating the allowed types in
nv50_vram.c and nouveau_gem.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
34cf01bc4b8021cef62cbd79224577c13d01b106 22-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: allow gpuobj vinst to be a virtual address when necessary

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b571fe21f5c24760368b3fb927af5a7384d7721b 16-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: tidy up PCIEGART implementation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4c1361429841344ce4d164492ee7620cf3286eb7 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: implement global channel address space on new VM code

As of this commit, it's guaranteed that if an object is in VRAM that its
GPU virtual address will be constant.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f869ef882382a4b6cb42d259e399aeec3781d4bb 15-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: implement BAR1/BAR3 management on top of new VM code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a11c3198c9ba38d81e25b65e3908d531feba1372 27-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: import new vm code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
573a2a37e8648a3249426c816f51e7ef50f6f73e 25-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: implement custom vram mm

This is required on nv50 as we need to be able to have more precise control
over physical VRAM allocations to avoid buffer corruption when using
buffers of mixed memory types.

This removes some nasty overallocation/alignment that we were previously
using to "control" this problem.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7a45d764a8e3177f0c9cd4a0be9f2ab7965e55cb 21-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: wrap calls to ttm_bo_validate()

This will be used later to fixup bo.offset with a buffer's fixed GPU
virtual address.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12fb9525075982bc65cfd71427dd7afdf47bafed 19-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: introduce a util function to wait on reg != val

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ceac30999dfb00ee7b56cfea8b28ef50999a3c95 23-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: implicitly insert non-DMA objects into RAMHT

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6dccd311dd4b104b3bc53cb67aef414141d11c9f 18-Nov-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Synchronize with the user channel before GPU object destruction.

There have been reports of PFIFO cache errors during context take down
(fdo bug 31637). They are caused by some GPU objects being taken out
while the channel is still potentially processing commands. Make sure
that all the previous rendering has landed before releasing a GPU
object.

Reported-by: Grzesiek Sójka <pld@pfu.pl>
Reported-by: Patrice Mandin <patmandin@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7f4a195fcbd8b16f25f1de7f1419414d7505daa5 16-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: tidy up and extend dma object creation interfaces

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7b4808bb6ee63c9cc9c9be5a52f0c7babfc50659 14-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove dummy page use from PCI(E)GART, use PTE present instead

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
20f63afe988a25b0a4d991e87b41f76ee14e2a84 14-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: allocate page for unknown PFB object in nv50_fb.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e41115d0ad5c40a7ea4d85b1c77b4c02185a5581 01-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: rework gpu-specific instmem interfaces

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
dc1e5c0dbff27c2b5147eaea16c578d2337870c3 25-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: simplify gpuobj suspend/resume

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fce2bad0ee2666d6a10bfeb634b1021469cc3d79 11-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: rework PGPIO IRQ handling and hotplug detection

Allows callers to install their own handlers for when a GPIO line
changes state (such as for hotplug detect).

This also fixes a bug where we weren't acknowledging the GPIO IRQ
until after the bottom half had run, causing a severe IRQ storm
in some cases.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
274fec93cdd627408a799519fa602f2eecb14d2f 03-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: tidy+move PGRAPH ISRs to their respective *_graph.c files

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5178d40dff23b5eef7f0a3be2411fa6a347e750d 03-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: move PFIFO ISR into nv04_fifo.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2cbd4c818578ef8f2e486dc77267ead1e503c637 03-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: move GPIO ISR to nv50_gpio.c

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8f8a54482b008714ccfad15f4592b3802b80d479 03-Nov-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: allow irq handlers to be installed by engine-specific code

Lets start to clean up this mess!

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
87a326a38589e1c919af5f86a59cd571ff0aa831 24-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nv20: Add Z compression support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a5cf68b04b2b8ea716cf6fd8499c1c54d05fdf5e 24-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Rework tile region handling.

The point is to share more code between the PFB/PGRAPH tile region
hooks, and give the hardware specific functions a chance to allocate
per-region resources.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e419cf0954901bb3a987f8b76cbc9654ca06121c 25-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add a separate class for the kernel channel mutex.

nouveau_bo_move_m2mf() needs to lock the kernel channel, and it may be
called from the pushbuf IOCTL with an user channel already locked. Use
a separate subclass for the kernel channel mutex because this is
legitimate mutex nesting.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1f6d2de2c539df6fe52ad2187191a9dfe10c7233 24-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nv50: Keep track of the head a channel is vsync'ing to.

In a multihead setup vblank interrupts may end up enabled in both
heads. In that case we want to ignore the vblank interrupts coming
from the wrong CRTC to avoid tearing and unbalanced calls to
drm_vblank_get/put (fdo bug 31074).

Reported-by: Felix Leimbach <felix.leimbach@gmx.net>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
332b242f47786d1a43bd7a19a0513dd5d493db8e 20-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Implement the pageflip ioctl.

nv0x-nv4x should be mostly fine, nv50 doesn't work yet.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
042206c0cd4924879c4292c5ffa2bf1e8023ae5a 21-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Implement the vblank DRM hooks.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
382d62e524db528cdf53563ad9a018adc170dfde 20-Oct-2010 Marcin Slusarz <marcin.slusarz@gmail.com> drm/nouveau: fix annoying nouveau_fence type issue

nouveau_fence_* functions are not type safe, which could lead to bugs.
Additionally every use of nouveau_fence_unref had to cast struct
nouveau_fence to void **.
Fix it by renaming old functions and creating static inline functions with
new prototypes. We still need old functions, because we pass function
pointers to ttm.
As we are wrapping functions, drop unused "void *arg" parameter where possible.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
35fa2f2ad161024e735fb0cd571cb92e50171afd 21-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add support for MSI

Only supported on NV50+ so far, and disabled by default currently. The
module parameter "msi=1" will enable it.

There's a kernel bug which will cause this to fail if the module (or the
NVIDIA binary driver) has ever been loaded before loading nouveau with
MSI enabled. As such, this is only safe to enable if you have nouveau
load on boot, and don't wish to ever reload it.

The workaround is to "echo 0 > /sys/bus/pci/devices/<device>/enable"
until the enable count reads 0. Then you should be able to load nouveau
with MSI enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
1e96268aca1bb40f42bdbc9d2293b123b072f1de 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: initial work to allow multiple evo channels

This doesn't work yet for unknown reasons.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
bd2e597de8dbd000a3977871f15cb81e2925d63e 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv84: add support for the PCRYPT engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b8c157d3a9a13871742c8a8d3d4598c3791ed5f5 20-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: only expose the object classes that are supported by the chipset

We previously added all the available classes for the entire generation,
even though the objects wouldn't work on the hardware.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a6a1a38075661bec189f2bad7912f8861e6ce357 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: use object class structs more extensively

The structs themselves, as well as the non-sw object creation function are
probably very misnamed now. That's a problem for later :)

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
50536946faaf3d9ac0245838eb09e5eb1065b06c 19-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: store engine type in gpuobj class structs

We will eventually want to address hw engines other than PGRAPH.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9100468d1be26063aa25ecd667ea922c101d203f 15-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: pass gpuobj alignment request down into backing allocator

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f091a3d403065416b7d27221bbeb956481132ffd 18-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Implement weak channel references.

nouveau_channel_ref() takes a "weak" channel reference that doesn't
prevent the hardware channel resources from being released, it just
keeps the channel data structure alive.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
feeb0aecfb73b5b7699c0a85ba1650e6f9c50be2 18-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add unlocked variants of nouveau_channel_get/put.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3945e47543863385b54d94c94b023ee7ca9df972 18-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Refactor context destruction to avoid a lock ordering issue.

The destroy_context() engine hooks call gpuobj management functions to
release the channel resources, these functions use HARDIRQ-unsafe locks
whereas destroy_context() is called with the HARDIRQ-safe
context_switch_lock held, that's a lock ordering violation.

Push the engine-specific channel destruction logic into destroy_context()
and let the hardware-specific code lock and unlock when it's actually
needed. Change the engine destruction order to avoid a race in the small
gap between pgraph and pfifo context uninitialization.

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6032649df9f456f379be8d51f64488cacbfa8317 11-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: hook up acpi power supply change tracking

Not used at all yet, but lets hook it up now anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
21e86c1c8a844bf978f8fc431a59c9f5a578812d 11-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove cpu_writers lock

No other driver uses this, and userspace should be responsible for handling
locking between them if they share BOs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cff5c1332486ced8ff4180e957e04983cb72a39e 06-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add more fine-grained locking to channel list + structures

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6a6b73f254123851f7f73ab5e57344a569d6a0ab 05-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add per-channel mutex, use to lock access to drm's channel

This fixes a race condition between fbcon acceleration and TTM buffer
moves. To reproduce:

- start X
- switch to vt and "while (true); do dmesg; done"
- switch to another vt and "sleep 2 && cat /path/to/debugfs/dri/0/evict_vram"
- switch back to vt running dmesg

We don't make use of this on any other channel yet, they're currently
protected by drm_global_mutex. This will change in the near future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ab838338a2a9e0cb8346eb0cab9977be13e8dce5 17-Nov-2010 Andy Lutomirski <luto@mit.edu> nouveau: Acknowledge HPD irq in handler, not bottom half

The old code generated an interrupt storm bad enough to completely
take down my system.

Signed-off-by: Andy Lutomirski <luto@mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
56ac7475350ee646f5f7316abcdf65d3be94da1c 22-Oct-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: implement possible workaround for NV86 PGRAPH TLB flush hang

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f13b32630dda7e583a84a8c535880cff7e4a9bdd 10-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Expose some BO usage flags to userspace.

This will be needed for Z compression and to take smarter placement
decisions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
cbab95db84f2a444d99bec77bac8b9b6ef20d11c 11-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Some random cleanups.

Remove some unused/duplicated definitions and make sparse happy again.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8af29ccd7917ab448ea7b5cf581fa7b2b4ea3cba 02-Oct-2010 Francisco Jerez <currojerez@riseup.net> drm/nv50: Fix large 3D performance regression caused by the interchannel sync patches.

Reported-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Maarten Maathuis <madman2003@gmail.com>
Tested-by: Xavier Chantry <chantry.xavier@gmail.com>
Tested-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0c6c1c2fb8b0fd4340f78db20ee7f35d2a810907 22-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Use semaphores to handle inter-channel sync in hardware.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8ac3891b48906b38db4b153c2d0d55db2ef81aee 21-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Provide a means to have arbitrary work run on fence completion.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2730723bbc4a8b289fa536fc3555e15947da09c1 21-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Minor refactoring/cleanup of the fence code.

Mainly to make room for inter-channel sync.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0cba1b7644cbcd855d0a2b2ea4d8da26fd08dec4 29-Sep-2010 Marcin Kościelnicki <koriakin@0x04.net> drm/nouveau: Add a module option to force card POST.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
aee582de806c7008756df23aa444c8e7d58004a9 27-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: run perflvl and M table scripts on mem clock change

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5c6dc6575460a0afe56d8cae7666e769e08ef942 27-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: pass perflvl struct to clock_pre()

On certain boards, there's BIOS scripts and memory timings that need to
be modified with the memclk. Just pass in the entire perflvl struct and
let the chipset-specific code decide what to do.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
7760fcb020b41352af4e675ce65a6aa0e93c170f 17-Sep-2010 Roy Spliet <r.spliet@student.tudelft.nl> drm/nouveau: Import initial memory timing work

This isn't correct everywhere yet, but since we don't use the data yet
it's perfectly safe to push in, and the information we gain from logs
will help to fix the remaining issues.

v2 (Ben Skeggs <bskeggs@redhat.com>):
- fixed up formatting
- free parsed timing info on takedown
- switched timing table printout to debug loglevel

Signed-off-by: Roy Spliet <r.spliet@student.tudelft.nl>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8155cac489eb8cc6fd96b9bdefacdf5a56e6ea32 23-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Refactor nouveau_temp_get() into engine pointers.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
34e9d85a1aae28b090ec4e72a0f98a5483c198c4 22-Sep-2010 Martin Peres <martin.peres@ensi-bourges.fr> drm/nouveau: Add temperature support (vbios parsing, readings, hwmon)

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6f876986bedf23b40ab707543e88fae7eac27f1f 16-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: allow static performance level setting

Guarded by a module parameter for the moment, read the code for the
magic value which enables it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
330c5988ee78045e6a731c3693251aaa5b0d14e3 16-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: import initial work on vbios performance table parsing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
855a95e4fc2ac6b758145ca7d6a0c95b66a57ef8 16-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: make the behaviour of get_pll_limits() consistent

This replaces all the pll_types definitions for ones that match the types
used in the tables in recent VBIOS versions.

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

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
9f56b1265d66f6698e3155529e6c5d0c34b37afa 07-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Simplify tile region handling.

Instead of emptying the caches to avoid a race with the PFIFO puller,
go straight ahead and try to recover from it when it happens. Also,
kill pfifo->cache_flush and tile->lock, we don't need them anymore.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4b5c152a79d512803ea525b0878ccef627cd1629 07-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Remove implicit argument from nv_wait().

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
de5899bdaccaabfaab894559a7eec3302ae88b52 08-Sep-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add module parameter to override the default AGP rate.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d96773e7b61d9976b8227e018a1c94fb7374e641 03-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: move vm trap to nv50_fb.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
185abeccabe5aed0ef79e8572c3916ea08034a45 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove nouveau_gpuobj_late_takedown

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e05d7eaeba57921abad0ef564b0875e225171de8 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: protect gpuobj list + global instmem heap with spinlock

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
eb9bcbdc45369105bc004a82c7bed60655aae926 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix gpuobj refcount to use atomics

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e05c5a317efb03854950a3fcc5c9501bfefc7d68 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: tidy ram{ht,fc,ro} a bit

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
fbd2895e45aebdb3d3ea73a3a796cf3bb9c912da 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: rework init ordering so nv50_instmem.c can be less bad

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6c3d7ef25e3b4a0ea511b1e9d4a0a212750874a6 11-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: calculate vram reordering block size

Will be used at a later point when we plug in an alternative VRAM memory
manager for GeForce 8+ boards.

Based on pscnv code to do the same.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5125bfd88608012d58652ac7ea6a03a78773200f 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: allow gpuobjs that aren't mapped into aperture

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
43efc9ce25c6956133c07394a6fa44ef2c9268a4 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: simplify fake gpu objects

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a8eaebc6c52bb0cd243b4cb421068f42d378be9c 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove nouveau_gpuobj_ref completely, replace with sanity

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
de3a6c0a3b642c0c350414d63298a1b19a009290 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: rebase per-channel pramin heap offsets to 0

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b3beb167af0de6d7cb03aed0687eca645cfd06a6 01-Sep-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: modify object accessors, offset in bytes rather than dwords

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2a7fdb2bc15b3bfc824eb969b3dc7efa3fb52463 30-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: have nv_mask return original register value

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
acae116ce16833859eb4eb929de571b9a800d685 15-Aug-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Use a helper function to match PCI device/subsystem IDs.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
415e6186f17136075f7cc825ba3835d005773637 23-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix race condition when under memory pressure

When VRAM is running out it's possible that the client's push buffers get
evicted to main memory. When they're validated back in, the GPU may
be used for the copy back to VRAM, but the existing synchronisation code
only deals with inter-channel sync, not sync between PFIFO and PGRAPH on
the same channel. This leads to PFIFO fetching from command buffers that
haven't quite been copied by PGRAPH yet.

This patch marks push buffers as so, and forces any GPU-assisted buffer
moves to be done on a different channel, which triggers the correct
synchronisation to happen before we submit them.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4b223eefe43d201c323d120a01dbd0dcbba64e6d 03-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nvc0: starting point for GF100 support, everything stubbed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
4a9f822fe1a6ca5de7d8cdd5efbead3b9ab4283b 20-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nv17-nv4x: Attempt to init some external TMDS transmitters.

sil164 and friends are the most common, usually they just need to be
poked once because a fixed configuration is enough for any modes and
clocks, so they worked without this patch if the BIOS had done a good
job on POST. Display couldn't survive a suspend/resume cycle though.
Unfortunately, BIOS scripts are useless here.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0d3470d218949dc1307313647c70154c7452a68b 02-Aug-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove unused ttm bo list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ba4420c224c2808f2661cf8428f43ceef7a73a4a 09-Mar-2010 Dave Airlie <airlied@redhat.com> drm: move ttm global code to core drm

I wrote this for the prime sharing work, but I also noticed other external
non-upstream drivers from a large company carrying a similiar patch, so I
may as well ship it in master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
ee2e013131dcf6427334663662dbe760ccdba735 26-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: introduce gpio engine

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c88c2e0631b03ffb1485f8790a5b659beb1ac0be 24-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Move display init to a new nouveau_engine.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e04d8e829d7807e132d8c82c3554b164a803c617 23-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Reset AGP before running the init scripts.

BIOS scripts usually make an attempt to reset the AGP controller,
however on some nv4x cards doing it properly involves switching FW off
and on: if we do that without updating the AGP bridge settings
accordingly (e.g. with the corresponding calls to agp_enable()) we
will be locking ourselves out of the card MMIO space. Do it from
nouveau_mem_reset_agp() before the init scripts are executed.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8bded189552800cae6c333475a54dabe048a74aa 21-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nv30: Init the PFB+0x3xx memory timing regs.

Fixes the randomly flashing vertical lines seen on some nv3x after a
cold-boot.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
d0875edd9374296af8702d850254809e34a809cd 23-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: add function to control GPIO IRQ reporting

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
49eed80ad0cfa5d5d02992e8088463cbf1a5ff85 23-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add nv_mask register accessor

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
5620ba4680db0ba25b89952bdda41a9c8fd11f50 23-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: fix build without CONFIG_ACPI

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a6ed76d7ffc62ffa474b41d31b011b6853c5de32 12-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: support fetching LVDS EDID from ACPI

Based on a patch from Matthew Garrett.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Acked-by: Matthew Garrett <mjg@redhat.com>
734ee8357ac2685a306acd598826d5eb8a3fca30 15-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: use correct PRAMIN flush register on original nv50

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
047d1d3cae2c4fc5be4fa20a97c8f5ba4fea1c56 30-May-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: reduce usage of fence spinlock to when absolutely necessary

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c50a5681e7d0ce1dd6de06fd70a7eff56ebfb9e9 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv20-nv30: move context table object out of dev_priv

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ac94a343c74fe0504663583a7590e89257214f0d 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: cleanup nv50_fifo.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3b569e0f2b8f48cd7f9ea37ef7597d1219b87477 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove unused fbdev_info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ec91db269e6a3c7f45b96169ccf5dbd1fde8fce8 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove ability to use external firmware

This was always really a developer option, and if it's really necessary we
can hack this in ourselves.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
631872155f35b907ae3950016d9e72a308449d69 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: move tlb flushing to a helper function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f56cb86f9abd229418f894a8ffedfb9ff465c181 08-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add instmem flush() hook

This removes the previous prepare_access() and finish_access() hooks, and
replaces it with a much simpler flush() hook.

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

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b6d3d8717855c72e541bace5edd0460f2eed6dde 07-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove dev_priv->init_state and friends

Nouveau will no longer load at all if card initialisation fails, so all
these checks are unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
87c0e0e5133e252a6d3d561dd0caeec0244ea9a5 06-Jul-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: rewrite display irq handler

The previous handler basically worked correctly for a full-blown mode
change. However, it did nothing at all when a partial (encoder only)
reconfiguation was necessary, leading to the display hanging on certain
types of mode switch.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8ccfe9e098d5975ef65d17de477f6b7dc0c446db 04-Jul-2010 Francisco Jerez <currojerez@riseup.net> drm/nv04-nv40: Prevent invalid DAC/TVDAC combinations.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8f1a60868f4594bc5576cca8952635f475e8bec6 28-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: tidy connector/encoder creation a little

Create connectors before encoders to avoid having to do another loop across
encoder list whenever we create a new connector. This allows us to pass
the connector to the encoder creation functions, and avoid using a
create_resources() callback since we can now call it directly.

This can also potentially modify the connector ordering on nv50. On cards
where the DCB connector and encoder tables are in the same order, things
will be unchanged. However, there's some cards where the ordering between
the tables differ, and in one case, leads us to naming the connectors
"wrongly".

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
b833ac26f1f1c8e8d9149d83dbdd91432f2807d5 01-Jun-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: use drm_mm in preference to custom code doing the same thing

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
afeb3e11147adb357603b071d6d7d1f30ea7f19d 07-Apr-2010 Dave Airlie <airlied@redhat.com> drm/nouveau: attempt to get bios from ACPI v3

Some of the laptops with the switchable graphics, seem to not post the secondary GPU at all, and we can't find a copy of the BIOS anywhere except in the ACPI rom retrieval.

This adds support for ACPI ROM retrieval to nouveau.

Signed-off-by: Dave Airlie <airlied@redhat.com>
e9ebb68b86dd75fe2d61467f834dcf572e6859df 28-Apr-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: support fractional feedback divider on newer chips

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
06415c564fb98562a4d6b6215615deb2d1cc0dae 16-May-2010 Marcin Slusarz <marcin.slusarz@gmail.com> fbmem, drm/nouveau: kick firmware framebuffers as soon as possible

Currently vesafb/efifb/... is kicked when hardware driver is registering
framebuffer. To do it hardware must be fully functional, so there's a short
window between start of initialisation and framebuffer registration when
two drivers touch the hardware. Unfortunately sometimes it breaks nouveau
initialisation.

Fix it by kicking firmware driver(s) before we start touching the hardware.

Reported-by: Didier Spaier <didier.spaier@epsm.fr>
Tested-by: Didier Spaier <didier.spaier@epsm.fr>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
4528416291e26456e68f7217576e40e589d276bf 06-Apr-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: implement gpio set/get routines

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a5acac66685397a73bed8638114262520565e41c 30-Mar-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: punt hotplug irq handling out to workqueue

On DP outputs we'll likely end up running vbios init tables here, which
may sleep.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a76fb4e8ffe42144529e21fe1e609b762e8eb5cc 18-Mar-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: detect vram amount once, and save the value

As opposed to repeatedly reading the amount back from the GPU every
time we need to know the VRAM size.

We should now fail to load gracefully on detecting no VRAM, rather than
something potentially messy happening.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
952eb63543552deb1bf1113739d59d29172d7755 18-Mar-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove some unused members from drm_nouveau_private

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
78ad0f7bf2bb667729581f099781fc0b7ae58fcc 18-Mar-2010 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Make use of TTM busy_placements.

Previously we were filling it the same as "placements", but in some
cases there're valid alternatives that we were ignoring completely.
Keeping a back-up memory type helps on several low-mem situations.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
8be48d924c307e72e3797ab5bde81b07a1ccc52d 30-Mar-2010 Dave Airlie <airlied@redhat.com> drm/kms/fb: move to using fb helper crtc grouping instead of core crtc list

This move to using the list of crtcs in the fb helper and cleans up the
whole picking code, now we store the crtc/connectors we want directly
into the modeset and we use the modeset directly to set the mode.

Fixes from James Simmons and Ben Skeggs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
386516744ba45d50f42c6999151cc210cb4f96e4 30-Mar-2010 Dave Airlie <airlied@redhat.com> drm/fb: fix fbdev object model + cleanup properly.

The fbdev layer in the kms code should act like a consumer of the kms services and avoid having relying on information being store in the kms core structures in order for it to work.

This patch

a) removes the info pointer/psuedo palette from the core drm_framebuffer structure and moves it to the fbdev helper layer, it also removes the core drm keeping a list of kernel kms fbdevs.
b) migrated all the fb helper functions out of the crtc helper file into the fb helper file.
c) pushed the fb probing/hotplug control into the driver
d) makes the surface sizes into a structure for ease of passing
This changes the intel/radeon/nouveau drivers to use the new helper.

Signed-off-by: Dave Airlie <airlied@redhat.com>
f4053509669f904aec70c51e2ff75563ba7ae823 15-Mar-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add module option to disable TV detection

Intended to be used as a workaround in cases where we falsely detect
that a TV is connected when it's not.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
da647d5bf3c0a4b7ad150803910cb1d737ac522e 03-Mar-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: add option to allow override of dcb connector table types

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
304424e17dd904cef048ef8966d9f54618a915cc 01-Mar-2010 Marcin Kościelnicki <koriakin@0x04.net> drm/nv50: Improve PGRAPH interrupt handling.

This makes nouveau recognise and report more kinds of PGRAPH errors, as
well as prevent GPU lockups resulting from some of them.

Lots of guesswork was involved and some part of this is probably
incorrect. Some potential-lockuop situations are handled by just
resetting a whole PGRAPH subunit, which doesn't sound like a "proper"
solution, but seems to work just fine... for now.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2f41a7f11c4bb93c41715008a693cadaee5efd82 03-Mar-2010 Dave Airlie <airlied@redhat.com> drm/nouveau: fix *staging* driver build with switcheroo off.

This driver is in *staging*. Fix the build with the switcheroo off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8edb381d6705811b278527907a5ae2a9c4db8074 01-Mar-2010 Dave Airlie <airlied@redhat.com> vga_switcheroo: fix build on platforms with no ACPI

radeon was always including the atpx code unnecessarily, also core
switcheroo was including acpi headers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
6a9ee8af344e3bd7dbd61e67037096cdf7f83289 01-Feb-2010 Dave Airlie <airlied@linux.ie> vga_switcheroo: initial implementation (v15)

Many new laptops now come with 2 gpus, one to be used for low power
modes and one for gaming/on-ac applications. These GPUs are typically
wired to the laptop panel and VGA ports via a multiplexer unit which
is controlled via ACPI methods.

4 combinations of systems typically exist - with 2 ACPI methods.
Intel/ATI - Lenovo W500/T500 - use ATPX ACPI method
ATI/ATI - some ASUS - use ATPX ACPI Method
Intel/Nvidia - - use _DSM ACPI method
Nvidia/Nvidia - - use _DSM ACPI method.

TODO:
This patch adds support for the ATPX method and initial bits
for the _DSM methods that need to written by someone with
access to the hardware.
Add a proper non-debugfs interface - need to get some proper
testing first.

v2: add power up/down support for both devices
on W500 puts i915/radeon into D3 and cuts power to radeon.

v3: redo probing methods, no DMI list, drm devices call to
register with switcheroo, it tries to find an ATPX method on
any device and once there is two devices + ATPX it inits the
switcher.

v4: ATPX msg handling using buffers - should work on more machines

v5: rearchitect after more mjg59 discussion - move ATPX handling to
radeon driver.

v6: add file headers + initial nouveau bits (to be filled out).

v7: merge delayed switcher code.

v8: avoid suspend/resume of gpu that is off

v9: rearchitect - mjg59 is always right. - move all ATPX code to
radeon, should allow simpler DSM also proper ATRM handling

v10: add ATRM support for radeon BIOS, add mutex to lock vgasr_priv

v11: fix bug in resuming Intel for 2nd time.

v12: start fixing up nvidia code blindly.

v13: blindly guess at finishing nvidia code

v14: remove radeon audio hacks - fix up intel resume more like upstream

v15: clean up printks + remove unnecessary igd/dis pointers

mount debugfs

/sys/kernel/debug/vgaswitcheroo/switch - should exist if ATPX detected
+ 2 cards.

DIS - immediate change to discrete
IGD - immediate change to IGD
DDIS - delayed change to discrete
DIGD - delayed change to IGD
ON - turn on not in use
OFF - turn off not in use

Tested on W500 (Intel/ATI) and T500 (Intel/ATI)

Signed-off-by: Dave Airlie <airlied@redhat.com>
d5f3c90d4f3ad6b054f9855b7b69137b97bda131 25-Feb-2010 Marcin Kościelnicki <koriakin@0x04.net> drm/nv50: Implement ctxprog/state generation.

This removes dependence on external firmware for NV50 generation cards.
If the generated ctxprogs don't work for you for some reason, please
report it.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
04a39c577f4114a3f098ee8ef0e20f7778b5ddad 24-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: merge nvbios and nouveau_bios_info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a1606a9596e54da90ad6209071b357a4c1b0fa82 12-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: new gem pushbuf interface, bump to 0.0.16

This commit breaks the userspace interface, and requires a new libdrm for
nouveau to operate again.

The multiple GEM_PUSHBUF ioctls that were present in 0.0.15 for
compatibility purposes are now gone, and replaced with the new ioctl which
allows for multiple push buffers to be submitted (necessary for hw index
buffers in the nv50 3d driver) and relocations to be applied on any buffer.

A number of other ioctls (CARD_INIT, GEM_PIN, GEM_UNPIN) that were needed
for userspace modesetting have also been removed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
9a391ad8a2cdd7e5be9b6aabb56f4a46683ba377 11-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: switch to indirect push buffer controls

PFIFO on G80 and up has a new mode where the main ring buffer is simply a
ring of pointers to indirect buffers containing the actual command/data
packets. In order to be able to implement index buffers in the 3D driver
we need to be able to submit data-only push buffers right after the cmd
packet header, which is only possible using the new command submission
method.

This commit doesn't make it possible to implement index buffers yet, some
userspace interface changes will be required, but it does allow for
testing/debugging of the hardware-side support in the meantime.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ff9e5279b14dc024599cc705ee199dadb94e90a3 01-Feb-2010 Maarten Maathuis <madman2003@gmail.com> drm/nouveau: protect channel create/destroy and irq handler with a spinlock

The nv50 pgraph handler (for example) could reenable pgraph fifo access
and that would be bad when pgraph context is being unloaded (we need the
guarantee a ctxprog isn't running).

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
76befb8c30cebe2af83fa346bdaf75b430893511 19-Feb-2010 Ben Skeggs <bskeggs@redhat.com> drm/nv50: fix instmem binding on IGPs to point at stolen system memory

This also modifies the unused PRAMIN PT entries to be all zeroes, can't
really recall why I used 9/0 initially, just that it didn't work for
some reason. It was likely masking a bug elsewhere that's since been
fixed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
3ad2f3fbb961429d2aa627465ae4829758bc7e07 03-Feb-2010 Daniel Mack <daniel@caiaq.de> tree-wide: Assorted spelling fixes

In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
a32ed69d7bb3cd259d813d71281d62993b9a70fd 26-Jan-2010 Marcin Kościelnicki <koriakin@0x04.net> drm/nouveau: Add module options to disable acceleration.

noaccel=1 disables all acceleration and doesn't even attempt
initialising PGRAPH+PFIFO, nofbaccel=1 only makes fbcon unaccelerated.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
a1470890f29da73783e932078ed911f5871e3ad3 18-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: report LVDS as disconnected if lid closed

Also adds a module option to ignore the status reported via ACPI, in case
we hit systems with broken ACPI.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ac8fb975e8c88d312a376b035494be17548d01c6 15-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: reserve VGA area for the moment

This is to prevent things such as GART tables and other important GPU
structures being allocated there before we take over fbcon ourselves.

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

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
c63834e1db41b59d6c7bfb1d2a549c027a42a877 08-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: initialise DMA tracking parameters earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
e9dd8e11edfff5e348f3dcfd152a70c5da921126 03-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove unused nouveau_channel_idle() function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ca4362adb4c01807dfcf3f2b3152a7ee36f0d1ca 26-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Allocate a per-channel instance of NV_SW.

It will be useful for various synchronization purposes, mostly stolen
from "[PATCH] drm/nv50: synchronize user channel after buffer object
move on kernel channel" by Maarten Maathuis.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
02076da97a15bbf7477bffed71d02f726de2afc2 17-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Clean up the nv17-nv4x load detection code a bit.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
287c1532145b63d394060d46c0309b123b862345 11-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Make the MM aware of pre-G80 tiling.

This commit has also the following 3 bugfix commits squashed into it from
the nouveau git tree:

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

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
0d87c100312ce75d9bb75a456d8a542e84a1722f 16-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Pre-G80 tiling support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
617e234b01757698ed5f8c9a5fbf12717b76e371 13-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add cache_flush/pull fifo engine functions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
75c99da6cdd0ec9d70747f9ced3e85b2dd955cdf 08-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: initialise DMA tracking parameters earlier

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
61768bf1e694056cb41029b60e1270bf2578a83f 03-Jan-2010 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: remove unused nouveau_channel_idle() function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
f03a314b4671407c4ff69a2d85e72413e8064c48 26-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Allocate a per-channel instance of NV_SW.

It will be useful for various synchronization purposes, mostly stolen
from "[PATCH] drm/nv50: synchronize user channel after buffer object
move on kernel channel" by Maarten Maathuis.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
11d6eb2af53395b25e1d6b8b79bb9a999c3e4c4d 17-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Clean up the nv17-nv4x load detection code a bit.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
a0af9add499cf29a16707b7b148842992077f4cb 11-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Make the MM aware of pre-G80 tiling.

This commit has also the following 3 bugfix commits squashed into it from
the nouveau git tree:

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

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
cb00f7c1419d09ee0daf7d8bed86f253d98db7b4 16-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Pre-G80 tiling support.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
588d7d1268658b6a010eb7415bff2f936c51acf7 13-Dec-2009 Francisco Jerez <currojerez@riseup.net> drm/nouveau: Add cache_flush/pull fifo engine functions.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
054b93e444550a72aef17115363cdef253b9ee7c 15-Dec-2009 Ben Skeggs <bskeggs@redhat.com> drm/nv40: implement ctxprog/state generation

The context programs are *very* simple compared to the ones used by
the binary driver. There's notes in nv40_grctx.c explaining most of
the things we don't implement. If we discover if/why any of it is
required further down the track, we'll handle it then.

The PGRAPH state generated for each chipset should match what NVIDIA
do almost exactly (there's a couple of exceptions). If someone has
a lot of time on their hands, they could figure out the mapping of
object/method to PGRAPH register and demagic the initial state a little,
it's not terribly important however.

At time of commit, confirmed to be working at least well enough for
accelerated X (and where tested, for 3D apps) on NV40, NV43, NV44, NV46,
NV49, NV4A, NV4B and NV4E.

A module option has been added to force the use of external firmware
blobs if it becomes required.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
ef2bb506687a5f1cc8ef2fef370bb168b2808106 13-Dec-2009 Maarten Maathuis <madman2003@gmail.com> drm/nouveau: use drm debug levels

- Use driver level (0x2) for NV_DEBUG instead of all levels
- Create a NV_DEBUG_KMS for KMS level (0x4) and use them in modesetting code
- Remove a few odd NV_TRACE calls and replace some of them with NV_DEBUG_KMS or
NV_INFO

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
6ee738610f41b59733f63718f0bdbcba7d3a3f12 11-Dec-2009 Ben Skeggs <bskeggs@redhat.com> drm/nouveau: Add DRM driver for NVIDIA GPUs

This adds a drm/kms staging non-API stable driver for GPUs from NVIDIA.

This driver is a KMS-based driver and requires a compatible nouveau
userspace libdrm and nouveau X.org driver.

This driver requires firmware files not available in this kernel tree,
interested parties can find them via the nouveau project git archive.

This driver is reverse engineered, and is in no way supported by nVidia.

Support for nearly the complete range of nvidia hw from nv04->g80 (nv50)
is available, and the kms driver should support driving nearly all
output types (displayport is under development still) along with supporting
suspend/resume.

This work is all from the upstream nouveau project found at
nouveau.freedesktop.org.

The original authors list from nouveau git tree is:
Anssi Hannula <anssi.hannula@iki.fi>
Ben Skeggs <bskeggs@redhat.com>
Francisco Jerez <currojerez@riseup.net>
Maarten Maathuis <madman2003@gmail.com>
Marcin Kościelnicki <koriakin@0x04.net>
Matthew Garrett <mjg@redhat.com>
Matt Parnell <mparnell@gmail.com>
Patrice Mandin <patmandin@gmail.com>
Pekka Paalanen <pq@iki.fi>
Xavier Chantry <shiningxc@gmail.com>
along with project founder Stephane Marchesin <marchesin@icps.u-strasbg.fr>

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>