Commit graph

13751 commits

Author SHA1 Message Date
Ilia Mirkin ea7dce9010 drm/nv50/gr: print mpc trap name when it's not an mp trap
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-01-23 13:39:17 +10:00
Ilia Mirkin f750ecc950 drm/nv50/gr: update list of mp errors, make it a bitfield
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-01-23 13:39:17 +10:00
Ilia Mirkin e2dd003dfa drm/nv50/gr: add more trap names to print on error
Also avoids printing the errors bitfield if that information has already
been shown.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
2014-01-23 13:39:16 +10:00
Ilia Mirkin f87cd8b695 drm/nouveau/devinit: lock/unlock crtc regs for all devices, not just pre-nv50
Also make nv_lockvgac work for nv50+ devices. This should fix
IO_CONDITION and related VBIOS opcodes that read/write the crtc regs.

See https://bugs.freedesktop.org/show_bug.cgi?id=60680

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:15 +10:00
Maarten Lankhorst d5c1e84b3a drm/nouveau: hold mutex while syncing to kernel channel
Not holding the mutex potentially causes corruption of the kernel
channel when page flipping.

Cc: stable@vger.kernel.org #3.13
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:14 +10:00
Ilia Mirkin 4019aaa2b3 drm/nv50-/devinit: prevent use of engines marked as disabled by hw/vbios
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:13 +10:00
Ilia Mirkin f0d13e3a85 drm/nouveau/device: provide a way for devinit to mark engines as disabled
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:13 +10:00
Ben Skeggs cf336014c6 drm/nouveau/devinit: tidy up the subdev class definition
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:12 +10:00
Ben Skeggs 52225551dd drm/nouveau/bar: tidy up the subdev and object class definitions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:11 +10:00
Ben Skeggs ab606194d1 drm/nouveau/instmem: tidy up the object class definition
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:10 +10:00
Ben Skeggs 24a4ae86de drm/nouveau/instmem: tidy up the subdev class definition
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:09 +10:00
Ben Skeggs 64c672ae1d drm/nouveau/pwr: implement a simple i2c stack
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:09 +10:00
Ben Skeggs 2e9dfe234a drm/nouveau/pwr: have rd/wr32 routines clobber data instead of addr
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:08 +10:00
Ben Skeggs 73216231ca drm/nve0/fb: turn off some bits in 10f584 at init
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:07 +10:00
Ben Skeggs cb54dd2f8e drm/nve0/fb/gddr5: merge a fix from ddr3 for one of the timing settings
Titan.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:06 +10:00
Ben Skeggs b13d0e4a93 drm/nve0/fb/gddr5: yet another random 10f200 bit
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:05 +10:00
Ben Skeggs c814a60dbe drm/nvc0-/fb: hook up skeleton interrupt handler
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:04 +10:00
Ben Skeggs 7f39e59772 drm/nve0/fb/gddr5: more 10f200 stuff
Seen on Titan.  NFI what the condition to switch this on is yet, and,
hardcoding it to on currently causes master to report unknown intr
with a mask of 0x08002000.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:04 +10:00
Ben Skeggs 12642e36e0 drm/nve0/clk: report ddr memory frequency
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:03 +10:00
Ben Skeggs 1a894c069d drm/nouveau/fb/gddr5: make sure we update mr7 when we're supposed to
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:02 +10:00
Ben Skeggs a8ccbb7701 drm/nve0/fb/gddr5: 10f698/69c
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:01 +10:00
Ben Skeggs cfe1760838 drm/nve0/fb: it's now safe to obey the memory voltage setting properly
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:00 +10:00
Ben Skeggs 46bf1c389f drm/nve0/fb: multi-stage reclock is required for certain transitions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:39:00 +10:00
Ben Skeggs 1789cab4ef drm/nouveau/clk: allow fb to signal it needs to do a multi-stage reclock
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:59 +10:00
Ben Skeggs b655f2bb77 drm/nve0/fb/gddr5: parse bios data into struct rather than using directly
Still essentially a struct of magic values with magic names and unknown
purposes.  But, we will shortly need to be able to mix and match bits of
the previous and next configurations to do a transition reclock, as such,
we can no longer directly use the vbios data with any ease.

This is probably nicer anyway in the long run, for a few reasons.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:58 +10:00
Ben Skeggs ea8b4a380d drm/nve0/fb/gddr5: found LP3 setting
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:57 +10:00
Ben Skeggs 971372eac1 drm/nve0/fb: note the memory voltage toggle, not using it yet
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:56 +10:00
Ben Skeggs db6735cab2 drm/nve0/fb/gddr5: somewhat better attempt at 100770/10f604/610/614
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

fb/gddr5/nve0: 100770 is like 10f604

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:56 +10:00
Ben Skeggs f4aa2c6677 drm/nve0/fb/gddr5: fixup delays a bit
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:55 +10:00
Ben Skeggs 1522ecae65 drm/nouveau/bios: timing 2.0 entries can have subentries
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:54 +10:00
Ben Skeggs 09692e5b4e drm/nve0/fb/gddr5: note another semi-unknown
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:53 +10:00
Ben Skeggs 1e1d6b4c53 drm/nouveau/fb/gddr5: modify mr8 with high bits of CL/WR
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:52 +10:00
Ben Skeggs e7084c669b drm/nve0/fb/gddr5: fix calculation of RDQS setting
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:52 +10:00
Ben Skeggs 334565abfe drm/nve0/fb/gddr5: switch off some other random bit at some point
As seen when comparing us vs nv on my GTX660

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:51 +10:00
Ben Skeggs 01891690e8 drm/nve0/fb/gddr5: punt all 10f910/914 accesses through ram_train
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:50 +10:00
Ben Skeggs d394fb12ec drm/nve0/fb/gddr5: not all memory partitions are created equal
As seen when comparing us vs nv on my GTX660.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:49 +10:00
Ben Skeggs dd95c8f782 drm/nve0/fb: typo in register name
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:48 +10:00
Ben Skeggs 0a0dc8f564 drm/nouveau/bios: make common code to handle ramcfg strap etc
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:48 +10:00
Ben Skeggs 5905439224 drm/nve0/fb/gddr5: fix an assumption of sane memory controller layout
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:47 +10:00
Ben Skeggs 2daaf5b0e4 drm/nve0/fb/gddr5: fix behaviour of lp3 setting
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:46 +10:00
Ben Skeggs cb1567c286 drm/nve0/fifo: recover from mmu faults on bar1/bar3
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:45 +10:00
Ben Skeggs 649ec925ae drm/nve0/fifo: keep mmu fault interrupts enabled at all times
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:44 +10:00
Ben Skeggs e1b6b14ad5 drm/nve0/fifo: update human-readable mmu fault descriptions
Ordering from Android GK20A driver, names from binary driver strings.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:44 +10:00
Ben Skeggs e9fb9805ad drm/nve0/fifo: document more intr status bits
As per Android GK20A driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:43 +10:00
Ben Skeggs 9f8459cf06 drm/nve0/fifo: populate PBDMA status bitfield with more definitions
As per Android GK20A driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:42 +10:00
Ben Skeggs 39b055427e drm/nve0/fifo: s/subfifo/PBDMA/
As per Android GK20A driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:41 +10:00
Ben Skeggs f82c44a78f drm/nve0/fifo: s/playlist/runlist/
As per Android GK20A driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:40 +10:00
Ben Skeggs f76dd80f76 drm/nvf0/gr: enable acceleration with our chsw ucode
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:40 +10:00
Ben Skeggs aa97cd31b6 drm/nv108/gr: enable acceleration with our chsw ucode
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:39 +10:00
Ben Skeggs 5d91e1916d drm/nvc0-/gr: handle fwmthd interrupts in ucode
Compute code in mesa triggers one of these, hanging the engine.  Let's
at least ack the request for now to avoid the hang.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:38 +10:00
Ben Skeggs e1b22bc148 drm/nvc0-/gr: fiddle some magic around strand init
Fixes HUB_INIT timeout on GK110/GK208 when not using NVIDIA's ucode.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:37 +10:00
Ben Skeggs 96616b4caf drm/nv108/gr: initial support (need external fuc)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:36 +10:00
Ben Skeggs daa9ab5821 drm/nv108/ce: enable copy engines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:35 +10:00
Ben Skeggs a763951a86 drm/nv108/fifo: initial support
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:35 +10:00
Ben Skeggs a0f95f11a3 drm/nvf0/gr: remove a copy+pasto in ctx reglist
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:34 +10:00
Ben Skeggs 67af60f0aa drm/nvc0-/gr: bring in some macros to abstract falcon isa differences
Need. A. Compiler...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:33 +10:00
Ilia Mirkin 90d6db1635 drm/nouveau/falcon: use vmalloc to create firwmare copies
Some firmware images may be large (64K), so using kmalloc memory is
inappropriate for them. Use vmalloc instead, to avoid high-order
allocation failures.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: stable@vger.kernel.org
2014-01-23 13:38:32 +10:00
Ben Skeggs d96bf437b6 drm/nouveau/gem: remove (now) unneeded pre-validate fence sync
Now that nouveau_bo.c can handle sync when it actually needs to, we can
remove this and avoid a double semaphore acquire when syncing in the
command submission path.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:31 +10:00
Ben Skeggs cef9e99e1e drm/nouveau/ttm: explicitly wait for bo idle before memcpy buffer move
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:30 +10:00
Ben Skeggs 35b8141b82 drm/nouveau/ttm: explicity sync with kernel channel before moving buffer
The GEM code handles this currently, but that'll be removed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:30 +10:00
Ben Skeggs 3c57d85d7d drm/nouveau/ttm: tidy up creation of temporary buffer move vmas
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:29 +10:00
Ilia Mirkin ab9b18a6a1 drm/nv04/plane: add support for nv04/nv05 video overlay
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:28 +10:00
Ilia Mirkin 7ffb078172 drm/nv10/plane: add YUYV support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:27 +10:00
Maarten Lankhorst a554090664 drm/nv50-: map TTM_PL_SYSTEM through a BAR for CPU access
Moves bo's to TTM_PL_TT for BAR mapping, to hide tiling from user.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:26 +10:00
Maarten Lankhorst ce8f7699f2 drm/nouveau: fix m2mf copy to tiled gart
Commit de7b7d59d5 introduced tiled GART, but a linear copy is
still performed. This may result in errors on eviction, fix it by
checking tiling from memtype.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: stable@vger.kernel.org #3.10+
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:25 +10:00
Ben Skeggs 2e2cfbe61b drm/nouveau/vm: reduce number of entry-points to vm_map()
Pretty much everywhere had to make the decision which to use, so it
makes a lot more sense to just have one entrypoint decide the path
to take instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-23 13:38:25 +10:00
Takashi Iwai 2510538fa0 drm/cirrus: correct register values for 16bpp
When the mode is set with 16bpp on QEMU, the output gets totally broken.
The culprit is the bogus register values set for 16bpp, which was likely
copied from from a wrong place.

