]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
14 years agodrm/i915/dp: Convert a udelay(17000) to a sleep during link-off
Chris Wilson [Sat, 11 Sep 2010 20:37:48 +0000 (21:37 +0100)]
drm/i915/dp: Convert a udelay(17000) to a sleep during link-off

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Use macros to switch between equivalent pipe registers
Chris Wilson [Sat, 11 Sep 2010 12:48:45 +0000 (13:48 +0100)]
drm/i915: Use macros to switch between equivalent pipe registers

The purpose is to make the code much easier to read and therefore reduce
the possibility for bugs.

A side effect is that it also makes it much easier for the compiler,
reducing the object size by 4k -- from just a few functions!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Tidy Ironlake watermark computation
Chris Wilson [Sat, 11 Sep 2010 09:46:47 +0000 (10:46 +0100)]
drm/i915: Tidy Ironlake watermark computation

Refactor the common code into seperate functions and use the MIN(large,
small) buffer calculation for self-refresh watermarks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Fix updating FBC
Chris Wilson [Sat, 11 Sep 2010 09:47:47 +0000 (10:47 +0100)]
drm/i915: Fix updating FBC

We need to track different state on each generation in order to detect
when we need to refresh the FBC registers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: enable thermal reporting for IPS
Jesse Barnes [Fri, 10 Sep 2010 17:02:13 +0000 (10:02 -0700)]
drm/i915: enable thermal reporting for IPS

Thermal reporting may not be enabled by default on some machines, so
enable the appropriate bits to allow IPS to get the data it needs from
the CPU thermal device.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agoMerge branch 'drm-intel-fixes' into drm-intel-next
Chris Wilson [Sat, 11 Sep 2010 08:49:58 +0000 (09:49 +0100)]
Merge branch 'drm-intel-fixes' into drm-intel-next

14 years agodrm/i915: Use the real FDI frequency for determining b/w
Chris Wilson [Tue, 7 Sep 2010 19:54:59 +0000 (20:54 +0100)]
drm/i915: Use the real FDI frequency for determining b/w

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Only call udelay() when waiting for clocks to stabilise
Chris Wilson [Fri, 10 Sep 2010 21:33:42 +0000 (22:33 +0100)]
drm/i915: Only call udelay() when waiting for clocks to stabilise

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Ensure all PLL registers are flushed before a udelay()
Chris Wilson [Fri, 10 Sep 2010 21:33:19 +0000 (22:33 +0100)]
drm/i915: Ensure all PLL registers are flushed before a udelay()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: set FDI RX TU size to match transmit size
Jesse Barnes [Fri, 10 Sep 2010 18:27:03 +0000 (11:27 -0700)]
drm/i915: set FDI RX TU size to match transmit size

This allows FDI error checking to work.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: don't write TU size to N1 reg
Jesse Barnes [Fri, 10 Sep 2010 18:22:02 +0000 (11:22 -0700)]
drm/i915: don't write TU size to N1 reg

TU size is only part of the M1 and M2 regs, not the N regs.  This keeps
us from overwriting a reserved field.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: split Ironlake FDI enable function
Jesse Barnes [Fri, 10 Sep 2010 18:10:00 +0000 (11:10 -0700)]
drm/i915: split Ironlake FDI enable function

Easier to read, and will pair up with a disable function.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: enable PCH PLL, FDI training and transcoder even for eDP
Jesse Barnes [Fri, 10 Sep 2010 17:57:18 +0000 (10:57 -0700)]
drm/i915: enable PCH PLL, FDI training and transcoder even for eDP

eDP panels require these to be set up prior to panel power sequencing,
or they'll fail to power on due to an "asset not ready" check.  And of
course, eDP panels attached to anything other than DP_A need them
enabled regardless, since they'll be driven from the CPU through FDI out
to the PCH.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: use i915 and Ironlake CRTC enable/disable functions in prepare/commit
Jesse Barnes [Fri, 10 Sep 2010 17:47:20 +0000 (10:47 -0700)]
drm/i915: use i915 and Ironlake CRTC enable/disable functions in prepare/commit

This will allow us to optimize our prepare/commit paths a bit better.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: minor tweak to handle the cursor across pipe resizing]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: don't unlock panel regs
Jesse Barnes [Fri, 10 Sep 2010 17:46:45 +0000 (10:46 -0700)]
drm/i915: don't unlock panel regs

This was just a workaround for some broken Ironlake CRTC code.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: split i9xx CRTC enable/disable code
Jesse Barnes [Fri, 10 Sep 2010 17:31:34 +0000 (10:31 -0700)]
drm/i915: split i9xx CRTC enable/disable code

So we can use it for CRTC prepare/commit.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: split Ironlake CRTC enable/disable code
Jesse Barnes [Fri, 10 Sep 2010 17:26:01 +0000 (10:26 -0700)]
drm/i915: split Ironlake CRTC enable/disable code

