Commit graph

11044 commits

Author SHA1 Message Date
Daniel Vetter
91d131d21e drm/i915: fold the no-irq check into intel_hpd_irq_handler
The usual pattern for our sub-function irq_handlers is that they check
for the no-irq case themselves. This results in more streamlined code
in the upper irq handlers.

v2: Rebase on top of the i965g/gm sdvo hpd fix.

Cc: Egbert Eich <eich@suse.de>
Reviewed-by: Egbert Eich <eich@suse.de>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:58 +02:00
Daniel Vetter
5876fa0d9e drm/i915: fold the queue_work into intel_hpd_irq_handler
Everywhere the same.

Note that this patch leaves unnecessary braces behind, but the next
patch will kill those all anyway (including the if itself) so I've
figured I can keep the diff a bit smaller.

v2: Rebase on top of the i965g/gm sdvo hpd fix.

Cc: Egbert Eich <eich@suse.de>
Reviewed-by: Egbert Eich <eich@suse.de>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:57 +02:00
Daniel Vetter
10a504de56 drm/i915: fold the hpd_irq_setup call into intel_hpd_irq_handler
We already have a vfunc for this (and other parts of the hpd storm
handling code already use it).

v2: Rebase on top of the i965g/gm sdvo hpd fix.

Cc: Egbert Eich <eich@suse.de>
Reviewed-by: Egbert Eich <eich@suse.de>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:57 +02:00
Daniel Vetter
22062dbacf drm/i915: s/hotplug_irq_storm_detect/intel_hpd_irq_handler/
The combination of Paulo's fifo underrun detection code and Egbert's
hpd storm handling code unfortunately made the hpd storm handling code
racy.

To avoid duplicating tricky interrupt locking code over all platforms
start with a bit of refactoring. This patch is the very first step
since in the end the irq storm handling code will handle all hotplug
logic (and so also encapsulate the locking nicely).

v2: Rebase on top of the i965g/gm sdvo hpd fix.

Cc: Egbert Eich <eich@suse.de>
Reviewed-by: Egbert Eich <eich@suse.de>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:56 +02:00
Daniel Vetter
6005ce4243 drm/i915: close tiny race in the ilk pcu even interrupt setup
By the time we write DEIER in the postinstall hook the interrupt
handler could run any time. And it does modify DEIER to handle
interrupts.

Hence the DEIER read-modify-write cycle for enabling the PCU event
source is racy. Close this races the same way we handle vblank
interrupts: Unconditionally enable the interrupt in the IER register,
but conditionally mask it in IMR. The later poses no such race since
the interrupt handler does not touch DEIMR.

Also update the comment, the clearing has already happened
unconditionally above.

v2: Actually shove the updated comment into the right train^W commit,
as spotted by Paulo.

Cc: Paulo Zanoni <przanoni@gmail.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:55 +02:00
Daniel Vetter
4bc9d43015 drm/i915: fix locking around ironlake_enable|disable_display_irq
The haswell unclaimed register handling code forgot to take the
spinlock. Since this is in the context of the non-rentrant interupt
handler and we only have one interrupt handler it is sufficient to
just grab the spinlock - we do not need to exclude any other
interrupts from running on the same cpu.

To prevent such gaffles in the future sprinkle assert_spin_locked over
these functions. Unfornately this requires us to hold the spinlock in
the ironlake postinstall hook where it is not strictly required:
Currently that is run in single-threaded context and with userspace
exlcuded from running concurrent ioctls. Add a comment explaining
this.

v2: ivb_can_enable_err_int also needs to be protected by the spinlock.
To ensure this won't happen in the future again also sprinkle a
spinlock assert in there.

v3: Kill the 2nd call to ivb_can_enable_err_int I've accidentally left
behind, spotted by Paulo.

Cc: Paulo Zanoni <przanoni@gmail.com>
Reviewed-by: Paulo Zanoni <przanoni@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:55 +02:00
Ben Widawsky
a0de80a0e0 drm/i915: Fix context sizes on HSW
With updates to the spec, we can actually see the context layout, and
how many dwords are allocated. That table suggests we need 70720 bytes
per HW context. Rounded up, this is 18 pages. Looking at what lives
after the current 4 pages we use, I can't see too much important (mostly
it's d3d related), but there are a couple of things which look scary. I
am hopeful this can explain some of our odd HSW failures.

v2: Make the context only 17 pages. The power context space isn't used
ever, and execlists aren't used in our driver, making the actual total
66944 bytes.

v3: Add a comment to the code. (Jesse & Paulo)

Reported-by: "Azad, Vinit" <vinit.azad@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:54 +02:00
Ville Syrjälä
921c3b677b drm/i915: Fix VLV sprite register offsets
We forgot to add VLV_DISPLAY_BASE to the VLV sprite registers, which
caused the sprites to not work at all.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:53 +02:00
Ville Syrjälä
2af2c4909b Revert "drm/i915: Don't use the HDMI port color range bit on Valleyview"
The PIPECONF color range bit doesn't appear to be effective, on HDMI
outputs at least. The color range bit in the port register works though,
so let's use it.

I have not yet verified whether the PIPECONF bit works on DP outputs.

This reverts commit 83a2af88f8.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:53 +02:00
Ville Syrjälä
4abb2c3981 drm/i915: s/LFP/LPF in DPIO PLL register names
LPF is short for "low pass filter".

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:52 +02:00
Ville Syrjälä
99750bd46f drm/i915: Fix VLV PLL LPF coefficients for DAC
The current PLL settings produce a rather unstable picture when
I hook up a VLV to my HP ZR24w display via a VGA cable.

According to VLV2A0_DP_eDP_HDMI_DPIO_driver_vbios_notes_9, we should
use the the same LPF coefficients for DAC as we do for HDMI and RBR DP.
And indeed that seems to cure the shivers.

v2: Add the name of the relevant document to the commit message

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:51 +02:00
Ville Syrjälä
7425034a33 drm/i915: Jump to at least RPe on VLV when increasing the GPU frequency
If the current GPU frquency is below RPe, and we're asked to increase
it, just go directly to RPe. This should provide better performance
faster than letting the frequency trickle up in response to the up
threshold interrupts.

For now just do it for VLV, since that matches quite closely how VLV
used to operate when the rps delayed timer kept things at RPe always.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:51 +02:00
Ville Syrjälä
6dc5848899 drm/i915: Don't increase the GPU frequency from the delayed VLV rps timer
There's little point in increasing the GPU frequency from the delayed
rps work on VLV. Now when the GPU is idle, the GPU frequency actually
keeps dropping gradually until it hits the minimum, whereas previously
it just ping-ponged constantly between RPe and RPe-1.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:50 +02:00
Ville Syrjälä
7a67092a25 drm/i915: GEN6_RP_INTERRUPT_LIMITS doesn't seem to exist on VLV
I can't find GEN6_RP_INTERRUPT_LIMITS (0xA014) anywhere in VLV docs.
Reading it always returns zero from what I can tell, and eliminating
it doesn't seem to make any difference to the behaviour of the system.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:49 +02:00
Ville Syrjälä
d8289c9e7b drm/i915: Make the rps new_delay comparison more readable
Eliminate the weird inverted logic from the rps new_delay comparison.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:48 +02:00
Ville Syrjälä
80814ae4da drm/i915: Don't wait for Punit after each freq change on VLV
It seems that even though Punit reports the frequency change to have
been completed, it still reports the old frequency in the status
register for some time.

So rather than polling for Punit to complete the frequency change after
each request, poll before. This gets rid of the spurious "Punit overrode
GPU freq" messages.