Addresses https://bugzilla.novell.com/show_bug.cgi?id=799216

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: David Airlie <airlied@linux.ie>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-23 11:01:40 +10:00
Jeff Mahoney d0ce7b8567 drm/nouveau: make vga_switcheroo code depend on VGA_SWITCHEROO
Commit 8116188fde ("nouveau/acpi: hook up to the MXM method for mux
switching.") broke the build on non-x86 architectures due to the new
dependency on MXM and MXM being an x86 platform driver.

It built previously since the vga switcheroo registration routines were
zereod out on !X86.  The code was built in but unused.

This patch makes all of the DSM code depend on CONFIG_VGA_SWITCHEROO,
allowing it to build on non-x86 and shrinking the module size as well.

[rdunlap@infradead.org: fix build eror when VGA_SWITCHEROO is not enabled]
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-23 11:01:40 +10:00
Dave Airlie 918be888d6 drm/mgag200: on cards with < 2MB VRAM default to 16-bit
This aligns with what the userspace -mga driver does in
the same situation.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-23 11:01:35 +10:00
Kenneth Graunke 4318101121 drm/i915: Allow reading the TIMESTAMP register on Gen8.
Nothing's changed here; we just need to bump the generation check.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:48:09 +01:00
Chris Wilson 74e21ac2cc drm/i915: Repeat evictions whilst pageflip completions are outstanding
Since an old pageflip will keep its scanout buffer object pinned until
it has executed its unpin task on the common workqueue, we can clog up
our GGTT with stale pinned objects. As we cannot flush those workqueues
without dropping our locks, we have to resort to falling back to
userspace and telling them to repeat the operation in order to have a
chance to run our workqueues and free up the required memory. If we
fail, then we are forced to report ENOSPC back to userspace causing the
operation to fail and best-case scenario is that it introduces temporary
corruption.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jon Bloomfield <jon.bloomfield@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:41 +01:00
Chris Wilson 5dce5b9387 drm/i915: Wait for completion of pending flips when starved of fences
On older generations (gen2, gen3) the GPU requires fences for many
operations, such as blits. The display hardware also requires fences for
scanouts and this leads to a situation where an arbitrary number of
fences may be pinned by old scanouts following a pageflip but before we
have executed the unpin workqueue. This is unpredictable by userspace
and leads to random EDEADLK when submitting an otherwise benign
execbuffer. However, we can detect when we have an outstanding flip and
so cause userspace to wait upon their completion before finally
declaring that the system is starved of fences. This is really no worse
than forcing the GPU to stall waiting for older execbuffer to retire and
release their fences before we can reallocate them for the next
execbuffer.

v2: move the test for a pending fb unpin to a common routine for
later reuse during eviction

Reported-and-tested-by: dimon@gmx.net
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73696
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jon Bloomfield <jon.bloomfield@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:40 +01:00
Imre Deak 2e82a72031 drm/i915: don't disable DP port after a failed link training
Atm after a failed link training we disable the DP port. This can happen
during a modeset-enable or a DP link re-establishment. The latter can be
a problem and we shouldn't disable the DP port, see the previous patch for
the reasoning. In the former case the right thing would be to disable
the DP port, but also the rest of the pipe.

As a stop-gap solution leave the DP port enabled in both cases. It is an
improvement on its own (avoiding HW lock ups) and the proper solution
for the first case requires a bigger change, so let's keep that on the
TODO list.

v2:
- fix explanation of change impact (Chris)

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:39 +01:00
Imre Deak 5d6a1116c6 drm/i915: don't disable the DP port if the link is lost
Currently if the DP link is lost (either because of a hot unplug, or
failed link status check) we disable the DP port, but leave the rest
of the pipe running. This is incompatible with the modeset disabling
sequence of some platforms/configurations. At least this is the case for
DP ports on the CPU as opposed to PCH.

Atm we'll also get a warning when we do a modeset disable after the
above link lost event, since we expect the DP port to be enabled at this
point (see the bugzilla ticket for the related dmesg).

Note that with this patch we'll still end up disabling the port, thanks
to the HPD uevent and subsequent modeset disable.

See also the next patch fixing the other half of this issue.

Solution suggested by Ville.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70570
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:39 +01:00
Ville Syrjälä dc5a43636c drm/i915: Eliminate lots of WARNs when there's no backlight present
My 855gm doesn't register the intel backlight but it still ends up
calling the backlight code to enable/disable the backlight via the
LVDS code. This leads to some WARNs due to backlight.max being 0.

Let's have intel_panel_enable_backlight() and intel_panel_disable_backlight()
check whether there's a backlight present or not.

Also move the backlight.present check from asle_set_backlight() into
intel_panel_set_backlight() for some extra symmetry.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:38 +01:00
Imre Deak bfbdb420f5 drm/i915: g4x/vlv: fix dp aux interrupt mask
Fix typo possibly leading to timed out DP aux transactions on ports C,D.

Introduced in:

Commmit 4aeebd7443
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Oct 31 09:53:36 2013 +0100

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72210
Signed off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:37 +01:00
Ben Widawsky 1d62beeaeb drm/i915/ppgtt: Defer request freeing on reset
We need to defer the free request until the object/vma is capable of
being freed - or else we have a problem  when we try to destroy the
context.

The exact same issue is described and fixed here:
commit e20780439b
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Fri Dec 6 14:11:22 2013 -0800

    drm/i915: Defer request freeing

I had this fix previously, but decided not to keep it for some reason I
can no longer remember.

gem_reset_stats is a really good test at hitting the problem.

For the inquisitive:
[  170.516392] ------------[ cut here ]------------
[  170.517227] WARNING: CPU: 1 PID: 105 at drivers/gpu/drm/drm_mm.c:578 drm_mm_takedown+0x2e/0x30 [drm]()
[  170.518064] Memory manager not clean during takedown.
[  170.518941] CPU: 1 PID: 105 Comm: kworker/1:1 Not tainted 3.13.0-rc4-BEN+ #28
[  170.519787] Hardware name: Hewlett-Packard HP EliteBook 8470p/179B, BIOS 68ICF Ver. F.02 04/27/2012
[  170.520662] Call Trace:
[  170.521517]  [<ffffffff814f0589>] dump_stack+0x4e/0x7a
[  170.522373]  [<ffffffff81049e6d>] warn_slowpath_common+0x7d/0xa0
[  170.523227]  [<ffffffff81049edc>] warn_slowpath_fmt+0x4c/0x50
[  170.524079]  [<ffffffffa06c414e>] drm_mm_takedown+0x2e/0x30 [drm]
[  170.524934]  [<ffffffffa07213f3>] gen6_ppgtt_cleanup+0x23/0x110
[i915]
[  170.525777]  [<ffffffffa07837ed>] ppgtt_release.part.5+0x24/0x29
[i915]
[  170.526603]  [<ffffffffa071aaa5>] i915_gem_context_free+0x195/0x1a0
[i915]
[  170.527423]  [<ffffffffa071189d>] i915_gem_free_request+0x9d/0xb0
[i915]
[  170.528247]  [<ffffffffa0718af9>] i915_gem_reset+0x1f9/0x3f0 [i915]
[  170.529065]  [<ffffffffa0700cce>] i915_reset+0x4e/0x180 [i915]
[  170.529870]  [<ffffffffa070829d>] i915_error_work_func+0xcd/0x120
[i915]
[  170.530666]  [<ffffffff8106c13a>] process_one_work+0x1fa/0x6d0
[  170.531453]  [<ffffffff8106c0d8>] ? process_one_work+0x198/0x6d0
[  170.532230]  [<ffffffff8106c72b>] worker_thread+0x11b/0x3a0
[  170.532996]  [<ffffffff8106c610>] ? process_one_work+0x6d0/0x6d0
[  170.533771]  [<ffffffff810743ef>] kthread+0xff/0x120
[  170.534548]  [<ffffffff810742f0>] ? insert_kthread_work+0x80/0x80
[  170.535322]  [<ffffffff814f97ac>] ret_from_fork+0x7c/0xb0
[  170.536089]  [<ffffffff810742f0>] ? insert_kthread_work+0x80/0x80
[  170.536847] ---[ end trace 3d4c12892e42d58f ]---

v2: Whitespace fix. (Chris)

Note: This is a bug that only hits the ppgtt topic branch but I've
figured that doing the request cleanup in this order is generally the
right thing to do.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
[danvet: Add a code comment to clarify what's actually going on since
the lifetime rules aroung ppgtt cleanup are ... fuzzy a best atm. Also
add a note about why we need this.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:37 +01:00
Kristen Carlson Accardi 1fb2362b43 i915: send D1 opregion notification
The opregion notification for runtime suspend is currently D1, not D3.

Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:36 +01:00
Jesse Barnes babb190351 drm/i915/bdw: remove preliminary_hw_support flag from BDW
It ought to work ok in 3.14.  We have some fun stuff coming after that,
but all the basics are in place now and seem relatively stable.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:35 +01:00
Daniel Vetter 8664850087 drm/i915: Tune down reset_stat output from ERROR to debug
This is user-triggerable and hence we should not allow it to spam
dmesg. Also, it upsets the nice dmesg tracking piglit does.

Note that this is just extra debugging information, mostly
unwanted, in case of a hang and that there is a separate message to the
user giving instructions on how to report a bug for a GPU hang.

v2: Add note as suggests in Chris' reply.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72740
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 10:34:35 +01:00
Ben Widawsky fae0ce15c2 drm/i915: Make semaphore modparam RO
A couple patches in the upcoming rework of semaphores will break if
semaphores are toggled by the user at various times. Since the code
cleanups there seem to be an overall win, and toggling semaphores at
runtime is not a terribly useful thing to do, simply make the module
parameter read-only.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 09:58:26 +01:00
Ben Widawsky f0a9f74c0d drm/i915: Fix disabled semaphores
The ring will emit too many if semaphores are disabled since we do not
add the correct number to num_dwords anymore.

This was introduced:
commit 52ed23253b
Author: Ben Widawsky <benjamin.widawsky@intel.com>
Date:   Mon Dec 16 20:50:38 2013 -0800

    drm/i915: Don't emit mbox updates without semaphores

FWIW, the bug was fixed later in the series.

/me hangs head in shame.

Daniel: Also note that we should have merged the read-only semaphore
modparam before this patch.

Reported-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 09:58:26 +01:00
Ben Widawsky 8b78f0e588 drm/i915: Clarify relocation errnos
While trying to find a random -EINVAL from a failing test, I noticed we
had a few hard to follow return values.

The first two hunks in this patch replace completely useless
initialization of ret. The last several hunks help to distinguish
between altering 'return ret' and 'return <ERROR>'

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-22 09:58:25 +01:00
Dave Airlie f5395ba35f Merge branch 'drm-vbl-timestamp' of git://gitorious.org/vsyrjala/linux into drm-next
Here's the vblank timestamp pull request you wanted.

I addressed the few bugs that Mario pointed out and added
the r-bs.

As it has been a while since I made the changes, I gave it a
quick spin on a few different i915 machines. Fortunately
everything still seems to be fine.

* 'drm-vbl-timestamp' of git://gitorious.org/vsyrjala/linux:
  drm/i915: Add a kludge for DSL incrementing too late and ISR not working
  drm/radeon: Move the early vblank IRQ fixup to radeon_get_crtc_scanoutpos()
  drm: Pass 'flags' from the caller to .get_scanout_position()
  drm: Fix vblank timestamping constants for interlaced modes
  drm/i915: Fix scanoutpos calculations for interlaced modes
  drm: Change {pixel,line,frame}dur_ns from s64 to int
  drm: Use crtc_clock in drm_calc_timestamping_constants()
  drm/radeon: Populate crtc_clock in radeon_atom_get_tv_timings()
  drm: Simplify the math in drm_calc_timestamping_constants()
  drm: Improve drm_calc_timestamping_constants() documentation
  drm/i915: Call drm_calc_timestamping_constants() earlier
  drm/i915: Kill hwmode save/restore
  drm: Pass the display mode to drm_calc_vbltimestamp_from_scanoutpos()
  drm: Pass the display mode to drm_calc_timestamping_constants()
2014-01-22 09:13:13 +10:00
Dave Airlie 2b76a676f7 Merge branch 'topic/core-stuff' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
Some straggling drm core patches

* 'topic/core-stuff' of git://people.freedesktop.org/~danvet/drm-intel:
  drm/gem: Always initialize the gem object in object_init
  drm/edid: Populate picture aspect ratio for CEA modes
  drm/edid: parse the list of additional 3D modes
  drm/edid: split VIC display mode lookup into a separate function
  drm: Make the connector mode_valid() vfunc return a drm_mode_status enum
2014-01-22 09:11:39 +10:00
Dave Airlie aec476a676 Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next
Just a single fix for sparse/smatch warnings introduced by the previous
vmwgfx-next pull.

* 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Fix recently introduced sparse / smatch warnings and errors
2014-01-22 09:11:09 +10:00
Thomas Hellstrom 3e894a6259 drm/vmwgfx: Fix recently introduced sparse / smatch warnings and errors
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrant <jakob@vmware.com>
2014-01-21 13:22:18 +01:00
Daniel Vetter 6ab11a2635 drm/gem: Always initialize the gem object in object_init
At least drm/i915 expects that the obj->dev pointer is set even in
failure paths. Specifically when the shmem initialization fails we
call i915_gem_object_free which needs to deref obj->base.dev to get at
the slab pointer in the device private structure. And the shmem
allocation can easily fail when userspace is hitting open file limits.

Doing the structure init even when the shmem file allocation fails
prevents this Oops.

This is a regression from

commit 89c8233f82
Author: David Herrmann <dh.herrmann@gmail.com>
Date:   Thu Jul 11 11:56:32 2013 +0200

    drm/gem: simplify object initialization

v2: Add regression note which Chris supplied.

Testcase: igt/gem_fd_exhaustion
Reported-and-Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
References: http://lists.freedesktop.org/archives/intel-gfx/2014-January/038433.html
Cc: stable@vger.kernel.org
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-21 10:19:58 +01:00
Alex Deucher 5d029339bb drm/radeon: add UVD support for OLAND
It seems this got dropped when we merged UVD support
last year.  Add this back now.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2014-01-20 18:20:58 -05:00
Alex Deucher 407b6dfd9a drm/radeon: fix minor typos in si_dpm.c
Copy/paste typos from the ni code. Should not
have any functional change.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 18:20:57 -05:00
Alex Deucher d45b964a22 drm/radeon: set the full cache bit for fences on r7xx+
Needed to properly flush the read caches for fences.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2014-01-20 18:20:56 -05:00
Alex Deucher 10e9ffae46 drm/radeon: fix surface sync in fence on cayman (v2)
We need to set the engine bit to select the ME and
also set the full cache bit.  Should help stability
on TN and cayman.

V2: fix up surface sync in ib execute as well

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2014-01-20 18:20:56 -05:00
Alex Deucher 8097d94116 drm/radeon/dpm: disable mclk switching on desktop RV770
Mclk switching doesn't seem to work reliably on these
cards.  Most RV770 boards specify the same mclk for all
performance levels anyway so in most cases, this has
no affect.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=73067

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2014-01-20 18:20:55 -05:00
Alex Deucher d526fbdd0f drm/radeon: fix endian handling in radeon_atom_init_mc_reg_table
Need to swap the data for big endian.
Notcied by sylware in IRC.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 18:20:54 -05:00
Alex Deucher aa34dba8fb drm/radeon: write gfx pg bases even when gfx pg is disabled
For consistency.  These buffers aren't used when pg is
disabled.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 18:20:53 -05:00
Alex Deucher c4756baa4a drm/radeon: bail early from enable ss in certain cases
If the ss percentage is 0 or we are using external ss,
just bail when enabling ss.  We disable it explicitly
earlier in the modeset already.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 18:20:53 -05:00
Alex Deucher 18f8f52b9a drm/radeon: handle ss percentage divider properly
It's either 100 or 1000 depending on the flags in the
table.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 18:20:52 -05:00
Alex Deucher f5f1f897c8 drm/radeon: add query to fetch the max engine clock (v2)
This is needed for reporting the max GPU engine clock
in OpenCL.  This just reports the max possible engine
clock, it does not take into account current conditions
that may limit that clock.

v2: fix query number for merge with 3.13

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 18:20:29 -05:00
Vandana Kannan 985e5dc207 drm/edid: Populate picture aspect ratio for CEA modes
Adding picture aspect ratio for CEA modes based on CEA-861D Table 3 or
CEA-861E Table 4. This is useful for filling up the detail in AVI
infoframe.

v2: Ville's review comments incorporated
Added picture aspect ratio as part of edid_cea_modes instead of DRM_MODE

Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-20 18:32:21 +01:00
Alex Deucher d30df55b3e drm/radeon/dp: sleep after powering up the display
According to the DP 1.1 spec, the sink must power
up within 1ms.  Noticed while reviewing Thierry's
drm/dp patches.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:19 -05:00
Alex Deucher ab9f51c09f drm/radeon/dp: use usleep_range rather than udelay
Based on common dp code proposed by Thierry Reding.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:18 -05:00
Alex Deucher 2138681bdd drm/radeon/dp: bump i2c-over-aux retries to 7
As per the DP1.2 spec.  Noticed while reviewing
Thierry's drm/dp patches. Also bump native aux
retries to 7 for consistency.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:18 -05:00
Alex Deucher d8e2452509 drm/radeon: disable ss on DP for DCE3.x
Seems to cause problems with certain DP monitors.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=40699

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
2014-01-20 12:05:17 -05:00
Alex Deucher 6dfa09d7c9 drm/radeon/cik: use hw defaults for TC_CFG registers
Use the hw power up values rather than 0.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:16 -05:00
Alex Deucher 919cf555c0 drm/radeon: disable dpm on BTC
Still unstable on some boards.

Bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=73053
https://bugzilla.kernel.org/show_bug.cgi?id=68571

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: 3.13 <stable@vger.kernel.org> # 3.13
2014-01-20 12:05:16 -05:00
Alex Deucher 5d2590673f drm/radeon/cik: use WAIT_REG_MEM special op for CP HDP flush
This is the preferred flushing method on CIK.

Note, this only works on the PFP so the engine bit must be
set.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:15 -05:00
Alex Deucher da9e07e6f5 drm/radeon/cik: use POLL_REG_MEM special op for sDMA HDP flush
This is the preferred flushing method on CIK.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:14 -05:00
Alex Deucher ca113f6bae drm/radeon: consolidate sdma hdp flushing code for CIK
It's used in several places so move to a common shared
function.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:13 -05:00
Alex Deucher 780f5dddae drm/radeon: consolidate cp hdp flushing code for CIK
It's used in several places so move to a common shared
function.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:13 -05:00
Christian König 8158eb9e32 drm/radeon: don't power gate paused UVD streams
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-20 12:05:12 -05:00
Alex Deucher 7f4237c6da Revert "drm/radeon: disable CIK CP semaphores for now"
This reverts commit 99b4f25122.

Semaphores work fine after further review and testing.
Cc: 3.13 <stable@vger.kernel.org> # 3.13
2014-01-20 12:05:11 -05:00
Thomas Wood 0e5083aa9d drm/edid: parse the list of additional 3D modes
Parse 2D_VIC_order_X and 3D_Structure_X from the list at the end of the
HDMI Vendor Specific Data Block.

v2: Use an offset value depending on 3D_Multi_present and add
    detail_present. (Ville Syrjälä)
v3: Make sure the list is parsed even if 3D_Structure_ALL/MASK is not
    present. (Ville Syrjälä)
    Fix one length check and remove another. (Ville Syrjälä)

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-20 17:43:55 +01:00
Thomas Wood aff04ace4e drm/edid: split VIC display mode lookup into a separate function
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-20 17:43:54 +01:00
Ville Syrjälä 095163bad5 drm/i915: Add a kludge for DSL incrementing too late and ISR not working
On pre-PCH platforms ISR doesn't seem to be an actual ISR, at least as
far as display interrupts are concerned. Instead it sort of looks like
some ISR bits just directly reflect the corresponding bit from PIPESTAT.
The bit appears in the ISR only if the PIPESTAT interrupt is enabled. So
in that sense it sort of looks a bit like the south interrupt scheme on
PCH platforms. So it goes something a bit like this:
PIPESTAT.status & PIPESTAT.enable -> ISR -> IMR -> IIR -> IER -> actual
interrupt

In any case that means the intel_pipe_in_vblank_locked() doesn't actually
work for pre-PCH platforms. As a last resort, add a similar kludge as radeon
has that fixes things up if we got called from the vblank interrupt,
but the scanline counter value indicates that we're not quite there yet.
We know that the scanline counter increments at hsync but is otherwise
accurate, so we can limit the kludge to the line just prior to vblank
start, instead of the relative distance that radeon uses.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 12:21:36 +02:00
Ville Syrjälä 8072bfa604 drm/radeon: Move the early vblank IRQ fixup to radeon_get_crtc_scanoutpos()
i915 doesn't need this kludge for most platforms. Although we do
appear to need something similar on certain platforms, but we can
be more accurate when we apply the adjustment since we know exactly
why the scanline counter doesn't always quite match the vblank
status.

Also the current code doesn't handle interlaced modes correctly,
and we already deal with interlaced modes in i915 code.

So let's just move the current code to radeon_get_crtc_scanoutpos()
since that's why it was added. For i915 we'll add a more finely
targeted variant.

v2: Fix vpos vs. *vpos bug (Mario)

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 12:21:35 +02:00
Ville Syrjälä abca9e4544 drm: Pass 'flags' from the caller to .get_scanout_position()
Preparation for moving the early vblank IRQ logic into
radeon_get_crtc_scanoutpos().

v2: Fix radeon_drv.c compile warning (Mario)

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 12:21:35 +02:00
Ville Syrjälä c0ae24c17e drm: Fix vblank timestamping constants for interlaced modes
We're currently miscalculating the line and pixel durations for
interlaced modes. crtc_htotal and crtc_vtotal are the full frame
timings, and so is crtc_clock, so we can compute the line
and pixel durations from those w/o any extra adjustments. But
we actually want framedur_ns to be the field, not frame, duration,
so we must divide it by two.

This should make the scanout based vblank timestamp corrections
work correctly with interlaced modes, at least for i915. It all
depends whether we keep the field or frame timings in the display
mode crtc_ timings.

v2: Preserve halve->half typo fix that happened in the meantine

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 12:20:51 +02:00
Ville Syrjälä d31faf65b8 drm/i915: Fix scanoutpos calculations for interlaced modes
The scanline counter counts lines in the current field, not the entire
frame. But the crtc_ timings are the values for the entire frame. Divide
the vertical timings by 2 to make them match the scanline counter.

The rounding was carefully chosen to make it do the right thing wrt. the
observed scanline counter and ISR vblank bit behaviour.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:06:34 +02:00
Ville Syrjälä 3c184f6991 drm: Change {pixel,line,frame}dur_ns from s64 to int
Using s64 for the timestamping constants is wasteful. Signed 32bit
integers get us a range of over +-2 seconds. Presuming that no-one
wants to a vrefresh rate less than 0.5, we can switch to using int
for the timestamping constants. We save a few bytes in drm_crtc and
avoid a bunch of 64bit math.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:06:26 +02:00
Ville Syrjälä 77666b7226 drm: Use crtc_clock in drm_calc_timestamping_constants()
drm_calc_timestamping_constants() computes the pixel/line/frame
durations based on the crtc_ timing values. The corresponding pixel
clock is in mode->crtc_clock, so we need to use that instead of
mode->clock.

This should fix drm_calc_timestamping_constants() for frame packing
stereo modes.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:06:17 +02:00
Ville Syrjälä 265d09aa82 drm/radeon: Populate crtc_clock in radeon_atom_get_tv_timings()
crtc_clock is now supposed to be the actual pixel clock corresponding to
the other crtc_ timing values. Populate crtc_clock appropriately in
radeon_atom_get_tv_timings().

This was the only obvious place where we frob with the crtc_ timigns
directly instead of calling drm_mode_set_crtcinfo() which would also
update crtc_clock.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:06:09 +02:00
Ville Syrjälä 0dae35a388 drm: Simplify the math in drm_calc_timestamping_constants()
drm_calc_timestamping_constants() makes the math more complex
than necessary.
- multipying the dotclock by 1000 is pointless, just makes all the
  numbers bigger
- div64_u64() is also pointless, div_u64 is enough
- pixeldur_ns doesn't need any 64bit math

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:06:01 +02:00
Ville Syrjälä 21b21560e9 drm: Improve drm_calc_timestamping_constants() documentation
Move the long blurp to into the body of the comment, leaving only
a short summary line at the top.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:05:52 +02:00
Ville Syrjälä c326c0a9c9 drm/i915: Call drm_calc_timestamping_constants() earlier
Update the pixel/line/frame duration information when we switch to the
new pipe config. This will keep the timestamping constants in better
sync with the real hardware state.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:05:41 +02:00
Ville Syrjälä 4b4b9238a3 drm/i915: Kill hwmode save/restore
drm core no longer uses crtc->hwmode, and neither does i915, so we can totally ignore it
in i915.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:05:30 +02:00
Ville Syrjälä 7da903ef04 drm: Pass the display mode to drm_calc_vbltimestamp_from_scanoutpos()
Rather than using crtc->hwmode, just pass the relevant mode to
drm_calc_vbltimestamp_from_scanoutpos(). This removes the last hwmode
usage from core drm.

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:05:08 +02:00
Ville Syrjälä 545cdd5510 drm: Pass the display mode to drm_calc_timestamping_constants()
We don't really use hwmode anymore in i915, so eliminating its use
from the core code seems prudent. Just pass the appropriate mode
to drm_calc_timestamping_constants().

Reviewed-by: mario.kleiner.de@gmail.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2014-01-20 11:04:46 +02:00
Ilia Mirkin 72de182362 drm/nouveau/mxm: fix null deref on load
Since commit 61b365a505 ("drm/nouveau: populate master subdev pointer
only when fully constructed"), the nouveau_mxm(bios) call will return
NULL, since it's still being called from the constructor.  Instead, pass
the mxm pointer via the unused data field.

See https://bugs.freedesktop.org/show_bug.cgi?id=73791

Reported-by: Andreas Reis <andreas.reis@gmail.com>
Tested-by: Andreas Reis <andreas.reis@gmail.com>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-01-19 18:28:30 -08:00
Dave Airlie cfd72a4c20 Merge branch 'drm-intel-next' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
drm-intel-next-2014-01-10:
- final bits for runtime D3 on Haswell from Paul (now enabled fully)
- parse the backlight modulation freq information in the VBT from Jani
  (but not yet used)
- more watermark improvements from Ville for ilk-ivb and bdw
- bugfixes for fastboot from Jesse
- watermark fix for i830M (but not yet everything)
- vlv vga hotplug w/a (Imre)
- piles of other small improvements, cleanups and fixes all over

Note that the pull request includes a backmerge of the last drm-fixes
pulled into Linus' tree - things where getting a bit too messy. So the
shortlog also contains a bunch of patches from Linus tree. Please yell if
you want me to frob it for you a bit.

* 'drm-intel-next' of git://people.freedesktop.org/~danvet/drm-intel: (609 commits)
  drm/i915/bdw: make sure south port interrupts are enabled properly v2
  drm/i915: Include more information in disabled hotplug interrupt warning
  drm/i915: Only complain about a rogue hotplug IRQ after disabling
  drm/i915: Only WARN about a stuck hotplug irq ONCE
  drm/i915: s/hotplugt_status_gen4/hotplug_status_g4x/
2014-01-20 10:21:54 +10:00
Dave Airlie 9354eafd89 Merge tag 'vmwgfx-next-2014-01-17' of git://people.freedesktop.org/~thomash/linux into drm-next
Pull request of 2014-01-17

Pull request for 3.14. One not so urgent fix, One huge device update.

The pull request corresponds to the patches sent out on dri-devel, except:
[PATCH 02/33], review tag typo pointed out by Matt Turner.
[PATCH 04/33], dropped. The new surface formats are never used.

The upcoming vmware svga2 hardware version 11 will introduce the concept
of "guest backed objects" or -resources. The device will in principle
get all
of its memory from the guest, which has big advantages from the device
point of view.

This means that vmwgfx contexts, shaders and surfaces need to be backed
by guest memory in the form of buffer objects called MOBs, presumably
short for MemoryOBjects, which are bound to the device in a special way.

This patch series introduces guest backed object support. Some new IOCTLs
are added to allocate these new guest backed object, and to optionally
provide
them with a backing MOB.

There is an update to the gallium driver that comes with this update, and
it will be pushed in the near timeframe presumably to a separate mesa branch
before merged to master.

* tag 'vmwgfx-next-2014-01-17' of git://people.freedesktop.org/~thomash/linux: (33 commits)
  drm/vmwgfx: Invalidate surface on non-readback unbind
  drm/vmwgfx: Silence the device command verifier
  drm/vmwgfx: Implement 64-bit Otable- and MOB binding v2
  drm/vmwgfx: Fix surface framebuffer check for guest-backed surfaces
  drm/vmwgfx: Update otable definitions
  drm/vmwgfx: Use the linux DMA api also for MOBs
  drm/vmwgfx: Ditch the vmw_dummy_query_bo_prepare function
  drm/vmwgfx: Persistent tracking of context bindings
  drm/vmwgfx: Track context bindings and scrub them upon exiting execbuf
  drm/vmwgfx: Block the BIND_SHADERCONSTS command
  drm/vmwgfx: Add a parameter to get max MOB memory size
  drm/vmwgfx: Implement a buffer object synccpu ioctl.
  drm/vmwgfx: Make sure that the multisampling is off
  drm/vmwgfx: Extend the command verifier to handle guest-backed on / off
  drm/vmwgfx: Fix up the vmwgfx_drv.h header for new files
  drm/vmwgfx: Enable 3D for new hardware version
  drm/vmwgfx: Add new unused (by user-space) commands to the verifier
  drm/vmwgfx: Validate guest-backed shader const commands
  drm/vmwgfx: Add guest-backed shaders
  drm/vmwgfx: Hook up guest-backed surfaces
  ...
2014-01-20 10:03:27 +10:00
Jakob Bornecrantz 1985f99987 drm/vmwgfx: Invalidate surface on non-readback unbind
Fixes error messages in vmware.log

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Michael Banack <banackm@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2014-01-17 09:12:26 +01:00
Thomas Hellstrom 96b43626a5 drm/vmwgfx: Silence the device command verifier
The device and kernel module disagrees about the command length of
some commands. More pack attributes might be needed.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2014-01-17 07:52:41 +01:00
Thomas Hellstrom f2a0dcb1aa drm/vmwgfx: Implement 64-bit Otable- and MOB binding v2
Adds the relevant commands to the device interface header and
implements 64-bit binding for 64 bit VMs.

v2: Uppercase command IDs, Correctly use also 64 bit page tables.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-01-17 07:52:40 +01:00
Thomas Hellstrom b360a3cecd drm/vmwgfx: Fix surface framebuffer check for guest-backed surfaces
With guest-backed surfaces, surface->sizes == NULL, causing a kernel oops.
Use the base_size member instead.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 07:52:39 +01:00
Thomas Hellstrom 7cba9062e6 drm/vmwgfx: Update otable definitions
Update otable definitions and modify the otable setup code
accordingly.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2014-01-17 07:52:38 +01:00
Thomas Hellstrom 0fd53cfb09 drm/vmwgfx: Use the linux DMA api also for MOBs
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2014-01-17 07:52:38 +01:00
Thomas Hellstrom 4b9e45e68f drm/vmwgfx: Ditch the vmw_dummy_query_bo_prepare function
Combine it with vmw_dummy_query_bo_create, and also make sure
we use tryreserve when reserving the bo to avoid any lockdep warnings
We are sure the tryreserve will always succeed since we are
the only users at that point.
In addition, allow the vmw_bo_pin function to pin/unpin system memory.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-01-17 07:52:37 +01:00
Thomas Hellstrom 173fb7d4e2 drm/vmwgfx: Persistent tracking of context bindings
Only scrub context bindings when a bound resource is destroyed, or when
the MOB backing the context is unbound.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:36 +01:00
Thomas Hellstrom b5c3b1a6bf drm/vmwgfx: Track context bindings and scrub them upon exiting execbuf
The device is no longer capable of scrubbing context bindings of resources
that are bound when destroyed.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-01-17 07:52:35 +01:00
Thomas Hellstrom 8ba07315d3 drm/vmwgfx: Block the BIND_SHADERCONSTS command
It's been deprecated.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
2014-01-17 07:52:34 +01:00
Thomas Hellstrom 311474dbdc drm/vmwgfx: Add a parameter to get max MOB memory size
Also bump minor to signal a GB-aware kernel module

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:34 +01:00
Thomas Hellstrom 1d7a5cbf8f drm/vmwgfx: Implement a buffer object synccpu ioctl.
This ioctl enables inter-process synchronization of buffer objects,
which is needed for mesa Guest-Backed objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 07:52:33 +01:00
Zack Rusin 15c6f65623 drm/vmwgfx: Make sure that the multisampling is off
By default SVGA device creates nonmaskable multisampling surfaces, in
which case multisampleCount of 1 means: the first quality setting
of nonmaskable multisampling surface. Lets change it to make sure
that the backends know that multisampling is really off.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 07:52:32 +01:00
Thomas Hellstrom c373d4eac4 drm/vmwgfx: Extend the command verifier to handle guest-backed on / off
Make sure we disallow commands if the device doesn't support them.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:31 +01:00
Thomas Hellstrom 7086d0995c drm/vmwgfx: Fix up the vmwgfx_drv.h header for new files
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:30 +01:00
Thomas Hellstrom d8c08b2b87 drm/vmwgfx: Enable 3D for new hardware version
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:29 +01:00
Thomas Hellstrom 74c10d1cd5 drm/vmwgfx: Add new unused (by user-space) commands to the verifier
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:29 +01:00
Thomas Hellstrom a21aa6143f drm/vmwgfx: Validate guest-backed shader const commands
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:28 +01:00
Thomas Hellstrom c74c162fd9 drm/vmwgfx: Add guest-backed shaders
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:27 +01:00
Thomas Hellstrom a97e21923b drm/vmwgfx: Hook up guest-backed surfaces
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:26 +01:00
Thomas Hellstrom 58a0c5f036 drm/vmwgfx: Hook up guest-backed contexts
Contexts are managed by the kernel only, so disable access to GB
context commands from user-space

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Ruzin <zackr@vmware.com>
2014-01-17 07:52:25 +01:00
Thomas Hellstrom f468911fee drm/vmwgfx: Detach backing store from its resources when it is evicted
When the backing store buffer is evicted, Issue a readback from the
resources and notify the resources that they are no longer bound to
a valid backing store.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:24 +01:00
Thomas Hellstrom ddcda24e3b drm/vmwgfx: Hook up guest-backed queries
Perform a translation of legacy query commands should they occur
in the command stream.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:23 +01:00
Thomas Hellstrom 96c5f0df22 drm/vmwgfx: Add the possibility to validate a buffer as a MOB
Also do basic consistency checking.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:22 +01:00
Thomas Hellstrom afb0e50fae drm/vmwgfx: Read bounding box memory from the appropriate register
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:22 +01:00
Thomas Hellstrom 6da768aa66 drm/vmwgfx: Hook up MOBs to TTM as a separate memory type
To bind a buffer object as a MOB, just validate it as a MOB
memory type. We are reusing the GMRID manager, although we create a new
instance of it to manage MOB ids and tomake sure we don't exceed
the maximum amount of MOB pages.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 07:52:21 +01:00
Thomas Hellstrom 3530bdc35e drm/vmwgfx: Add MOB management
Implement MOB setup, binding and unbinding, but don't hook up to
TTM yet.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:19 +01:00
Thomas Hellstrom 716a2fd66d drm/vmwgfx: Adapt capability reporting to new hardware version
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>

Conflicts:
	drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
2014-01-17 07:52:18 +01:00
Thomas Hellstrom c1234db74d drm/vmwgfx: Update the svga register definition
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:17 +01:00
Thomas Hellstrom bc2d6508ab drm/vmwgfx: Replace vram_size with prim_bb_mem for calculation of max resolution
In the future, Scanout buffers need not be backed by VRAM and
the two definitions will differ.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:52:16 +01:00
Thomas Hellstrom d9019498dd drm/vmwgfx: Update the svga3d register header file for new device version
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2014-01-17 07:44:24 +01:00
Thomas Hellstrom 0d00c488f3 drm/vmwgfx: Fix the driver for large dma addresses
With dma compliance / IOMMU support added to the driver in kernel 3.13,
the dma addresses can exceed 44 bits, which is what we support in
32-bit mode and with GMR1.
So in 32-bit mode and optionally in 64-bit mode, restrict the dma
addresses to 44 bits, and strip the old GMR1 code.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
2014-01-17 07:44:15 +01:00
Daniel Vetter 0d9d349d87 Merge commit origin/master into drm-intel-next
Conflicts are getting out of hand, and now we have to shuffle even
more in -next which was also shuffled in -fixes (the call for
drm_mode_config_reset needs to move yet again).

So do a proper backmerge. I wanted to wait with this for the 3.13
relaese, but alas let's just do this now.

Conflicts:
	drivers/gpu/drm/i915/i915_reg.h
	drivers/gpu/drm/i915/intel_ddi.c
	drivers/gpu/drm/i915/intel_display.c
	drivers/gpu/drm/i915/intel_pm.c

Besides the conflict around the forcewake get/put (where we chaged the
called function in -fixes and added a new parameter in -next) code all
the current conflicts are of the adjacent lines changed type.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-16 22:06:30 +01:00
Dave Airlie 53dac83053 drm/mgag200: fix oops in cursor code.
In some cases we enter the cursor code with file_priv = NULL causing an oops,
we also can try to unpin something that isn't pinned, and this is a good fix for it.

Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-16 14:43:04 +10:00
Dave Airlie 703a8c2dfa Merge branch 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6 into drm-fixes
Single regression fix for nouveau

* 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6:
  drm/nouveau: fix null ptr dereferences on some boards
2014-01-15 15:01:11 +10:00
Ben Skeggs fdd239ac99 drm/nouveau: fix null ptr dereferences on some boards
Regression from "device: populate master subdev pointer only when fully
constructed"

Reported-by: Bob Gleitsmann <rjgleits@bellsouth.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-01-15 14:24:05 +10:00
Stephen Warren 70bf6878a8 drm/panel: update EDID BLOB in panel_simple_get_modes()
This stashes away the EDID data so that the sysfs per-connector file
"edid" can display it. Without this change, the "edid" file is always
empty.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 16:02:02 +01:00
Thierry Reding 7236aa03ff drm/tegra: Use proper data type
The last argument to of_get_property() is a pointer to an int, rather
than size_t.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:39:38 +01:00
Thierry Reding acde541324 drm/tegra: Clarify how panel modes override others
When a panel advertises one or more modes, they are used exclusively.
Other methods for obtaining the mode, such as DDC as used for HDMI or
binary EDID blobs embedded in the DT, are ignored. The panel drivers
should be providing this functionality if they want to expose it as
well.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:36:51 +01:00
Thierry Reding 456ac56b7d drm/tegra: Fix possible CRTC mask for RGB outputs
The mask of possible CRTCs that an output (DRM encoder) can be attached
to is relative to the position within the DRM device's list of CRTCs.
Deferred probing can cause this to not match the pipe number associated
with a CRTC. Use the newly introduced drm_crtc_mask() to compute the
mask by looking up the proper index of the given CRTC in the list.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:35:56 +01:00
Thierry Reding 14509916c3 drm/i915: Use drm_encoder_crtc_ok()
The intel_encoder_crtc_ok() is a duplicate of the drm_encoder_crtc_ok()
function that used to be only available in the DRM CRTC helpers. It has
recently been moved to the core, so the duplicate can now be dropped.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:35:27 +01:00
Thierry Reding 3d88736870 drm: Move drm_encoder_crtc_ok() to core
Using the new drm_crtc_mask() function, drm_encoder_crtc_ok() can now be
written in a significantly shorter way, so it can be moved to a header
file and be made static inline.

Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:35:11 +01:00
Russell King db5f7a6e78 drm: provide a helper for the encoder possible_crtcs mask
The encoder possible_crtcs mask identifies which CRTCs can be bound to
a particular encoder.  Each bit from bit 0 defines an index in the list
of CRTCs held in the DRM mode_config crtc_list.  Rather than having
drivers trying to track the position of their CRTCs in the list, expose
the code which already exists for calculating the appropriate mask bit
for a CRTC.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
[treding@nvidia.com: add drm_crtc_index(), move to core]
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:35:02 +01:00
Wolfram Sang ff5009ef8d drm/tegra: Don't check resource with devm_ioremap_resource()
devm_ioremap_resource() does sanity checks on the given resource. No
need to duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-01-14 14:34:14 +01:00
Randy Dunlap c5416d661d gpu: fix qxl missing crc32_le
Fix build error: qxl uses crc32 functions so it needs to select
CRC32.

Also use angle quotes around a kernel header file name.

drivers/built-in.o: In function `qxl_display_read_client_monitors_config':
(.text+0x19d754): undefined reference to `crc32_le'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 13:08:37 +10:00
Rashika 1302b23f88 drivers: gpu: Include appropriate header file in r128_ioc32.c
Include appropriate header file drm/r128/r128_drv.h in
drm/r128/r128_ioc32.c because function r128_compat_ioctl() has its
prototype declaration in the header file.

This eliminates the following warning in drm/r128/r128_ioc32.c:
drivers/gpu/drm/r128/r128_ioc32.c:196:6: warning: no previous prototype for ‘r128_compat_ioctl’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 13:05:37 +10:00
Rashika 1e164bb87d drivers: gpu: Mark function as static in via_drv.c
Mark function as static because it is not used outside the file
drm/via/via_drv.c.

This eliminates the following warning in drm/via/via_drv.c:
drivers/gpu/drm/via/via_drv.c:49:6: warning: no previous prototype for ‘via_driver_postclose’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 13:05:00 +10:00
Rashika 902f4a7400 drivers: gpu: Mark function as static in sis_drv.c
Mark function as static because it is not used outside the file
drm/sis/sis_drv.c.

This eliminates the following warning in drm/sis/sis_drv.c:
drivers/gpu/drm/sis/sis_drv.c:97:6: warning: no previous prototype for ‘sis_driver_postclose’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 13:04:33 +10:00
Rashika 0662e4c2c2 drivers: gpu: Mark function as static in qxl_kms.c
Mark function qxl_device_init() as static in drm/qxl/qxl_kms.c because
it is not used outside this file.

This eliminates the following warning in drm/qxl/qxl_kms.c:
drivers/gpu/drm/qxl/qxl_kms.c:118:5: warning: no previous prototype for ‘qxl_device_init’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:25 +10:00
Rashika 06a8c6509a drivers: gpu: Include appropriate header file in mga_ioc32.c
Include appropriate header file drivers/gpu/drm/mga/mga_drv.h in
drm/mga/mga_ioc32.c because function mga_compat_ioctl() has its
prototype declaration in the header file.

This eliminates the following warning in drm/mga/mga_ioc32.c:
drivers/gpu/drm/mga/mga_ioc32.c:207:6: warning: no previous prototype for ‘mga_compat_ioctl’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:24 +10:00
Rashika f242a64b4f drivers: gpu: Mark functions as static in mgag200_ttm.c
Mark functions mgag200_ttm_global_release(),
mgag200_ttm_bo_is_mgag200_bo() and mgag200_ttm_tt_create() as static in
drm/mgag200/mgag200_ttm.c because they are not used outside this file.

This eliminates the following warning in drm/mgag200/mgag200_ttm.c:
drivers/gpu/drm/mgag200/mgag200_ttm.c:84:1: warning: no previous prototype for ‘mgag200_ttm_global_release’ [-Wmissing-prototypes]
drivers/gpu/drm/mgag200/mgag200_ttm.c:105:6: warning: no previous prototype for ‘mgag200_ttm_bo_is_mgag200_bo’ [-Wmissing-prototypes]
drivers/gpu/drm/mgag200/mgag200_ttm.c:211:16: warning: no previous prototype for ‘mgag200_ttm_tt_create’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:21 +10:00
Rashika 080fd6b503 drivers: gpu: Mark functions as static in mgag200_mode.c
Mark functions mga_set_start_address(), mga_encoder_destroy() and
mga_connector_best_encoder() as static in drm/mgag200/mgag200_mode.c
because they are not used outside this file.

This eliminates the following warnings in drm/mgag200/mgag200_mode.c:
drivers/gpu/drm/mgag200/mgag200_mode.c:694:6: warning: no previous
prototype for ‘mga_set_start_address’ [-Wmissing-prototypes]
drivers/gpu/drm/mgag200/mgag200_mode.c:1401:6: warning: no previous
prototype for ‘mga_encoder_destroy’ [-Wmissing-prototypes]
drivers/gpu/drm/mgag200/mgag200_mode.c:1561:21: warning: no previous
prototype for ‘mga_connector_best_encoder’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:20 +10:00
Rashika b2890a769e drivers: gpu: Mark function as static in mgag200_main.c
Mark function mgag200_bo_unref() as static in drm/mgag200/mgag200_main.c
because it is not used outside this file.

This eliminates the following warning in drm/mgag200/mgag200_main.c:
drivers/gpu/drm/mgag200/mgag200_main.c:313:6: warning: no previous prototype for ‘mgag200_bo_unref’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:19 +10:00
Rashika cdd7330667 drivers: gpu: Mark functions as static and remove unused function in cirrus_ttm.c
Mark functions cirrus_ttm_global_release(), cirrus_ttm_bo_is_cirrus_bo()
and cirrus_ttm_tt_create() as static in drm/cirrus/cirrus_ttm.c because
they are not used outside this file. Remove unused function
cirrus_bo_unpin() from drm/cirrus/cirrus_ttm.c.

This eliminates the following warnings in drm/cirrus/cirrus_ttm.c:
drivers/gpu/drm/cirrus/cirrus_ttm.c:84:1: warning: no previous prototype for ‘cirrus_ttm_global_release’ [-Wmissing-prototypes]
drivers/gpu/drm/cirrus/cirrus_ttm.c:105:6: warning: no previous prototype for ‘cirrus_ttm_bo_is_cirrus_bo’ [-Wmissing-prototypes]
drivers/gpu/drm/cirrus/cirrus_ttm.c:211:16: warning: no previous prototype for ‘cirrus_ttm_tt_create’ [-Wmissing-prototypes]
drivers/gpu/drm/cirrus/cirrus_ttm.c:378:5: warning: no previous prototype for ‘cirrus_bo_unpin’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:19 +10:00
Rashika 5e89440f49 drivers: gpu: Mark functions as static in cirrus_mode.c
Mark functions cirrus_set_start_address(), cirrus_encoder_destroy(),
cirrus_vga_get_modes() and cirrus_connector_best_encoder() as static in
drm/cirrus/cirrus_mode.c because they are not used outside this file.

This eliminates the following warnings in drm/cirrus/cirrus_mode.c:
drivers/gpu/drm/cirrus/cirrus_mode.c:105:6: warning: no previous
prototype for ‘cirrus_set_start_address’ [-Wmissing-prototypes]
drivers/gpu/drm/cirrus/cirrus_mode.c:456:6: warning: no previous
prototype for ‘cirrus_encoder_destroy’ [-Wmissing-prototypes]
drivers/gpu/drm/cirrus/cirrus_mode.c:495:5: warning: no previous
prototype for ‘cirrus_vga_get_modes’ [-Wmissing-prototypes]
drivers/gpu/drm/cirrus/cirrus_mode.c:512:21: warning: no previous
prototype for ‘cirrus_connector_best_encoder’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:17 +10:00
Rashika 70d5422b5b drivers: gpu: Mark function as static in cirrus_main.c
Mark function cirrus_bo_unref() as static in drm/cirrus/cirrus_main.c
because it is not used outside this file.

This eliminates the following warning in drm/cirrus/cirrus_main.c:
drivers/gpu/drm/cirrus/cirrus_main.c:258:6: warning: no previous
prototype for ‘cirrus_bo_unref’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:17 +10:00
Rashika a1537f33b1 drivers: gpu: Mark functions as static in ast_ttm.c
Mark functions ast_ttm_global_release(), ast_ttm_bo_is_ast_bo() and
ast_ttm_tt_create() as static in drm/ast/ast_ttm.c because they are not
used outside this file.

This eliminates the following warnings in drm/ast/ast_ttm.c:
drivers/gpu/drm/ast/ast_ttm.c:84:1: warning: no previous prototype for
‘ast_ttm_global_release’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_ttm.c:105:6: warning: no previous prototype for
‘ast_ttm_bo_is_ast_bo’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_ttm.c:211:16: warning: no previous prototype for
‘ast_ttm_tt_create’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:16 +10:00
Rashika 7f5ccd443e drivers: gpu: Mark functions as static in ast_mode.c
Mark functions ast_set_sync_reg(), ast_set_dac_reg(),
ast_set_start_address_crt1(), ast_crtc_init(), ast_encoder_init(),
ast_connector_init(), ast_cursor_init(), ast_cursor_fini(),
ast_show_cursor() and ast_hide_cursor() as static in drm/ast/ast_mode.c
because they are not used outside this file.

This eliminates the following warning in drm/ast/ast_mode.c:
drivers/gpu/drm/ast/ast_mode.c:407:6: warning: no previous prototype for
‘ast_set_sync_reg’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:418:6: warning: no previous prototype for
‘ast_set_dac_reg’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:430:6: warning: no previous prototype for
‘ast_set_start_address_crt1’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:626:5: warning: no previous prototype for
‘ast_crtc_init’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:713:5: warning: no previous prototype for
‘ast_encoder_init’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:780:5: warning: no previous prototype for
‘ast_connector_init’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:813:5: warning: no previous prototype for
‘ast_cursor_init’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:850:6: warning: no previous prototype for
‘ast_cursor_fini’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:968:6: warning: no previous prototype for
‘ast_show_cursor’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_mode.c:979:6: warning: no previous prototype for
‘ast_hide_cursor’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:16 +10:00
Rashika f6109803f2 drivers: gpu: Mark function as static and remove unused function in ast_main.c
Mark function ast_bo_unref() as static because it is not used outside
file ast_main.c and remove unused function ast_get_max_dclk() in
ast_main.c.

This eliminates the following warning in drm/ast/ast_main.c:
drivers/gpu/drm/ast/ast_main.c:192:10: warning: no previous prototype
for ‘ast_get_max_dclk’ [-Wmissing-prototypes]
drivers/gpu/drm/ast/ast_main.c:452:6: warning: no previous prototype for
‘ast_bo_unref’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:59:15 +10:00
Rashika 8eed55be96 drivers: gpu: Include appropriate header file in drm_usb.c
Include appropriate header file include/drm/drm_usb.h in drm/drm_usb.c
because functions drm_get_usb_dev(), drm_usb_init() and drm_usb_exit()
have their prototype declarations in the header file.

This eliminates the following warning in drm/drm_usb.c:
drivers/gpu/drm/drm_usb.c:5:5: warning: no previous prototype for
‘drm_get_usb_dev’ [-Wmissing-prototypes]
drivers/gpu/drm/drm_usb.c:61:5: warning: no previous prototype for
‘drm_usb_init’ [-Wmissing-prototypes]
drivers/gpu/drm/drm_usb.c:75:6: warning: no previous prototype for
‘drm_usb_exit’ [-Wmissing-prototypes]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:53:41 +10:00
Dave Airlie abce1ec9b0 Revert "drm: copy mode type in drm_mode_connector_list_update()"
This reverts commit 3fbd6439e4.

This caused some strange booting lockup issues on an Intel G33
belonging to Daniel Vetter, very unusual, I was hoping Daniel
would track this down, but it looks like instead I'll have to hack
a different fix for -next.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:50:49 +10:00
Dave Airlie c0eeb856e9 Merge tag 'drm-intel-fixes-2014-01-13' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes
Black screen fixes, one for hsw+bdw each and a regression fix for
locking+load detection.

* tag 'drm-intel-fixes-2014-01-13' of git://people.freedesktop.org/~danvet/drm-intel:
  drm/i915/bdw: make sure south port interrupts are enabled properly v2
  drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
  drm/i915: fix DDI PLLs HW state readout code
2014-01-14 12:44:48 +10:00
Daniel Vetter c85dd51c38 drm/gma500: Remove unused function declaration
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:38:40 +10:00
Daniel Vetter b04a590623 drm: store the gem vma offset manager in a typed pointer
This was hidden in a generic void * dev->mm_private. But only ever
used for gem. But thanks to this fake generic pretension no one
noticed that Rob's drm drivers are now all broken.

So just give the offset manager a type pointer and fix up msm, omapdrm
and tilcdc.

v2: Fixup compile fail.

v3: Fixup rebase fail that David spotted.

Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-14 12:38:32 +10:00
Dave Airlie faf096ffba Merge tag 'vmwgfx-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux into drm-next
Anyway, nothing big here, Three more code cleanup patches from Rashika
Kheria, and one TTM/vmwgfx patch from me that tightens security around TTM
objects enough for them to opened using prime objects from render nodes:

Previously any client could access a shared buffer using the "name", also
without actually opening it. Now a reference is required, and for render nodes
such a reference is intended to only be obtainable using a prime fd.

vmwgfx-next 2014-01-13 pull request

* tag 'vmwgfx-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux:
  drivers: gpu: Mark functions as static in vmwgfx_fence.c
  drivers: gpu: Mark functions as static in vmwgfx_buffer.c
  drivers: gpu: Mark functions as static in vmwgfx_kms.c
  drm/ttm: ttm object security fixes for render nodes
2014-01-14 10:55:36 +10:00
Dave Airlie a095c60bd0 Merge tag 'ttm-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux into drm-next
Some code cleanup by Rashika Keria,
VM stuff for ttm:
-Use PFNMAP instead of MIXEDMAP where possible for performance
-Refuse to fault imported pages, an initial step to support dma-bufs
better from within TTM.
-Correctly set page mapping and -index members. These are needed in various
places in the vm subsystem that we are not using yet, but plan to use soonish:
For example unmap-mapping-range keeping COW pages, and dirty tracking
fbdefio style, but also for PCI memory.

ttm-next 2013-01-14 pull request

* tag 'ttm-next-2014-01-13' of git://people.freedesktop.org/~thomash/linux:
  drivers: gpu: Remove unused function in ttm_lock.c
  drivers: gpu: Mark function as static in ttm_bo_util.c
  drivers: gpu: Mark function as static in ttm_bo.c
  drm/ttm: Correctly set page mapping and -index members
  drm/ttm: Refuse to fault (prime-) imported pages
  drm/ttm: Use VM_PFNMAP for shared bo maps
2014-01-14 10:46:19 +10:00
Martin Koegler 99d4a8ae93 drm/cirrus: Fix cirrus drm driver for fbdev + qemu
Xorg fbdev driver requires smem_start/smem_len, otherwise
it tries to map 0 bytes as video memory.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=856760
Signed-off-by: Martin Koegler <martin.koegler@chello.at>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-01-13 14:15:04 +10:00
Dave Airlie ca2a2bb13e Merge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next
This pull request adds an anon file for exynos specific mmaper
to resolve potential a dead lock issue pointed out by Al Viro,
and fixes build break of drm-next.

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos: fix build error caused by removed drm core macros
  drm/exynos: use a new anon file for exynos gem mmaper
2014-01-13 13:55:48 +10:00
Dave Airlie e95d9f9550 Merge branch 'drm-next-3.14-wip' of git://people.freedesktop.org/~agd5f/linux into drm-next
This is the drm-next pull for radeon for 3.14. Highlights include:
- dpm rework which fixes some issues and allows us to enable dpm by
default on CIK parts
- enable clockgating on CIK parts
- pci config reset.  This is a bus-level chip reset that can be more
reliable than soft reset in certain cases.  Disabled by default.  Enable
with the hard_reset module option.
- big endian rptr/wrptr update fixes
- lots of debugfs improvements
- some driver cleanup patches from Rashika Kheria
- bug fixes

* 'drm-next-3.14-wip' of git://people.freedesktop.org/~agd5f/linux: (50 commits)
  drm/radeon: implement pci config reset for CIK (v3)
  drm/radeon: implement pci config reset for SI (v2)
  drm/radeon: implement pci config reset for evergreen/cayman (v2)
  drm/radeon: implement pci config reset for r6xx/7xx (v3)
  drm/radeon: add pci config hard reset
  drm/radeon: add hard_reset module parameter
  drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID
  radeon/pm: Guard access to rdev->pm.power_state array
  drivers: gpu: Move prototype declarations to header file radeon_mode.h from radeon_atombios.c and radeon_combios.c
  drivers: gpu: Move prototype declaration to header file radeon_mode.h
  drm/radeon: move com/atombios scratch reg functions to radeon_mode.h
  drm/radeon/dpm: make some functions static for TN
  drm/radeon/dpm: make some functions static for sumo
  drm/radeon/dpm: make some functions static for CI
  drivers: gpu: Include appropriate header file in ci_smc.c
  drivers: gpu: Move prototype declaration to header file radeon_mode.h from atombios_i2c.c
  drivers: gpu: Include appropriate header file in si_smc.c and remove prototype declaration from header file sislands_smc.h
  drivers: gpu: Add static keyword to the definition of KMS_INVALID_IOCTL in radeon_kms.c
  drivers: gpu: Mark function as static in r600_hdmi.c
  drivers: gpu: Mark function as static in radeon_gem.c
  ...
2014-01-13 13:55:10 +10:00
Dave Airlie feb5cde61d Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next
MSM tree from Rob.

* 'msm-next' of git://people.freedesktop.org/~robclark/linux:
  drm/msm: add a330/apq8x74
  drm/msm: add mdp5/apq8x74
  drm/msm: add hdmi support for apq8x74/mdp5
  drm/msm: move irq utils to mdp_kms
  drm/msm: split out msm_kms.h
  drm/msm: mdp4_format -> mdp_format
  drm/msm: resync generated headers
  drm/msm: move mdp4 -> mdp/mdp4
  drm/msm: add support for msm8060ab/bstem
  drm/msm: add support for non-IOMMU systems
  drm/msm: fix bus scaling
  drm/msm: add missing MODULE_FIRMWARE()s
  drm/msm: COMPILE_TEST support
2014-01-13 13:53:56 +10:00
Jesse Barnes 09f2344d08 drm/i915/bdw: make sure south port interrupts are enabled properly v2
We were apparently relying on the defaults on BDW, which resulted in no
hotplug or AUX interrupts.  So be sure to call the ibx_irq_preinstall to
enable all interrupts.

v2: use preinstall instead of redundant SDIER write

References: https://bugs.freedesktop.org/show_bug.cgi?id=72834
References: https://bugs.freedesktop.org/show_bug.cgi?id=72833
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 22:35:15 +01:00
Chris Wilson cba1c07377 drm/i915: Include more information in disabled hotplug interrupt warning
Daniel thought that this was an opportune moment to include which pins
and bits ended up being stuck in the WARN.

Suggested-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 22:27:18 +01:00
Chris Wilson 8b5565b878 drm/i915: Only complain about a rogue hotplug IRQ after disabling
Disabling the hotplug IRQ is a two-step process. First, inside the IRQ
handler we mark the rogue hotplug pin for disabling. Then later in the
hotplug worker, we actually disable the hotplug pin. So we should not
WARN about the rogue hotplug IRQ being sent until after we have
completed disabling the pin.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1051170
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 22:27:13 +01:00
Chris Wilson 3432087ef8 drm/i915: Only WARN about a stuck hotplug irq ONCE
It seems that hardware that is broken enough to emit a hotplug IRQ even
though the pin is surposedly disable, will do so indefinitely.

Note: There's a good chance the underlying issue has been fixed with

commit 0ce99f749b
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Jul 26 11:27:49 2013 +0200

    drm/i915: fix gen4 digital port hotplug definitions

References: https://bugzilla.redhat.com/show_bug.cgi?id=1051170
Link: https://bugzilla.redhat.com/attachment.cgi?id=847786
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Add note about the potential fix.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 22:26:15 +01:00
Daniel Vetter 704cfb8788 drm/i915: s/hotplugt_status_gen4/hotplug_status_g4x/
We specifically exclude original gen4 (i.e. i965g/gm), so update the
naming for consistency. Spotted while reviewing related code due to a
report from Jesse about byt needing again different values.

v2: g4x, not gm45 since this also applies to the desktop version.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 20:53:54 +01:00
Jani Nikula 49938ac459 drm/i915: add braces around KHz/MHz macro parameters
It's an accident waiting to happen.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 18:03:59 +01:00
Ville Syrjälä 3f2dc5ac05 drm/i915: Fix 915GM self-refresh enable/disable
INSTPM is a masked register so use the _MASKED_BIT_{ENABLE,DISABLE}
macros when enabling/disabling self-refresh on 915GM.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 18:03:35 +01:00
Ville Syrjälä 0fb5822396 drm/i915: 830M doesn't have an LVDS port
There's no LVDS port on 830M so don't go reading the LVDS control
register.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 18:03:27 +01:00
Ville Syrjälä dc9e7decf1 drm/i915: No panel fitter on 830M or non-mobile gen2/3 platforms
PFIT_CONTROL doesn't exist on 830M, so avoid reading it in
i9xx_get_pfit_config().

Also assume that only mobile gen2/3 chipsets have a panel fitter. This
matches the documentation, but I didn't have real hardware to verify.

Gen4 docmentation is a bit inconsistent, but experimenetation on my
LPT machine suggests that the panel fitter is available on non-mobile
gen4 platforms. At least on this machine panel fitter appears works
just fine even on VGA output.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 18:03:17 +01:00
Deepak S 669ab5aaeb drm/i915/vlv: Add drpc debugfs support for valleyview
Many of the fields from Gen6 have gone away for vlv. Strip all those
fields that are not relevent and try to update fields that we care
about. This patch give information about current RP & RC status and
individual Wells.

v2: Move Render & Media Well status to separate lines (Ville)

Signed-off-by: Deepak S <deepak.s@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 18:00:14 +01:00
Imre Deak e5cbfbfb2e drm/i915: vlv: W/a for hotplug/manual VGA detection
VGA detection requires the reference clock to be on, so make sure this
is the case.

This fixes VGA hotplug/manual detection where all pipes are off and so
we would normally disable all clocks.

v2:
- Instead of disabling PSR clock gating, force the reference clock on
  through the DPLL_A register. (Kin Chan S <kin.s.chan@intel.com>)

v3:
- Move enabling of the clock to intel_reset_dpio() and use the DPLL_B
  register instead, where we already have a similar tweak for the CRI
  clock. (Ville)

Reported-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 17:59:57 +01:00
Imre Deak 404faabc3f drm/i915: vlv: make CRI clock enabling explicit during resume
intel_init_dpio() isn't called during resume, so we won't set the CRI
clock enable bit during that time. Move the enabling to
intel_reset_dpio() instead.

Note that the HW reset value for this bit is 1, so probably this patch
won't make any difference. We should still make the setting explicit,
since BIOS could change things under us.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 17:59:40 +01:00
Paulo Zanoni 41e6fc4cd4 drm/i915: only apply GAMMA_MODE IPS WA on HSW
The WA is mentioned in HSW's GAMMA_MODE register documentation, but
not on on BDW's documentation, so let's assume it is not needed there.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 17:59:17 +01:00
Damien Lespiau ba0fbca474 drm/i915: Introduce new intel_output_name()
That we can use for debugging purposes.

v2: Use designated initializers for the 'names' array (Paulo Zanoni,
    Jani Nikula).
    Add a check in case the array has a hole (which can now remain
    unnoticed with designated initializers) (Jani Nikula)

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> (for v1)
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 17:58:03 +01:00
Paulo Zanoni 5a65f3582e drm/i915: don't set modes for 2 connectors on the same encoder
In some cases we have more than 1 connector associated to an encoder
(e.g., SDVO, Haswell DP/HDMI) and we can only set a mode for one of
these connectors. If we only allowed modesets for connected connectors
we would never need this patch, but since we do allow modeset for
disconnected connectors we may see user space trying to set modes on
the two connectors attached to the same encoder, so we need to forbid
that.

This problem can be reproduced by running the following
intel-gpu-tools test case:
  ./kms_setmode --run-subtest clone-exclusive-crtc

Thanks to Daniel Vetter for providing a version of this patch on
pastebin.

Credits-to: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 17:56:39 +01:00
Daniel Vetter feb56b9344 drm/i915: i830M has watermarks like i855
So shuffle the checks around a bit. Also give all the structs and
functions proper prefixes: i830_ for the dual-pipe mobile platforms
and i845_ for the two single-pipe desktop platforms.

Note that the max fifo value isn't actually correct for the i830M, but
since we don't frob the fifo split we don't actually need it. This is
different for some gen3 devices where we need the full fifo for self
refresh mode.

Cc: Thomas Richter <richter@rus.uni-stuttgart.de>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 17:54:20 +01:00
Daniel Vetter 3a77c4c441 drm/i915: Drop I915_ prefix from HAS_FBC
My OCD just couldn't let this slide. Spotted while reviewing Ville's
patch to only flip planes when we have FBC.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 10:28:28 +01:00
Ville Syrjälä 38af609678 drm/i915: Don't swap planes on 830M
Looks like 830M doesn't quite like it when you try to move a plane from
one pipe to another. It seems that the plane's old pipe has to be active
even if the plane is already disabled, otherwise the relevant register
just won't accept new values.

The following commit:

 commit 1f1c2e2468
 Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
 Date:   Thu Nov 28 17:30:01 2013 +0200

    drm/i915: Swap primary planes on gen2 for FBC

caused a regression on 830M. It will attempt to swap the planes when the
driver is loaded, but at that time only pipe A might be active, so plane
A gets disabled, but plane B won't get enabled since pipe B is not
active when we try to move the plane over to pipe A.

There's no reason to swap planes on 830M since it doesn't support
FBC. Change the logic a bit to limit the plane swapping to platforms
which actually support FBC. This should avoid getting a black screen on
830M.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 08:49:19 +01:00
Ville Syrjälä 7ad228b11e drm/i915: Don't grab crtc mutexes in intel_modeset_gem_init()
When the pipe A force quirk is applied the code will attempt to grab
a crtc mutex during intel_modeset_setup_hw_state(). If we're already
holding all crtc mutexes this will obviously deadlock every time.

So instead of using drm_modeset_lock_all() just grab the
mode_config.mutex. This is enough to avoid the unlocked mutex warnings
from certain lower level functions.

The regression was introduced in:

 commit 0274766428
 Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
 Date:   Mon Dec 2 11:08:06 2013 +0200

    drm/i915: Take modeset locks around intel_modeset_setup_hw_state()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org
[danvet: Add cc: stable since the offending commit has that, too.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 08:46:19 +01:00
Chris Wilson e910303802 drm/i915: Free requests after object release when retiring requests
Freeing a request triggers the destruction of the context. This needs to
occur after all objects are themselves unbound from the context, and so
the free request needs to occur after the object release during retire.

This tidies up

commit e20780439b
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Fri Dec 6 14:11:22 2013 -0800

    drm/i915: Defer request freeing

by simply swapping the order of operations rather than introducing
further complexity - as noted during review.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 08:21:52 +01:00
Ben Widawsky ad1d219974 drm/i915: set ctx->initialized only after RCS
The initialized flag is used to specify a context has been initialized
and it's context is safe to load, ie. the 3d state is setup properly.
With full PPGTT, we emit the address space loads during context switch
and this currently marks a context as initialized. With full PPGTT
patches, if a client first emits a batch to !RCS, then later, RCS, the
code will mistake the context as initialized and try to reload an
uninitialized context.

1. context 1 blit // context marked as initialized, but isn't
2. context 1 render // loads random state from step 2

It is really easy to hit this with a planned upcoming patch which makes
default context reuse possible.

NOTE: This should only effect full PPGTT branches, ie. current
drm-intel-nightly.

Thanks to Chris for helping me track this down.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Simplify the failure scenario in the commit message according
to Chris' review a bit.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 08:21:51 +01:00
Ben Widawsky c2cf2416ca drm/i915/bdw: Return -ENONENT on default ctx destroy
This was an accidental "ABI" change introduced during PPGTT:

commit 0eea67eb26
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Fri Dec 6 14:11:19 2013 -0800

    drm/i915: Create a per file_priv default context

The failure test application actually tests the return type. The other
option is to simply change the test.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 08:21:50 +01:00
Daniel Vetter 0e46ce2e7a drm/i915: fix ppgtt dump code for DEBUG_FS=n
A regression in the topic/ppgtt branch introduce in

commit 87d60b63e0
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Fri Dec 6 14:11:29 2013 -0800

    drm/i915: Add PPGTT dumper

The issue is that we're missing the definitions for the seq_file
functions and hence compilation fails.

v2: Just include the right header instead of splattering #ifdefs all
over the place (Chris).

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reported-by: Antti Koskipaa <antti.koskipaa@linux.intel.com>
Cc: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-10 08:21:37 +01:00
Rob Clark 5545996817 drm/msm: add a330/apq8x74
Add support for adreno 330.  Not too much different, just a few
differences in initial configuration plus setting OCMEM base.
Userspace support is already in upstream mesa.

Note that the existing DT code is simply using the bindings from
downstream android kernel, to simplify porting of this driver to
existing devices.  These do not constitute any committed/stable
DT ABI.  The addition of proper DT bindings will be a subsequent
patch, at which point (as best as possible) I will try to support
either upstream bindings or what is found in downstream android
kernel, so that existing device DT files can be used.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:44:06 -05:00
Rob Clark 06c0dd96bf drm/msm: add mdp5/apq8x74
Add support for the new MDP5 display controller block.  The mapping
between parts of the display controller and KMS is:

  plane   -> PIPE{RGBn,VIGn}             \
  crtc    -> LM (layer mixer)            |-> MDP "device"
  encoder -> INTF                        /
  connector -> HDMI/DSI/eDP/etc          --> other device(s)

Unlike MDP4, it appears we can get by with a single encoder, rather
than needing a different implementation for DTV, DSI, etc.  (Ie. the
register interface is same, just different bases.)

Also unlike MDP4, all the IRQs for other blocks (HDMI, DSI, etc) are
routed through MDP.

And finally, MDP5 has this "Shared Memory Pool" (called "SMP"), from
which blocks need to be allocated to the active pipes based on fetch
stride.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:44:06 -05:00
Rob Clark dada25bd22 drm/msm: add hdmi support for apq8x74/mdp5
The HDMI block is basically the same between older SoC's with mdp4
display controller, and newer ones with mdp5.

So mostly this consists of better abstracting out the different sets of
regulators, clks, etc.  In particular, for regulators and clks we can
split it up by what is needed for hot plug detect to work, and what is
needed to light up the display.

Also, 8x74 has a new phy.. a very simple one, but split out into a
different mmio space.  And with mdp5, the irq is shared with mdp, so we
don't directly register our own irq handler.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:44:05 -05:00
Rob Clark 9e0efa6356 drm/msm: move irq utils to mdp_kms
We'll want basically the same thing for mdp5, so refactor it out so it
can be shared.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:44:05 -05:00
Rob Clark dd2da6e346 drm/msm: split out msm_kms.h
Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:44:04 -05:00
Rob Clark 10a02eb646 drm/msm: mdp4_format -> mdp_format
This can be shared between mdp4 and mdp5.  Both use the same set of
parameters to describe the format to the hw.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:43:58 -05:00
Rob Clark facb4f4e7f drm/msm: resync generated headers
resync to latest envytools db, add mdp5 registers

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:59 -05:00
Rob Clark 2e54a92ff2 drm/msm: move mdp4 -> mdp/mdp4
There are some little bits and pieces that mdp4 and mdp5 can share, so
move things around so that we can have both in a common parent
directory.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:59 -05:00
Rob Clark e529c7e674 drm/msm: add support for msm8060ab/bstem
This adds the necessary configuration for the APQ8060A SoC (dual-core
krait + a320 gpu) as found on the bstem board.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:58 -05:00
Rob Clark 871d812aa4 drm/msm: add support for non-IOMMU systems
Add a VRAM carveout that is used for systems which do not have an IOMMU.

The VRAM carveout uses CMA.  The arch code must setup a CMA pool for the
device (preferrably in highmem.. a 256m-512m VRAM pool in lowmem is not
cool).  The user can configure the VRAM pool size using msm.vram module
param.

Technically, the abstraction of IOMMU behind msm_mmu is not strictly
needed, but it simplifies the GEM code a bit, and will be useful later
when I add support for a2xx devices with GPUMMU, so I decided to keep
this part.

It appears to be possible to configure the GPU to restrict access to
addresses within the VRAM pool, but this is not done yet.  So for now
the GPU will refuse to load if there is no sort of mmu.  Once address
based limits are supported and tested to confirm that we aren't giving
the GPU access to arbitrary memory, this restriction can be lifted

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:58 -05:00
Rob Clark bf2b33afb9 drm/msm: fix bus scaling
This got a bit broken with original patches when re-arranging things to
move dependencies on mach-msm inside #ifndef OF.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:58 -05:00
Rob Clark 3b57f23b1c drm/msm: add missing MODULE_FIRMWARE()s
Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:57 -05:00
Rob Clark 3083894f7f drm/msm: COMPILE_TEST support
With a simple stub, we can get COMPILE_TEST support.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2014-01-09 14:38:47 -05:00
Archit Taneja 3d232346c5 drm/omap: Enable DT support for DMM
Enable use of DT for DMM/Tiler.

Originally worked on by Andy Gross <andygro@gmail.com>

Cc: Andy Gross <andygro@gmail.com>
Cc: DRI Development <dri-devel@lists.freedesktop.org>
Signed-off-by: Archit Taneja <archit@ti.com>
[tomi.valkeinen@ti.com: use of_match_ptr()]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-01-09 15:25:35 +02:00
Archit Taneja 80e4ed5411 drm/omap: fix: change dev_unload order
The current dev_unload order uninits the irqs too early.

In the current sequence, it's possible that a crtc queues work(apply_worker)
to display a buffer, which registers to omap_crtc_apply_irq to notfiy the
completion of the configuration we applied.

Calling drm_vblank_cleanup and omap_drm_irq_uninstall here causes the crtc's
apply handler to never get called, which results in an incorrect state of the
apply_irq.registered parameter.

This condition occurs where there is no mode set via omapdrm, and dev_lastclose
tries to set a default fb mode via drm_fb_helper_restore_fbdev_mode. The apply
work scheduled by restore_fbdev_mode is very close in time to the disabling of
the irq handler, and hence leads to a race condition. We move the irq cleanup
at the end of the unload sequence to prevent this.

Also, the call to flush_workqueue is removed since it's called internally by
destroy_workqueue.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-01-09 15:17:25 +02:00
Archit Taneja ec72a81e27 drm/omap: fix: disable encoder before destroying it
Currently, an encoder is disabled only when an apply work is queued for the
corresponding crtc. This works fine for the paths where userspace explicitly
disables crtc, this results in disabling the omapdss device in the crtc's
pre_apply function.

However, when the omapdrm module is removed, there is no work queued to ensure
that the encoder is disabled. This can result in an enabled omapdss device when
removing omapdrm. omapdss is left in an inconsistent state, and that prevents us
from using that omapdss device being used again.

Disable enabled encoders in omap_encoder_destroy, we could consider a better
place for doing this later.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-01-09 15:17:25 +02:00
Archit Taneja cc823bdcfb drm/omap: fix: disconnect devices when omapdrm module is removed
At omapdrm probe, we install manager ops and connect omapdss devices. This
needs to be undone when omapdrm module is removed so that omapdss is in a
clean state. This ensures that we can re-insert omapdrm module, or some other
module which uses omapdss(like omapfb/omap_vout).

Currently, omapdrm's remove neither uninstalls manager ops, or disconnects
omapdss devices. We make sure that this is done in pdev_remove.

omapdrm establishes connections for omap_dss_device devices when probed. It
should also be responsible to disconnect the devices. Keeping the devices
connected can prevent the panel driver modules from unloading, it also causes
issues when we try to remove or re-insert omapdrm module.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-01-09 15:17:25 +02:00
Archit Taneja 3a01ab2556 drm/omap: fix: Defer probe if an omapdss device requests for it at connect
With the omapdss device model changes. omapdrm is required to call dssdriver's
connect() op to register a panel. This is currently done in omap_modeset_init()

A call to connect() can fail if the omapdss panels or the encoders(HDMI/DPI)
they connect to have some resource(like regulators, I2C adapter) missing. If
this happens, the correct approach is to defer omapdrm's probe.

omapdrm currently ignores those panels which return a non zero value when
connected. This could result in omapdrm ignoring all panels on an omap board.

The right approach would be for omapdrm to request for probe deferral when a
panel's connect op returns -EPROBE_DEFER.

In order to do this, we need to call connect() much earlier during omapdrm's
probe to prevent too many things are already done by then. We now connect the
panels during pdev_probe(), before anything else is initialized, so that we
don't need to undo too many things if a defer was requested.

Now when we enter omap_modeset_init(), we have a set of panels that have been
connected. We now proceed with registering only those panels that are already
connected.

A special case has to be considered when no panels are available to connect when
omapdrm probes. In this case too, we defer probe and expect that a panel will be
available to connect the next time.

Checking whether the panel has a driver or whether it has get_timing/read_edid
ops in omap_modeset_init() are redundant with the new display model. These can
be removed since a dssdev device will always have a driver associated with it,
and all dssdev drivers have a get_timings op.

This will mainly fix cases when omapdrm is built-in the kernel, since that's
generally where resources like regulators or I2C are unavailable because of
probe order dependencies.

In particular this fixes boot with omapdrm built-in on an omap4 panda ES board.
The regulators used by HDMI(provided by I2C based TWL regulators) aren't
initialized because I2C isn't initialized, I2C isn't initialized as it's pins
are not configured because pinctrl is yet to probe.

Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
2014-01-09 15:17:25 +02:00
Tomi Valkeinen 6da9f89172 drm/omap: fix (un)registering irqs inside an irq handler
omapdrm (un)registers irqs inside an irq handler. The problem is that
the (un)register function uses dispc_runtime_get/put() to enable the
clocks, and those functions are not irq safe by default.

This was kind of fixed in 48664b21ae
(OMAPDSS: DISPC: set irq_safe for runtime PM), which makes dispc's
runtime calls irq-safe.

However, using pm_runtime_irq_safe in dispc makes the parent of dispc,
dss, always enabled, effectively preventing PM for the whole DSS module.

This patch makes omapdrm behave better by adding new irq (un)register
functions that do not use dispc_runtime_get/put, and using those
functions in interrupt context. Thus we can make dispc again
non-irq-safe, allowing proper PM.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
2014-01-09 15:15:24 +02:00
Alex Deucher 0279ed19bd drm/radeon: implement pci config reset for CIK (v3)
pci config reset is a low level reset that resets
the entire chip from the bus interface.  It can
be more reliable if soft reset fails.

v2: fix rebase
v3: hide behind module parameter

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 18:42:24 -05:00
Alex Deucher 4a5c8ea59f drm/radeon: implement pci config reset for SI (v2)
pci config reset is a low level reset that resets
the entire chip from the bus interface.  It can
be more reliable if soft reset fails.

v2: hide behind module parameter

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 18:42:24 -05:00
Alex Deucher b5470b036e drm/radeon: implement pci config reset for evergreen/cayman (v2)
pci config reset is a low level reset that resets
the entire chip from the bus interface.  It can
be more reliable if soft reset fails.

v2: put behind module parameter

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 18:42:23 -05:00
Alex Deucher de9ae7447a drm/radeon: implement pci config reset for r6xx/7xx (v3)
pci config reset is a low level reset that resets
the entire chip from the bus interface.  It can
be more reliable if soft reset fails.

There's not much information still available on
r6xx, so r6xx is based on guess-work.

v2: put behind module parameter
v3: add IGP check

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 18:42:22 -05:00
Alex Deucher 1a0041b8f9 drm/radeon: add pci config hard reset
This is used to hard reset the asic.  If a soft
reset is not able to reset things, a hard reset
can be used.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 18:42:22 -05:00
Alex Deucher 363eb0b4b7 drm/radeon: add hard_reset module parameter
Enabling this parameter enables pci config reset,
aka hard reset, which is a bus level chip reset.
In some cases this works more reliably than a soft
reset.  Disabled by default.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 18:41:48 -05:00
Paulo Zanoni 89eff4bea7 drm/i915: fix wrong PLL debug messages.
LPT does have PCH refclk, but it's different form the IBX/CPT/PPT one
and doesn't use the same structs. It is wrong to have a message saying
that "LPT does not has PCH refclk" (sic). While at it, signal that we
only want this function on IBX/CPT/PPT by renaming it and adding a
WARN.

On HSW we also print "0 shared PLLs initialized", but we *do* have
shared PLLs on HSW (LCPLL, WRPLL, SPLL) and we *do* initialize them.
We just don't use "struct intel_shared_dpll". So remove the debug
message.

In the future we may want to rename all that "intel shared pll" code
to "ibx shared pll", but I'll leave this to another patch.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2014-01-08 18:33:56 +01:00
Marek Olšák 56492e0fac drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID
This fixes a bug which was causing rejections of valid GPU commands
from userspace.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2014-01-08 12:25:43 -05:00