Commit graph

15460 commits

Author SHA1 Message Date
Ville Syrjälä 2b85886a54 drm/i915: Avoid div-by-zero when pixel_multiplier is zero
On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disable
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().

To avoid the problem simply check for zero pixel_multiplier and skip
the division. Another attempt at fixing this involved populating
pixel_multiplier to 1 even for disabled pipes, but that triggered a
WARN because SDVO_CMD_GET_CLOCK_RATE_MULT command failed and thus
encoder_pixel_multiplier was left at zero and didn't match
pipe_config->pixel_multiplier.

The "divide by pixel_multiplier" operation got introduced here:
 commit 18442d0878
 Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
 Date:   Fri Sep 13 16:00:08 2013 +0300

    drm/i915: Fix port_clock and adjusted_mode.clock readout all over

and it has caused a regression on certain machines since they would
hit the div-by-zero during resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76520
Cc: <stable@vger.kernel.org> # 3.13+
Tested-by: Tim Richardson <tim@tim-richardson.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2014-06-11 11:06:43 +03:00
Chris Wilson 0368920e51 drm/i915: Disable FBC by default also on Haswell and later
It causes black screen on bootup and is approximately 100x slower than
running with FBC disabled, so the GPU runs at a high frequency for much
longer - completely contrary to the power saving claims. It also still
has mutex deadlocks in multi-head scenarios, which can lead to a
system/X lockup. These bugs were known before FBC was enabled by default
on Haswell and still have not been fixed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79716
Reported-and-tested-by: Jon Kristensen <info@jonkri.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@vger.kernel.org
[Jani: update subject to reflect the actual change]
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2014-06-11 11:06:43 +03:00
Dave Airlie bc1dfff04a Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next
display rework fixes lots of displayport issues.

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (43 commits)
  drm/nouveau/disp/dp: fix tmds passthrough on dp connector
  drm/nouveau/dp: probe dpcd to determine connectedness
  drm/nv50-: trigger update after all connectors disabled
  drm/nv50-: prepare for attaching a SOR to multiple heads
  drm/gf119-/disp: fix debug output on update failure
  drm/nouveau/disp/dp: make use of postcursor when its available
  drm/g94-/disp/dp: take max pullup value across all lanes
  drm/nouveau/bios/dp: parse lane postcursor data
  drm/nouveau/dp: fix support for dpms
  drm/nouveau: register a drm_dp_aux channel for each dp connector
  drm/g94-/disp: add method to power-off dp lanes
  drm/nouveau/disp/dp: maintain link in response to hpd signal
  drm/g94-/disp: bash and wait for something after changing lane power regs
  drm/nouveau/disp/dp: split link config/power into two steps
  drm/nv50/disp: train PIOR-attached DP from second supervisor
  drm/nouveau/disp/dp: make use of existing output data for link training
  drm/gf119/disp: start removing direct vbios parsing from supervisor
  drm/nv50/disp: start removing direct vbios parsing from supervisor
  drm/nouveau/disp/dp: maintain receiver caps in response to hpd signal
  drm/nouveau/disp/dp: create subclass for dp outputs
  ...
2014-06-11 16:28:10 +10:00
Ben Skeggs 1ae5a62bb8 drm/nouveau/disp/dp: fix tmds passthrough on dp connector
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:47 +10:00
Ben Skeggs 8777c5c117 drm/nouveau/dp: probe dpcd to determine connectedness
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:42 +10:00
Ben Skeggs efa366fdf5 drm/nv50-: trigger update after all connectors disabled
We were sending the necessary state changes to unset the mode, but
never actually hit the big GO button unless another modeset happens
afterwards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:35 +10:00
Ben Skeggs e84a35a805 drm/nv50-: prepare for attaching a SOR to multiple heads
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:29 +10:00
Ben Skeggs e32d68c9c7 drm/gf119-/disp: fix debug output on update failure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:29 +10:00
Ben Skeggs c33ba689e5 drm/nouveau/disp/dp: make use of postcursor when its available
And at the same time, obey the spec better wrt out-of-range requests.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:28 +10:00
Ben Skeggs 3e1eb5cf7c drm/g94-/disp/dp: take max pullup value across all lanes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:19 +10:00
Ben Skeggs 7a14bc783e drm/nouveau/bios/dp: parse lane postcursor data
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:18 +10:00
Ben Skeggs 4874322e78 drm/nouveau/dp: fix support for dpms
SOR_PWR has no effect to power-off DP links, unlike other SOR protocols.