This also lets us continue working while Punit is performing the actual
frequency change. As a result, openarena demo088-test1 timedemo average
fps is increased by ~5 fps, and the slowest frame duration is reduced
by ~25%.

The sysfs cur_freq file always reads the current frequency from Punit
anyway, so having rps.cur_delay be slightly off at times doesn't matter.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:48 +02:00
Ville Syrjälä
73008b989f drm/i915: Clean up VLV rps code a bit
Always print both the MHz value and raw register value for rps stuff.

Also kill a somewhat pointless local 'rpe' variable and just use
dev_priv->rps.rpe_delay.

While at it clean up the caps in "GPU" and "Punit" debug messages.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:47 +02:00
Chris Wilson
a35cdaa0e1 drm/i915: Detect invalid scanout pitches
Report back the user error of attempting to setup a CRTC with an invalid
framebuffer pitch. This is trickier than it should be as on gen4, there
is a restriction that tiled surfaces must have a stride less than 16k -
which is less than the largest supported CRTC size.

v2: Fix the limits for gen3
v3: Move check into intel_framebuffer_init() and fix VLV limits. (vsyrjala)
v4: Use idiomatic '>=' for generation checks

References: https://bugs.freedesktop.org/show_bug.cgi?id=65099
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:46 +02:00
Ville Syrjälä
e4e9222d4b drm/i915: Remove duplicated WaForceL3Serialization:vlv
No need to apply WaForceL3Serialization:vlv twice.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:46 +02:00
Daniel Vetter
bf67dfeb68 drm/i915: don't scream into dmesg when a modeset fails
There are legit cases, e.g. when userspace asks for something
impossible. So tune it down to debug output like we do with all other
userspace-triggerable warnings.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66111#c5
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Rebased.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:45 +02:00
Daniel Vetter
4f7fd7095d drm/i915: Fix up sdvo hpd pins for i965g/gm
Bspec seems to be full of lies, at least it disagress with reality:
Two systems corrobated that SDVO hpd bits are the same as on gen3.

v2: Update comment a bit.

Cc: Arthur Ranyan <arthur.j.runyan@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-and-tested-by: Alex Fiestas <afiestas@kde.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58405
Cc: stable@vger.kernel.org
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:44 +02:00
Damien Lespiau
f5adf94e5f drm/i915: Introduce an HAS_IPS() macro
Follow the trend and don't code conditions with platforms but with
features.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:44 +02:00
Jani Nikula
3765f30486 drm/i915: fix build warning on format specifier mismatch
drivers/gpu/drm/i915/i915_gem.c: In function ‘i915_gem_object_bind_to_gtt’:
drivers/gpu/drm/i915/i915_gem.c:3002:3: warning: format ‘%ld’ expects
argument of type ‘long int’, but argument 5 has type ‘size_t’ [-Wformat]

v2: Use %zu instead of %d. Two char patch, and 100% wrong. (Ville)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:43 +02:00
Daniel Vetter
0f4f7b5795 drm/i915: tune down DIDL warning about too many outputs
Nothing the user (nor we) really can do about this, but upsets a nice
quiet boot.