This way we can also use it in CRTC prepare/commit.  Also makes it
easier to split out FDI and other code.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Adapt workqueue to new alloc_workqueue interface
Chris Wilson [Thu, 9 Sep 2010 11:46:34 +0000 (12:46 +0100)]
drm/i915: Adapt workqueue to new alloc_workqueue interface

create_singlethreaded_workqueue() is being phased out for a new
concurrency managed task infrastructure.

Adapt our workqueue constructor to explicitly create a domain that only
allows the execution of a single task at any time. All the tasks are
expected to require the dev->struct_mutex, so would block concurrency of
other tasks if we allow more than a single i915 task to be run at once.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: don't enable self-refresh on Ironlake
Jesse Barnes [Thu, 9 Sep 2010 18:58:02 +0000 (11:58 -0700)]
drm/i915: don't enable self-refresh on Ironlake

We don't know how to enable it safely, especially as outputs turn on and
off.  When disabling LP1 we also need to make sure LP2 and 3 are already
disabled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29173
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29082
Reported-by: Chris Lord <chris@linux.intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915/debug: Include Ironlake in self-refresh status
Chris Wilson [Thu, 19 Aug 2010 17:04:08 +0000 (18:04 +0100)]
drm/i915/debug: Include Ironlake in self-refresh status

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Make the connector->encoder relationship explicit
Chris Wilson [Thu, 9 Sep 2010 15:20:55 +0000 (16:20 +0100)]
drm/i915: Make the connector->encoder relationship explicit

Currently we have a exact mapping of a connector onto an encoder for its
whole lifetime. Make this an explicit property of the structure and so
simplify the code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
14 years agodrm/i915: Use the direct mapping of pipe->crtc
Chris Wilson [Thu, 9 Sep 2010 14:44:14 +0000 (15:44 +0100)]
drm/i915: Use the direct mapping of pipe->crtc

Why iterate all the crtcs to find the pipe, when we already know which
crtc is attached to which pipe?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
14 years agodrm/i915: Rename intel_encoder->enc to base for consistency
Chris Wilson [Thu, 9 Sep 2010 14:14:28 +0000 (15:14 +0100)]
drm/i915: Rename intel_encoder->enc to base for consistency

[Patch is slightly larger than is strictly necessary to fixup
surrounding checkpatch.pl errors.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
14 years agodrm/i915: Double check that the wait_request is not pending before warning
Chris Wilson [Wed, 8 Sep 2010 23:02:03 +0000 (00:02 +0100)]
drm/i915: Double check that the wait_request is not pending before warning

If we are busy, then we may have woken up the wait_request handler but
not yet serviced it before the hang check fires. So in hang check,
double check that the i915_gem_do_wait_request() is still pending the
wake-up before declaring all hope lost.

Fixes regression with e78d73b16bcde921c9cf458d2e4de8e4fc2518f3.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30073
Reported-and-tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915/dp: Flush the PLL register write before sleeping
Chris Wilson [Wed, 8 Sep 2010 20:07:28 +0000 (21:07 +0100)]
drm/i915/dp: Flush the PLL register write before sleeping

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: make sure panel is sequenced off when starting a mode set
Jesse Barnes [Wed, 8 Sep 2010 19:42:05 +0000 (12:42 -0700)]
drm/i915: make sure panel is sequenced off when starting a mode set

Otherwise we may not be able to train the DP link.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: make sure VDD AUX power has time to settle
Jesse Barnes [Wed, 25 Aug 2010 20:09:48 +0000 (13:09 -0700)]
drm/i915: make sure VDD AUX power has time to settle

When turning on or off the VDD AUX bit, we need to give the panel time
to start or stop or AUX transactions may fail.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: don't change VDD AUX status in panel power functions
Jesse Barnes [Wed, 8 Sep 2010 19:42:03 +0000 (12:42 -0700)]
drm/i915: don't change VDD AUX status in panel power functions

Mode set sequence outlines when the AUX VDD bit should be set and
cleared, and it's separate from the panel power sequence.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: split DP link training across panel power sequencing
Jesse Barnes [Wed, 8 Sep 2010 19:42:02 +0000 (12:42 -0700)]
drm/i915: split DP link training across panel power sequencing

Mode set sequence requires that we start training, then enable the
panel, then complete training.  So split the DP training function into
two parts; the first enables the DP port and sets training pattern 1 and
the second completes the training.

As part of this, remove some redundant function args from the various DP
handling functions and use the intel_dp fields everywhere we can.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: removed first ironlake_edp_backlight_on() on advice of jbarnes]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: use VDD AUX for panel power around detection and in prepare
Jesse Barnes [Wed, 8 Sep 2010 19:42:01 +0000 (12:42 -0700)]
drm/i915: use VDD AUX for panel power around detection and in prepare

