GitHub/LineageOS/android_kernel_motorola_exynos9610.git
13 years agodrm/i915/dp: Fix the math in intel_dp_link_required
Adam Jackson [Fri, 14 Oct 2011 16:43:49 +0000 (12:43 -0400)]
drm/i915/dp: Fix the math in intel_dp_link_required

The previous code was confused about units, which is pretty reasonable
given that the units themselves are confusing.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915/panel: Always record the backlight level again (but cleverly)
Takashi Iwai [Fri, 14 Oct 2011 09:45:40 +0000 (11:45 +0200)]
drm/i915/panel: Always record the backlight level again (but cleverly)

The commit 47356eb67285014527a5ab87543ba1fae3d1e10a introduced a
mechanism to record the backlight level only at disabling time, but it
also introduced a regression.  Since intel_lvds_enable() may be called
without disabling (e.g. intel_lvds_commit() calls it unconditionally),
the backlight gets back to the last recorded value.  For example, this
happens when you dim the backlight, close the lid and open the lid,
then the backlight suddenly goes to the brightest.

This patch fixes the bug by recording the backlight level always
when changed via intel_panel_set_backlight().  And,
intel_panel_{enable|disable}_backlight() call the internal function not
to update the recorded level wrongly.

Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoi915: Move i915_read/write out of line
Andi Kleen [Thu, 13 Oct 2011 23:08:51 +0000 (16:08 -0700)]
i915: Move i915_read/write out of line

With the tracing code in there they are far too big to inline.

.text savings compared to a non force inline kernel:

i915_restore_display                        4393   12036   +7643
i915_save_display                           4295   11459   +7164
i915_handle_error                           2979    6666   +3687
i915_driver_irq_handler                     2923    5086   +2163
i915_ringbuffer_info                         458    1661   +1203
i915_save_vga                                  -    1200   +1200
i915_driver_irq_uninstall                    453    1624   +1171
i915_driver_irq_postinstall                  913    2078   +1165
ironlake_enable_drps                         719    1872   +1153
i915_restore_vga                               -    1142   +1142
intel_display_capture_error_state            784    2030   +1246
intel_init_emon                              719    2016   +1297

and more ...

[AK: these are older numbers, with the new SNB forcewake checks
it will be even worse]

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: remove transcoder PLL mashing from mode_set per specs
Jesse Barnes [Thu, 13 Oct 2011 17:08:34 +0000 (10:08 -0700)]
drm/i915: remove transcoder PLL mashing from mode_set per specs

Belongs in PCH enable instead.  The duplication is worrying and the
specs explicitly list transcoder select *after* actual PLL enable, which
doesn't occur until later.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: if transcoder disable fails, say which
Jesse Barnes [Thu, 13 Oct 2011 16:46:32 +0000 (09:46 -0700)]
drm/i915: if transcoder disable fails, say which

Just some extra debug output.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: set watermarks for third pipe on IVB
Jesse Barnes [Wed, 12 Oct 2011 22:36:42 +0000 (15:36 -0700)]
drm/i915: set watermarks for third pipe on IVB

The watermark reg for the third pipe is in an unusual offset; add
support for it and set watermarks for 3 pipe configs.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: export a CPT mode set verification function
Jesse Barnes [Tue, 11 Oct 2011 17:43:02 +0000 (10:43 -0700)]
drm/i915: export a CPT mode set verification function

At the point where we check, we can't do much about the failure, but it
can aid debugging.  Note that the auto-train override bit will be reset
as part of normal mode setting with this patch if a pipe ever does get
stuck, but that's consistent with the workaround for CPT provided by the
hardware team.  This patch helped catch the fact that the pipe wasn't
running in the !composite sync FDI case on my IVB SDV, so has already
shown to be useful.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: fix transcoder PLL select masking
Jesse Barnes [Wed, 12 Oct 2011 22:01:33 +0000 (15:01 -0700)]
drm/i915: fix transcoder PLL select masking

Transcoder A will always use PLL A and transcoder B will use PLL B.  But
transcoder C could use either, so always mask the select bits off before
or'ing in a new value.

Reported-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: fix IVB cursor support
Jesse Barnes [Wed, 12 Oct 2011 18:10:21 +0000 (11:10 -0700)]
drm/i915: fix IVB cursor support

The cursor regs have moved around, add the offsets and new macros for
getting at them.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: fix debug output for 3 pipe configs
Jesse Barnes [Wed, 12 Oct 2011 17:49:14 +0000 (10:49 -0700)]
drm/i915: fix debug output for 3 pipe configs

We can have more than just A and B these days.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: add PLL sharing support to handle 3 pipes
Jesse Barnes [Wed, 12 Oct 2011 16:51:31 +0000 (09:51 -0700)]
drm/i915: add PLL sharing support to handle 3 pipes

Add two new fields to the intel_crtc struct for 3 pipe support: no_pll
and use_pll_a.  The no_pll field is only set on the 3rd pipe to indicate
that it doesn't have a PLL of its own and so shouldn't try to write the
main PLL regs.  The use_pll_a field controls which PLL pipe 3 will
share, A or B.  The core code will try to share PLLs with whichever pipe
has the same timings, rejecting the mode set if none is found.  This
means that pipe 3 must always be set after one of the other pipes has
been configured with real PLL settings.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: fix PCH PLL assertion check for 3 pipes
Jesse Barnes [Wed, 12 Oct 2011 16:27:42 +0000 (09:27 -0700)]
drm/i915: fix PCH PLL assertion check for 3 pipes

Add a couple of checks now that we're using the 3rd transcoder:
  1) make sure the transcoder PLL enable bit is set for the transcoder
     in question
  2) when checking actual PLL enable, use the selected PLL number rather
     than the transcoder number (they could be different now)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: use transcoder select bits on VGA and HDMI on CPT