Note that this happens mostly on SDVs where OEMs obviously haven't had
a chance yet to appropriately trim the output list.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65988
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
[danvet: Amend commit message a bit to clarify a question from Paulo.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:42 +02:00
Konrad Rzeszutek Wilk
1625e7e549 drm/i915: make compact dma scatter lists creation work with SWIOTLB backend.
Git commit 90797e6d1e
("drm/i915: create compact dma scatter lists for gem objects") makes
certain assumptions about the under laying DMA API that are not always
correct.

On a ThinkPad X230 with an Intel HD 4000 with Xen during the bootup
I see:

[drm:intel_pipe_set_base] *ERROR* pin & fence failed
[drm:intel_crtc_set_config] *ERROR* failed to set mode on [CRTC:3], err = -28

Bit of debugging traced it down to dma_map_sg failing (in
i915_gem_gtt_prepare_object) as some of the SG entries were huge (3MB).

That unfortunately are sizes that the SWIOTLB is incapable of handling -
the maximum it can handle is a an entry of 512KB of virtual contiguous
memory for its bounce buffer. (See IO_TLB_SEGSIZE).

Previous to the above mention git commit the SG entries were of 4KB, and
the code introduced by above git commit squashed the CPU contiguous PFNs
in one big virtual address provided to DMA API.

This patch is a simple semi-revert - were we emulate the old behavior
if we detect that SWIOTLB is online. If it is not online then we continue
on with the new compact scatter gather mechanism.

An alternative solution would be for the the '.get_pages' and the
i915_gem_gtt_prepare_object to retry with smaller max gap of the
amount of PFNs that can be combined together - but with this issue
discovered during rc7 that might be too risky.

Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
CC: Imre Deak <imre.deak@intel.com>
CC: Daniel Vetter <daniel.vetter@ffwll.ch>
CC: David Airlie <airlied@linux.ie>
CC: <dri-devel@lists.freedesktop.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:42 +02:00
Rui Guo
6a9c4b35e6 drm/i915: Fix PCH detect with multiple ISA bridges in VM
In some virtualized environments (e.g. XEN), there is irrelevant ISA bridge in
the system. To work reliably, we should scan trhough all the ISA bridge
devices and check for the first match, instead of only checking the first one.

Signed-off-by: Rui Guo <firemeteor@users.sourceforge.net>
[danvet: Fixup conflict with the num_pch_pll removal. And add
subsystem header to the commit message headline.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:41 +02:00
Paulo Zanoni
73845adf33 drm/i915: rename intel_dp_destroy to intel_dp_connector_destroy
Because it's the function that destroys the connector, not the
encoder. And we already have intel_dp_encoder_destroy.

This has annoyed me for a long time.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-07-01 11:14:41 +02:00
Dave Airlie
f7d452f4fd Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next
- Various fixes that make surviving concurrent piglit more possible.
- Buffer object deletion no longer synchronous
- Context/register initialisation updates that have been reported to
solve some stability issues (particularly on some problematic GF119
chips)
- Kernel side support for VP2 video decoding engines

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (44 commits)
  drm/nvd0-/disp: handle case where display engine is missing/disabled
  drm/gr/nvc0-: merge nvc0/nve0 ucode, and use cpp instead of m4
  drm/nouveau/bsp/nv84: initial vp2 engine implementation
  drm/nouveau/vp/nv84: initial vp2 engine implementation
  drm/nouveau/core: xtensa engine base class implementation
  drm/nouveau/vdec: fork vp3 implementations from vp2
  drm/nouveau/core: move falcon class to engine/
  drm/nouveau/kms: don't fail if there's no dcb table entries
  drm/nouveau: remove limit on gart
  drm/nouveau/vm: perform a bar flush when flushing vm
  drm/nvc0/gr: cleanup register lists, and add nvce/nvcf to switches
  drm/nvc8/gr: update initial register/context values
  drm/nvc4/gr: update initial register/context values
  drm/nvc1/gr: update initial register/context values
  drm/nvc3/gr: update initial register/context values
  drm/nvc0/gr: update initial register/context values
  drm/nvd9/gr: update initial register/context values
  drm/nve4/gr: update initial register/context values
  drm/nvc0-/gr: bump maximum gpc/tpc limits
  drm/nvf0/gr: initial register/context setup
  ...
2013-07-01 14:10:20 +10:00
Maarten Lankhorst
791dc143ed drm/nvd0-/disp: handle case where display engine is missing/disabled
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:50 +10:00
Ben Skeggs
e99716f13d drm/gr/nvc0-: merge nvc0/nve0 ucode, and use cpp instead of m4
No code changes, proven by envyas producing identical binaries.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:50 +10:00
Ilia Mirkin
05f9a5bc58 drm/nouveau/bsp/nv84: initial vp2 engine implementation
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:49 +10:00
Ilia Mirkin
a0376b1481 drm/nouveau/vp/nv84: initial vp2 engine implementation
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:49 +10:00
Ilia Mirkin
44b1e3bd6a drm/nouveau/core: xtensa engine base class implementation
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:48 +10:00
Ilia Mirkin
0d4a1450c9 drm/nouveau/vdec: fork vp3 implementations from vp2
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:48 +10:00
Ben Skeggs
a0fd4ec8f1 drm/nouveau/core: move falcon class to engine/
Not really "core" per-se.  About to merge Ilia's work adding another
similar class for the VP2 xtensa engines, so, seems like a good time to
move all these to engine/.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:47 +10:00
Ben Skeggs
d2898713fb drm/nouveau/kms: don't fail if there's no dcb table entries
Fixes module not loading on Tesla K20.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:46 +10:00
Maarten Lankhorst
79442c3af0 drm/nouveau: remove limit on gart
Most graphics cards nowadays have a multiple of this limit as their vram,
so limiting GART doesn't seem to make much sense.

Signed-off-by: Maarten >Lnkhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:43 +10:00
Maarten Lankhorst
36798b61ed drm/nouveau/vm: perform a bar flush when flushing vm
Appears to fix the regression from "drm/nvc0/vm: handle bar tlb flushes
internally".

nvidia always seems to do this flush after writing values.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:42 +10:00
Ben Skeggs
57f0ec159b drm/nvc0/gr: cleanup register lists, and add nvce/nvcf to switches
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:41 +10:00
Ben Skeggs
eb12f57be6 drm/nvc8/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:41 +10:00
Ben Skeggs
dba50728fd drm/nvc4/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:40 +10:00
Ben Skeggs
58ef23056a drm/nvc1/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:40 +10:00
Ben Skeggs
8b637ae3a3 drm/nvc3/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:39 +10:00
Ben Skeggs
d8b02dbbc3 drm/nvc0/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:39 +10:00
Ben Skeggs
37c3afd07c drm/nvd9/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:38 +10:00
Ben Skeggs
1dd44acfab drm/nve4/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:37 +10:00
Ben Skeggs
a8004a9edd drm/nvc0-/gr: bump maximum gpc/tpc limits
Needed for GK110, separate commit to catch any unexpected breaks to
other parts of the code.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:37 +10:00
Ben Skeggs
cb1e06e0e3 drm/nvf0/gr: initial register/context setup
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:36 +10:00
Ben Skeggs
507cd5b553 drm/nve7/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:36 +10:00
Ben Skeggs
99bd5537bd drm/nve6/gr: update initial register/context values
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:35 +10:00
Ben Skeggs
c4c7044ffc drm/nouveau: delay busy bo vma removal until fence signals
As opposed to an explicit wait.  Allows userspace to not stall waiting
on buffer deletion.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:50:31 +10:00
Ben Skeggs
780194b1b9 drm/nouveau/vm: make each vma take a reference on its parent vm
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:45:09 +10:00
Ben Skeggs
51a506c012 drm/nouveau/core: remove nouveau_mm.mutex, no more users
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:45:05 +10:00
Ben Skeggs
4e67bee8e1 drm/nouveau/vm: take subdev mutex, not the mm, protects against race with vm/nvc0
nvc0_vm_flush() accesses the pgd list, which will soon be able to race
with vm_unlink() during channel destruction.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:45:03 +10:00
Ben Skeggs
15cace5917 drm/nvc0/vm: handle bar tlb flushes internally
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:57 +10:00
Ben Skeggs
ca97a36698 drm/nv50-/vm: take mutex rather than irqsave spinlock
These operations can take quite some time, and we really don't want to
have to hold a spinlock for too long.

Now that the lock ordering for vm and the gr/nv84 hw bug workaround has
been reversed, it's possible to use a mutex here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:50 +10:00
Ben Skeggs
464d636bd0 drm/nv50/vm: remove explicit vm knowledge from engines
This reverses the lock ordering between VM and gr/nv84:nvc0.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:44 +10:00
Ben Skeggs
c3032adb5c drm/nv50/vm: handle bar tlb flushes internally
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:37 +10:00
Ben Skeggs
fec43a722a drm/nvc0/gr: port mp trap handling from calim's kepler code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:32 +10:00
Ben Skeggs
16b133df33 drm/nve0/gr: attempt to resume after sm traps
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:26 +10:00
Ben Skeggs
3d8a6ed247 drm/nve0/gr: s/tp/tpc/
NVIDIA's name...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:20 +10:00
Ben Skeggs
8d6f585d00 drm/nve0/fifo: create our playlists up-front, at startup
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:12 +10:00
Ben Skeggs
da746d4ec9 drm/nva3/clk: minor improvements to fractional N calculation
Helps us to get identical numbers to the binary driver for (at least)
Kepler memory PLLs, and fixes a rounding error.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:06 +10:00
Ben Skeggs
dceef5d87c drm/nouveau/fb: initialise vram controller as pfb sub-object
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:04 +10:00
Ben Skeggs
54ecff3e1a drm/nouveau/clk: change init ordering, no longer needed by devinit
And, will depend on FB/VOLT/DAEMON being ready when it gets initialised
so that it can set/restore clocks.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:44:01 +10:00
Ben Skeggs
88524bc069 drm/nouveau/devinit: move simple pll setting routines to devinit
These are pretty much useless for reclocking purposes.  Lets make it
clearer what they're for and move them to DEVINIT to signify they're
for the very simple PLL setting requirements of running the init
tables.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:54 +10:00
Ben Skeggs
7ada785f18 drm/nouveau: pass generic subdev to calculation routines
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:47 +10:00
Ben Skeggs
aca78e9158 drm/nve0/ce: stub interrupt handler
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:42 +10:00
Ben Skeggs
48506d17d5 drm/nve0/ce: link ce2 to its engine, rather than from graphics
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:36 +10:00
Ben Skeggs
01672ef454 drm/nve0/fifo: copy engine context stored in ramfc, not externally
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:30 +10:00
Ben Skeggs
b0bc5304fe drm/nve0/ce: create engine object for ce2
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:23 +10:00
Ben Skeggs
d53635a980 drm/nouveau: pull in latest ucode builds from external tree
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2013-07-01 13:43:21 +10:00
Al Viro
80537965d0 i810: VM_IO is set by io_remap_pfn_range()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29 12:46:40 +04:00
Al Viro
7922e2d279 drm: io_remap_pfn_range() sets VM_IO...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2013-06-29 12:46:39 +04:00
Paulo Zanoni
b2a1475561 drm/i915: check the return value of intel_dp_i2c_init
We've been ignoring this return value, so print a nice backtrace in
case it's not what we expected.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-28 14:14:19 +02:00
Paulo Zanoni
15b1d171d8 drm/i915: fix the "ghost eDP" encoder unwind path
Because calling intel_dp_encoder_destroy inside
intel_edp_init_connector is just wrong. This is the initialization
path, so we should properly unwind all the initialization through the
whole caller stack.

On the intel_dp_encoder_destroy function we do the following:
1 - Call i2c_del_adapter
2 - Call drm_encoder_cleanup
3 - If edp:
3.1 - Cancel panel_vdd_work
3.2 - Call ironlake_panel_vdd_of_sync
4 - Free the encoder

And here is how we unwind each specific step:
1 - We have intel_dp_init_connector -> intel_dp_i2c_init ->
    i2c_dp_aux_add_bus -> i2c_add_adapter, so we call
    i2c_del_dapter at intel_dp_init_connector
2 - Call it in the same function that called drm_encoder_init
3 - Call it in the same function that called INIT_DELAYED_WORK
4 - Free it in the same function that allocated it

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-28 14:14:19 +02:00
Paulo Zanoni
b2f246a899 drm/i915: fix the "ghost eDP" connector unwind path
Because calling intel_dp_destroy inside intel_edp_init_connector is
just wrong. This is the initialization path, so we should properly
unwind all the initialization through the whole caller stack.

On the intel_dp_destroy function we do the following:
1 - Free edid if it exists
2 - Call intel_panel_fini in case it's eDP
3 - Call drm_sysfs_connector_remove
4 - Call drm_connector_cleanup
5 - Free the connector

And here is how we unwind each specific step:
1 - No need as we still didn't assign anything
2 - No need as we still didn't call intel_panel_init
3 - Call it in the same function that called drm_sysfs_connector_add
4 - Call it in the same function that called drm_connector_init
5 - Free it in the same function that allocated it

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-28 14:14:18 +02:00
Paulo Zanoni
16c255335b drm/i915: propagate errors from intel_dp_init_connector
In case we detect a "ghost eDP", intel_edp_init_connector frees both
the connector and encoder and then returns. On Haswell, intel_ddi_init
then tries to use the freed encoder on the HDMI initialization path
since the following commit:

commit 21a8e6a485
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Apr 10 23:28:35 2013 +0200
    drm/i915: don't setup hdmi for port D edp in ddi_init

So now on intel_ddi_init we check for the "ghost eDP" case and return
without trying to initialize HDMI. This way we won't try to read the
freed "intel_encoder" struct in the next "if" statement.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-28 14:14:17 +02:00
Paulo Zanoni
ed92f0b239 drm/i915: extract intel_edp_init_connector
Because intel_dp_init_connector is too big for my poor little brain.
No functional changes.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-28 14:14:17 +02:00
Paulo Zanoni
acd8db100e drm/i915: don't check encoder at DP connector destroy()
By the time we call intel_dp_destroy (which destroys the connector)
the encoder may have been destroyed already, so if we use it we may be
reading some free memory. That happens in drm_mode_config_cleanup()
and also inside intel_dp_init_connector() when we detect a ghost eDP.

I also hope this may solve some random memory bugs.

Reported by kmemcheck.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-06-28 14:14:16 +02:00
Rahul Sharma
def5e09571 drm/exynos: add support for exynos5420 mixer
Add support for exynos5420 mixer IP in the drm mixer driver.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:57 +09:00
Rahul Sharma
cc57caf0cf drm/exynos: add new compatible strings for hdmi subsystem
This patch adds new combatible strings for hdmi, mixer, ddc
and hdmiphy. It follows the convention of using compatible string
which represent the SoC in which the IP was added for the first
time.

Drivers continue to support the previous compatible strings
but further addition of these compatible strings in device tree
is deprecated.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:57 +09:00
Rahul Sharma
1482995c70 drm/exynos: fix interlace resolutions for exynos5420
Modified code for calculating hdmi IP register values from drm timing
values. The modification is based on the inputs from hw team and specifically
proposed for 1440x576i and 1440x480i. But same changes holds good for other
interlaced resolutions also.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:57 +09:00
Rahul Sharma
5f916e2898 drm/exynos: use of_get_named_gpio to get hdmi hpd gpio
Cleanup by removing flags variable from drm_hdmi_dt_parse_pdata
which is not used anywhere. Swtiching to of_get_named_gpio instead
of of_get_named_gpio_flags solved this.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Acked-by: Seung-Woo Kim <sw0312@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:56 +09:00
Inki Dae
23f340e031 drm/exynos: make sure to handle an error case to vm_mmap call
vm_mmap function returns unsigned long so addr type should be unsigned long.
a pointer or address variable is required to use unsigned long or uint64_t
type for 64bits address support.

So this patch makes sure that addr has unsigned long type and also
exynos_drm_gem_mmap_ioctl returns correct error type.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2013-06-28 21:13:56 +09:00
Sachin Kamat
2fa7b74c7b drm/exynos: exynos_drm_ipp: Remove redundant break statement
'break' after goto statement is redundant. Silences the following
message:
drivers/gpu/drm/exynos/exynos_drm_ipp.c:1067 exynos_drm_ipp_check_valid()
info: ignoring unreachable code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:56 +09:00
Rahul Sharma
59956d35a8 drm/exynos: add mout_hdmi clock in hdmi driver to change parent
HDMI driver needs to configure the mout_hdmi mux clock to change
the parent between sclk_hdmiphy and sclk_pixel.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:56 +09:00
Sean Paul
0bfb1f8bcb drm/exynos: Prepare/Unprepare HDMI subsystem clocks
Change the clk_enable/clk_disable calls in mixer and hdmi drivers into
clk_prepare_enable/clk_disable_unprepare, respectively.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:56 +09:00
YoungJun Cho
cbc4c33d14 drm/exynos: Clean up logs for DRM_ERROR / DRM_DEBUG_KMS
This patch cleans up logs for DRM_ERROR / DRM_DEBUG_KMS to avoid
logging duplicated function name because the macros already contain
 __func__.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:56 +09:00
YoungJun Cho
bca34c9a40 drm/exynos: Remove tracking log functions
This patch removes tracking log functions which were used to debug
in the early development stage and are not so important as were.
So remove them for code clean up.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:13:55 +09:00
Rahul Sharma
16844fb1e6 drm/exynos: hdmi: use drm_display_mode to check the supported modes
This patch renames check_timing to check_mode and removes the
unnecessary conversion of drm_display_mode to/from fb_videomode in
the hdmi driver.

v4:
1) Changed the commit message to add information related to renaming
the callbacks to check_mode.
2) Changed debug message to print 1/0 for interlace mode.