Mode setting sequence specifies that we use VDD AUX for configuration
and detection, and early in the mode set sequence.  Only later (after
DP_A has started training) should we actually enable panel power.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: checkpatch.pl complaining about whitespace]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: use 125MHz reference clock for PCH attached eDP
Jesse Barnes [Wed, 8 Sep 2010 19:42:00 +0000 (12:42 -0700)]
drm/i915: use 125MHz reference clock for PCH attached eDP

Fix the test so we don't try to use the 450MHz refclk on PCH attached
eDP.

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

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: fix eDP detection
Jesse Barnes [Wed, 8 Sep 2010 19:41:59 +0000 (12:41 -0700)]
drm/i915: fix eDP detection

Panel needs to be powered up.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agoi915: snprintf returns large values
Dan Carpenter [Wed, 8 Sep 2010 19:44:47 +0000 (21:44 +0200)]
i915: snprintf returns large values

snprintf() returns the number of bytes which would have been used if
there was enough space.  It can be larger than the size of the buffer.
Obviously in this case the buffer is large enough but everyone just
copy and pastes this code so it's better to limit it and set a good
example.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: die, i915_probe_agp, die
Daniel Vetter [Mon, 6 Sep 2010 18:08:44 +0000 (20:08 +0200)]
drm/i915: die, i915_probe_agp, die

Use the detection from intel-gtt.ko instead. Hooray!

Also move the stolen mem allocator to the other gtt stuff in dev_prv->mem.

v2: Chris Wilson noted that my error handling was crap. Fix it. He also
said that this fixes a problem on his i845. Indeed, i915_probe_agp
misses a special case for i830/i845 stolen mem detection.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=25476
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: drop prealloc_start from i915_dma gtt init
Daniel Vetter [Wed, 8 Sep 2010 19:26:07 +0000 (21:26 +0200)]
drm/i915: drop prealloc_start from i915_dma gtt init

Not used and simply confusing.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: use chipset generation number some more
Daniel Vetter [Tue, 31 Aug 2010 20:30:43 +0000 (22:30 +0200)]
intel-gtt: use chipset generation number some more

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: call init_gtt_init in probe function
Daniel Vetter [Sun, 29 Aug 2010 12:18:49 +0000 (14:18 +0200)]
intel-gtt: call init_gtt_init in probe function

This way create_gatt_table become dummy glue functions for the fake
agp driver - rename them accordingly (and kill the now unnecessary
i9xx copy).

With this change, the gtt initialization code is almost independant
from the agp stuff. Two things are still missing:
- the scratch page is created by the generic agp code.
- filling the whole gtt with scratch_page ptes is not yet consolidated -
  this needs abstracted pte handling, first.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: consolidate i9xx setup
Daniel Vetter [Sun, 29 Aug 2010 15:35:30 +0000 (17:35 +0200)]
intel-gtt: consolidate i9xx setup

The only difference between i915 and i965 was the calculation of the
gtt address. So merge these two paths into one. Otherwise the same
changes as in the i830 setup consolidation.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: consolidate i830 setup
Daniel Vetter [Sun, 29 Aug 2010 15:29:50 +0000 (17:29 +0200)]
intel-gtt: consolidate i830 setup

Slighlty reordered sequence was necessary. Also don't set
agp_bridge->gatt_bus_addr anymore. Only used by generic agp helper
functions, hence unnecessary for the intel fake agp driver.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: consolidate the gtt ioremap calls
Daniel Vetter [Sun, 29 Aug 2010 15:27:36 +0000 (17:27 +0200)]
intel-gtt: consolidate the gtt ioremap calls

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: i830: adjust ioremap of regs and gtt to i9xx
Daniel Vetter [Sat, 28 Aug 2010 22:15:03 +0000 (00:15 +0200)]
intel-gtt: i830: adjust ioremap of regs and gtt to i9xx

This way around this can be extracted into common code.

Also use a common cleanup function (and give it a generic name).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: i965: use detected gtt size for mapping
Daniel Vetter [Sat, 28 Aug 2010 14:14:32 +0000 (16:14 +0200)]
intel-gtt: i965: use detected gtt size for mapping

Also move the Sandybdridge size detection into gtt_total_entries, like
the rest.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: i915: use detected gtt size for mapping
Daniel Vetter [Wed, 8 Sep 2010 19:20:12 +0000 (21:20 +0200)]
intel-gtt: i915: use detected gtt size for mapping

Slight reordering of the init sequence required.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: introduce intel_gtt_driver
Daniel Vetter [Wed, 8 Sep 2010 19:18:53 +0000 (21:18 +0200)]
intel-gtt: introduce intel_gtt_driver