Jesse Barnes [Wed, 12 Oct 2011 16:01:58 +0000 (09:01 -0700)]
drm/i915: use transcoder select bits on VGA and HDMI on CPT

Required for 3 pipe functionality.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: split refclk code out of ironlake_crtc_mode_set
Jesse Barnes [Fri, 2 Sep 2011 20:03:05 +0000 (13:03 -0700)]
drm/i915: split refclk code out of ironlake_crtc_mode_set

Just a cleanup to make the mode_set function more manageable.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: support 3 pipes on IVB+
Jesse Barnes [Fri, 2 Sep 2011 19:54:37 +0000 (12:54 -0700)]
drm/i915: support 3 pipes on IVB+

Well almost anyway.  IVB has 3 planes, pipes, transcoders, and FDI
interfaces, but only 2 pipe PLLs.  So two of the pipes must use the same
pipe timings (e.g. 2 DP plus one other, or two HDMI with the same mode
and one other, etc.).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: PLL macro cleanup and pipe assertion check
Jesse Barnes [Fri, 2 Sep 2011 19:52:11 +0000 (12:52 -0700)]
drm/i915: PLL macro cleanup and pipe assertion check

Add a macro for accessing the two pipe PLLs and add a check to make sure
we don't access a non-existent one in the enable/disable functions.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: always set FDI composite sync bit
Jesse Barnes [Mon, 10 Oct 2011 21:28:52 +0000 (14:28 -0700)]
drm/i915: always set FDI composite sync bit

It's needed for 3 pipe support as well as just regular functionality
(e.g. DisplayPort).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Adam Jackson <ajax@redhat.com>
Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Use PIPE_CONTROL for flushing on gen6+.
Jesse Barnes [Sun, 16 Oct 2011 08:23:31 +0000 (10:23 +0200)]
drm/i915: Use PIPE_CONTROL for flushing on gen6+.

v2 by danvet: Use a new flag to flush the render target cache on gen6+
(hw reuses the old write flush bit), as suggested by Ben Widawsdy.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
[danvet: this seems to fix cairo-perf-trace hangs on my snb]
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Rename PIPE_CONTROL bit defines to be less terse.
Kenneth Graunke [Tue, 11 Oct 2011 21:41:09 +0000 (23:41 +0200)]
drm/i915: Rename PIPE_CONTROL bit defines to be less terse.

"STALL_AT_SCOREBOARD" is much clearer than "STALL_EN" now that there are
several different kinds of stalls.  Also, "INSTRUCTION_CACHE_INVALIDATE"
is a lot easier to understand at a glance than the terse "IS_FLUSH."

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
[danvet: use INVALIDATE for ro cache flags for more consistency]
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Remove implied length of 2 from GFX_OP_PIPE_CONTROL #define.
Kenneth Graunke [Tue, 11 Oct 2011 21:41:08 +0000 (23:41 +0200)]
drm/i915: Remove implied length of 2 from GFX_OP_PIPE_CONTROL #define.

Not all PIPE_CONTROLs have a length of 2, so remove it from the #define
and make each invocation specify the desired length.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
[danvet: implement style suggestion from Ben Widawsdy]
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm: Add Panel Self Refresh DP addresses
Ben Widawsky [Tue, 4 Oct 2011 22:16:48 +0000 (15:16 -0700)]
drm: Add Panel Self Refresh DP addresses

Add the addresses and definitions I care about for Panel Self Refresh, as
documented in the eDP spec.

I'm sending these out before some other patches because this should be a fairly
simple one to get upstream and not require too much fuss (where the others may
have some fuss).

This file is a mess with white spacing. I tried to stay consistent with the
surrounding code.

v2: had some silly mistakes in v1 which Keith caught

Cc: Dave Airlie <airlied@redhat.com>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: ILK + VT-d workaround
Ben Widawsky [Mon, 17 Oct 2011 22:51:55 +0000 (15:51 -0700)]
drm/i915: ILK + VT-d workaround

Idle the GPU before doing any unmaps. We know if VT-d is in use through
an exported variable from iommu code.

This should avoid a known HW issue.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Remove early exit on i915_gpu_idle
Ben Widawsky [Mon, 17 Oct 2011 22:51:54 +0000 (15:51 -0700)]
drm/i915: Remove early exit on i915_gpu_idle

[Description from: Daniel Vetter]
I've just discussed this quickly with Chris on irc and it's probably
best to just kill the list_empty early bailout. gpu_idle isn't a
fastpath, so who cares. One candidate where we emit commands to the ring
without adding anything onto these lists is e.g. pageflip. There are
probably more.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agointel-iommu: Export a flag indicating that the IOMMU is used for iGFX.
David Woodhouse [Mon, 17 Oct 2011 22:51:53 +0000 (15:51 -0700)]
intel-iommu: Export a flag indicating that the IOMMU is used for iGFX.

We really don't want this to work in the general case; device drivers
*shouldn't* care whether they are behind an IOMMU or not. But the
integrated graphics is a special case, because the IOMMU and the GTT are
all kind of smashed into one and generally horrifically buggy, so it's
reasonable for the graphics driver to want to know when the IOMMU is
active for the graphics hardware.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agointel-iommu: Workaround IOTLB hang on Ironlake GPU
David Woodhouse [Mon, 17 Oct 2011 22:51:52 +0000 (15:51 -0700)]
intel-iommu: Workaround IOTLB hang on Ironlake GPU

To work around a hardware issue, we have to submit IOTLB flushes while
the graphics engine is idle. The graphics driver will (we hope) go to
great lengths to ensure that it gets that right on the affected
chipset(s)... so let's not screw it over by deferring the unmap and
doing it later. That wouldn't be very helpful.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: drop KM_USER0 argument to k(un)map_atomic
Daniel Vetter [Sat, 17 Sep 2011 18:55:46 +0000 (20:55 +0200)]
drm/i915: drop KM_USER0 argument to k(un)map_atomic

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoio-mapping: ensure io_mapping_map_atomic _is_ atomic
Daniel Vetter [Wed, 28 Sep 2011 09:57:23 +0000 (11:57 +0200)]
io-mapping: ensure io_mapping_map_atomic _is_ atomic

