Commit graph

169502 commits

Author SHA1 Message Date
Francisco Jerez e5ec882cfc drm/nv04-nv40: Fix up the programmed horizontal sync pulse delay.
The calculated values were a little bit off (~16 clocks), the only
effect it could have had is a slightly offset image with respect to
the blob on analog outputs (bug 26790).

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:07:21 +10:00
Ben Skeggs 53c44c3a06 drm/nouveau: Gigabyte NX85T connector table lies, it has DVI-I not HDMI
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:07:14 +10:00
Ben Skeggs da647d5bf3 drm/nouveau: add option to allow override of dcb connector table types
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:07:07 +10:00
Marcin Kościelnicki 304424e17d 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>
2010-03-10 16:07:02 +10:00
Marcin Kościelnicki 3bf777bf0a drm/nv50: Make ctxprog wait until interrupt handler is done.
This will fix races between generated ctxprogs and interrupt handler.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:06:57 +10:00
Marcin Kościelnicki c82b88d578 drm/nouveau: Fix fbcon corruption with font width not divisible by 8
NV50 is nice and has a switch that autoaligns stuff for us. Pre-NV50,
we need to align input bitmap width manually.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:06:44 +10:00
Marcin Kościelnicki 37000d2757 drm/nv50: Remove redundant/incorrect ctxvals initialisation.
11c/004 offset corresponds to PGRAPH reg 0x400828, and is initialised
earlier anyway by both our ctxprog generator and blob ctxvals. It's
actually incorrect with the generator, since we use different layout
on pre-NVA0.

Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-03-10 16:06:40 +10:00
Matt Turner 3bfc7d22d0 drm/nouveau: use ALIGN instead of open coding it
CC: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:46 +10:00
Ben Skeggs b30083bdb9 drm/nouveau: report unknown connector state if lid closed
This is in preference to disconnected.  If there's no other outputs
connected this will cause LVDS to be programmed even with the lid
closed rather than having X fail to start because of no available
outputs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:44 +10:00
Ben Skeggs c52e53fd38 drm/nouveau: support version 0x20 displayport tables
Not entirely identical to 0x21, the per-encoder table header lacks the
third init table pointer.  However, our current parsing of the table
should work just fine.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:42 +10:00
Marcin Kościelnicki 81e2d42200 drm/nouveau: Fix noaccel/nofbaccel option descriptions.
Signed-off-by: Marcin Kościelnicki <koriakin@0x04.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:40 +10:00
Marcin Kościelnicki d5f3c90d4f 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>
2010-02-25 15:09:38 +10:00
Ben Skeggs be079e97b5 drm/nouveau: use dcb connector types throughout the driver
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:36 +10:00
Ben Skeggs 1157563931 drm/nv50: enable hpd on any connector we know the gpio line for
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:34 +10:00
Ben Skeggs 7f612d87f8 drm/nouveau: use dcb connector table for creating drm connectors
This makes this code common to both the nv04 and nv50 paths.

For the moment, we keep the previous behaviour with HDMI/eDP connectors
and report them as DVI-D/DP instead.  This will be fixed once the rest
of the code has been fixed to deal with those types.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:32 +10:00
Ben Skeggs dc5bc4ed38 drm/nouveau: construct a connector table for cards that lack a real one
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:30 +10:00
Ben Skeggs f66fa771d5 drm/nouveau: check for known dcb connector types
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:28 +10:00
Ben Skeggs 54abb5ddae drm/nouveau: parse dcb gpio/connector tables after encoders
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:26 +10:00
Ben Skeggs e7cc51c565 drm/nouveau: reorganise bios header, add dcb connector type enums
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:23 +10:00
Ben Skeggs 04a39c577f drm/nouveau: merge nvbios and nouveau_bios_info
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:21 +10:00
Ben Skeggs 7f245b20e3 drm/nouveau: merge parsed_dcb and bios_parsed_dcb into dcb_table
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:19 +10:00
Ben Skeggs a6678b2ace drm/nouveau: rename parsed_dcb_gpio to dcb_gpio_table
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:17 +10:00
Ben Skeggs b42861f40f drm/nouveau: allow retrieval of vbios image from debugfs
It's very useful to be able to access this without additional tools for
debugging purposes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:15 +10:00
Luca Barbieri e32b2c883b drm/nouveau: fix missing spin_unlock in failure path
Found by sparse.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:09:13 +10:00
Marcin Slusarz 761c5a6975 drm/nouveau: fix i2ctable bounds checking
i2c_entries seems to be the number of i2c entries,
so with index equal to this number, we could read
invalid data from i2ctable. Fix it.

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>
2010-02-25 15:09:11 +10:00
Marcin Slusarz b762b8ce53 drm/nouveau: fix nouveau_i2c_find bounds checking
Reported-by: Dan Carpenter <error27@gmail.com>
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>
2010-02-25 15:09:09 +10:00
Marcin Slusarz df31ef4dbd drm/nouveau: fix pramdac_table range checking
get_tmds_index_reg reads some value from stack when mlv happens
to be equal to size of pramdac_table array. Fix it.