v3:
1) Replaced check_timing callbacks with check_mode.
2) Change the type of second parameter of check_mode callback from void
pointer paramenter to struct drm_display_mode pointer.

v2:
1) Removed convert_to_video_timing().
2) Corrected DRM_DEBUG_KMS to print the resolution properly.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:12:52 +09:00
Tomasz Figa
725ddead50 drm/exynos: fimd: Add support for S3C64xx SoCs
The FIMD block present on S3C6400/S3C6410 SoCs is compatible with this
driver, so it can be supported by it as well.

This patch adds appropriate device IDs and driver data to enable this
driver for S3C64xx SoCs.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:12:51 +09:00
Tomasz Figa
411d9ed448 drm/exynos: fimd: Add support for FIMD variants with clock selection
Some platforms that can be supported this driver has additional clock
source selection bits in VIDCON0 register that allows to select which
clock should be used to drive the pixel clock: bus clock or special
clock.

Since this driver assumes that special clock always drives the pixel
clock, this patch sets the selection bitfield to use the special clock.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:12:51 +09:00
Tomasz Figa
de7af1004b drm/exynos: fimd: Add support for FIMD versions without SHADOWCON register
Some platforms that can be supported with this driver have PRTCON
register instead of SHADOWCON, which requires slightly different
handling.