For the !HAVE_ATOMIC_IOMAP case the stub functions did not call
pagefault_disable/_enable. The i915 driver relies on the map
actually being atomic, otherwise it can deadlock with it's own
pagefault handler in the gtt pwrite fastpath.

This is exercised by gem_mmap_gtt from the intel-gpu-toosl gem
testsuite.

v2: Chris Wilson noted the lack of an include.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38115
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Defend against userspace creating a gem object with size==0
Chris Wilson [Wed, 14 Sep 2011 12:14:28 +0000 (14:14 +0200)]
drm/i915: Defend against userspace creating a gem object with size==0

We currently only round up the userspace size to the next page. We
assume that userspace hasn't made a mistake and requested a zero-length
gem object and all through our internal code we then presume that every
object is backed by at least a single page. Fix that oversight and
report EINVAL back to userspace if they try to create a zero length
object.

[danvet: This fixes tests/gem_bad_length]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: simplify swapin/out swizzle checking a bit
Daniel Vetter [Mon, 12 Sep 2011 19:30:02 +0000 (21:30 +0200)]
drm/i915: simplify swapin/out swizzle checking a bit

Use the helper function already employed by the pwrite/pread
functions.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: fix swizzling on gen6+
Daniel Vetter [Mon, 12 Sep 2011 18:49:16 +0000 (20:49 +0200)]
drm/i915: fix swizzling on gen6+

Fixes tests/gem_tiled_pread on my snb. I know, mesa doesn't use this
on gen6+, but I also hate failing testcases.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: properly cancel rps_work on module unload v2
Daniel Vetter [Thu, 8 Sep 2011 12:00:22 +0000 (14:00 +0200)]
drm/i915: properly cancel rps_work on module unload v2

The rps disabling code wasn't properly cancelling outstanding work
items. Also add a comment that explains why we're not racing with
the work item that could unmask interrupts - that piece of code
confused me quite a bit.

v2: Ben Widawsky pointed out that the first patch would deadlock
(and a few lesser problems). All corrected.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: close PM interrupt masking races in the rps work func
Daniel Vetter [Thu, 8 Sep 2011 12:00:21 +0000 (14:00 +0200)]
drm/i915: close PM interrupt masking races in the rps work func

This patch closes the following race:

We get a PM interrupt A, mask it, set dev_priv->iir = PM_A and kick of the
work item. Scheduler isn't grumpy, so the work queue takes rps_lock,
grabs pm_iir = dev_priv->pm_iir and pm_imr = READ(PMIMR). Note that
pm_imr == pm_iir because we've just masked the interrupt we've got.

Now hw sends out PM interrupt B (not masked), we process it and mask
it.  Later on the irq handler also clears PMIIR.

Then the work item proceeds and at the end clears PMIMR. Because
(local) pm_imr == pm_iir we have
        pm_imr & ~pm_iir == 0
so all interrupts are enabled.

Hardware is still interrupt-happy, and sends out a new PM interrupt B.
PMIMR doesn't mask B (it does not mask anything), PMIIR is cleared, so
we get it and hit the WARN in the interrupt handler (because
dev_priv->pm_iir == PM_B).

That's why I've moved the
        WRITE(PMIMR, 0)
up under the protection of the rps_lock. And write an uncoditional 0
to PMIMR, because that's what we'll do anyway.

This races looks much more likely because we can arbitrarily extend
the window by grabing dev->struct mutex right after the irq handler
has processed the first PM_B interrupt.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: close PM interrupt masking races in the irq handler
Daniel Vetter [Thu, 8 Sep 2011 12:00:20 +0000 (14:00 +0200)]
drm/i915: close PM interrupt masking races in the irq handler

Quoting Chris Wilson's more concise description:

"Ah I think I see the problem. As you point out we only mask the current
interrupt received, so that if we have a task pending (and so IMR != 0) we
actually unmask the pending interrupt and so could receive it again before the
tasklet is finally kicked off by the grumpy scheduler."

We need the hw to issue PM interrupts A, B, A while the scheduler is hating us
and refuses to run the rps work item. On receiving PM interrupt A we hit the
WARN because

dev_priv->pm_iir == PM_A | PM_B

Also add a posting read as suggested by Chris to ensure proper ordering of the
writes to PMIMR and PMIIR. Just in case somebody weakens write ordering.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Remove redundant bit shifting from intel_gmbus_set_speed
Adam Jackson [Thu, 16 Jun 2011 20:36:28 +0000 (16:36 -0400)]
drm/i915: Remove redundant bit shifting from intel_gmbus_set_speed

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Rename intel_sdvo_hdmi_sink_detect
Adam Jackson [Thu, 16 Jun 2011 20:36:25 +0000 (16:36 -0400)]
drm/i915: Rename intel_sdvo_hdmi_sink_detect

This is general TMDS detect, not HDMI specifically.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Fix multifunction SDVO detection
Adam Jackson [Thu, 16 Jun 2011 20:36:24 +0000 (16:36 -0400)]
drm/i915: Fix multifunction SDVO detection

I can't think of any sensible reason to limit this to a mask of 0x0f,
ie, SDVO_OUTPUT_{TMDS,RGB,CVBS,SVID}0.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Remove "i2c_speed" nonsense from child device table
Adam Jackson [Thu, 16 Jun 2011 20:36:23 +0000 (16:36 -0400)]
drm/i915: Remove "i2c_speed" nonsense from child device table