Instead, on the source side, we cut power to the lanes after having put
the sink into D3.  Link training takes care of everything required to
bring it back again.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:10 +10:00
Ben Skeggs 8894f4919b drm/nouveau: register a drm_dp_aux channel for each dp connector
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:11:04 +10:00
Ben Skeggs ebd6acbb06 drm/g94-/disp: add method to power-off dp lanes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:57 +10:00
Ben Skeggs 55f083c33f drm/nouveau/disp/dp: maintain link in response to hpd signal
This previously worked for the most part due to userspace doing a
modeset in response to HPD interrupts.  This will allow us to
properly handle cases where sync is lost for other reasons, or if
userspace isn't caring.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:56 +10:00
Ben Skeggs 13a61757db drm/g94-/disp: bash and wait for something after changing lane power regs
Some kind of update?  Needed to make the power-down take effect at least.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:47 +10:00
Ben Skeggs 1ecee1cda3 drm/nouveau/disp/dp: split link config/power into two steps
We want to be able to power down the lanes for DPMS off.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:46 +10:00
Ben Skeggs b17932c01a drm/nv50/disp: train PIOR-attached DP from second supervisor
Same place as for SOR, between detach and attach phases.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:46 +10:00
Ben Skeggs 3b52a1f906 drm/nouveau/disp/dp: make use of existing output data for link training
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:45 +10:00
Ben Skeggs 2bd651ea43 drm/gf119/disp: start removing direct vbios parsing from supervisor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:45 +10:00
Ben Skeggs 415f12efc1 drm/nv50/disp: start removing direct vbios parsing from supervisor
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:44 +10:00
Ben Skeggs bb7ef1ec2e drm/nouveau/disp/dp: maintain receiver caps in response to hpd signal
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:43 +10:00
Ben Skeggs b8407c9e50 drm/nouveau/disp/dp: create subclass for dp outputs
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:43 +10:00
Ben Skeggs 456b0579fb drm/nouveau: use connector events for HPD instead of GPIO watching
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:37 +10:00
Ben Skeggs 7a014a8729 drm/nouveau/disp: add internal representaion of output paths and connectors
This will, at some point, be used to replace various bits and pieces of
code doing direct bios parsing.  For now, it'll just be used for some
DP improvements.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:36 +10:00
Ben Skeggs 20014cbe8b drm/nouveau/bios: extend connector table parsing
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:36 +10:00
Ben Skeggs 377b1f165c drm/nouveau/disp: nothing to see here
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:35 +10:00
Ben Skeggs 37da5b87ac drm/nouveau/i2c/anx9805: add debugging to aux transactions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:35 +10:00
Ben Skeggs 9efc583ea9 drm/nouveau/i2c: introduce locking at a per-port level
There's also provisions to allow a pad to be locked with a specific
routing, for an indefinite period of time.  This will be used in
future patches.

The G94+ pad driver will now also power-down pads when not required.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:34 +10:00
Ben Skeggs d2ae2eb469 drm/nouveau/i2c: balance port acquire/release
This was a half-finished hack before, just enough to handle the shared
aux/i2c pad thing on G94 and up.