This patch factors out all register shadow control code from the driver
and adds a function to control register shadowing appropriately,
depending on driver data.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:12:51 +09:00
Tomasz Figa
188734653c drm/exynos: fimd: Hold pointer to driver data in context struct
This patch adds pointer to driver data to fimd_context structure, to
remove the need to call drm_fimd_get_driver_data() each time access to
driver data is necessary.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Acked-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:12:51 +09:00
Inki Dae
7fd65df155 drm/exynos: do not use mode_set_base function directly
This patch adds exynos_drm_crtc_mode_set_commit function
to update mode data and it makes page flip call this function
instead of calling exynos_drm_crtc_mode_set_base function directly.

exynos_drm_crtc_mode_set_base function is called by drm subsystem
as a callback so we don't have to call this function directly.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2013-06-28 21:12:51 +09:00
Sachin Kamat
e436b09dc5 drm/exynos: Remove redundant use of of_match_ptr macro
'mixer_match_types' is always compiled in. Hence of_match_ptr is not
necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:11:48 +09:00
Seung-Woo Kim
ad07945a85 drm/exynos: remove ignoring return value warning in hdmi
The definition of regulator_bulk_enable is fixed with __must_check
and this causes following build warning.
warning: ignoring return value of 'regulator_bulk_enable',
declared with attribute warn_unused_result
This patch fixes to check return value of the function.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:11:48 +09:00
Inki Dae
a7f98d6a92 drm/exynos: fix WINDOWS_NR checking to vidi driver
This patch just checks if win_data array range is valid
or not correctly.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2013-06-28 21:11:48 +09:00
Krzysztof Kozlowski
37b006e88e drm/exynos: fix tests for valid FIMD window number
Valid values for FIMD windows are from 0 to WINDOWS_NR-1
inclusive (5 windows in total). The WINDOWS_NR is also
a size of fimd_context.win_data array.
However, early-return tests for wrong values of windows
accepted a value of WINDOWS_NR which is out of bound
for fimd_context.win_data.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:11:48 +09:00
Krzysztof Kozlowski
1586d80cbf drm/exynos: fix checks for valid mixer window
Valid values for mixer window are from 0 to MIXER_WIN_NR-1 inclusive.
Arrays in structures (e.g. mixer_context.win_data) have size of
MIXER_WIN_NR so checks for wrong mixer window must be greater-equal.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Hyunhee Kim <hyunhee.kim@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
2013-06-28 21:11:48 +09:00
Dave Airlie
d482e5fa29 Revert "drm: kms_helper: don't lose hotplug event"
This reverts commit 160954b7bc.

This was rearming the workqueue with a 0 timeout, causing
a WARN_ON, and possible loop.

Daniel writes:
"I've looked a bit into this and I think we need to have a separate
work struct for recovering these lost hotplug events since the
continuous self-rearming case is a real risk (e.g. if a connector
flip-flops all the time). At least I don't see a sane way to block out
re-arming with the current code in a simple way. So reverting the
offender seems like the right thing and I'll go back to the drawing
board for 3.12."

Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 20:31:34 +10:00
YoungJun Cho
da34242e5e drm/prime: add return check for dma_buf_fd
The dma_buf_fd() can return error when it fails to prepare fd,
so the dma_buf needs to be put.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 14:43:04 +10:00
Seung-Woo Kim
ce92e3c961 drm/prime: reorder drm_prime_add_buf_handle and remove prototype
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 14:42:57 +10:00
Dave Airlie
18097b91aa drm/qxl: add missing access check for execbuffer ioctl
Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 13:27:40 +10:00
YoungJun Cho
7d8f06ac90 drm/prime: fix to put an exported dma_buf for adding handle failure
When drm_prime_add_buf_handle() returns failure for an exported
dma_buf, the dma_buf was already allocated and its refcount was
increased, so it needs to be put.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:49:07 +10:00
Joonyoung Shim
538d6661f5 drm/prime: support to cache mapping
The drm prime also can support it like GEM CMA supports to cache
mapping. It doesn't allow multiple mappings for one attachment.

[airlied: rebased on top of other prime changes]
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:47:32 +10:00
YoungJun Cho
7e3d88f9cc drm/prime: replace NULL with error value in drm_prime_pages_to_sg
Instead of NULL, error value is casted with ERR_PTR() for
drm_prime_pages_to_sg() and IS_ERR_OR_NULL() macro is replaced
with IS_ERR() macro for drm_gem_map_dma_buf().

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:45:19 +10:00
YoungJun Cho
b720d54a5c drm/prime: fix to check return of dma_map_sg in prime helper
The dma_map_sg(), in map_dma_buf callback operation of prime helper,
can return 0 when it fails to map, so it needs to release related
resources.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:45:11 +10:00
YoungJun Cho
2e07fb2293 drm/gem: fix not to assign error value to gem name
If idr_alloc() is failed, obj->name can be error value. Also
it cleans up duplicated flink processing code.

This regression has been introduced in

commit 2e928815c1
Author: Tejun Heo <tj@kernel.org>
Date:   Wed Feb 27 17:04:08 2013 -0800

    drm: convert to idr_alloc()

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: stable@vger.kernel.org
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:31:23 +10:00
YoungJun Cho
4368dd846d drm/gem: add mutex lock when using drm_gem_mmap_obj
The drm_gem_mmap_obj() has to be protected with dev->struct_mutex,
but some caller functions do not. So it adds mutex lock to missing
callers and adds assertion to check whether drm_gem_mmap_obj() is
called with mutex lock or not.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:30:15 +10:00
Dave Airlie
2644ee9614 drm/omap: drop the !FB_OMAP2 dep
This ends up causing circularity and really let people shoot themselves
in the foot.

Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:08:10 +10:00
Maarten Lankhorst
8bd4ce5678 drm/vmwgfx: get rid of ttm_bo_is_reserved usage
Use lockdep_assert_held instead.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:14 +10:00
Maarten Lankhorst
977c38d50e drm/radeon: get rid of ttm_bo_is_reserved usage
Try to use lockdep_assert_held or other alternatives where possible.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:12 +10:00
Maarten Lankhorst
009a9dadb6 drm/ttm: get rid of ttm_bo_is_reserved usage
Use lockdep_assert_held instead.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:10 +10:00
Maarten Lankhorst
3482032457 drm/ttm: inline ttm_bo_reserve and related calls
Makes lockdep a lot more useful.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:09 +10:00
Maarten Lankhorst
c43f9b1699 drm/radeon: inline reservations
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:07 +10:00
Maarten Lankhorst
06597ce8b4 drm/mgag200: inline reservations
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:06 +10:00
Maarten Lankhorst
37c5a52584 drm/cirrus: inline reservations
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:05 +10:00
Maarten Lankhorst
4094dc2a3b drm/ast: inline reservations
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:04 +10:00
Maarten Lankhorst
5e33840511 drm/ttm: convert to the reservation api
Now that the code is compatible in semantics, flip the switch.
Use ww_mutex instead of the homegrown implementation.

ww_mutex uses -EDEADLK to signal that the caller has to back off,
and -EALREADY to indicate this buffer is already held by the caller.