I have no evidence for this byte being used this way, and lots of
counterexamples.  Restore the struct to its empirical definition and
patch up gmbus setup to match.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoMerge branch 'fix-pch-refclk' into foo
Keith Packard [Thu, 20 Oct 2011 21:10:43 +0000 (14:10 -0700)]
Merge branch 'fix-pch-refclk' into foo

13 years agoMerge branch 'edp-training-fixes' into drm-intel-next
Keith Packard [Thu, 20 Oct 2011 20:40:33 +0000 (13:40 -0700)]
Merge branch 'edp-training-fixes' into drm-intel-next

Conflicts:
drivers/gpu/drm/i915/intel_dp.c

Just whitespace change conflicts

13 years agodrm/i915: No need to wait for eDP power off delay if panel is on
Keith Packard [Thu, 29 Sep 2011 23:51:26 +0000 (16:51 -0700)]
drm/i915: No need to wait for eDP power off delay if panel is on

If the panel is powered up, there's no need to delay for the 'off'
interval when turning the panel on.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Restrict ILK-specific eDP power hack to ILK
Keith Packard [Thu, 29 Sep 2011 23:33:01 +0000 (16:33 -0700)]
drm/i915: Restrict ILK-specific eDP power hack to ILK

This eliminates a fairly long delay when power sequencing newer
hardware

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Disable eDP VDD in a delayed work proc instead of synchronously
Keith Packard [Mon, 19 Sep 2011 06:09:52 +0000 (23:09 -0700)]
drm/i915: Disable eDP VDD in a delayed work proc instead of synchronously

There's no good reason to turn off the eDP force VDD bit synchronously
while probing devices; that just sticks a huge delay into all mode
setting paths. Instead, queue a delayed work proc to disable the VDD
force bit and then remember when that fires to ensure that the
appropriate delay is respected before trying to turn it back on.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Create helper functions to determine eDP power state
Keith Packard [Thu, 29 Sep 2011 22:53:27 +0000 (15:53 -0700)]
drm/i915: Create helper functions to determine eDP power state

We need to check eDP VDD force and panel on in several places, so
create some simple helper functions to avoid duplicating code.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: edp_panel_on does not need to return a bool
Keith Packard [Thu, 29 Sep 2011 23:05:34 +0000 (16:05 -0700)]
drm/i915: edp_panel_on does not need to return a bool

The return value was unused, so just stop doing that.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Move eDP panel fixed mode from dev_priv to intel_dp
Keith Packard [Mon, 19 Sep 2011 00:35:47 +0000 (17:35 -0700)]
drm/i915: Move eDP panel fixed mode from dev_priv to intel_dp

This value doesn't come directly from the VBT, and so is rather
specific to the particular DP output.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Correct eDP panel power sequencing delay computations
Keith Packard [Wed, 28 Sep 2011 23:48:10 +0000 (16:48 -0700)]
drm/i915: Correct eDP panel power sequencing delay computations

Store the panel power sequencing delays in the dp private structure,
rather than the global device structure. Who knows, maybe we'll get
more than one eDP device in the future.

From the eDP spec, we need the following numbers:

 T1 + T3 Power on to Aux Channel operation (panel_power_up_delay)

This marks how long it takes the panel to boot up and
get ready to receive aux channel communications.

 T8 Video signal to backlight on (backlight_on_delay)

Once a valid video signal is being sent to the device,
it can take a while before the panel is actuall
showing useful data. This delay allows the panel
to get something reasonable up before the backlight
is turned on.

 T9 Backlight off to video off (backlight_off_delay)

Turning the backlight off can take a moment, so
this delay makes sure there is still valid video
data on the screen.

 T10 Video off to power off (panel_power_down_delay)

Presumably this delay allows the panel to perform
an orderly shutdown of the display.

 T11 + T12 Power off to power on (panel_power_cycle_delay)

So, once you turn the panel off, you have to wait a
while before you can turn it back on. This delay is
usually the longest in the entire sequence.

Neither the VBIOS source code nor the hardware documentation has a
clear mapping between the delay values they provide and those required
by the eDP spec. The VBIOS code actually uses two different labels for
the delay values in the five words of the relevant VBT table.

**** MORE LATER ***

Look at both the current hardware register settings and the VBT
specified panel power sequencing timings. Use the maximum of the two
delays, to make sure things work reliably. If there is no VBT data,
then those values will be initialized to zero, so we'll just use the
values as programmed in the hardware. Note that the BIOS just fetches
delays from the VBT table to place in the hardware registers, so we
should get the same values from both places, except for rounding.

VBT doesn't provide any values for T1 or T2, so we'll always just use
the hardware value for that.

The panel power up delay is thus T1 + T2 + T3, which should be
sufficient in all cases.

The panel power down delay is T1 + T2 + T12, using T1+T2 as a proxy
for T11, which isn't available anywhere.

For the backlight delays, the eDP spec says T6 + T8 is the delay from the
end of link training to backlight on and T9 is the delay from
backlight off until video off. The hardware provides a 'backlight on'
delay, which I'm taking to be T6 + T8 while the VBT provides something
called 'T7', which I'm assuming is s

On the macbook air I'm testing with, this yields a power-up delay of
over 200ms and a power-down delay of over 600ms. It all works now, but
we're frobbing these power controls several times during mode setting,
making the whole process take an awfully long time.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Ensure eDP powered up during DP_SET_POWER operation in dp_prepare
Keith Packard [Wed, 28 Sep 2011 23:44:14 +0000 (16:44 -0700)]
drm/i915: Ensure eDP powered up during DP_SET_POWER operation in dp_prepare

Any call to intel_dp_sink_dpms must ensure that the panel has power so
that the DP_SET_POWER operation will be correctly received. The only
one missing this was in intel_dp_prepare.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Enable eDP panel power during I2C initialization sequence
Keith Packard [Wed, 28 Sep 2011 23:41:05 +0000 (16:41 -0700)]
drm/i915: Enable eDP panel power during I2C initialization sequence