Same idea as INTEL_INFO from drm/i915. This
- reduces the dependancy on agp_driver
- stops the what-does-IS_I965G-mean confusion (here it's just gen4, in
  drm/i915 it's gen >=4)
- further prepares the separation of the fake agp driver from the rest.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: fix gtt_total_entries detection
Daniel Vetter [Sat, 28 Aug 2010 09:04:32 +0000 (11:04 +0200)]
intel-gtt: fix gtt_total_entries detection

In commit f1befe71 Chris Wilson added some code to clear the full gtt
on g33/pineview instead of just the mappable part. The code looks like
it was copy-pasted from agp/intel-gtt.c, at least an identical piece
of code is still there (in intel_i830_init_gtt_entries). This lead to
a regression in 2.6.35 which was supposedly fixed in commit e7b96f28

Now this commit makes absolutely no sense to me. It seems to be
slightly confused about chipset generations - it references docs for
4th gen but the regression concerns 3rd gen g33. Luckily the the g33
gmch docs are available with the GMCH Graphics Control pci config
register definitions. The other (bigger problem) is that the new
check in there uses the i830 stolen mem bits (.5M, 1M or 8M of stolen
mem). They are different since the i855GM.

The most likely case is that it hits the 512M fallback, which was
probably the right thing for the boxes this was tested on.

So the original approach by Chris Wilson seems to be wrong and the
current code is definitely wrong. There is a third approach by Jesse
Barnes from his RFC patch "Who wants a bigger GTT mapping range?"
where he simply shoves g33 in the same clause like later chipset
generations.

I've asked him and Jesse confirmed that this should work. So implement
it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16891$
Tested-by: Anisse Astier <anisse@astier.eu>
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: s/i8[13]0/fake_agp for generic functions
Daniel Vetter [Fri, 27 Aug 2010 15:51:29 +0000 (17:51 +0200)]
intel-gtt: s/i8[13]0/fake_agp for generic functions

Start to separate the fake agp driver from the rest of intel-gtt.c

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: adjust overhead entries in intel_gtt_stolen_entries
Daniel Vetter [Fri, 27 Aug 2010 15:12:41 +0000 (17:12 +0200)]
intel-gtt: adjust overhead entries in intel_gtt_stolen_entries

agp/intel_gtt.c and drm/i915/i915_dma.c don't calculate this the same
way: The intel-gtt code seems to use the actual gtt size, the drm
module just the mappable. Go with the logic from the drm module because
that's the more conservative choice.

But conserve the original code in intel_gtt_total_size for later use.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: drop unnecessary conditions in intel_gtt_stolen_entries
Daniel Vetter [Fri, 27 Aug 2010 14:25:54 +0000 (16:25 +0200)]
intel-gtt: drop unnecessary conditions in intel_gtt_stolen_entries

The dedection function in drm/i915/i915_dma.c works without it, so
drop it here, too. All the values are disdinct, anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: sane variable names for intel_gtt_stolen_entries
Daniel Vetter [Fri, 27 Aug 2010 14:13:52 +0000 (16:13 +0200)]
intel-gtt: sane variable names for intel_gtt_stolen_entries

This somewhat aligns it with the version in drm/i915/i915_dma.c.
Changes:
- s/gtt_entries/stolen_size
- track overhead entries in a seperate var (the effective gtt size
  calculation will be extracted later on).
- subtract the overhead at the end instead of in each clause.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: generic intel_fake_agp_fetch_size
Daniel Vetter [Fri, 27 Aug 2010 13:33:26 +0000 (15:33 +0200)]
intel-gtt: generic intel_fake_agp_fetch_size

This uses the new mappable gtt size detection from the previous patch.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: new function intel_gtt_mappable_entries
Daniel Vetter [Wed, 8 Sep 2010 19:01:04 +0000 (21:01 +0200)]
intel-gtt: new function intel_gtt_mappable_entries

This implementation is stolen from drm/i915, but is equivalent to
the code sprinkled over intel-gtt.c in the various fetch_size functions.
It's not yet used anywhere, though.

Also introduce intel_gtt_init which only calls intel_gtt_stolen_entries.
Over the course of the next patches, this will grow untill it contains
the complete init sequence starting from the call to gtt_mappable_entries.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: s/intel_i830_init_gtt_entries/intel_gtt_stolen_entries
Daniel Vetter [Tue, 24 Aug 2010 21:07:59 +0000 (23:07 +0200)]
intel-gtt: s/intel_i830_init_gtt_entries/intel_gtt_stolen_entries

First simple step towards a more generic initialization. This
is needed to disentangle the agp stuff from the stuff that is
actually needed by drm/i915.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: store a local pointer to the bridge pci dev
Daniel Vetter [Tue, 24 Aug 2010 21:06:19 +0000 (23:06 +0200)]
intel-gtt: store a local pointer to the bridge pci dev

When the intel-gtt code now longer depends on agp, we cannot rely
on this. So store a local reference in intel-gtt.c.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agointel-gtt: introduce drm/intel-gtt.h
Daniel Vetter [Tue, 24 Aug 2010 20:18:41 +0000 (22:18 +0200)]
intel-gtt: introduce drm/intel-gtt.h

Add a few definitions to it that are already shared and that will
be shared in the future (like the number of stolen entries).
No functional changes in here.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agoagp/intel: make intel-gtt.c into a real source file
Daniel Vetter [Wed, 8 Sep 2010 15:29:51 +0000 (17:29 +0200)]
agp/intel: make intel-gtt.c into a real source file

Now that the disentangling is complete, stop including intel-gtt.c
from intel-agp.c.

The linux build system _really_ doesn't allow .c source files with the
same name as the module. It fails with the following message when trying
to build such a bugger:

make[3]: Circular drivers/char/agp/intel-agp.o <- drivers/char/agp/intel-agp.o dependency dropped.

Instead of renameing intel-agp.c I've simply created a new module out
of intel-gtt.c. Renaming intel-agp.ko to something else is not an option
for it will surely kill someones boot process.

This also paves the way to use the gtt code without loading the agp
driver.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agoagp/intel: split out gmch/gtt probe, part 2
Daniel Vetter [Tue, 24 Aug 2010 17:39:48 +0000 (19:39 +0200)]
agp/intel: split out gmch/gtt probe, part 2

This just splits the device list into two and moves the gtt related stuff
to intel-gtt.c. The two new devices lists also lose the not longer needed
fields. There where only about 5 cases anyway with both a gmch and a
possible agp port, so the duplication of entries is rather small.
Additionally kill 2 out of the three Ironlake mobile entries that
only differed in host bridge pci id.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Don't disable panel for modesetting if pfit hasn't changed
Matthew Garrett [Tue, 18 May 2010 17:53:16 +0000 (13:53 -0400)]
drm/i915: Don't disable panel for modesetting if pfit hasn't changed

It seems to be possible to program a new mode without disabling the panel
if the panel fitter setup doesn't change. Add support for that.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: set dither bits on eDP panels too
Jesse Barnes [Tue, 7 Sep 2010 21:48:06 +0000 (14:48 -0700)]
drm/i915: set dither bits on eDP panels too

We really need a macro to test whether a given connector has a panel
attached rather than sprinkling HAS_PCH_SPLIT/IS_eDP/has_edp_encoder
etc all over. In the meantime, fix the bug...

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: tidy up the duplicity in the conditionals]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: fix pipeconf dither bit definitions
Jesse Barnes [Tue, 7 Sep 2010 21:48:05 +0000 (14:48 -0700)]
drm/i915: fix pipeconf dither bit definitions