ttm used -EAGAIN and -EDEADLK for those, respectively. So some changes
were needed to handle this correctly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:04:01 +10:00
Maarten Lankhorst
b580c9e2b7 drm/nouveau: make flipping lockdep safe
cli->mutex was inverted with reservations, and multiple reservations were
used without a ticket, fix both. This commit had to be done after the previous
commit, because otherwise ttm_eu_* calls would use a different seqno counter..

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:03:58 +10:00
Maarten Lankhorst
ecff665f5e drm/ttm: make ttm reservation calls behave like reservation calls
This commit converts the source of the val_seq counter to
the ww_mutex api. The reservation objects are converted later,
because there is still a lockdep splat in nouveau that has to
resolved first.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 12:02:20 +10:00
Maarten Lankhorst
8ade2b8281 drm/ast: do not attempt to acquire a reservation while in an interrupt handler
Mutexes should not be acquired in interrupt context. While the trylock
fastpath is arguably safe on all implementations, the slowpath
unlock path definitely isn't.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:56:39 +10:00
Maarten Lankhorst
a06b9a74c7 drm/mgag200: do not attempt to acquire a reservation while in an interrupt handler
Mutexes should not be acquired in interrupt context. While the trylock
fastpath is arguably safe on all implementations, the slowpath
unlock path definitely isn't.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:56:36 +10:00
Maarten Lankhorst
19d4b72c0c drm/cirrus: do not attempt to acquire a reservation while in an interrupt handler
Mutexes should not be acquired in interrupt context. While the trylock
fastpath is arguably safe on all implementations, the slowpath
unlock path definitely isn't. This fixes the following lockdep splat:

[   13.044313] ------------[ cut here ]------------
[   13.044367] WARNING: at /c/kernel-tests/src/tip/kernel/mutex.c:858 mutex_trylock+0x87/0x220()
[   13.044378] DEBUG_LOCKS_WARN_ON(in_interrupt())
[   13.044378] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.0-rc4-00296-ga2963dd #20
[   13.044379] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
[   13.044390]  0000000000000009 ffff88000de039f8 ffffffff81fc86d5 ffff88000de03a38
[   13.044395]  ffffffff810d511b ffff880000000018 ffff88000f33c690 0000000000000001
[   13.044398]  00000000000003f0 ffff88000f4677c8 0000000000000000 ffff88000de03a98
[   13.044400] Call Trace:
[   13.044412]  <IRQ>  [<ffffffff81fc86d5>] dump_stack+0x19/0x1b
[   13.044441]  [<ffffffff810d511b>] warn_slowpath_common+0x6b/0x90
[   13.044445]  [<ffffffff810d51a6>] warn_slowpath_fmt+0x46/0x50
[   13.044448]  [<ffffffff81fd34d7>] mutex_trylock+0x87/0x220
[   13.044482]  [<ffffffff8186484d>] cirrus_dirty_update+0x1cd/0x330
[   13.044486]  [<ffffffff818649e8>] cirrus_imageblit+0x38/0x50
[   13.044506]  [<ffffffff8165782e>] soft_cursor+0x22e/0x240
[   13.044510]  [<ffffffff81656c31>] bit_cursor+0x581/0x5b0
[   13.044525]  [<ffffffff815de9f4>] ? vsnprintf+0x124/0x670
[   13.044529]  [<ffffffff81651333>] ? get_color.isra.16+0x43/0x130
[   13.044532]  [<ffffffff81653fca>] fbcon_cursor+0x18a/0x1d0
[   13.044535]  [<ffffffff816566b0>] ? update_attr.isra.2+0xa0/0xa0
[   13.044556]  [<ffffffff81754b82>] hide_cursor+0x32/0xa0
[   13.044565]  [<ffffffff81755bd3>] vt_console_print+0x103/0x3b0
[   13.044569]  [<ffffffff810d58ac>] ? print_time+0x9c/0xb0
[   13.044576]  [<ffffffff810d5960>] ? print_prefix+0xa0/0xc0
[   13.044580]  [<ffffffff810d63f6>] call_console_drivers.constprop.6+0x146/0x1f0
[   13.044593]  [<ffffffff815f9b38>] ? do_raw_spin_unlock+0xc8/0x100
[   13.044597]  [<ffffffff810d6f27>] console_unlock+0x2f7/0x460
[   13.044600]  [<ffffffff810d787a>] vprintk_emit+0x59a/0x5e0
[   13.044615]  [<ffffffff81fb676c>] printk+0x4d/0x4f
[   13.044650]  [<ffffffff82ba5511>] print_local_APIC+0x28/0x41c
[   13.044672]  [<ffffffff8114db55>] generic_smp_call_function_single_interrupt+0x145/0x2b0
[   13.044688]  [<ffffffff8106f9e7>] smp_call_function_single_interrupt+0x27/0x40
[   13.044697]  [<ffffffff81fd8f72>] call_function_single_interrupt+0x72/0x80
[   13.044707]  <EOI>  [<ffffffff81078166>] ? native_safe_halt+0x6/0x10
[   13.044717]  [<ffffffff811425cd>] ? trace_hardirqs_on+0xd/0x10
[   13.044738]  [<ffffffff8104f669>] default_idle+0x59/0x120
[   13.044742]  [<ffffffff810501e8>] arch_cpu_idle+0x18/0x40
[   13.044754]  [<ffffffff811320c5>] cpu_startup_entry+0x235/0x410
[   13.044763]  [<ffffffff81f9e781>] rest_init+0xd1/0xe0
[   13.044766]  [<ffffffff81f9e6b5>] ? rest_init+0x5/0xe0
[   13.044778]  [<ffffffff82b93ec2>] start_kernel+0x425/0x493
[   13.044781]  [<ffffffff82b93810>] ? repair_env_string+0x5e/0x5e
[   13.044786]  [<ffffffff82b93595>] x86_64_start_reservations+0x2a/0x2c
[   13.044789]  [<ffffffff82b93688>] x86_64_start_kernel+0xf1/0x100
[   13.044799] ---[ end trace 113ad28772af4058 ]---

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:56:30 +10:00
Maarten Lankhorst
1107276c8a drm/nouveau: always select ACPI_VIDEO if ACPI is enabled.
Having nouveau builtin would still allow ACPI_VIDEO to be used as external module
if some of the deps for acpi_video have not been met, which would result in a linking
failure. Solve this by selecting all dependencies as well.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:56:22 +10:00
Maarten Lankhorst
27f06b2dbb drm/nouveau: complain loudly if buffer is pinned during destruction
Shouldn't happen, and we invert the struct_mutex with reservation here,
potentially leading to deadlocks. Once reservations become lockdep annotated,
lockdep will go splat on this.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:56:11 +10:00
Maarten Lankhorst
1e2bd5f53b drm/nouveau: fixup fbcon failure paths
Add missing calls, and fix a leak from forgetting to call the unpin function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:56:00 +10:00
Maarten Lankhorst
198c14a0da drm/nouveau: unpin notify object in chan_fini
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:55:48 +10:00
Maarten Lankhorst
1af7c7dd21 drm/nouveau: implement prime helper unpin function
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:55:34 +10:00
Maarten Lankhorst
280cf21186 drm/radeon: implement unpin function, v2
Changes since v1:
- Fixup compiler warning in unpin function.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-06-28 11:55:11 +10:00
Dave Airlie
5b0207bb59 Merge branch 'drm-next-3.11' of git://people.freedesktop.org/~agd5f/linux into drm-next
This is the pull request for radeon for 3.11.  Highlights include:

- Support for CIK (Sea Islands) asics: 3D, compute, UVD
- DPM (Dynamic Power Management) support for 6xx-SI
- ASPM support for 6xx-SI
- Assorted bug fixes