The DP i2c initialization code does a couple of i2c transactions,
which means that an eDP panel must be powered up.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Wrap DP EDID fetch functions to enable eDP panel power
Keith Packard [Wed, 28 Sep 2011 23:38:44 +0000 (16:38 -0700)]
drm/i915: Wrap DP EDID fetch functions to enable eDP panel power

Talking to the eDP DDC channel requires that the panel be powered
up. Wrap both the EDID and modes fetch code with calls to turn the vdd
power on and back off.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Delay DP i2c initialization until panel power timings are computed
Keith Packard [Wed, 28 Sep 2011 23:31:53 +0000 (16:31 -0700)]
drm/i915: Delay DP i2c initialization until panel power timings are computed

On eDP, DDC requires panel power, but turning that on uses the panel
power sequencing timing values fetch from the DPCD data.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Ensure panel is on during DPMS off
Keith Packard [Thu, 6 Oct 2011 02:53:09 +0000 (19:53 -0700)]
drm/i915: Ensure panel is on during DPMS off

If the panel is already off, we'll need to turn VDD on to execute the
(useless) DPMS off code. Yes, it would be better to just not do any of
this, but correctness, and *then* performance.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Turn force VDD back off when panel running in intel_dp_dpms
Keith Packard [Wed, 28 Sep 2011 23:28:00 +0000 (16:28 -0700)]
drm/i915: Turn force VDD back off when panel running in intel_dp_dpms

The VDD force bit is turned on before touching the panel, but if it
was enabled, there was no call to turn it back off. Add a call.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Check for eDP inside edp panel on/off funcs
Keith Packard [Wed, 28 Sep 2011 23:23:51 +0000 (16:23 -0700)]
drm/i915: Check for eDP inside edp panel on/off funcs

Cleans up code dealing with eDP a bit. Remove redundant checks in
callers

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Unlock PCH_PP_CONTROL always
Keith Packard [Mon, 19 Sep 2011 20:59:29 +0000 (13:59 -0700)]
drm/i915: Unlock PCH_PP_CONTROL always

Avoid any question about locked registers by just writing the unlock
pattern with every write to the register.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Check eDP power when doing aux channel communications
Keith Packard [Mon, 19 Sep 2011 20:54:47 +0000 (13:54 -0700)]
drm/i915: Check eDP power when doing aux channel communications

Verify that the eDP VDD is on, either with the panel being on or with
the VDD force-on bit being set.

This demonstrates that in many instances, VDD is not on when needed,
which leads to failed EDID communications.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Only use VBT panel mode on eDP if no EDID is found
Keith Packard [Mon, 19 Sep 2011 21:33:26 +0000 (14:33 -0700)]
drm/i915: Only use VBT panel mode on eDP if no EDID is found

We're going to assume that EDID is more reliable than the VBT tables
for eDP panels, which is notably true on MacBook machines where the
VBT contains completely bogus data.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Shut down PCH interrupts during irq_uninstall
Keith Packard [Tue, 20 Sep 2011 17:12:44 +0000 (10:12 -0700)]
drm/i915: Shut down PCH interrupts during irq_uninstall

This masks out all interrupts and ack's any pending ones at IRQ
uninstall time to make sure we don't receive any unexpected interrupts
later on.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agodrm/i915: Enable digital port hotplug on PCH systems
Keith Packard [Mon, 19 Sep 2011 20:31:02 +0000 (13:31 -0700)]
drm/i915: Enable digital port hotplug on PCH systems

We were relying on the BIOS to set these bits, which doesn't always
happen.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
13 years agoMerge branch 'drm-intel-fixes' into drm-intel-next
Keith Packard [Wed, 28 Sep 2011 21:44:38 +0000 (14:44 -0700)]
Merge branch 'drm-intel-fixes' into drm-intel-next

13 years agodrm/i915: Initialize PCH refclks at modeset init time
Keith Packard [Tue, 27 Sep 2011 05:24:57 +0000 (22:24 -0700)]
drm/i915: Initialize PCH refclks at modeset init time

The reference clock configuration must be done before any mode setting
can occur as all outputs must be disabled to change
anything. Initialize the clocks after turning everything off during
the initialization process.

Also, re-initialize the refclk at resume time.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: All PCH refclks are 120MHz
Keith Packard [Tue, 27 Sep 2011 03:42:37 +0000 (20:42 -0700)]
drm/i915: All PCH refclks are 120MHz

I can't find any reference clocks which run at 96MHz as seems to be
indicated from the comments in this code.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Use CK505 as non-SSC source where available
Keith Packard [Mon, 26 Sep 2011 21:29:12 +0000 (14:29 -0700)]
drm/i915: Use CK505 as non-SSC source where available

When trying to use SSC on Ibex Peak without CK505, any non-SSC outputs
(like VGA or TV) get broken. So, do not use SSC on Ibex Peak unless
there is a CK505 available (as specified by the VBT).

On Cougar Point, all clocking is internal, so SSC can always be used,
and there will never be a CK505 available.

This eliminates VGA shimmer on some Ironlake machines which have a
CK505 clock source.

References: https://bugzilla.kernel.org/show_bug.cgi?id=21742
References: https://bugs.freedesktop.org/show_bug.cgi?id=38750
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Fix PCH SSC reference clock settings
Keith Packard [Thu, 22 Sep 2011 19:01:57 +0000 (12:01 -0700)]
drm/i915: Fix PCH SSC reference clock settings

The PCH refclk settings are global, so we need to look at all of the
encoders, not just the current encoder when deciding how to configure
it. Also, handle systems with more than one panel (any combination of
PCH/non-PCH eDP and LVDS).

Disable SSC clocks when no panels are connected.

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Allow SSC parameter to override VBT value
Keith Packard [Mon, 26 Sep 2011 23:09:45 +0000 (16:09 -0700)]
drm/i915: Allow SSC parameter to override VBT value

