Commit graph

277192 commits

Author SHA1 Message Date
Daniel Vetter
40c34d042d drm/i810: don't acces hw regs in lastclose
i810 uses a userspace provided mmio map using the drm core map
infrastructure. By the time we reach lastclose, this is all gone
and our mmio_map pointer points at freed memory. Depending upon
luck that still works, most often it just oopses.

Aside: drm maps aren't refcounted, so userspace can essentially oops
the kernel any time it wants to. Who cares.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 19:54:58 +01:00
Daniel Vetter
87499ffdcb drm/i810: cleanup reclaim_buffers
My dear old i815 always hits the deadlocked on reclaim_buffers
warning. Switch over to the idlelock duct-tape on hope that
works better. I've fired up my i815 and now closing glxgears doesn't
take 5 seconds anymore. \o/

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 19:54:43 +01:00
Dave Airlie
5d56fe5fd7 Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-core-next
* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (102 commits)
  drm/nouveau/ttm: fix crash as a result of a recent ttm change
  drm/nouveau: Fix notifier blocks over the 4GB mark.
  drm/nouveau: Fix pushbufs over the 4GB mark.
  drm/nvc0/pm: initial engine reclocking
  drm/nouveau: move hpd enable/disable to common code
  drm/nv40/disp: implement support for hotplug irq
  drm/nouveau/gpio: reimplement as nouveau_gpio.c, fixing a number of issues
  drm/nouveau: just pass gpio line to pwm_*, not entire gpio struct
  drm/nouveau/hwsq: remove some magic, give proper opcode names
  drm/nv50/pm: introduce hwsq-based memory reclocking
  drm/nv04/disp: handle dual-link spwg panels without needing quirks
  drm/nouveau/dp: remove broken display depth function, use the improved one
  drm/nouveau/mxm: implement ROM shadow method
  drm/nouveau/mxm: implement _DSM shadow method
  drm/nouveau/mxm: implement wmi shadow method
  drm/nouveau/mxm: initial implementation of dcb sanitisation
  drm/nouveau/disp: parse connector info directly in nouveau_connector.c
  drm/nouveau/i2c: handle bit-banging ourselves
  drm/nouveau/i2c: fix debug message
  drm/nouveau/i2c: tidy up bit-bang helpers, also fixing nv50 setsda bug
  ...
2011-12-22 11:02:06 +00:00
Ben Skeggs
f7b24c42da drm/nouveau/ttm: fix crash as a result of a recent ttm change
"drm/ttm: callback move_notify any time bo placement change v4" failed to
avoid a NULL pointer dereference in nouveau caused by move_notify being
expected to handle that case now.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-22 15:23:25 +10:00
Daniel Vetter
7a6e0daaf4 drm: kill drm_sman
No longer used.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:23 +01:00
Daniel Vetter
be2fb9da32 drm/sis: use drm_mm instead of drm_sman
v2: Smash compile fix from Tormod Volden <debian.tormod@gmail.com> for
CONFIG_FB_SIS on top of this.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:23 +01:00
Daniel Vetter
977b4f6edd drm/via: use drm_mm instead of drm_sman
To make the transition in a piece-wise and bisectable way possible,
I've hijacked the ->owner_list from drm_sman. While transitioning, the
list_add was done by the driver, while the list_del was still done by
the dying sman code.

Now that we are in full control of ->owner_list, do the list_del
ourselves.

v2: Better explain the list_del trickery as suggested by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:22 +01:00
Daniel Vetter
94e895321b drm/sman: kill user_hash_tab
No longer used.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:22 +01:00
Daniel Vetter
6de8a74888 drm/sis: track user->memblock mapping with idr
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:21 +01:00
Daniel Vetter
77ee8f3825 drm/via: track user->memblock mapping with idr
Massive indirection through a hashtable for a simple key->pointer
look-up actually just adds bloat.