Make them match the others and add BPP definitions.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Remove impossible error handling from bit17 swizzling
Chris Wilson [Sat, 4 Sep 2010 11:59:16 +0000 (12:59 +0100)]
drm/i915: Remove impossible error handling from bit17 swizzling

Our usage of kmap() cannot return NULL here, so remove the unnecessary
error handling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Add ringbuffer wait reset to hangcheck
Chris Wilson [Sun, 8 Aug 2010 19:38:12 +0000 (20:38 +0100)]
drm/i915: Add ringbuffer wait reset to hangcheck

The GPU records whether it is currently waiting for a completion of a
WAIT_FOR_EVENT in the RB_WAIT bit in the ringbuffer control registers.
On third generation chipsets and later, a write of 1 to this bit breaks
the hang and returns the GPU to arbitration, i.e. the GPU should
continue executing the reminder of the batchbuffer and return to normal
operations.

By adding this to hangcheck we can avoid a full GPU reset under these
conditions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Clear scanline waits after disabling the pipe.
Chris Wilson [Sun, 8 Aug 2010 10:53:53 +0000 (11:53 +0100)]
drm/i915: Clear scanline waits after disabling the pipe.

If we disable the pipe and the GPU is currently waiting on a scanline
WAIT_FOR_EVENT, the GPU will hang. Fortunately, there is a magic bit
which we can write on i915+ to break this wait after disabling the
pipe.

References:

  Bug 29252 - [Arrandale] Hung WAIT_FOR_EVENT when running rss-glx-skyrocket
  https://bugs.freedesktop.org/show_bug.cgi?id=29252

  Bug 28964 - [i965gm] GPU infinite MI_WAIT_FOR_EVENT while watching video in Totem
  https://bugs.freedesktop.org/show_bug.cgi?id=28964