Allow SSC to be enabled even when the BIOS disables it for testing SSC paths.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Document a few more BDB_GENERAL_FEATURES bits from PCH BIOS
Keith Packard [Mon, 26 Sep 2011 21:25:57 +0000 (14:25 -0700)]
drm/i915: Document a few more BDB_GENERAL_FEATURES bits from PCH BIOS

This includes whether an eDP panel is present, and whether that should
use SSC (and at what frequency)

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrv/i915: Pull display_clock_mode out of VBT table
Keith Packard [Mon, 26 Sep 2011 21:24:14 +0000 (14:24 -0700)]
drv/i915: Pull display_clock_mode out of VBT table

This tells the driver whether a CK505 clock source is available on
pre-PCH hardware. If so, it should be used as the non-SSC source,
leaving the internal clock for use as the SSC source.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wison <chris@chris-wilson.co.uk>
13 years agodrm/i915: Use DRM_DEBUG_KMS for all messages in intel_bios.c
Keith Packard [Thu, 22 Sep 2011 19:32:35 +0000 (12:32 -0700)]
drm/i915: Use DRM_DEBUG_KMS for all messages in intel_bios.c

These are all KMS related anyways, so don't hide them under other
debug levels.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: broken copyright encoding in intel_bios.c
Keith Packard [Thu, 22 Sep 2011 19:30:16 +0000 (12:30 -0700)]
drm/i915: broken copyright encoding in intel_bios.c

Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: FBC off for ironlake and older, otherwise on by default
Keith Packard [Tue, 20 Sep 2011 04:34:19 +0000 (21:34 -0700)]
drm/i915: FBC off for ironlake and older, otherwise on by default

Make the default FBC behaviour chipset specific, allowing us to turn
it on by default for Ironlake and older where it has been seen to
cause trouble with screen updates.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Francis Moreau <francis.moro@gmail.com>
13 years agodrm/i915: Enable SDVO hotplug interrupts for HDMI and DVI
Simon Farnsworth [Wed, 21 Sep 2011 16:13:30 +0000 (17:13 +0100)]
drm/i915: Enable SDVO hotplug interrupts for HDMI and DVI

I was seeing a nasty 5 frame glitch every 10 seconds, caused by the
poll for connection on DVI attached by SDVO.

As my SDVO DVI supports hotplug detect interrupts, the fix is to
enable them, and hook them in to the various bits of driver
infrastructure so that they work reliably.

Note that this is only tested on single-function DVI-D SDVOs, on two
platforms (965GME and 945GSE), and has not been checked against a
specification document.

With lots of help from Adam Jackson <ajax@redhat.com> on IRC.

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agoMerge branch 'drm-intel-fixes' into drm-intel-next
Keith Packard [Wed, 21 Sep 2011 21:52:46 +0000 (14:52 -0700)]
Merge branch 'drm-intel-fixes' into drm-intel-next

13 years agodrm/i915: Dumb down the semaphore logic
Ben Widawsky [Thu, 15 Sep 2011 03:32:47 +0000 (20:32 -0700)]
drm/i915: Dumb down the semaphore logic

While I think the previous code is correct, it was hard to follow and
hard to debug. Since we already have a ring abstraction, might as well
use it to handle the semaphore updates and compares.

I don't expect this code to make semaphores better or worse, but you
never know...

v2:
Remove magic per Keith's suggestions.
Ran Daniel's gem_ring_sync_loop test on this.

v3:
Ignored one of Keith's suggestions.

v4:
Removed some bloat per Daniel's recommendation.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: pass ELD to HDMI/DP audio driver
Wu Fengguang [Mon, 5 Sep 2011 06:25:34 +0000 (14:25 +0800)]
drm/i915: pass ELD to HDMI/DP audio driver

Add ELD support for Intel Eaglelake, IbexPeak/Ironlake,
SandyBridge/CougarPoint and IvyBridge/PantherPoint chips.

ELD (EDID-Like Data) describes to the HDMI/DP audio driver the audio
capabilities of the plugged monitor. It's built and passed to audio
driver in 2 steps:

(1) at get_modes time, parse EDID and save ELD to drm_connector.eld[]

(2) at mode_set time, write drm_connector.eld[] to the Transcoder's hw
    ELD buffer and set the ELD_valid bit to inform HDMI/DP audio driver

This patch is tested OK on G45/HDMI, IbexPeak/HDMI and IvyBridge/HDMI+DP.
Test scheme: plug in the HDMI/DP monitor, and run

        cat /proc/asound/card0/eld*

to check if the monitor name, HDMI/DP type, etc. show up correctly.

Minor imperfection: the GEN5_AUD_CNTL_ST/DIP_Port_Select field always
reads 0 (reserved). Without knowing the port number, I worked it around
by setting the ELD_valid bit for ALL the three ports. It's tested to not
be a problem, because the audio driver will find invalid ELD data and
hence rightfully abort, even when it sees the ELD_valid indicator.

Thanks to Zhenyu and Pierre-Louis for a lot of valuable help and testing.

CC: Zhao Yakui <yakui.zhao@intel.com>
CC: Wang Zhenyu <zhenyu.z.wang@intel.com>
CC: Jeremy Bush <contractfrombelow@gmail.com>
CC: Christopher White <c.white@pulseforce.com>
CC: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
CC: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm: support routines for HDMI/DP ELD
Wu Fengguang [Mon, 5 Sep 2011 06:23:20 +0000 (14:23 +0800)]
drm: support routines for HDMI/DP ELD

ELD (EDID-Like Data) describes to the HDMI/DP audio driver the audio
capabilities of the plugged monitor.

This adds drm_edid_to_eld() for converting EDID to ELD. The converted
ELD will be saved in a new drm_connector.eld[128] data field. This is
necessary because the graphics driver will need to fixup some of the
data fields (eg. HDMI/DP connection type, AV sync delay) before writing
to the hardware ELD buffer. drm_av_sync_delay() will help the graphics
drivers dynamically compute the AV sync delay for fixing-up the ELD.