* 'drm-next-3.11' of git://people.freedesktop.org/~agd5f/linux: (168 commits)
  drm/radeon/SI: fix TDP adjustment in set_power_state
  drm/radeon/NI: fix TDP adjustment in set_power_state
  drm/radeon: fix endian issues in atombios dpm code
  drm/radeon/dpm: fix UVD clock setting on SI
  drm/radeon/dpm: fix UVD clock setting on cayman
  drm/radeon/dpm: add support for setting UVD clock on rv6xx
  drm/radeon/dpm: add support for setting UVD clock on rs780
  drm/radeon: fix typo in ni_print_power_state
  drm/radeon: fix typo in cik_select_se_sh()
  drm/radeon/si: fix typo in function name
  drm/radeon/dpm: fix typo in setting uvd clock
  drm/radeon/dpm: add dpm_set_power_state failure output (si)
  add dpm_set_power_state failure output (7xx-ni)
  drm/radeon/dpm: add dpm_set_power_state failure output (7xx-ni)
  drm/radeon/dpm: add dpm_enable failure output (si)
  drm/radeon/dpm: add dpm_enable failure output (7xx-ni)
  drm/radeon/kms: add dpm support for SI (v7)
  drm/radeon: switch SI to use radeon_ucode.h
  drm/radeon: add SI to r600_is_internal_thermal_sensor()
  drm/radeon/dpm/rs780: properly catch errors in dpm setup
  ...
2013-06-28 10:53:23 +10:00
Dave Airlie
28419261b0 Merge tag 'drm-intel-next-2013-06-18' of git://people.freedesktop.org/~danvet/drm-intel into drm-next
Last 3.11 feature pull. I have a few odds bits and pieces and fixes in my
queue, I'll sort them out later on to see what's for 3.11-fixes and what's
for 3.12. But nothing to hold this here up imo.

Highlights:
- more hangcheck work from Mika and Chris to prepare for arb robustness
- trickle feed fixes from Ville
- first parts of the shared pch pll rework, with some basic hw state
  readout and cross-checking (this shuts up the confused pch pll refcount
  WARN that Linus just recently forwarded)
- Haswell audio power well support from Wang Xingchao (alsa bits acked by
  Takashi)
- some cleanups and asserts sprinkling around the plane/gamma enabling
  sequence from Ville
- more gtt refactoring from Ben
- clear up the adjusted->mode vs. pixel clock vs. port clock confusion
- 30bpp support, this time for real hopefully

* tag 'drm-intel-next-2013-06-18' of git://people.freedesktop.org/~danvet/drm-intel: (97 commits)
  drm/i915: remove a superflous semi-colon
  drm/i915: Kill useless "Enable panel fitter" comments
  drm/i915: Remove extra "ring" from error message
  drm/i915: simplify the reduced clock handling for pch plls
  drm/i915: stop killing pfit on i9xx
  drm/i915: explicitly set up PIPECONF (and gamma table) on haswell
  drm/i915: set up PIPECONF explicitly for i9xx/vlv platforms
  drm/i915: set up PIPECONF explicitly on ilk-ivb
  drm/i915: find guilty batch buffer on ring resets
  drm/i915: store ring hangcheck action
  drm/i915: add batch bo to i915_add_request()
  drm/i915: change i915_add_request to macro
  drm/i915: add i915_gem_context_get_hang_stats()
  drm/i915: add struct i915_ctx_hang_stats
  drm/i915: Try harder to disable trickle feed on VLV
  drm/i915: fix up pch pll enabling for pixel multipliers
  drm/i915: hw state readout and cross-checking for shared dplls
  drm/i915: WARN on lack of shared dpll
  drm/i915: split up intel_modeset_check_state
  drm/i915: extract readout_hw_state from setup_hw_state
  ...

Conflicts:
	drivers/gpu/drm/i915/intel_display.c
	drivers/gpu/drm/i915/intel_fb.c
	drivers/gpu/drm/i915/intel_sdvo.c
2013-06-28 09:50:34 +10:00
Alex Deucher
a144acbcfb drm/radeon/SI: fix TDP adjustment in set_power_state
Fixes hangs with DPM in some cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:16 -04:00
Alex Deucher
728cf6bb4d drm/radeon/NI: fix TDP adjustment in set_power_state
Fixes hangs with DPM in some cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:15 -04:00
Alex Deucher
6e764764d5 drm/radeon: fix endian issues in atombios dpm code
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:15 -04:00
Alex Deucher
e34568b892 drm/radeon/dpm: fix UVD clock setting on SI
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:14 -04:00
Alex Deucher
d434e81e59 drm/radeon/dpm: fix UVD clock setting on cayman
The rv770 version was using the wrong power state type.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:13 -04:00
Alex Deucher
02478a102b drm/radeon/dpm: add support for setting UVD clock on rv6xx
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:12 -04:00
Alex Deucher
915203c187 drm/radeon/dpm: add support for setting UVD clock on rs780
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:12 -04:00
Alex Deucher
71de795c6c drm/radeon: fix typo in ni_print_power_state
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:11 -04:00
Alex Deucher
b0fe3d39f6 drm/radeon: fix typo in cik_select_se_sh()
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:10 -04:00
Alex Deucher
ba19031a80 drm/radeon/si: fix typo in function name
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:10 -04:00
Alex Deucher
e38bb5aeef drm/radeon/dpm: fix typo in setting uvd clock
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:09 -04:00
Alex Deucher
cc833b6088 drm/radeon/dpm: add dpm_set_power_state failure output (si)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:08 -04:00
Alex Deucher
173dbb0ef6 add dpm_set_power_state failure output (7xx-ni)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:08 -04:00
Alex Deucher
72dd2c54ee drm/radeon/dpm: add dpm_set_power_state failure output (7xx-ni)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:07 -04:00
Alex Deucher
2c48febb47 drm/radeon/dpm: add dpm_enable failure output (si)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:06 -04:00
Alex Deucher
fa4b5471bd drm/radeon/dpm: add dpm_enable failure output (7xx-ni)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:05 -04:00
Alex Deucher
a9e6141092 drm/radeon/kms: add dpm support for SI (v7)
This adds dpm support for SI asics.  This includes:
- dynamic engine clock scaling
- dynamic memory clock scaling
- dynamic voltage scaling
- dynamic pcie gen1/gen2/gen3 switching
- power containment
- shader power scaling

Set radeon.dpm=1 to enable.

v2: enable hainan support, rebase
v3: guard acpi stuff
v4: fix 64 bit math
v5: fix 64 bit div harder
v6: fix thermal interrupt check noticed by Jerome
v7: attempt fix state enable

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:40:05 -04:00
Dave Airlie
4a00908597 Merge branch 'drm/for-next' of git://anongit.freedesktop.org/tegra/linux into drm-next
These changes are mostly minor fixes to things introduced in 3.10. The
biggest chunk is updates to the host1x firewall which checks job
submissions from userspace and wasn't working properly. All other
patches are mostly one-liners. Nothing new or too exciting this time
around.

* 'drm/for-next' of git://anongit.freedesktop.org/tegra/linux:
  gpu: host1x: Rework CPU syncpoint increment
  gpu: host1x: Fix client_managed type
  gpu: host1x: Fix memory access in syncpt request
  gpu: host1x: Copy gathers before verification
  gpu: host1x: Don't reset firewall between gathers
  gpu: host1x: Check reloc table before usage
  gpu: host1x: Check INCR opcode correctly
  drm/tegra: Remove DRIVER_BUS_PLATFORM from driver_features
  drm/tegra: Fix return value
  drm/tegra: Include header drm/drm.h
  MAINTAINERS: Update Tegra DRM entry
  drm/tegra: fix error return code in gr2d_submit()
  drm/tegra: fix missing unlock on error
  drm/tegra: Honor pixel-format changes
  drm/tegra: Explicitly set irq_enabled
  drm/tegra: Don't disable unused planes