and many others.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
14 years agodrm/i915: Show framebuffer info in debugfs
Chris Wilson [Wed, 25 Aug 2010 21:45:57 +0000 (22:45 +0100)]
drm/i915: Show framebuffer info in debugfs

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Show device capabilities in debugfs
Chris Wilson [Wed, 25 Aug 2010 15:03:34 +0000 (16:03 +0100)]
drm/i915: Show device capabilities in debugfs

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915/tv: After disabling the pipe, use wait_for_vblank_off()
Chris Wilson [Tue, 24 Aug 2010 15:07:16 +0000 (16:07 +0100)]
drm/i915/tv: After disabling the pipe, use wait_for_vblank_off()

Hopefully this is a contributing factor to the spurious TV detection
repoted by Ivan Bulatovic and others.

References:

  Bug 16871 - "TV1 connected" with no tv
  https://bugzilla.kernel.org/show_bug.cgi?id=16871

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Ivan Bulatovic <combuster@gmx.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
14 years agodrm/i915: Refactor panel backlight controls
Chris Wilson [Sun, 22 Aug 2010 12:18:16 +0000 (13:18 +0100)]
drm/i915: Refactor panel backlight controls

There were two instances of code to control the panel backlight and
neither handled the complete set of device variations.

Fixes:

  Bug 29716 - [GM965] Regression: Backlight resets to minimum when changing resolution
  https://bugs.freedesktop.org/show_bug.cgi?id=29716

And a bug on one of my PineView boxes which overflowed the backlight
value.

Incorporates part of a similar patch by Matthew Garrett that exposes a
native Intel backlight controller.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Remove redundant initialisation of fb_base
Chris Wilson [Fri, 20 Aug 2010 21:37:03 +0000 (22:37 +0100)]
drm/i915: Remove redundant initialisation of fb_base

We do it whilst configuring dev->mode_config, so remove the out-of-place
earlier initialisation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Quieten sparse warnings for missing prototypes.
Chris Wilson [Fri, 20 Aug 2010 12:23:26 +0000 (13:23 +0100)]
drm/i915: Quieten sparse warnings for missing prototypes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Kill the active list spinlock
Chris Wilson [Sat, 3 Jul 2010 06:58:38 +0000 (07:58 +0100)]
drm/i915: Kill the active list spinlock

This spinlock only served debugging purposes in a time when we could not
be sure of the mutex ever being released upon a GPU hang. As we now
should be able rely on hangcheck to do the job for us (and that error
reporting should not itself require the struct mutex) we can kill the
incomplete attempt at protection.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Remove the random SyncFlush during initialisation
Chris Wilson [Fri, 20 Aug 2010 10:26:59 +0000 (11:26 +0100)]
drm/i915: Remove the random SyncFlush during initialisation

We have no idea why we request a SyncFlush via INSTPM at that point in
time -- we certainly never check for its completion...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: Compile out error state without DEBUG_FS
Chris Wilson [Thu, 19 Aug 2010 07:19:30 +0000 (08:19 +0100)]
drm/i915: Compile out error state without DEBUG_FS

Alexander reported that the compilation of intel_overlay.c was failing
due to an inclusion that was only valid with CONFIG_DEBUG_FS. As the
whole error reporting is only useful with debugfs enabled, remove all
the redundant error state collection code when compiling without
CONFIG_DEBUG_FS.

Reported-by: Alexander Lam <lambchop468@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915/overlay: Use a continuation hook to finish work after a flip.
Chris Wilson [Thu, 12 Aug 2010 13:03:48 +0000 (14:03 +0100)]
drm/i915/overlay: Use a continuation hook to finish work after a flip.

Slightly easier to follow than the state machine and now possible as the
control structure is opaque and hw_wedged is no longer interferred with.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Make the overlay control struct opaque.
Chris Wilson [Thu, 12 Aug 2010 12:53:37 +0000 (13:53 +0100)]
drm/i915/overlay: Make the overlay control struct opaque.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Pass interruptible to switch_off()
Chris Wilson [Thu, 12 Aug 2010 12:50:28 +0000 (13:50 +0100)]
drm/i915/overlay: Pass interruptible to switch_off()

During DPMS we currently do not want the overlay code to be
interruptible, so pass that information down and only take the
uninterrruptible paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Workaround i830 overlay activation bug.
Chris Wilson [Fri, 16 Jul 2010 16:13:01 +0000 (17:13 +0100)]
drm/i915/overlay: Workaround i830 overlay activation bug.

On i830, there exists a bug where an overlay on pipe B requires the mode
clock on pipe A in order to activate. So workaround this by activating
pipe A when trying to enable the overlay on pipe B.

References:

  [Bug 29007] GPU hang on video playback with overlay
  https://bugs.freedesktop.org/show_bug.cgi?id=29007

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915/overlay: Make do_put_image() as static
Chris Wilson [Thu, 12 Aug 2010 11:38:21 +0000 (12:38 +0100)]
drm/i915/overlay: Make do_put_image() as static

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915: Preallocate requests
Chris Wilson [Thu, 12 Aug 2010 11:36:12 +0000 (12:36 +0100)]
drm/i915: Preallocate requests