ELD selection policy: it's possible for one encoder to be associated
with multiple connectors (ie. monitors), in which case the first found
ELD will be returned by drm_select_eld(). This policy may not be
suitable for all users, but let's start it simple first.

The impact of ELD selection policy: assume there are two monitors, one
supports stereo playback and the other has 8-channel output; cloned
display mode is used, so that the two monitors are associated with the
same internal encoder. If only the stereo playback capability is reported,
the user won't be able to start 8-channel playback; if the 8-channel ELD
is reported, then user space applications may send 8-channel samples
down, however the user may actually be listening to the 2-channel
monitor and not connecting speakers to the 8-channel monitor.

According to James, many TVs will either refuse the display anything or
pop-up an OSD warning whenever they receive hdmi audio which they cannot
handle. Eventually we will require configurability and/or per-monitor
audio control even when the video is cloned.

CC: Zhao Yakui <yakui.zhao@intel.com>
CC: Wang Zhenyu <zhenyu.z.wang@intel.com>
CC: Jeremy Bush <contractfrombelow@gmail.com>
CC: Christopher White <c.white@pulseforce.com>
CC: Pierre-Louis Bossart <pierre-louis.bossart@intel.com>
CC: Paul Menzel <paulepanter@users.sourceforge.net>
CC: James Cloos <cloos@jhcloos.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
13 years agodrm/i915: Enable dither whenever display bpc < frame buffer bpc
Keith Packard [Mon, 5 Sep 2011 18:53:21 +0000 (11:53 -0700)]
drm/i915: Enable dither whenever display bpc < frame buffer bpc

We want to enable dithering on any pipe where the frame buffer has
more color resolution than the output device.

The previous code was incorrectly clamping the frame buffer bpc to the
display bpc, effectively disabling dithering all of the time as the
computed frame buffer bpc would never be larger than the display bpc.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reported-by: Oliver Hartkopp <socketcan@hartkopp.net>
Tested-by: Oliver Hartkopp <socketcan@hartkopp.net>
13 years agoMerge branch 'drm-intel-next' of git://people.freedesktop.org/~keithp/linux into...
Dave Airlie [Tue, 20 Sep 2011 08:36:22 +0000 (09:36 +0100)]
Merge branch 'drm-intel-next' of git://people.freedesktop.org/~keithp/linux into drm-next

* 'drm-intel-next' of git://people.freedesktop.org/~keithp/linux:
  Drivers: i915: Fix all space related issues.

13 years agoMerge branch 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2...
Dave Airlie [Tue, 20 Sep 2011 08:35:22 +0000 (09:35 +0100)]
Merge branch 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6 into drm-next

* 'drm-nouveau-next' of git://git.freedesktop.org/git/nouveau/linux-2.6: (353 commits)
  drm/nouveau: remove allocations from gart populate() hook
  drm/nvc0/fb: slightly improve PMFB intr handling, move out of nvc0_graph.c
  drm/nvc0/fifo: avoid touching missing subfifos
  drm/nvd9/disp: bail out of mode_set_base if no fb bound to crtc
  drm/nvd9/disp: stub some more api hooks so we don't oops on resume
  drm/nouveau: fix printk typo in ioremap failure path
  drm/nvc0/pm: minor clock readback fixes
  drm/nv40/pm: execute memory reset script from vbios
  drm/nv50/gr: refactor initialisation
  drm/nouveau: if requested, try harder at disabling sysmem pushbufs
  drm/nv50/gr: enable ctxprog xfer only when we need it to save power
  drm/nouveau/dp: add support for displayport table 0x30
  drm/nouveau/dp: return master dp table pointer too when looking up encoder
  drm/nouveau/bios: simplify U/d table hash matching func to just match
  drm/nouveau/dp: preserve non-pattern bits in DP_TRAINING_PATTERN_SET
  drm/nvc0/gr: remove MODULE_FIRMWARE() lines
  drm/nouveau/dp: use alternate lane mask for nvaf
  drm/nouveau/dp: link rate scripts are selected with a comparison table
  drm/nv40/pm: write nv40-specific reclocking routines
  drm/nv40/pm: parse geometric delta clock from vbios
  ...

13 years agodrm/nouveau: remove allocations from gart populate() hook
Ben Skeggs [Tue, 30 Aug 2011 04:30:11 +0000 (14:30 +1000)]
drm/nouveau: remove allocations from gart populate() hook

Since some somewhat questionable changes a while back, TTM provides a
completely empty array of struct dma_address that stays around for the
entire lifetime of the TTM object.

Lets use this array, *always*, rather than wasting yet more memory on
another array who's purpose is identical, as well as yet another bool array
of the same size saying *which* of the previous two arrays to use...

This change will also solve the high order allocation failures seen by
some people while using nouveau.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/fb: slightly improve PMFB intr handling, move out of nvc0_graph.c
Ben Skeggs [Fri, 26 Aug 2011 03:05:23 +0000 (13:05 +1000)]
drm/nvc0/fb: slightly improve PMFB intr handling, move out of nvc0_graph.c