v2: Drop the misleading comment noted by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:20 +01:00
Daniel Vetter
763240deb4 drm/sman: rip out owner tracking
In contrast to kms drivers, sis/via _always_ associated a buffer with
a drm fd. So by the time we reach lastclose, all open drm fds are gone
and with them their associated objects.

So when sis/via call drm_sman_cleanup in their lastclose funcs, that
will free 0 objects.

The owner tracking now serves no purpose at all, hence rip it ou. We
can't kill the corresponding fields in struct drm_memblock_item yet
because we hijack these in the new driver private owner tracking. But
now that drm_sman.c doesn't touch ->owner_list anymore, we need to
kill the list_move hack and properly add the item to the file_priv
list.

Also leave the list_del(&obj->owner_list) in drm_sman_free for the
moment, it will move to the drivers when sman disappears completely.

v2: Remove the redundant INIT_LIST_HEAD as noted by Chris Wilson

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:20 +01:00
Daniel Vetter
aa38e2e015 drm/sman: kill owner tracking interface functions
These are now unused.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:19 +01:00
Daniel Vetter
c828e20456 drm/via: track obj->drm_fd relations in the driver
Exactly like the previous patch for sis.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:19 +01:00
Daniel Vetter
fdc0b8a63c drm/sis: track obj->drm_fd relations in the driver
By attach a driver private struct to each open drm fd.

Because we steal the owner_list from drm_sman until things settle,
use list_move instead of list_add.

This requires to export a drm_sman function temporarily before
drm_sman will die for real completely.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2011-12-22 00:33:15 +01:00
Dave Airlie
4cf73129cb Merge remote-tracking branch 'pfdo/drm-fixes' into drm-core-next
-next reported a messy merge, so I've merged my upstream pull into
my -next tree.

Conflicts:
	drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
2011-12-21 09:50:56 +00:00
Francisco Jerez
b2e0d195d2 drm/nouveau: Fix notifier blocks over the 4GB mark.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:47 +10:00
Francisco Jerez
4e03b4af6d 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>
2011-12-21 19:01:46 +10:00
Ben Skeggs
045da4e555 drm/nvc0/pm: initial engine reclocking
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:46 +10:00
Ben Skeggs
52c4d76743 drm/nouveau: move hpd enable/disable to common code
No idea why I didn't do this initially... NVD9 HPD is now enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:46 +10:00
Ben Skeggs
47e5d5cb83 drm/nv40/disp: implement support for hotplug irq
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:45 +10:00
Ben Skeggs
a0b2563551 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>
2011-12-21 19:01:45 +10:00
Ben Skeggs
675aac033e 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>
2011-12-21 19:01:44 +10:00
Ben Skeggs
c8b9641a91 drm/nouveau/hwsq: remove some magic, give proper opcode names
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:44 +10:00
Martin Peres
eeb7a50bdd drm/nv50/pm: introduce hwsq-based memory reclocking
More work needs to be done on supporting the different memory types.

v2 (Ben Skeggs):
- fixed up conflicts from not having pausing patch first
- restructured code somewhat to fit with how all the other code works
- fixed bug where incorrect mpll_ctrl could get set sometimes
- removed stuff that's cargo-culted from the binary driver
- merged nv92+ display disable into hwsq
- fixed incorrect opcode 0x5f magic at end of ucode

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:44 +10:00
Ben Skeggs
abbd3f8e3b drm/nv04/disp: handle dual-link spwg panels without needing quirks
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:43 +10:00
Ben Skeggs
d4c2c99bdc drm/nouveau/dp: remove broken display depth function, use the improved one
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:43 +10:00
Ben Skeggs
c37e99050c drm/nouveau/mxm: implement ROM shadow method
Untested, -ENOHW.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:43 +10:00
Ben Skeggs
3952315b9d drm/nouveau/mxm: implement _DSM shadow method
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:42 +10:00
Ben Skeggs
93d9206d08 drm/nouveau/mxm: implement wmi shadow method
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:42 +10:00
Ben Skeggs
b4c26818ae 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>
2011-12-21 19:01:41 +10:00
Ben Skeggs
befb51e9c9 drm/nouveau/disp: parse connector info directly in nouveau_connector.c
Another case where we parsed vbios data to some structs, then again use
that info once to construct another set of data.  Skip the intermediate
step.