We got lucky with locking etc up until now, as this was (generally) all
protected by the DRM mode_config lock.  It's about to become a lot more
likely to hit the races.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:33 +10:00
Ben Skeggs 0ff32977ea drm/gk104/i2c: add aux channel interrupt driver
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:33 +10:00
Ben Skeggs d78fa39a2b drm/g94/i2c: add aux channel interrupt driver
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:10:25 +10:00
Ben Skeggs 3668a339d6 drm/nouveau/i2c: add interfaces to support handling aux channel interrupts
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:16 +10:00
Ben Skeggs c26fe84356 drm/nouveau/i2c: start hiding subdev-internal interfaces
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:15 +10:00
Ben Skeggs 0bac987984 drm/nouveau/i2c: remove unnecessary i2c_set_adapdata()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:15 +10:00
Ben Skeggs 842c2953fc drm/nouveau/i2c: properly hand aux reply back to caller, and only retry on defer
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:15 +10:00
Ben Skeggs febb844917 drm/nv50-/mc: also pass PMGR interrupts onto I2C subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:15 +10:00
Ben Skeggs 20a8007485 drm/nouveau/gpio: send separate event types for high/low transitions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:15 +10:00
Ben Skeggs bc3b0c41b1 drm/nouveau/gpio: use base constructor for all implementations
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:14 +10:00
Ben Skeggs f4277a0e42 drm/nouveau/gpio: move on-reset intr disable-and-ack to common code
Re-uses the implementation's accessor functions rather than requiring
and init/fini implementation for each chipset.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:14 +10:00
Ben Skeggs 5693c0f26f drm/nouveau/gpio: split "toggled" interrupt into "went high" / "went low"
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:14 +10:00
Ben Skeggs 7356859a29 drm/nouveau/gpio: split g92 class from nv50
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:14 +10:00
Ben Skeggs d93174ec39 drm/nouveau/gpio: use indirect pointer to base class definition
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:13 +10:00
Ben Skeggs 1f86ca1a2e drm/nouveau/disp/dp: support training to highest rate, rather than a target
We really want this for, at least, MST devices.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:13 +10:00
Ben Skeggs 04e7e92d53 drm/nouveau/disp/dp: support postcursor in link training
Not enabled at the backends yet, but will read status and send back max
reached at level 0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:13 +10:00
Ben Skeggs 8e8832e8a8 drm/nouveau/core: allow event source to handle multiple event types per index
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-06-11 16:09:13 +10:00
Dave Airlie b06c47a13c Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next
There's really not a great deal this time due to me spending most of this window on Maxwell.  But, here's the random bits and pieces that's currently queued.
* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (25 commits)
  drm/gk208/gr: add missing registers to grctx init
  drm/nouveau/kms/nv04-nv40: fix pageflip events via special case.
  drm/nv50-/mc: fix kms pageflip events by reordering irq handling order.
  drm/nouveau/disp/nv04-nv40: abort scanoutpos query on vga analog.
  drm/nv50-/kms: wait for enough ring space in crtc_prepare()
  drm/nouveau/disp/dp: support training pattern 3
  drm/nouveau/disp/dp: support aux read interval during link training
  drm/gk104/gpio: fix incorrect interrupt register usage
  drm/nouveau/core: punt all object state change messages to trace level
  drm/nouveau/clk: allow end-user reclocking for nv40, nvaa, and nve0 clock types
  drm/nouveau/fb: default NvMemExec to on, turning it off is used for debugging only
  drm/nouveau/bios: fix a potential NULL deref in the PROM shadowing function
  drm/nouveau/i2c: bump the i2c delay for the adt7473
  drm/nouveau/therm/fan/tach: default to 2 pulses per revolution
  drm/nvf0/device: enable video decoding engines on gk110/gk208
  drm/nvf1/device: add support for 0xf1 (gk110b)
  drm/nouveau/device: support for probing GK20A
  drm/nouveau/graph: add GK20A support
  drm/nouveau/graph: pad firmware code at load time
  drm/nouveau/graph: enable when using external fw
  ...
2014-06-10 16:39:21 +10:00
Ilia Mirkin 255b329ca7 drm/gk208/gr: add missing registers to grctx init
This fixes hangs on GK208 which happen instantaneously on trying to use a
geometry shader.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org # v3.14+
2014-06-10 16:08:09 +10:00
Mario Kleiner af4870e406 drm/nouveau/kms/nv04-nv40: fix pageflip events via special case.
Cards with nv04 display engine can't reliably use vblank
counts and timestamps computed via drm_handle_vblank(), as
the function gets invoked after sending the pageflip events.

Fix this by defaulting to the old crtcid = -1 fallback path
on <= NV-50 cards, and only using the precise path on NV-50
and later.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: <stable@vger.kernel.org> # 3.13+
2014-06-10 16:08:09 +10:00
Mario Kleiner dcfb1009df drm/nv50-/mc: fix kms pageflip events by reordering irq handling order.
Whenever a single nouveau_mc_intr() main gpu irq-handler invocation was
responsible for calling both, the vblank-irq handler (display engine irq)
and kms-pageflip completion handler (from fifo irq), the order of
invocation was wrong. nouveau_finish_flip() was called before
drm_handle_vblank() for the vblank of pageflip completion, so the
emitted pageflip event contained stale vblank count and timestamp
from previous vblank. This caused failure in userspace to timestamp
properly.

Reorder order of invocation of engine irq handlers: Put
NVDEV_ENGINE_DISP always on top, and thereby before NVDEV_ENGINE_FIFO,
so that drm_handle_vblank() gets called to update vblank timestamps
and count before potential pageflip events make use of that
information.

This works on nv-50 and later, where kms-pageflip completion triggers
an irq either after a separate vblank irq, or both pageflip and vblank
trigger one common irq invocation, but never before vblank irqs.

v2 (Ben):
- removed mods for nv04-nv40, it doesn't help there anyway
- this is considered a hack, and a better solution should be found

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: <stable@vger.kernel.org> # 3.13+
2014-06-10 16:08:08 +10:00