By allocating the request prior to writing to the ringbuffer, we can
abort the operation without leaving the GPU in an inconsistent state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Tidy release_old_vid()
Chris Wilson [Thu, 12 Aug 2010 11:21:54 +0000 (12:21 +0100)]
drm/i915/overlay: Tidy release_old_vid()

Inline the call to wait_flip() and simplify the resulting code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Combine SWITCH_OFF into a single step
Chris Wilson [Thu, 12 Aug 2010 11:07:32 +0000 (12:07 +0100)]
drm/i915/overlay: Combine SWITCH_OFF into a single step

We can program the h/w to first wait on the flip and then switch off
without relying on s/w intervention. This removes the need for a double
step switch off, bringing much rejoicing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Explicitly pass regs from map to unmap
Chris Wilson [Thu, 12 Aug 2010 11:02:11 +0000 (12:02 +0100)]
drm/i915/overlay: Explicitly pass regs from map to unmap

The scoping of the validity of the mapping is thus clarified.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Refactor do_wait_request()
Chris Wilson [Thu, 12 Aug 2010 10:55:08 +0000 (11:55 +0100)]
drm/i915/overlay: Refactor do_wait_request()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Tidy check_overlay_dst()
Chris Wilson [Thu, 12 Aug 2010 10:29:34 +0000 (11:29 +0100)]
drm/i915/overlay: Tidy check_overlay_dst()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Tidy update_pfit_vscale_ratio()
Chris Wilson [Thu, 12 Aug 2010 10:15:58 +0000 (11:15 +0100)]
drm/i915/overlay: Tidy update_pfit_vscale_ratio()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Remove duplicated definition of OFC_UPDATE
Chris Wilson [Thu, 12 Aug 2010 09:57:04 +0000 (10:57 +0100)]
drm/i915/overlay: Remove duplicated definition of OFC_UPDATE

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Destroy reg_bo on shutdown.
Chris Wilson [Thu, 12 Aug 2010 09:50:36 +0000 (10:50 +0100)]
drm/i915/overlay: Destroy reg_bo on shutdown.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Use the recommended page alignment for physical regs
Chris Wilson [Thu, 12 Aug 2010 09:47:56 +0000 (10:47 +0100)]
drm/i915/overlay: Use the recommended page alignment for physical regs

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Tidy attribute checking.
Chris Wilson [Thu, 12 Aug 2010 09:44:45 +0000 (10:44 +0100)]
drm/i915/overlay: Tidy attribute checking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Use non-atomic mappings for the common case.
Chris Wilson [Thu, 12 Aug 2010 09:35:26 +0000 (10:35 +0100)]
drm/i915/overlay: Use non-atomic mappings for the common case.

The only time where an atomic mapping is required is during
error-capture and there we cannot use the default slot, but need to
specifically use one of the IRQ slots. So separate out the two
conditions and use the atomic mapping only when appropriate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Move capabilities bits to common info block.
Chris Wilson [Thu, 12 Aug 2010 08:42:51 +0000 (09:42 +0100)]
drm/i915/overlay: Move capabilities bits to common info block.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Ensure that the reg_bo is in the GTT prior to writing.
Chris Wilson [Thu, 12 Aug 2010 08:35:00 +0000 (09:35 +0100)]
drm/i915/overlay: Ensure that the reg_bo is in the GTT prior to writing.

Just makes sure that writes are not being aliased by the CPU cache and
do make it out to main memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=24977
Cc: stable@kernel.org
14 years agodrm/i915/overlay: Missing breaks between case statements for color depth
Chris Wilson [Thu, 12 Aug 2010 08:30:58 +0000 (09:30 +0100)]
drm/i915/overlay: Missing breaks between case statements for color depth

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915/overlay: Whitespace
Chris Wilson [Thu, 12 Aug 2010 08:28:50 +0000 (09:28 +0100)]
drm/i915/overlay: Whitespace

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
14 years agodrm/i915: drop i915_add_request right in front of i915_wait_request
Daniel Vetter [Thu, 11 Feb 2010 21:53:20 +0000 (22:53 +0100)]
drm/i915: drop i915_add_request right in front of i915_wait_request

... take advantage of the new implicit request issuing of
i915_wait_request.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: move the wait_rendering call into flush_gpu_write_domain
Daniel Vetter [Thu, 11 Feb 2010 21:37:04 +0000 (22:37 +0100)]
drm/i915: move the wait_rendering call into flush_gpu_write_domain

One caller (for the pageflip support) wants a purely pipelined flush.
Distinguish this case by a new parameter. This will also be useful
later on for pipelined fencing.