This is also slightly improved in that we can now use DCB 3.x connector
table info, which will allow NV4x to gain hotplug support, and to make
quirks for SPWG LVDS panels unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:41 +10:00
Ben Skeggs
f553b79c03 drm/nouveau/i2c: handle bit-banging ourselves
i2c-algo-bit doesn't actually work very well on one card I have access to
(NVS 300), random single-bit errors occur most of the time - what we're
doing now is closer to what xf86i2c.c does.

The original plan was to figure out why i2c-algo-bit fails on the NVS 300,
and fix it.  However, while investigating I discovered i2c-algo-bit calls
cond_resched(), which makes it a bad idea for us to be using as we execute
VBIOS scripts from a tasklet, and there may very well be i2c transfers as
a result.

So, since I already wrote this code in userspace to track down the NVS 300
bug, and it's not really much code - lets use it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:41 +10:00
Ben Skeggs
9e3b6b9907 drm/nouveau/i2c: fix debug message
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:40 +10:00
Ben Skeggs
2bdb06e3cf drm/nouveau/i2c: tidy up bit-bang helpers, also fixing nv50 setsda bug
Was using nv_mask, which is bad.  Reading the reg senses the current line
states, which aren't necessarily the states we're trying to drive the
lines to.

Fixed to store SCL driver state just as we already do for SDA.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:40 +10:00
Ben Skeggs
486a45c2a6 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>
2011-12-21 19:01:40 +10:00
Ben Skeggs
6b5a81a2e7 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>
2011-12-21 19:01:39 +10:00
Ben Skeggs
0f8067c705 drm/nouveau/bios: fold fixup_legacy_i2c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:39 +10:00
Ben Skeggs
f9f9f53631 drm/nouveau/bios: pass drm_device to ROMPTR, rather than nvbios
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:39 +10:00
Ben Skeggs
816af2f2d6 drm/nvd0/disp: use single, shared, sync bo for all evo channels
This simplifies some things, and hopefully won't come back to bite me.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:38 +10:00
Ben Skeggs
a63a97eb66 drm/nvd0/disp: rename sync channel to flip channel
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:38 +10:00
Ben Skeggs
84e052e626 drm/nvd0/disp: handle yet another interrupt
Spotted while messing with overlay channels (probably as a result of
sending a similar "disable" sequence as we do for the flip channels).

The value in 0x61008c was 0x20, which one would reasonably guess is
"bit 5 == something to report about evo channel 5" - but who knows.

Spotted the binary driver getting this too, and it appears to not do
anything exciting as a result.  So, handle it the same way and avoid
an IRQ storm.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:37 +10:00
Ben Skeggs
8a46438a6a drm/nvd0/disp: initialise overlay channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:37 +10:00
Ben Skeggs
3376ee374d drm/nvd0/disp: add support for page flipping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:37 +10:00
Ben Skeggs
4acd429398 drm/nvd0/disp: make it clearer that the cursor regs are pio evo channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:36 +10:00
Ben Skeggs
2eac77b793 drm/nvd0/disp: have evo names now, use them
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:36 +10:00
Ben Skeggs
bdb8c212be drm/nvd0/disp: init display sync channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:36 +10:00
Ben Skeggs
9285462273 drm/nvd0/disp: scaler updates, overscan compensation etc
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:35 +10:00
Ben Skeggs
2d1d898b46 drm/nvd0/disp: update crtc timing calculations for interlace/doublescan
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:35 +10:00
Ben Skeggs
f62b27db6b 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>
2011-12-21 19:01:35 +10:00
Ben Skeggs
1772fcc6f8 drm/nv50/disp: fix evo for create/init + destroy/fini split
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-12-21 19:01:34 +10:00