2013-06-28 09:29:04 +10:00
Alex Deucher
a0ceada6b4 drm/radeon: switch SI to use radeon_ucode.h
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:53 -04:00
Alex Deucher
ac1633876f drm/radeon: add SI to r600_is_internal_thermal_sensor()
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:52 -04:00
Alex Deucher
a172230f19 drm/radeon/dpm/rs780: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:52 -04:00
Alex Deucher
ac0cdcb514 drm/radeon/dpm/r6xx: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:51 -04:00
Alex Deucher
b97721f311 drm/radeon/dpm/r7xx: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:50 -04:00
Alex Deucher
c3efac0d5b drm/radeon/dpm/trinity: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:49 -04:00
Alex Deucher
2c47b063a0 drm/radeon/dpm/sumo: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:48 -04:00
Alex Deucher
1f67df4df7 drm/radeon/dpm/evergreen: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:47 -04:00
Alex Deucher
aafb3afa59 drm/radeon/dpm/btc: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:46 -04:00
Alex Deucher
79fb809a5d drm/radeon/dpm/ni: properly catch errors in dpm setup
We weren't properly catching errors in dpm_enable()
and dpm_set_power_state().

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:44 -04:00
Alex Deucher
779187f2c3 drm/radeon/atom: fix voltage table parsing
The arrays items are variable sized.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:42 -04:00
Alex Deucher
da289525b6 drm/radeon: fix typo in atom voltage table handling (si+)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:42 -04:00
Alex Deucher
7a80c2c9a9 drm/radeon: fix typo in atom voltage table handling (6xx-ni)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:41 -04:00
Alex Deucher
4bd9f516f6 drm/radeon/dpm: add pcie gen helper function
Add a helper function to determine the preferred
pcie gen based on the card, system, and circumstance.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:40 -04:00
Alex Deucher
2abba66e7a drm/radeon: update radeon_atombios_get_default_voltages for mvdd
Add a way to look up the bootup mvdd.  Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:40 -04:00
Alex Deucher
4489cd62e5 drm/radeon/dpm: validate voltages against dispclk requirements
Validate the voltages against the voltage requirements of the
dispclk.  We currently don't adjust the disp clock so it never
changes, but we need to filter out voltage levels that are too
low none the less.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:39 -04:00
Alex Deucher
f907eec036 drm/radeon: fix some memory leaks in extended table parsing
Forgot to free some structs when allocation fails for some
tables.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:38 -04:00
Alex Deucher
b253e4b359 drm/radeon/dpm/cayman: use new fixed point functions (v2)
Use the new fixed point functions for leakage
calculations on cayman.

v2: fix up 64 bit math

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:38 -04:00
Alex Deucher
9ed36f7505 drm/radeon: minor sid.h cleanup
Consolidate the non-register defines.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:36 -04:00
Alex Deucher
7178d2a642 drm/radeon/dpm: save some display parameters for DPM
Required for SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:36 -04:00
Alex Deucher
a5cb318e3f drm/radeon/dpm: pull in ppm info from atom
Used by SI dpm.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:35 -04:00
Alex Deucher
9985318b7f drm/radeon/dpm: endian fixes for extended power tables
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:34 -04:00
Alex Deucher
929ee7a8b3 drm/radeon/dpm: pull in phase shedding limits from atom
Required for dpm on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:34 -04:00
Alex Deucher
32ce4652dc drm/radeon/dpm: add an enum for pcie gen selection
This makes it easier the understand what the code is
doing.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:33 -04:00
Alex Deucher
f8f84ac5d4 drm/radeon: implement clock and power gating for SI
Only Cape Verde supports power gating.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:32 -04:00
Alex Deucher
bd8cd5391a drm/radeon: add clearstate init for verde power gating
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:31 -04:00
Alex Deucher
6d8cf0005d drm/radeon: initialize save/restore buffer for pg on verde
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:31 -04:00
Alex Deucher
93656cdd3c drm/radeon: add indirect accessors for UVD CTX registers
These are needed for certain UVD power saving features.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:30 -04:00
Alex Deucher
beb79f40b8 drm/radeon: add atom get leakage vddc function
Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:29 -04:00
Alex Deucher
d719cef316 drm/radeon: update rlc programming sequence on SI
This is required for certain power management features.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:29 -04:00
Alex Deucher
8ba104637b drm/radeon: enable additional power gating features on trinity
TN has some additional powergating features beyond what is
supported on ON/LN.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:28 -04:00
Alex Deucher
e0bcf1654d drm/radeon: add support for ASPM on SI asics (v2)
Enables PCIE ASPM (Active State Power Management) on
SI asics.

v2: fix typo

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:27 -04:00
Alex Deucher
f52382d73e drm/radeon: add support for ASPM on evergreen asics
Enables PCIE ASPM (Active State Power Management) on
evergreen-cayman asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:27 -04:00
Alex Deucher
792edd6957 drm/radeon: add accessors of pif_phy indirect register space
Required for accessing certain pcie related registers.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:26 -04:00
Alex Deucher
b9d305dfb6 drm/radeon: implement pcie gen2/3 support for SI
If both the motherboard and GPU support pcie gen2 or 3,
enable it.  PCIE gen2 and 3 offer more bandwidth than
pcie gen1.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:25 -04:00
Alex Deucher
6517194417 drm/radeon: update radeon_atom_get_voltage_table() for SI
SI uses a new atom table revision.  Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:25 -04:00
Alex Deucher
58653abdd2 drm/radeon: update radeon_atom_is_voltage_gpio() for SI
SI uses a new atom table.  Required for DPM on SI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:24 -04:00
Alex Deucher
eaa778aff0 drm/radeon/atom: add helper to calcuate mpll params
There's a new table for calculating the memory pll
parameters on SI.  Required for SI DPM support.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:23 -04:00
Alex Deucher
e37e6a0e4f drm/radeon: implement apci perf request
These functions use acpi methods to adjust the pcie
gen speed.  Used by DPM.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:23 -04:00
Alex Deucher
9d45ad5aff drm/radeon/dpm: remove local sumo_get_xclk()
Use the new asic callback instead.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:22 -04:00
Alex Deucher
a5b91af2e2 drm/radeon: add missing UVD clock set in cayman dpm code
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:21 -04:00
Alex Deucher
89c9bc5651 drm/radeon/dpm: remove broken dyn state remnants
Now that the proper fix has been implemented I can
remove the last remnants of the initial implementation.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:21 -04:00
Alex Deucher
fee3d744bf drm/radeon/dpm: add pre/post_set_power_state callback (cayman)
This properly implemented dynamic state adjustment by
using a working copy of the requested and current
power states.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:20 -04:00
Alex Deucher
e8a9539fa0 drm/radeon/dpm: add pre/post_set_power_state callback (BTC)
This properly implemented dynamic state adjustment by
using a working copy of the requested and current
power states.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:19 -04:00
Alex Deucher
a284c48ae7 drm/radeon/dpm: add pre/post_set_power_state callback (TN)
This properly implemented dynamic state adjustment by
using a working copy of the requested and current
power states.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:18 -04:00
Alex Deucher
422a56bc8a drm/radeon/dpm: add pre/post_set_power_state callback (sumo)
This properly implemented dynamic state adjustment by
using a working copy of the requested and current
power states.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:18 -04:00
Alex Deucher
98243917d7 drm/radeon/dpm: add pre/post_set_power_state callbacks (6xx-eg)
For r6xx-evergreen, they are no-ops as they don't support
any dynamic state adjustment.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:17 -04:00
Alex Deucher
84dd192826 drm/radeon/dpm: add new pre/post_set_power_state callbacks
Needed to properly handle dynamic state adjustment.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-06-27 19:16:16 -04:00