v2: Simplify the code by depending upon the implicit request emitting
of i915_wait_request.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ickle: And drop the non-interruptible support in the process.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: drop seqno argument from i915_gem_object_move_to_active
Daniel Vetter [Thu, 11 Feb 2010 21:16:02 +0000 (22:16 +0100)]
drm/i915: drop seqno argument from i915_gem_object_move_to_active

By moving one i915_add_request we can solely depend on the new
auto-seqno-numbering behaviour.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: kill a no longer necessary BUG_ON
Daniel Vetter [Tue, 2 Feb 2010 21:54:18 +0000 (22:54 +0100)]
drm/i915: kill a no longer necessary BUG_ON

i915_gem_object_move_to_active can handle zero seqno for us now.
And not emitting a request is not fatal here - we'll try to emit
a new one if we have to wait for some rendering to complete.

In case this assumption ever gets accidentally broken, there's already
a BUG_ON to catch it in i915_do_wait_request.

So just silently ignore ENOMEM here instead of screwing up the whole
drm.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: move flushing list processing to i915_retire_commands
Daniel Vetter [Thu, 11 Feb 2010 21:29:04 +0000 (22:29 +0100)]
drm/i915: move flushing list processing to i915_retire_commands

... instead of threading flush_domains through the execbuf code to
i915_add_request.

With this change 2 small cleanups are possible (likewise the majority
of the patch):

- The flush_domains parameter of i915_add_request is always 0. Drop it
  and the corresponding logic.
- Ditto for the seqno param of i915_gem_process_flushing_list.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: only one interrupt per batchbuffer is not enough!
Daniel Vetter [Tue, 2 Feb 2010 16:08:37 +0000 (17:08 +0100)]
drm/i915: only one interrupt per batchbuffer is not enough!

Previously I thought that one interrupt per batchbuffer should be
enough. Now tedious benchmarking showed this to be wrong.

Therefore track whether any commands have been isssued with a future
seqno (like pipelined fencing changes or flushes). If this is the case
emit a request before issueing the batchbuffer.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: move flushing list processing to i915_gem_flush
Daniel Vetter [Thu, 11 Feb 2010 21:19:40 +0000 (22:19 +0100)]
drm/i915: move flushing list processing to i915_gem_flush

Now that we can move objects to the active list without already having
emitted a request, move the flushing list handling into i915_gem_flush.
This makes more sense and allows to drop a few i915_add_request calls
that are not strictly necessary.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
14 years agodrm/i915: allow lazy emitting of requests
Daniel Vetter [Thu, 11 Feb 2010 21:13:59 +0000 (22:13 +0100)]
drm/i915: allow lazy emitting of requests

Sometimes (like when flushing in preparation of batchbuffer execution)
we know that we'll emit a request but haven't yet done so. Allow this
case by simply taking the next seqno by default. Ensure that a request
is eventually emitted before waiting for an request by issuing it
in i915_wait_request iff this is not yet done.

Also replace one open-coded version of i915_gem_object_wait_rendering,
to prevent future code-diversion.

Chris Wilson asked me to explain and clarify what this patch does and why.
Here it goes:

Old way of moving objects onto the active list and associating them with a
reques:

1. i915_add_request + store the returned seqno somewhere
2. i915_gem_object_move_to_active (with the stored seqno as parameter)

For the current users, this is all fine. But I'd like to associate objects
(and fence regs) with the batchbuffer request deep down in the execbuf
call-chain. I thought about three ways of implementing this.

a) Don't care, just emit request when we need a new seqno. When heavily
pipelining fence reg changes, this would have caused tons of superflous
request (and corresponding irqs).

b) Thread all changed fences, objects, whatever through the execbuf-maze,
so that when we emit a request, we can store the new seqno at all the right
places.

c) Kill that seqno-threading-around business by simply storing the next
seqno, i.e. allow 2. to be done before 1. in the above sequence.

I've decided to implement c) (in this patch). The following patches are
just fall-out that resulted from this small conceptual change.

* We can handle the flushing list processing where we actually emit a flush
  (i915_gem_flush and i915_retire_commands) instead of in i915_add_request.
  The code makes IMHO more sense this way (and i915_add_request looses the
  flush_domains parameter, obviously).

* We can avoid emitting unnecessary requests. IMHO there's no point in
  emitting more than one request per batchbuffer (with or without an
  corresponding irq).

* By enforcing 2. before 1. ordering in the above sequence the seqno
  argument of i915_gem_object_move_to_active is redundant and can be
  dropped.

v2: Now i915_wait_request issues request if it is not yet emitted.
Also introduce i915_gem_next_request_seqno(dev) just in case we ever
need to do some prep work before using a new seqno.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ickle: Keep i915_gem_object_set_to_display_plane() uninterruptible.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>