I'm still not certain how to determine the number of SUBPs are present on
a given board.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/fifo: avoid touching missing subfifos
Ben Skeggs [Thu, 25 Aug 2011 05:53:57 +0000 (15:53 +1000)]
drm/nvc0/fifo: avoid touching missing subfifos

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd9/disp: bail out of mode_set_base if no fb bound to crtc
Ben Skeggs [Thu, 25 Aug 2011 23:40:39 +0000 (09:40 +1000)]
drm/nvd9/disp: bail out of mode_set_base if no fb bound to crtc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvd9/disp: stub some more api hooks so we don't oops on resume
Ben Skeggs [Thu, 25 Aug 2011 04:09:43 +0000 (14:09 +1000)]
drm/nvd9/disp: stub some more api hooks so we don't oops on resume

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: fix printk typo in ioremap failure path
Marcin Slusarz [Mon, 22 Aug 2011 21:28:56 +0000 (23:28 +0200)]
drm/nouveau: fix printk typo in ioremap failure path

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/pm: minor clock readback fixes
Ben Skeggs [Thu, 23 Jun 2011 06:37:00 +0000 (16:37 +1000)]
drm/nvc0/pm: minor clock readback fixes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv40/pm: execute memory reset script from vbios
Ben Skeggs [Fri, 12 Aug 2011 00:05:43 +0000 (10:05 +1000)]
drm/nv40/pm: execute memory reset script from vbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/gr: refactor initialisation
Ben Skeggs [Thu, 11 Aug 2011 23:30:58 +0000 (09:30 +1000)]
drm/nv50/gr: refactor initialisation

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau: if requested, try harder at disabling sysmem pushbufs
Ben Skeggs [Thu, 11 Aug 2011 22:56:06 +0000 (08:56 +1000)]
drm/nouveau: if requested, try harder at disabling sysmem pushbufs

On >=nv50, userspace would still end up allocating pushbufs in GART.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv50/gr: enable ctxprog xfer only when we need it to save power
Martin Peres [Sat, 30 Jul 2011 21:08:45 +0000 (23:08 +0200)]
drm/nv50/gr: enable ctxprog xfer only when we need it to save power

This patch adds instructions to ctxprog and by doing, impacts context
switching performance.  My testcase showed a 1% performance cost using
glxgears that is a context-switch bound application.

Please test and report bugs/performance/power/other.

Many thanks to Maxim Levitsky for his dedicated work on lowering power
consumption with nouveau.

More patches are coming thanks to his work:

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

Signed-off-by: Martin Peres <martin.peres@ensi-bourges.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: add support for displayport table 0x30
Ben Skeggs [Fri, 5 Aug 2011 04:47:28 +0000 (14:47 +1000)]
drm/nouveau/dp: add support for displayport table 0x30

Written from observations of my NVD9's vbios, completely untested due to
my NVD9 lacking actual DisplayPort connectors..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: return master dp table pointer too when looking up encoder
Ben Skeggs [Fri, 5 Aug 2011 04:07:04 +0000 (14:07 +1000)]
drm/nouveau/dp: return master dp table pointer too when looking up encoder

Will need to be able to distinguish 2.0/2.1 from 3.0 soon.  Also, move
the vbios parsing to nouveau_dp where it belongs.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/bios: simplify U/d table hash matching func to just match
Ben Skeggs [Fri, 5 Aug 2011 03:42:49 +0000 (13:42 +1000)]
drm/nouveau/bios: simplify U/d table hash matching func to just match

The caller is now responsible for parsing its own lists (or whatever) of
possible encoders.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: preserve non-pattern bits in DP_TRAINING_PATTERN_SET
Ben Skeggs [Fri, 5 Aug 2011 05:56:53 +0000 (15:56 +1000)]
drm/nouveau/dp: preserve non-pattern bits in DP_TRAINING_PATTERN_SET

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nvc0/gr: remove MODULE_FIRMWARE() lines
Ben Skeggs [Sun, 7 Aug 2011 22:57:55 +0000 (08:57 +1000)]
drm/nvc0/gr: remove MODULE_FIRMWARE() lines

We don't use these by default anymore, and there's been complaints from a
number of places thinking that the firmware blobs are required still.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: use alternate lane mask for nvaf
Ben Skeggs [Fri, 5 Aug 2011 01:09:21 +0000 (11:09 +1000)]
drm/nouveau/dp: use alternate lane mask for nvaf

Naturally...  Because Macs can't just be the same as everything else
now can they?

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: link rate scripts are selected with a comparison table
Ben Skeggs [Fri, 5 Aug 2011 00:28:52 +0000 (10:28 +1000)]
drm/nouveau/dp: link rate scripts are selected with a comparison table

Not hardcoded as originally thought.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv40/pm: write nv40-specific reclocking routines
Ben Skeggs [Mon, 18 Jul 2011 05:15:34 +0000 (15:15 +1000)]
drm/nv40/pm: write nv40-specific reclocking routines

Not 100% perfect yet, but a good start towards what it'll look like in the
end.

Actually seems stable on a NV44 I have here, as much as running around OA
for a fair amount of time constantly switching between performance levels
can prove..

My NV49 isn't quite so happy, and semaphores mess up somehow (sometimes) as
a result of the memory reclocking.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nv40/pm: parse geometric delta clock from vbios
Ben Skeggs [Mon, 18 Jul 2011 06:02:37 +0000 (16:02 +1000)]
drm/nv40/pm: parse geometric delta clock from vbios

This changes the meaning of what we reported as "core" clock previously.

The shader/rop units are allegedly supposed to be run at the base clock
listed in the perf table, while the geometric clock can be bumped from
this value on some boards.

So that we can report both, we'll report the base clock as "shader" (since
the shaders *do* run at it), and the geometric clock as "core".

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: enable down-spread if vbios and sink support it
Ben Skeggs [Thu, 4 Aug 2011 04:31:28 +0000 (14:31 +1000)]
drm/nouveau/dp: enable down-spread if vbios and sink support it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: execute some more vbios tables relating to link rate
Ben Skeggs [Thu, 4 Aug 2011 04:16:45 +0000 (14:16 +1000)]
drm/nouveau/dp: execute some more vbios tables relating to link rate

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
13 years agodrm/nouveau/dp: store unencoded link_bw everywhere
Ben Skeggs [Wed, 3 Aug 2011 23:55:44 +0000 (09:55 +1000)]
drm/nouveau/dp: store unencoded link_bw everywhere

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>