Reported-by: Dan Carpenter <error27@gmail.com>
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>
2010-02-25 15:09:07 +10:00
Ben Skeggs a1606a9596 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>
2010-02-25 15:08:44 +10:00
Ben Skeggs d87897d4c8 drm/nv50: make pushbuf dma object cover entire vm
This allows us to submit push buffers from any memtype to the hardware.
We'll need this ability for VRAM index buffers at some point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:08:33 +10:00
Ben Skeggs 2ccb04ecc7 drm/nouveau: remove PUSHBUF_CAL macro
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-25 15:08:31 +10:00
Ben Skeggs 9a391ad8a2 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>
2010-02-25 15:08:29 +10:00
Maarten Maathuis ff9e5279b1 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>
2010-02-25 15:07:53 +10:00
Ben Skeggs 6c42966768 drm/nv50: fix vram ptes on IGPs to point at stolen system memory
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-23 13:50:24 +10:00
Ben Skeggs 76befb8c30 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>
2010-02-23 13:50:21 +10:00
Ben Skeggs 531e77139f drm/nv50: improve vram page table construction
This commit changes nouveau to construct PTEs which look very much like
the ones the binary driver creates.

I presume that filling multiple PTEs identically with length flags and
the physical address of the start of a block of VRAM is a hint to the
memory controller that it need not perform additional page table lookups
for that range of addresses.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-23 13:50:03 +10:00
Ben Skeggs 4c27bd339d drm/nv50: more efficient clearing of gpu page table entries
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-23 13:49:58 +10:00
Ben Skeggs 66b6ebaccb drm/nv50: make nv50_mem_vm_{bind,unbind} operate only on vram
GART is handled elsewhere, no reason to have the code for it here too.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-23 13:41:16 +10:00
Francisco Jerez e7e65caefd drm/nouveau: Fix up pre-nv17 analog load detection.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-23 13:41:05 +10:00
Francisco Jerez bf929efa56 drm/nouveau: Force TV encoder DPMS reinit after resume.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-16 11:15:07 +10:00
Ben Skeggs d9184fa97b drm/nouveau: use mutex for vbios lock
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-16 11:14:33 +10:00
Matthew Garrett 13876c6e5f nouveau: fix state detection with switchable graphics
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-11 09:52:02 +10:00
Marcin Slusarz dd19e44b28 drm/nouveau: move dereferences after null checks
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-11 09:52:00 +10:00
Maarten Maathuis b1d37aa0aa drm/nv50: make the pgraph irq handler loop like the pre-nv50 version
Unset the bit that indicates that a ctxprog can continue at the end.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-10 08:19:39 +10:00
Maarten Maathuis a87ff62a80 drm/nv50: delete ramfc object after disabling fifo, not before
ramfc is zero'ed upon destruction, so it's safer to do things in the right
order.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-10 08:19:38 +10:00
Maarten Maathuis a51a3bf50d drm/nv50: avoid unloading pgraph context when ctxprog is running
- We need to disable pgraph fifo access before checking the current channel,
  otherwise we could still hit a running ctxprog.
- The writes to 0x400500 are already handled by pgraph->fifo_access and are
  therefore redundant, moreover pgraph fifo access should not be reenabled
  before current context is set as invalid. So remove them altogether.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-10 08:19:36 +10:00
Maarten Maathuis eb1dba0eba drm/nv50: align size of buffer object to the right boundaries.
- In the current situation the padding that is added is dangerous to write
  to, userspace could potentially overwrite parts of another bo.
- Depth and stencil buffers are supposed to be large enough in general so
  the waste of memory should be acceptable.
- Alternatives are hiding the padding from users or splitting vram into 2
  zones.

Signed-off-by: Maarten Maathuis <madman2003@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-10 08:19:34 +10:00
Ben Skeggs 5025b43120 drm/nv50: disregard dac outputs in nv50_sor_dpms()
Fixes DVI+VGA on my 9400, and likely a lot of other configurations that
got broken by the previos DVI-over-DP fix.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-10 08:19:33 +10:00
Ben Skeggs 39c9bfb453 drm/nv50: prevent multiple init tables being parsed at the same time
With DVI and DP plugged, the DVI clock change interrupts being run can
cause DP link training to fail.  This adds a spinlock around init table
parsing to prevent this.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-10 08:19:18 +10:00
Ben Skeggs 1ee7698fc3 drm/nouveau: make dp auxch xfer len check for reads only
Writes don't return a count, and adding the check broke native DP.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-09 12:50:43 +10:00
Ben Skeggs e235c1f3e1 drm/nv40: make INIT_COMPUTE_MEM a NOP, just like nv50
It appears we aren't required to do memory sizing ourselves on nv40
either.  NV40 init tables read a strap from PEXTDEV_BOOT_0 into a
CRTC register, and then later use that value to select a memory
configuration (written to PFB_CFG0, just like INIT_COMPUTE_MEM on
earlier cards) with INIT_IO_RESTRICT_PROG.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2010-02-09 12:50:35 +10:00