History log of /drivers/gpu/drm/i915/i915_dma.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e90f3b61f4432e3c5bb6b57f4b3e8d8cba747541 30-Apr-2012 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Only enable IPS polling for gen5

On SandyBridge IPS was entirely implemented in hardware and not reliant
on the driver monitoring power consumption and feeding back desired run
states, so the hardware is able to adapt quicker and more flexibly. Which
is a huge relief for us as we no longer have to carry empirically
derived magic algorithms.

Yet despite the advance in technology, the driver was still doing its
IPS polling on all machines. Restrict it to the only supported hardware,
Clarkdale/Arrandale.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tested-by: Andrey Rahmatullin <wrar@wrar.name>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49025
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
e02f14cd48a5da0ebaecf88c93dbd54a81e0dead 02-Apr-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: don't leak struct_mutex lock on ppgtt init failures

Reported-by: Konstantin Belousov <kostikbel@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
650dc07ec3b0eba8ff21da706d2b1876ada59fc3 02-Apr-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: disable ppgtt on snb when dmar is enabled

Totally unexpected that this regressed. Luckily it sounds like we just
need to have dmar disable on the igfx, not the entire system. At least
that's what a few days of testing between Tony Vroon and me indicates.

Reported-by: Tony Vroon <tony@linx.net>
Cc: Tony Vroon <tony@linx.net>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43024
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
ff5f4b0585620e5c158ecaad84d91c5bf3c5d0a1 23-Feb-2012 Daniel Vetter <daniel.vetter@ffwll.ch> Merge remote-tracking branch 'airlied/drm-next' into for-airlied

Manually resolve the conflict between the new enum drm property
helpers in drm-next and the new "force-dvi" option that the "audio" output
property gained in drm-intel-next.

While resolving this conflict, switch the new drm_prop_enum_list to
use the newly introduced enum defines instead of magic values.

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

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
466e69b8b03b8c1987367912782bc12988ad8794 19-Dec-2011 Dave Airlie <airlied@redhat.com> drm: move pci bus master enable into driver.

The current enabling of bus mastering in the drm midlayer allows a large
race condition under kexec. When a kexec'ed kernel re-enables bus mastering
for the GPU, previously setup dma blocks may cause writes to random pieces
of memory. On radeon the writeback mechanism can cause these sorts of issues.

This patch doesn't fix the problem, but it moves the bus master enable under
the individual drivers control so they can move enabling it until later in
their load cycle and close the race.

Fix for radeon kms driver will be in a follow-up patch.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
cdbe8b5426e71d09882212073c27c9dcf25a71b6 14-Feb-2012 Dave Airlie <airlied@redhat.com> Merge tag 'drm-intel-next-2012-02-07' of git://people.freedesktop.org/~danvet/drm-intel into drm-core-next

* tag 'drm-intel-next-2012-02-07' of git://people.freedesktop.org/~danvet/drm-intel: (29 commits)
drm/i915: Handle unmappable buffers during error state capture
drm/i915: rewrite shmem_pread_slow to use copy_to_user
drm/i915: rewrite shmem_pwrite_slow to use copy_from_user
drm/i915: fall through pwrite_gtt_slow to the shmem slow path
drm/i915: add debugfs file for swizzling information
drm/i915: fix swizzle detection for gen3
drm/i915: Remove the upper limit on the bo size for mapping into the CPU domain
drm/i915: add per-ring fault reg to error_state
drm/i915: reject GTT domain in relocations
drm/i915: remove the i915_batchbuffer_info debugfs file
drm/i915: capture error_state also for stuck rings
drm/i915: refactor debugfs create functions
drm/i915: refactor debugfs open function
drm/i915: don't trash the gtt when running out of fences
drm/i915: Separate fence pin counting from normal bind pin counting
drm/i915/ringbuffer: kill snb blt workaround
drm/i915: collect more per ring error state
drm/i915: refactor ring error state capture to use arrays
drm/i915: switch ring->id to be a real id
drm/i915: set AUD_CONFIG N_value_index for DisplayPort
...
d3ae08109d628d26615d7f7f4d8d53cdd8d71fd0 26-Jan-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: fix up locking inconsistency around gem_do_init

The locking in our setup and teardown paths is rather arbitrary, but
generally we try to protect gem stuff with dev->struct_mutex. Further,
the ums/gem ioctl to setup gem _does_ take the look. So fix up this
benign inconsistency.

Notice while reading through code.

v2: Rebased on top of the ppgtt code.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
9edd576d89a5b6d3e136d7dcab654d887c0d25b7 10-Feb-2012 Daniel Vetter <daniel.vetter@ffwll.ch> Merge remote-tracking branch 'airlied/drm-fixes' into drm-intel-next-queued

Back-merge from drm-fixes into drm-intel-next to sort out two things:

- interlaced support: -fixes contains a bugfix to correctly clear
interlaced configuration bits in case the bios sets up an interlaced
mode and we want to set up the progressive mode (current kernels
don't support interlaced). The actual feature work to support
interlaced depends upon (and conflicts with) this bugfix.

- forcewake voodoo to workaround missed IRQ issues: -fixes only enabled
this for ivybridge, but some recent bug reports indicate that we
need this on Sandybridge, too. But in a slightly different flavour
and with other fixes and reworks on top. Additionally there are some
forcewake cleanup patches heading to -next that would conflict with
currrent -fixes.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
e21af88d39796c907c38648c824be3d646ffbe35 09-Feb-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: enable ppgtt

We want to unconditionally enable ppgtt for two reasons:
- Windows uses this on snb and later.
- We need the basic hw support to work before we can think about real
per-process address spaces and other cool features we want.

But Chris Wilson was complaining all over irc and intel-gfx that this
will blow up if we don't have a module option to disable it. Hence add
one, to prevent this.

ppgtt support seems to slightly change the timings and make crashy
things slightly more or less crashy. Now in my testing and the testing
this got on troublesome snb machines, it seems to have improved things
only. But on ivb it makes quite a few crashes happen much more often,
see

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

Luckily Eugeni Dodonov seems to have a set of workarounds that fix
this issue.

v2: Don't try to enable ppgtt on pre-snb.

v3: Pimp commit message and make Chris Wilson less grumpy by adding a
module option.

v4: New try at making Chris Wilson happy.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
1d2a314c97ceaf383de8e23cdde46729927d433c 09-Feb-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: initialization/teardown for the aliasing ppgtt

This just adds the setup and teardown code for the ppgtt PDE and the
last-level pagetables, which are fixed for the entire lifetime, at
least for the moment.

v2: Kill the stray debug printk noted by and improve the pte
definitions as suggested by Chris Wilson.

v3: Clean up the aperture stealing code as noted by Ben Widawsky.

v4: Paint the init code in a more pleasing colour as suggest by Chris
Wilson.

v5: Explain the magic numbers noticed by Ben Widawsky.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
f691e2f4cec334e906f971471b3bf1460c6256d4 02-Feb-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: swizzling support for snb/ivb

We have to do this manually. Somebody had a Great Idea.

I've measured speed-ups just a few percent above the noise level
(below 5% for the best case), but no slowdows. Chris Wilson measured
quite a bit more (10-20% above the usual snb variance) on a more
recent and better tuned version of sna, but also recorded a few
slow-downs on benchmarks know for uglier amounts of snb-induced
variance.

v2: Incorporate Ben Widawsky's preliminary review comments and
elaborate a bit about the performance impact in the changelog.

v3: Add a comment as to why we don't need to check the 3rd memory
channel.

v4: Fixup whitespace.

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
198ceac091049003ffcc4b7cda76785510fc3b59 07-Feb-2012 Dave Airlie <airlied@redhat.com> Merge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel into drm-core-next

* 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel:
drm/i915: add a LLC feature flag in device description
drm/i915: kill i915_mem.c
drm/i915: Use kcalloc instead of kzalloc to allocate array
drm/i915/dp: Check for AUXCH error before checking for success
drm/i915/dp: Use auxch precharge value of 5 everywhere
drm/i915/dp: Tweak auxch clock divider for PCH
drm/i915: Remove a comment about PCH from the non-PCH path
drm/i915: Fix assert_pch_hdmi_disabled to mention HDMI (not DP)
drm/i915: Implement plane-disabled assertion for PCH too
drivers: i915: Fix BLC PWM register setup
drm/i915: Check that plane/pipe is disabled before removing the fb
drm/i915: fix typo in function name
drm/i915: split out pll divider code
drm/i915: split 9xx refclk & sdvo tv code out
agp/intel: Add pci id for hostbridge from has/qemu
drm/i915: there is no pipe CxSR on ironlake
drm/i915: Only look for matching clocks for LVDS downclock
drm/i915: Silence _DSM errors
b93f9cf14e714c20ce9a544ed1a6070ee7604588 26-Jan-2012 Ben Widawsky <ben@bwidawsk.net> drm/i915: argument to control retiring behavior

Sometimes it may be the case when we idle the gpu or wait on something
we don't actually want to process the retiring list. This patch allows
callers to choose the behavior.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
9f1f46a45a681d357d1ceedecec3671a5ae957f4 14-Dec-2011 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: protect force_wake_(get|put) with the gt_lock

The problem this patch solves is that the forcewake accounting
necessary for register reads is protected by dev->struct_mutex. But the
hangcheck and error_capture code need to access registers without
grabbing this mutex because we hold it while waiting for the gpu.
So a new lock is required. Because currently the error_state capture
is called from the error irq handler and the hangcheck code runs from
a timer, it needs to be an irqsafe spinlock (note that the registers
used by the irq handler (neglecting the error handling part) only uses
registers that don't need the forcewake dance).

We could tune this down to a normal spinlock when we rework the
error_state capture and hangcheck code to run from a workqueue. But
we don't have any read in a fastpath that needs forcewake, so I've
decided to not care much about overhead.

This prevents tests/gem_hangcheck_forcewake from i-g-t from killing my
snb on recent kernels - something must have slightly changed the
timings. On previous kernels it only trigger a WARN about the broken
locking.

v2: Drop the previous patch for the register writes.

v3: Improve the commit message per Chris Wilson's suggestions.

Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
3d29b842e58fbca2c13a9f458fddbaa535c6e578 17-Jan-2012 Eugeni Dodonov <eugeni.dodonov@intel.com> drm/i915: add a LLC feature flag in device description

LLC is not SNB/IVB-specific, so we should check for it in a more generic
way.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
b2c606fe1defd1fb79612b48b528b2568c97def7 17-Jan-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: kill i915_mem.c

Some decent history digging indicates that this was to be used for the
GLX_MESA_allocate_memory extension but never actually implemented for
any released i915 userspace code.

So just rip it out.

v2: Fixup the Makefile.

Acked-by: Dave Airlie <airlied@gmail.com>
Cc: Keith Whitwell <keithw@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
/drivers/gpu/drm/i915/i915_dma.c
ae662d31264979e52581bd2573bf0b82812f52ab 03-Jan-2012 Eric Anholt <eric@anholt.net> drm/i915: Add support for resetting the SO write pointers on gen7.

These registers are automatically incremented by the hardware during
transform feedback to track where the next streamed vertex output
should go. Unlike the previous generation, which had a packet for
setting the corresponding registers to a defined value, gen7 only has
MI_LOAD_REGISTER_IMM to do so. That's a secure packet (since it loads
an arbitrary register), so we need to do it from the kernel, and it
needs to be settable atomically with the batchbuffer execution so that
two clients doing transform feedback don't stomp on each others'
state.

Instead of building a more complicated interface involcing setting the
registers to a specific value, just set them to 0 when asked and
userland can tweak its pointers accordingly.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
8ea30864229e54b01ac0e9fe88c4b733a940ec4e 03-Jan-2012 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add color key support v4

Add new ioctls for getting and setting the current destination color
key. This allows for simple overlay display control by matching a color
key value in the primary plane before blending the overlay on top.

v2: remove unnecessary mutex acquire/release around reg accesses
v3: add support for full color key management
v4: fix copy & paste bug in snb_get_colorkey
don't bother checking min/max values against docs as the docs are likely
wrong (how could we handle 10bpc surface formats?)

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
4ed0b577457eb6aeb7cdc7e7316576e63d15abb2 10-Nov-2011 Eugeni Dodonov <eugeni.dodonov@intel.com> drm/i915: prevent division by zero when asking for chipset power

This prevents an in-kernel division by zero which happens when we are
asking for i915_chipset_val too quickly, or within a race condition
between the power monitoring thread and userspace accesses via debugfs.

The issue can be reproduced easily via the following command:
while ``; do cat /sys/kernel/debug/dri/0/i915_emon_status; done

This is particularly dangerous because it can be triggered by
a non-privileged user by just reading the debugfs entry.

This issue was also found independently by Konstantin Belousov
<kostikbel@gmail.com>, who proposed a similar patch.

Reported-by: Konstantin Belousov <kostikbel@gmail.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
e0cd3608135b2ed8eddbe3fdf048d22e0593d836 30-Aug-2011 Paul Gortmaker <paul.gortmaker@windriver.com> gpu: add module.h to drivers/gpu files as required.

So that we don't get build failures once the implicit module.h
presence is removed.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
/drivers/gpu/drm/i915/i915_dma.c
27f8227b1e2b326a9a0995dd9c1f14893c61ee01 02-Sep-2011 Jesse Barnes <jbarnes@virtuousgeek.org> 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>
/drivers/gpu/drm/i915/i915_dma.c
0206e353a0416ad63ce07f53c807c2c725633b87 16-Aug-2011 Akshay Joshi <me@akshayjoshi.com> Drivers: i915: Fix all space related issues.

Various issues involved with the space character were generating
warnings in the checkpatch.pl file. This patch removes most of those
warnings.

Signed-off-by: Akshay Joshi <me@akshayjoshi.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
df7976797fa9af161690dbf4dee81ed92cdc150f 22-Jul-2011 Keith Packard <keithp@keithp.com> Merge branch 'drm-intel-fixes' into drm-intel-next
f3234706a77bd6e1592ae71fb3268e04cb030dba 22-Jul-2011 Keith Packard <keithp@keithp.com> drm/i915: Initialize RCS ring status page address in intel_render_ring_init_dri

Physically-addressed hardware status pages are initialized early in
the driver load process by i915_init_phys_hws. For UMS environments,
the ring structure is not initialized until the X server starts. At
that point, the entire ring structure is re-initialized with all new
values. Any values set in the ring structure (including
ring->status_page.page_addr) will be lost when the ring is
re-initialized.

This patch moves the initialization of the status_page.page_addr value
to intel_render_ring_init_dri.

Signed-off-by: Keith Packard <keithp@keithp.com>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
9aa73a51c91cb0d0af4caaa9823969c1a1179a12 12-Jul-2011 Keith Packard <keithp@keithp.com> Merge branch 'drm-intel-fixes' into drm-intel-next
a7b85d2aa63ed09cd5a4a640772b3272f5ac7caa 10-Jul-2011 Keith Packard <keithp@keithp.com> drm/i915: Clean up i915_driver_load failure path

i915_driver_load adds a write-combining MTRR region for the GTT
aperture to improve memory speeds through the aperture. If
i915_driver_load fails after this, it would not have cleaned up the
MTRR. This shouldn't cause any problems, except for consuming an MTRR
register. Still, it's best to clean up completely in the failure path,
which is easily done by calling mtrr_del if the mtrr was successfully
allocated.

i915_driver_load calls i915_gem_load which register
i915_gem_inactive_shrink. If i915_driver_load fails after calling
i915_gem_load, the shrinker will be left registered. When called, it
will access freed memory and crash. The fix is to unregister the shrinker in the
failure path using code duplicated from i915_driver_unload.

i915_driver_load also has some incorrect gotos in the error cleanup
paths:

* After failing to initialize the GTT (which cannot happen, btw,
intel_gtt_get returns a fixed (non-NULL) value), it tries to
free the uninitialized WC IO mapping. Fixed this by changing the
target from out_iomapfree to out_rmmap

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Lin Ming <ming.m.lin@intel.com>
/drivers/gpu/drm/i915/i915_dma.c
43a9539fa9e780f16c0d1e4bc91a2701f1ce178f 08-Jul-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Only export the generic intel_disable_fbc() interface

As the enable/disable routines will be gain additional complexity in
future patches, it is necessary that all callers do not bypass the
generic interface by calling into the chipset routines directly. to do
this we make the chipset routines static, so there is no choice.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
f71d4af4cd475aced6d9ec9730b03885ac80b833 28-Jun-2011 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: move IRQ function table init to i915_irq.c

This lets us make the various IRQ functions static and helps avoid
problems like the one fixed in "drm/i915: Use chipset-specific irq
installers" where one of the exported functions was called rather than
the chipset specific version.

This also fixes a UMS-mode bug -- the correct irq functions for IRL
and later chips were only getting loaded in the KMS path.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
ecbec53b1d00ba582f71b210ed96cafc05ebd189 28-Jun-2011 Hugh Dickins <hughd@google.com> drm/i915: more struct_mutex locking

When auditing the locking in i915_gem.c (for a prospective change which
I then abandoned), I noticed two places where struct_mutex is not held
across GEM object manipulations that would usually require it.

Since one is in initial setup and the other in driver unload, I'm
guessing the mutex is not required for either; but post a patch in case
it is.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/gpu/drm/i915/i915_dma.c
b1f14ad01ab09f5e22fb1240a6a158a23527ff14 06-Apr-2011 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: interrupt & vblank support for Ivy Bridge

Add new interrupt handling functions for Ivy Bridge.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
f796cf8f517f13826bb691432b03c7b5da13e530 07-Apr-2011 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: split enable/disable vblank code into chipset specific functions

This makes the Ironlake+ code trivial and generally simplifies things.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
4697995b98417c6da9ab2708a36f5e2bc926c8ac 07-Apr-2011 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: split irq handling into per-chipset functions

Set the IRQ handling functions in driver load so they'll just be used
directly, rather than branching over most of the code in the chipset
functions.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
4912d04193733a825216b926ffd290fada88ab07 25-Apr-2011 Ben Widawsky <ben@bwidawsk.net> drm/i915: move gen6 rps handling to workqueue

The render P-state handling code requires reading from a GT register.
This means that FORCEWAKE must be written to, a resource which is shared
and should be protected by struct_mutex. Hence we can not manipulate
that register from within the interrupt handling and so must delegate
the task to a workqueue.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
/drivers/gpu/drm/i915/i915_dma.c
2c7111dbaec72b01c804afb8ad77c6c7523986fd 29-Mar-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Disable all outputs early, before KMS takeover

If the outputs are active and continuing to access the GATT when we
teardown the PTEs, then there is a potential for us to hang the GPU.
The hang tends to be a PGTBL_ER with either an invalid host access or
an invalid display plane fetch.

v2: Reorder IRQ initialisation to defer until after GEM is setup.

Reported-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Daniel Vetter <daniel.vetter@ffwll.ch> (855GM)
Tested-by: Pekka Enberg <penberg@kernel.org>
# note that this doesn't fix the underlying problem of the
PGTBL_ER and pipe underruns being reported immediately upon
init on his 965GM MacBook
Reported-and-tested-by: Rick Bramley <richard.bramley@hp.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35635
Reported-and-tested-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36048
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
/drivers/gpu/drm/i915/i915_dma.c
96f298aa9c9fc9b7c8a2ebaf8c195d178f570e09 20-Mar-2011 Ben Widawsky <ben@bwidawsk.net> drm/1915: ringbuffer wait for idle function

Added a new function which waits for the ringbuffer space to be equal to
(total - 8). This is the empty condition of the ringbuffer, and
equivalent to head==tail.

Also modified two users of this functionality elsewhere in the code.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
e8e7a2b8ccfdae0d4cb6bd25824bbedcd42da316 21-Apr-2011 Dave Airlie <airlied@redhat.com> drm/i915: restore only the mode of this driver on lastclose (v2)

i915 calls the panic handler function on last close to reset the modes,
however this is a really bad idea for multi-gpu machines, esp shareable
gpus machines. So add a new entry point for the driver to just restore
its own fbcon mode.

v2: move code into fb helper, fix panic code to block mode change on
powered off GPUs.

[airlied: this hits drm core and I wrote it and it was reviewed on intel-gfx
so really I signed it off twice ;-).]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
4cbf74ccf8362e99b2bdf1e66112a480c79ecacf 25-Feb-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: don't store the reg value for HWS_PGA

It is trivially computable from the real physical address so no need to
store both.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
8d3c3ddfa85837e24fad6fa39318617cbb59e843 02-Mar-2011 Chris Wilson <chris@chris-wilson.co.uk> Merge branch 'drm-intel-fixes' into drm-intel-next
6927faf30920b8c03dfa007e732642a1f1f20089 01-Mar-2011 Jan Niehusmann <jan@gondor.com> drm/i915: fix memory corruption with GM965 and >4GB RAM

On a Thinkpad x61s, I noticed some memory corruption when
plugging/unplugging the external VGA connection. The symptoms are that
4 bytes at the beginning of a page get overwritten by zeroes.
The address of the corruption varies when rebooting the machine, but
stays constant while it's running (so it's possible to repeatedly write
some data and then corrupt it again by plugging the cable).

Further investigation revealed that the corrupted address is
(dev_priv->status_page_dmah->busaddr & 0xffffffff), ie. the beginning of
the hardware status page of the i965 graphics card, cut to 32 bits.

So it seems that for some memory access, the hardware uses only 32 bit
addressing. If the hardware status page is located >4GB, this
corrupts unrelated memory.

Signed-off-by: Jan Niehusmann <jan@gondor.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
271d81b84171d84723357ae6d172ec16b0d8139c 01-Mar-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Allow relocation deltas outside of target bo

Userspace has a legitimate requirement to use a delta that points to
outside of the target bo, and so we need to enable this. (As this is an
abi break, albeit a relaxation of the current restrictions, mark the change
with a new flag.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
9db4a9c7b2a3bd5b4952846bc0c2f58daa80ddd7 07-Feb-2011 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: cleanup per-pipe reg usage

We had some conversions over to the _PIPE macros, but didn't get
everything. So hide the per-pipe regs with an _ (still used in a few
places for legacy) and add a few _PIPE based macros, then make sure
everyone uses them.

[update: remove usage of non-existent no-op macro]
[update 2: keep modesetting suspend/resume code, update to new reg names]
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: stylistic cleanups for checkpatch and taste]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
db53a302611c06bde01851f61fa0675a84ca018c 03-Feb-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Refine tracepoints

A lot of minor tweaks to fix the tracepoints, improve the outputting for
ftrace, and to generally make the tracepoints useful again. It is a start
and enough to begin identifying performance issues and gaps in our
coverage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
bdd92c9ad287e03a2ec52f5a89c470cd5caae1c2 23-Jan-2011 Chris Wilson <chris@chris-wilson.co.uk> Merge branch 'drm-intel-fixes' into drm-intel-next

Merge important suspend and resume regression fixes and resolve the
small conflict.

Conflicts:
drivers/gpu/drm/i915/i915_dma.c
934f992c763ae1e5eefcce8af769c16444085df7 20-Jan-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Recognise non-VGA display devices

Starting with SandyBridge (though possible with earlier hacked BIOSes),
the BIOS may initialise the IGFX as secondary to a discrete GPU. Prior,
it would simply disable the integrated GPU. So we adjust our PCI class
mask to match any DISPLAY_CLASS device.

In such a configuration, the IGFX is not a primary VGA controller and
so should not take part in VGA arbitration, and the error return from
vga_client_register() is expected.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
e8616b6ced6137085e6657cc63bc2fe3900b8616 20-Jan-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Initialise ring vfuncs for old DRI paths

We weren't setting up the vfunc table when initialising the old DRI
ringbuffer, leading to such OOPSes as:

BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<(null)>] (null)
PGD 10c441067 PUD 1185e5067 PMD 0
Oops: 0010 [#1] PREEMPT SMP
last sysfs file: /sys/class/dmi/id/chassis_asset_tag
CPU 3
Modules linked in: i915 drm_kms_helper drm fb fbdev i2c_algo_bit
cfbcopyarea video backlight output cfbimgblt cfbfillrect autofs4 ipv6
nfs lockd fscache nfs_acl auth_rpcgss sunrpc coretemp hwmon_vid mousedev
usbhid hid option usb_wwan snd_hda_codec_via asus_atk0110 atl1e
usbserial snd_hda_intel snd_hda_codec firmware_class snd_hwdep snd_pcm
snd_seq snd_timer snd_seq_device processor parport_pc thermal snd
thermal_sys parport 8250_pnp button rng_core rtc_cmos shpchp hwmon
rtc_core ehci_hcd pci_hotplug uhci_hcd soundcore tpm_tis i2c_i801
rtc_lib tpm serio_raw snd_page_alloc tpm_bios i2c_core usbcore psmouse
intel_agp sg pcspkr sr_mod evdev cdrom ext3 jbd mbcache dm_mod sd_mod
ata_piix libata scsi_mod unix
Jan 18 15:49:29 lithui kernel:
Pid: 3605, comm: Xorg Not tainted 2.6.36.2 #5 P5KPL-CM/System Product
Name
RIP: 0010:[<0000000000000000>] [<(null)>] (null)
RSP: 0018:ffff8801150d1d40 EFLAGS: 00010202
RAX: 000000000001ffff RBX: ffff88011a011b00 RCX: 000000000001a704
RDX: ffff880118566028 RSI: ffff880118566028 RDI: ffff880117876800
RBP: ffff8801150d1d48 R08: ffff8801195fe300 R09: 00000000c0086444
R10: 0000000000000001 R11: 0000000000003206 R12: ffff880117876800
R13: ffff880118566000 R14: ffff880117876820 R15: ffff8801150d1df8
FS: 00007f1038d456e0(0000) GS:ffff880001780000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000001187e7000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process Xorg (pid: 3605, threadinfo ffff8801150d0000, task
ffff88011b016e40)
Stack:
ffffffffa043b8e6 ffff8801150d1d98 ffffffffa041768b dead000000000000
<0> 0000000000000048 00007f1023f2a000 0000000000000044 0000000000000008
<0> ffff88010d26bd80 ffff880117876800 ffff8801150d1df8 ffff8801150d1ea8
Call Trace:
[<ffffffffa043b8e6>] ? intel_ring_advance+0x16/0x20 [i915]
[<ffffffffa041768b>] i915_irq_emit+0x15b/0x240 [i915]
[<ffffffffa03ea7b1>] drm_ioctl+0x1f1/0x460 [drm]
[<ffffffffa0417530>] ? i915_irq_emit+0x0/0x240 [i915]
[<ffffffff810dd8f1>] ? do_sync_read+0xd1/0x120
[<ffffffff81025b1f>] ? do_page_fault+0x1df/0x3d0
[<ffffffff810ed5c7>] do_vfs_ioctl+0x97/0x550
[<ffffffff8115c2ea>] ? security_file_permission+0x7a/0x90
[<ffffffff810edb19>] sys_ioctl+0x99/0xa0
[<ffffffff810024ab>] system_call_fastpath+0x16/0x1b
Code: Bad RIP value.
RIP [<(null)>] (null)
RSP <ffff8801150d1d40>
CR2: 0000000000000000

Reported-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Herbert Xu <herbert@gondor.apana.org.au>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29153
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=23172
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
311bd68e024f9006db66cbadc3bd9f62fd663f4b 13-Jan-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Trivial sparse fixes

Move code around and invoke iomem annotation in a few more places in
order to silence sparse. Still a few more iomem annotations to go...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
759010728b1323aec03c5baae13fde8f76e44a99 03-Jan-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Remove impossible test

As has_gem is unconditionally set to true, the conditional immediately
following that assignment is superfluous.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
5bcf719b7db0f9366cedaf102b081f99b1c325ae 07-Dec-2010 Dave Airlie <airlied@redhat.com> drm/switcheroo: track state of switch in drivers.

We need to track the state of the switch in drivers, so that after s/r
we don't resume the card we've explicitly switched off before. Also
don't allow a userspace open to occur if we've switched the gpu off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
8d608aa6295242fe4c4b6105b8c59c6a5b232d89 06-Dec-2010 Dave Airlie <airlied@redhat.com> vga_switcheroo: add reprobe hook for fbcon to recheck connected outputs.

This adds a hook after the mux is switched for the driver to reprobe
the connected outputs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
4f125010d2d02c481a0fdf5aee23a9f937bc5de1 04-Jan-2011 Dave Airlie <airlied@redhat.com> Merge branch 'master' of /home/airlied/kernel/linux-2.6 into drm-core-next
63ee41d794d9c555f84205517a68509848988760 21-Dec-2010 Eric Anholt <eric@anholt.net> drm/i915, intel_ips: When i915 loads after IPS, make IPS relink to i915.

The IPS driver is designed to be able to run detached from i915 and
just not enable GPU turbo in that case, in order to avoid module
dependencies between the two drivers. This means that we don't know
what the load order between the two is going to be, and we had
previously only supported IPS after (optionally) i915, but not i915
after IPS. If the wrong order was chosen, you'd get no GPU turbo, and
something like half the possible graphics performance.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
72bfa19c8deb4d1db5ad068c34fd580cb295cbe8 19-Dec-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Allow the application to choose the constant addressing mode

The relative-to-general state default is useless as it means having to
rewrite the streaming kernels for each batch. Relative-to-surface is
more useful, as that stream usually needs to be rewritten for each
batch. And absolute addressing mode, vital if you start streaming
state, is also only available by adjusting the register...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
9c04f015ebc2cc2cca5a4a576deb82a311578edc 15-Dec-2010 Yuanhan Liu <yuanhan.liu@linux.intel.com> drm/i915: Add frame buffer compression on Sandybridge

Add frame buffer compression on Sandybridge. The method is similar to
Ironlake, except that two new registers of type GTTMMADR must be written
with the right fence info.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
5aa7d52aebfc11760bbc5b081ed621227bb77981 05-Dec-2010 Chris Wilson <chris@chris-wilson.co.uk> Merge branch 'drm-intel-fixes' into drm-intel-next

Immediate merge for the conflicting introduction of HAS_COHERENT_RINGS.

Conflicts:
drivers/gpu/drm/i915/i915_dma.c
include/drm/i915_drm.h
bbf0c6b3620b3872929ef7d3c392ce436889110f 05-Dec-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: announce to userspace that the bsd ring is coherent

Otherwise we can't really fix the abi-braindeadness of forcing
libva to manually wait for rendering when switching rings. Which
in turn makes implementing hw semaphores a pointless exercise
(at least for ironlake).

[Also added the relaxed fencing param to explain the jump in
numbering - relaxed fencing is in -next.]

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
1ec14ad3132702694f2e1a90b30641cf111183b9 04-Dec-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Implement GPU semaphores for inter-ring synchronisation on SNB

The bulk of the change is to convert the growing list of rings into an
array so that the relationship between the rings and the semaphore sync
registers can be easily computed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
c4e7a4146798ce22c229dd21ed31f59f07c4119e 30-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/ringbuffer: Handle cliprects in the caller

This makes the various rings more consistent by removing the anomalous
handing of the rendering ring execbuffer dispatch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
05394f3975dceb107a5e1393e2244946e5b43660 08-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use drm_i915_gem_object as the preferred type

A glorified s/obj_priv/obj/ with a net reduction of over a 100 lines and
many characters!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
faa60c4174d943696b9478c5de6438c4f0fecba6 23-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Contract the magic IPS constants into a direct LUT

... and no need to perform a linear search for the index.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
c64f7ba5f1006d8c20eacafecf98d4d00a6902a0 23-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> agp/intel: Remove confusion of stolen entries not stolen memory

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
fe669bf88e9108b96a847385df08c9b1e98c1420 23-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Compute physical addresses from base of stolen memory

The GATT is a write-only set of registers, reading from them in the
manner of i915_gtt_to_phys() is supposed to be undefined. However a
simple solution exists as we allocate linear memory from the stolen
area, we can simply add the block offset to the base register. As a
side-effect we recover all the unused stolen GTT entries and so enlarge
our aperture.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
df9c2042858e85ab46731c13e708a5b0799db848 18-Nov-2010 Eric Anholt <eric@anholt.net> drm/i915: Correct a comment about the use of the workqueue.

It isn't used for the hangcheck, which does its work right from the
timer trigger, but hangcheck can lead to error state recording, which
is run off of the workqueue.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
8168bd48bb863c00747497aadf13884b2d69d287 11-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Remove the definitions for Primary Ring Buffer

We only ever used the PRB0, neglecting the secondary ring buffers, and
now with the advent of multiple engines with separate ring buffers we
need to excise the anachronisms from our code (and be explicit about
which ring we mean where). This is doubly important in light of the
FORCEWAKE required to read ring buffer registers on SandyBridge.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
56e2ea346ab4c2ea159ecdec85fffc24f50c2903 08-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Fix unload after failed initialisation

If modeset init failed we attempted to unload the module, before we
finished setting it up and so triggered various oopses.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
6dda569fe0fb71a03e2a2e815761796f98232cdb 29-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Switch to using pci_iounmap in conjunction with pci_iomap

After switching the MMIO registers to use pci_iomap, remember to dispose
of the mapping with pci_iounmap (for symmetry).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
a00b10c360b35d6431a94cbf130a4e162870d661 24-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Only enforce fence limits inside the GTT.

So long as we adhere to the fence registers rules for alignment and no
overlaps (including with unfenced accesses to linear memory) and account
for the tiled access in our size allocation, we do not have to allocate
the full fenced region for the object. This allows us to fight the bloat
tiling imposed on pre-i965 chipsets and frees up RAM for real use. [Inside
the GTT we still suffer the additional alignment constraints, so it doesn't
magic allow us to render larger scenes without stalls -- we need the
expanded GTT and fence pipelining to overcome those...]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
17250b71553680bc6e927497aa619ab06ab1015b 28-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Make the inactive object shrinker per-device

Eliminate the racy device unload by embedding a shrinker into each
device. Smaller, simpler code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
b4ce0f85159f77f208a62930f67b4e548576a5a3 28-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use pci_iomap for remapping the MMIO registers.

Play safe and use the common routines which take care of the cachability
of the memory when setting up the iomapping for the PCI registers.
Whilst they should be cacheable for the current generations, actually
honouring what the device requires is a better long term strategy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
71e9339c3389de6a685ecb26261a81b8a583aa1c 27-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use the agp_size determined from the GTT

This is the same value as before, but it just makes the code slightly
more readable to use the local variable than converting the aperture
size into bytes every time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
53984635a659e360f206a81ada4ae813152d72f1 22-Sep-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: use the complete gtt

At least the part that's currently enabled by the BIOS.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
e1f99ce6cac3b6a95551642be5ddb5d9c46bea76 27-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Propagate errors from writing to ringbuffer

Preparing the ringbuffer for adding new commands can fail (a timeout
whilst waiting for the GPU to catch up and free some space). So check
for any potential error before overwriting HEAD with new commands, and
propagate that error back to the user where possible.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
78501eac34f372bfbeb4e1d9de688c13efa916f6 27-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/ringbuffer: Drop the redundant dev from the vfunc interface

The ringbuffer keeps a pointer to the parent device, so we can use that
instead of passing around the pointer on the stack.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
f00a3ddf91d596bece5fa31e8ce2e8a3b4c0623b 21-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: IS_IRONLAKE is synonymous with gen == 5

So remove the redundant bit in the capabilities block and
s/IS_IRONLAKE/IS_GEN5/.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
549f7365820a212a1cfd0871d377b1ad0d1e5723 19-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Enable SandyBridge blitter ring

Based on an original patch by Zhenyu Wang, this initializes the BLT ring for
SandyBridge and enables support for user execbuffers.

Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
87acb0a550694ff1a7725ea3a73b80d8ccf56180 19-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Simplify most HAS_BSD() checks

... by always initialising the empty ringbuffer it is always then safe
to check whether it is active.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
6d139a87b747aaebc969ac5f4eb8db766fcd9cbd 14-Oct-2010 Bryan Freed <bfreed@chromium.org> drm/i915: Initialize panel timing registers if VBIOS did not

The time between start of the pixel clock and backlight enable is a basic
panel timing constraint. If the Panel Power On/Off registers are found
to be 0, assume we are booting without VBIOS initialization and set these
registers to something reasonable.

Change-Id: Ibed6cc10d46bf52fd92e0beb25ae3525b5eef99d
Signed-off-by: Bryan Freed <bfreed@chromium.org>
[ickle: rearranged into a separate function to distinguish its role from
simply parsing the VBIOS tables.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
701394cc534a4a7883ddc4f8f82fb438b3d664ff 10-Oct-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: Fix oops on HWS unload

Freeing the Hardware Status Page was writing to the HWS register in
order to disable the GPU writing to the HWS page. Unfortunately, we were
writing to the mmio register after unmapping the register space, hence
the oops.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
83e41eb9cc3de6c08d63bbcf2c953bfbf65c025c 08-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> Revert "drm/i915: Prevent module unload to avoid random memory corruption"

This reverts commit 6939a5aca7cfada279a24c307e772f33104fca20.

Daniel Vetter supplied a set of fixes for all the module unload bugs he
could trigger on his machines, so let the fun recommence!
/drivers/gpu/drm/i915/i915_dma.c
fb9a90f7c674f3ddef6baf55cb1612dadd8ea752 19-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> Merge remote branch 'airlied/drm-core-next' into tmp
b7ae5056c94a8191c1fd0b5697707377516c0c5d 19-Oct-2010 Dave Airlie <airlied@redhat.com> Merge branch 'drm-fixes' of /home/airlied/kernel/linux-2.6 into drm-core-next

Conflicts:
drivers/gpu/drm/i915/intel_fb.c
drivers/gpu/drm/radeon/r600_blit_kms.c
drivers/gpu/drm/ttm/ttm_bo.c
6939a5aca7cfada279a24c307e772f33104fca20 08-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Prevent module unload to avoid random memory corruption

The i915 driver has quite a few module unload bugs, the known ones at
least have fixes that are targeting 2.6.37. However, in order to
maintain a stable kernel, we should prevent this known random memory
corruption following driver unload. This should have very low impact on
normal users who are unlikely to need to unload the i915 driver.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
723bfd707a97fee06eb3ba4d3e8b4714c29a1064 08-Oct-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add _DSM support

The _DSM method on the integrated graphics device can tell us which
connectors are muxable, so add support for making the call and parsing
out the connector info.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: fix compiler warnings for using uninitialized 'result' and
downgrade error message for non-switchable devices]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
c2873e9633fe908dccd36dbb1d370e9c59a1ca62 07-Oct-2010 Keith Packard <keithp@keithp.com> drm/i915: Free hardware status page on unload when physically mapped

A physically mapped hardware status page is allocated at driver load
time but was never freed. Call the existing code to free this page at
driver unload time on hardware which uses this kind.

Signed-off-by: Keith Packard <keithp@keithp.com>
[ickle: call before tearing down registers on KMS-only path, as pointed
out by Dave Airlie]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
7b4f3990a22fbe800945f12001bc30db374d0af5 04-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Avoid circular locking from intel_fbdev_fini()

lockdep spots that the fb_info->lock takes the dev->struct_mutex during
init (due to the device probing) and so we can not hold
dev->struct_mutex when unregistering the framebuffer. Simply reverse the
order of initialisation during cleanup and so do the intel_fbdev_fini()
before the intel_modeset_cleanup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
e0e41598b433c0216814d54c62e7c1834f464d9b 28-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> Merge branch 'drm-intel-fixes' into drm-intel-next
d270ae34eb77c58dea60e5b1e300a698d2ce39ac 27-Sep-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: fix GMCH power reporting

The IPS driver needs to know the current power consumption of the GMCH
in order to make decisions about when to increase or decrease the CPU
and/or GPU power envelope. So fix up the divisions to save the results
so the numbers are actually correct (contrary to some earlier comments
and code, these functions do not modify the first argument and use it
for the result).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
53b2087d218c100657bddcb8ae887fa07862fb81 26-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: fix debugging compilation error from previous commit

There is no equivalent to mutex_destroy() for spinlocks so just delete
the code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
1c25595f8d31392b8c36b54c624d01591dbfb87b 26-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Convert the file mutex into a spinlock

Daniel Vetter pointed out that in this case is would be clearer and
cleaner to use a spinlock instead of a mutex to protect the per-file
request list manipulation. Make it so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
447da18742b170b8e09ac71edf63c5798d2dbb0b 24-Sep-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: kill ring->setup_status_page

It's the same code, essentially, so kill all copies safe one unified
version.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
f787a5f59e1b0e320a6b0a37e9a2e306551d1e40 24-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Only hold a process-local lock whilst throttling.

Avoid cause latencies in other clients by not taking the global struct
mutex and moving the per-client request manipulation a local per-client
mutex. For example, this allows a compositor to schedule a page-flip
(through X) whilst an OpenGL application is monopolising the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
6eecba33f2fc24544073631dc1b23b7a312e644b 08-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Disable output polling across suspend & resume

Suspending (especially hibernating) may take a finite amount of time,
during which a hotplug event may trigger and we will attempt to handle
it with inconsistent state. Disable hotplug polling around suspend and
resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30070
Reported-by: Rui Tiago Matos <tiagomatos@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
0af9e92e779602bdd6d4d19acf63b4802fab91b6 12-Sep-2010 Daniel Vetter <daniel.vetter@ffwll.ch> intel-gtt: clean up gtt size reporting

Consolidate everything in intel-gtt.c and also kill the export
of intel_max_stolen.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
a6c45cf013a57e32ddae43dd4ac911eb4a3919fd 17-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: INTEL_INFO->gen supercedes i8xx, i9xx, i965g

Avoid confusion between i965g meaning broadwater and the gen4+ chipset
families.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
f899fc64cda8569d0529452aafc0da31c042df2e 21-Jul-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: use GMBUS to manage i2c links

Use the GMBUS interface rather than direct bit banging to grab the EDID
over DDC (and for other forms of auxiliary communication with external
display controllers). The hope is that this method will be much faster
and more reliable than bit banging for fetching EDIDs from buggy monitors
or through switches, though we still preserve the bit banging as a
fallback in case GMBUS fails.

Based on an original patch by Jesse Barnes.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
e642abbf303741b245375b2e3f8f00e900d462dc 09-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> 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>
/drivers/gpu/drm/i915/i915_dma.c
19966754328d99ee003ddfc7a8c31ceb115483ac 06-Sep-2010 Daniel Vetter <daniel.vetter@ffwll.ch> 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>
/drivers/gpu/drm/i915/i915_dma.c
ac622a9cdb742cad90648d95f2c4877774518f19 08-Sep-2010 Daniel Vetter <daniel.vetter@ffwll.ch> 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>
/drivers/gpu/drm/i915/i915_dma.c
0ade638655f0ef4d807295c14a4c97544bd6b9ca 24-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> 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>
/drivers/gpu/drm/i915/i915_dma.c
5d607f9b038ea03f5e5b3064d2f3993f9ea67e1e 20-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> 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>
/drivers/gpu/drm/i915/i915_dma.c
995b6762f0fd54377bbfafdf5328b12de698bfa8 20-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Quieten sparse warnings for missing prototypes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
015b9c8ce50e5bfb7ea78613dcad4b30d1a0d9da 20-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> 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>
/drivers/gpu/drm/i915/i915_dma.c
44834a67c0082e2cf74b16be91e49108b1432d65 19-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use the VBT from OpRegion when available (v3)

It is recommended that we use the Video BIOS tables that were copied
into the OpRegion during POST when initialising the driver. This saves
us from having to furtle around inside the ROM ourselves and possibly
allows the vBIOS to adjust the tables prior to initialisation.

On some systems, such as the Samsung N210, there is no accessible VBIOS
and the only means of finding the VBT is through the OpRegion.

v2: Rearrange the code so that ASLE is enabled along with ACPI
v3: Enable OpRegion parsing even without ACPI

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Garrett <mjg@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
75ef9da2cdb64e7926404dd2b755bbbfe98eaeaf 21-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: unload: fix retire_work races

ums-gem code correctly cancels the retire work (at lastclose time),
kms does not do so. Fix this by canceling the work right after ideling
the gpu.

While staring at the code I noticed that the work function is not
static. Fix this, too.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
c911fc1c6ad61b56869ee521f1a477c741b039da 20-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: unload: ensure that gem is idle

When the module unloads, all users should be gone, hence all bo references
held by userspace, too. This should already result in an idle ringbuffer.
Still, be paranoid and idle gem before starting the unload dance.

Also kill the call to i915_gem_lastclose under an if (kms), it's a noop
for kms.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
67e77c5ae8bff6f805d207541f1315051248a87b 20-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: unload: fix unpin_work related races

Kill any outstanding unpin_work when destroying the corresponding
crtc. Then flush the workqueue before the gem teardown, in case
any unpin work is still outstanding.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
a8b4899e4658e53c0c8f4206af105e358e39ee93 20-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: unload: don't leak error state

With kms, interrupts now get disabled in the modesetting cleanup. So
free the error state afterwards, it currently gets allocated in
the interrupt handler.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
6c0d93500eb50098e4e35b8b79e073f2f2f5b773 20-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: unload: fix hotplug_work races

hotplug_work is queued by the hotplug interrupt and only either emits
a hotplug uevent or queues a crt poll slow-work. No other locking. So
it's safe to cancel this work _after_ irq's have been turned off. But
before the modesetting objects are destroyed because the hotplug
function accesses them (without locking).

The current code (for kms) only switches irqs off after modesetting
teardown, hence move the irq teardown into the modeset cleanup right
before the crtc cleanup.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
bc0c7f14432f7f94b16f972f2d23b8c1248249b4 20-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: unload: fix error_work races

This is the first patch to clean up module unload races due to
outstanding timers/work. Preparatory step: Thou shalt not destroy
the workqueue when new work might still get enqued.

Now error_work gets queued by the hangcheck timer and only (atomically)
reads the chip wedged status. So cancel it right after the hangcheck
timer is killed. But the hangcheck is armed by interrupts, so move
everything after irqs are disabled.

Also change a del_timer to a del_timer_sync in the ums gem code, the
hangcheck timer is self-rearming.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
a25c25c2a2aa55e609099a9f74453c518aec29a6 20-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Allocate the PCI resource for the MCHBAR

We were failing when trying to allocate the resource for MMIO of the
MCHBAR because we forgot to specify what type of resource we wanted.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@kernel.org
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
9927a403ca8c97798129953fa9cbb5dc259c7cb9 19-Jun-2010 Dan Carpenter <error27@gmail.com> i915: return -EFAULT if copy_to_user fails

copy_to_user returns the number of bytes remaining to be copied, but we
want to return a negative error code here. These are returned to
userspace.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
/drivers/gpu/drm/i915/i915_dma.c
9f82d23846146990d475f6753be733e55788d88d 30-Aug-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: overlay on gen2 can't address above 1G

So set the coherent dma mask accordingly. This dma mask is only used
for physical objects, so it won't really matter allocation-wise.

Now this never really surfaced because sane 32bit kernels only have 1G
of lowmem. But some eager testers (distros?) still carry around the patch
to adjust lowmem via a kconfig option. And the kernel seems to favour
high allocations on boot-up, hence the overlay blowing up reliably.

Because the patch is tiny and nicely shows how broken gen2 is it's imho
worth to merge despite the fact that mucking around with the lowmem/
highmem division is (no longer) supported.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28318
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
ee005577aa3b89f5291fe73be2054d375d23f5eb 24-Aug-2010 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (33 commits)
drm/radeon/kms: fix typo in radeon_compute_pll_gain
drm/radeon/kms: try to detect tv vs monitor for underscan
drm/radeon/kms: fix sideport detection on newer rs880 boards
drm/radeon: fix passing wrong type to gem object create.
drm/radeon/kms: set encoder type to DVI for HDMI on evergreen
drm/radeon/kms: add back missing break in info ioctl
drm/radeon/kms: don't enable MSIs on AGP boards
drm/radeon/kms: fix agp mode setup on cards that use pcie bridges
drm: move dereference below check
drm: fix end of loop test
drm/radeon/kms: rework radeon_dp_detect() logic
drm/radeon/kms: add missing asic callback assignment for evergreen
drm/radeon/kms/DCE3+: switch pads to ddc mode when going i2c
drm/radeon/kms/pm: bail early if nothing's changing
drm/radeon/kms/atom: clean up dig atom handling
drm/radeon/kms: DCE3/4 transmitter fixes
drm/radeon/kms: rework encoder handling
drm/radeon/kms: DCE3/4 AdjustPixelPll updates
drm/radeon: Fix stack data leak
drm/radeon/kms: fix GTT/VRAM overlapping test
...
1b2f1489633888d4a06028315dc19d65768a1c05 14-Aug-2010 Dave Airlie <airlied@redhat.com> drm: block userspace under allocating buffer and having drivers overwrite it (v2)

With the current screwed but its ABI, ioctls for the drm, Linus pointed out that we could allow userspace to specify the allocation size, but we pass it to the driver which then uses it blindly to store a struct. Now if userspace specifies the allocation size as smaller than the driver needs, the driver can possibly overwrite memory.

This patch restructures the driver ioctls so we store the structure size we are expecting, and make sure we allocate at least that size. The copy from/to userspace are still restricted to the size the user specifies, this allows ioctl structs to grow on both sides of the equation.

Up until now we didn't really use the DRM_IOCTL defines in the kernel, so this cleans them up and adds them for nouveau.

v2:
fix nouveau pushbuf arg (thanks to Ben for pointing it out)

Reported-by: Linus Torvalds <torvalds@linuxfoundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
1cafd34731cd14e5a72edaf0f41717c8126cfce9 25-Jun-2010 Zou Nan hai <nanhai.zou@intel.com> drm/i915 invalidate indirect state pointers at end of ring exec

This is required by the spec, and without this some 3D programs will
hang after resume from RC6 we enable that.

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
d1d6ca73ef548748e141747e7260798327d6a2c1 08-Jul-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/agp/i915: trim stolen space to 32M

Some BIOSes will claim a large chunk of stolen space. Unless we
reclaim it, our aperture for remapping buffer objects will be
constrained. So clamp the stolen space to 32M and ignore the rest.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=15469 among others.

Adding the ignored stolen memory back into the general pool using the
memory hotplug code is left as an exercise for the reader.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Simon Farnsworth <simon.farnsworth@onelan.com>
Tested-by: Artem S. Tashkinov <t.artem@mailcity.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
2bd34f6ca86b5a5f9b749624f73310820e7a93fd 02-Aug-2010 Eric Anholt <eric@anholt.net> Merge remote branch 'origin/master' into drm-intel-next

This resolves the conflict in the EDP code, which has been rather
popular to hack on recently.

Conflicts:
drivers/gpu/drm/i915/intel_dp.c
b52eb4dcab23fe0c52a437276258e0afcf913ef5 12-Jun-2010 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Add frame buffer compression support on Ironlake mobile

About 0.2W power can be saved on one HP laptop.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
aebf0dafee1a0a22b3d25db8107c6479db4aaebe 22-Jul-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: don't free non-existent compressed llb on ILK+

We should only free the compressed llb if we allocated it in the first
place otherwise we'll panic at unload time.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
db8cc27b804f89e8fd5f9d5385161956a777c471 07-Jul-2010 Dave Airlie <airlied@redhat.com> Merge branch 'drm-platform' into drm-testing

* drm-platform:
drm: Make sure the DRM offset matches the CPU
drm: Add __arm defines to DRM
drm: Add support for platform devices to register as DRM devices
drm: Remove drm_resource wrappers
97e0214044d9f279a3d6286c9f859696ef0b7ebe 02-Jul-2010 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel:
drm/i915: fix page flip finish vs. prepare on plane B
drm/i915: change default panel fitting mode to preserve aspect ratio
drm/i915: fix uninitialized variable warning in i915_setup_compression()
drm/i915: take struct_mutex in i915_dma_cleanup()
drm/i915: Fix CRT hotplug regression in 2.6.35-rc1
i915: fix ironlake edp panel setup (v4)
drm/i915: don't access FW_BLC_SELF on 965G
drm/i915: Account for space on the ring buffer consumed whilst wrapping.
drm/i915: gen3 page flipping fixes
drm/i915: don't queue flips during a flip pending event
drm/i915: Fix incorrect intel_ring_begin size in BSD ringbuffer.
drm/i915: Turn on 945 self-refresh only if single CRTC is active
drm/i915/gen4: Fix interrupt setup ordering
drm/i915: Use RSEN instead of HTPLG for tfp410 monitor detection.
drm/i915: Move non-phys cursors into the GTT
Revert "drm/i915: Don't enable pipe/plane/VCO early (wait for DPMS on)."

(Included the "fix page flip finish vs. prepare on plane B" patch from
Jesse on top of the pull request from Eric. -- Linus)
132b6aab90d2673af67c414878da241a197e00fb 27-May-2010 Prarit Bhargava <prarit@redhat.com> drm/i915: fix uninitialized variable warning in i915_setup_compression()

Fixes:

drivers/gpu/drm/i915/i915_dma.c: In function ‘i915_setup_compression’:
drivers/gpu/drm/i915/i915_dma.c:1311: error: ‘compressed_llb’ may be used uninitialized in this function

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
ee0c6bfbd602cdad2ab1780061b3b1a9108cbd6c 23-Jun-2010 Dan Carpenter <error27@gmail.com> drm/i915: take struct_mutex in i915_dma_cleanup()

intel_cleanup_ring_buffer() calls drm_gem_object_unreference() (as
opposed to drm_gem_object_unreference_unlocked()) so it needs to be
called with "struct_mutex" held. If we don't hold the lock, it triggers
a BUG_ON(!mutex_is_locked(&dev->struct_mutex));

I also audited the other places that call intel_cleanup_ring_buffer()
and they all hold the lock so they're OK.

This was introduced in: 8187a2b70e3 "drm/i915: introduce
intel_ring_buffer structure (V2)" and it's a regression from v2.6.34.

Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=16247

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reported-by: Benny Halevy <bhalevy@panasas.com>
Tested-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
1afe3e9d4335bf3bc5615e37243dc8fef65dac8f 26-Mar-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: gen3 page flipping fixes

Gen3 chips have slightly different flip commands, and also contain a bit
that indicates whether a "flip pending" interrupt means the flip has
been queued or has been completed.

So implement support for the gen3 flip command, and make sure we use the
flip pending interrupt correctly depending on the value of ECOSKPD bit
0.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
5a79395b2791cc70442ab8434aed1b5206683e7c 06-Jun-2010 Chris Wilson <chris@chris-wilson.co.uk> drm: Propagate error from drm_fb_helper_init().

The previous commit fixes the problem, these commits make sure we actually
fail properly if it happens again.

I've squashed the commits from Chris since they are all fixing one issue.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
1067b6c2bea7fd2cc9da290d865ab3f3b91c8130 03-Jun-2010 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (41 commits)
drm/radeon/kms: make sure display hw is disabled when suspending
drm/vmwgfx: Allow userspace to change default layout. Bump minor.
drm/vmwgfx: Fix framebuffer modesetting
drm/vmwgfx: Fix vga save / restore with display topology.
vgaarb: use MIT license
vgaarb: convert pr_devel() to pr_debug()
drm: fix typos in Linux DRM Developer's Guide
drm/radeon/kms/pm: voltage fixes
drm/radeon/kms/pm: radeon_set_power_state fixes
drm/radeon/kms/pm: patch default power state with default clocks/voltages on r6xx+
drm/radeon/kms/pm: enable SetVoltage on r7xx/evergreen
drm/radeon/kms/pm: add support for SetVoltage cmd table (V2)
drm/radeon/kms/evergreen: add initial CS parser
drm/kms: disable/enable poll around switcheroo on/off
drm/nouveau: fixup confusion over which handle the DSM is hanging off.
drm/nouveau: attempt to get bios from ACPI v3
drm/nv50: cast IGP memory location to u64 before shifting
drm/ttm: Fix ttm_page_alloc.c
drm/ttm: Fix cached TTM page allocation.
drm/vmwgfx: Remove some leftover debug messages.
...
e3a815fcd38043b8f1bb526123d8ab6ae01deb77 31-May-2010 Zou Nan hai <nanhai.zou@intel.com> drm/i915: add HAS_BSD check to i915_getparam

This will let userland only try to use the new media decode
functionality when the appropriate kernel is present.

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
fbf81762e385d3d45acad057b654d56972acf58c 01-Jun-2010 Dave Airlie <airlied@redhat.com> drm/kms: disable/enable poll around switcheroo on/off

Because we aren't in a suspend state the poll will still run when we have switcherooed a card off.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
dcdb167402cbdca1d021bdfa5f63995ee0a79317 27-May-2010 Jordan Crouse <jcrouse@codeaurora.org> drm: Add support for platform devices to register as DRM devices

Allow platform devices without PCI resources to be DRM devices.

[airlied: fixup warnings with dev pointers]

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
01d73a6967f12fe6c4bbde1834a9fe662264a2eb 27-May-2010 Jordan Crouse <jcrouse@codeaurora.org> drm: Remove drm_resource wrappers

Remove the drm_resource wrappers and directly use the
actual PCI and/or platform functions in their place.

[airlied: fixup nouveau properly to build]

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
e20f9c64c79e2282f9eb531509181965ec8f0a92 26-May-2010 Eric Anholt <eric@anholt.net> drm/i915: Clean up leftover bits from hws move to ring structure.

Fixes /debug/dri/0/i915_gem_interrupt output for status page.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
9553426372eef71c849499fb1d232f4b0577c0f9 18-May-2010 Li Peng <peng.li@linux.intel.com> drm/i915: Add CxSR support on Pineview DDR3

Pineview with DDR3 memory has different latencies to enable CxSR.
This patch updates CxSR latency table to add Pineview DDR3 latency
configuration. It also adds one flag "is_ddr3" for checking DDR3
setting in MCHBAR.

Cc: Shaohua Li <shaohua.li@intel.com>
Cc: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Li Peng <peng.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
7648fa99eb77a2e1a90b7beaa420e07d819b9c11 20-May-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add power monitoring support

Add power monitoring support to the i915 driver for use by the IPS
driver. Export the available power info to the IPS driver through a few
new inter-driver hooks. When used together, the IPS driver and this
patch can significantly increase graphics performance on Ironlake class
chips.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: Fixed 32-bit compile. stupid obfuscating div_u64()]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
d1b851fc0d105caa6b6e3e7c92d2987dfb52cbe0 21-May-2010 Zou Nan hai <nanhai.zou@intel.com> drm/i915: implement BSD ring buffer V2

The BSD (bit stream decoder) ring is used for accessing the BSD engine
which decodes video bitstream for H.264 and VC1 on G45+. It is
asynchronous with the render ring and has access to separate parts of
the GPU from it, though the render cache is coherent between the two.

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Xiang Hai hao <haihao.xiang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
852835f343146a82a528c3b712b373661d4fa17a 21-May-2010 Zou Nan hai <nanhai.zou@intel.com> drm/i915: convert some gem structures to per-ring V2

The active list and request list move into the ringbuffer structure,
so each can track its active objects in the order they are in that
ring. The flushing list does not, as it doesn't matter which ring
caused data to end up in the render cache. Objects gain a pointer to
the ring they are active on (if any).

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Xiang Hai hao <haihao.xiang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
8187a2b70e34c727a06617441f74f202b6fefaf9 21-May-2010 Zou Nan hai <nanhai.zou@intel.com> drm/i915: introduce intel_ring_buffer structure (V2)

Introduces a more complete intel_ring_buffer structure with callbacks
for setup and management of a particular ringbuffer, and converts the
render ring buffer consumers to use it.

Signed-off-by: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Xiang Hai hao <haihao.xiang@intel.com>
[anholt: Fixed up whitespace fail and rebased against prep patches]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
d3301d86b4bf2bcf649982ae464211d8bcf9575a 21-May-2010 Eric Anholt <eric@anholt.net> drm/i915: Rename dev_priv->ring to dev_priv->render_ring.

With the advent of the BSD ring, be clear about which ring this is.
The docs are pretty consistent with calling this the Render engine at
this point.
/drivers/gpu/drm/i915/i915_dma.c
62fdfeaf8b1f487060b6e160e7b5cd90287607c9 21-May-2010 Eric Anholt <eric@anholt.net> drm/i915: Move ringbuffer-related code to intel_ringbuffer.c.

This is preparation for supporting multiple ringbuffers on Ironlake.
The non-copy-and-paste changes are:
- de-staticing functions
- I915_GEM_GPU_DOMAINS moving to i915_drv.h to be used by both files.
- i915_gem_add_request had only half its implementation
copy-and-pasted out of the middle of it.
/drivers/gpu/drm/i915/i915_dma.c
79a78dd6266a4f3e31c800e941ec62e250770a7d 17-May-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Fail to load driver if KMS request without GEM

The i915's implementation of KMS requires GEM in order to manage the
memory and execution domains of the framebuffer and associated
resources. By the point at which we detect broken a BIOS and need to
disable GEM, we have already registered ourselves as a KMS driver with
several subsystems. Rather than introducing a fragile unwind and attempt
to continue with UMS, spit out an error and unload the driver.

References:

[Bug 15754] IP: [<ffffffffa0207589>] drm_mm_search_free+0x49/0x90 [drm]
BUG: unable to handle kernel NULL pointer dereference at (null)
https://bugzilla.kernel.org/show_bug.cgi?id=15754

[drm:i915_driver_load] *ERROR* Detected broken video BIOS with
262140/262144kB of video memory stolen.
[drm:i915_driver_load] *ERROR* Disabling GEM. (try reducing stolen
memory or updating the BIOS to fix).
i915 0000:00:02.0: irq 30 for MSI/MSI-X
[drm] set up 255M of stolen space
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffffa0207589>] drm_mm_search_free+0x49/0x90 [drm]
PGD 69719067 PUD 69dda067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
last sysfs file: /sys/module/snd_seq_oss/initstate
CPU 1
Pid: 867, comm: modprobe Not tainted 2.6.33-ARCH #1 G43Twins-FullHD/To
Be Filled By O.E.M.
RIP: 0010:[<ffffffffa0207589>] [<ffffffffa0207589>] drm_mm_search_free+0x49/0x90 [drm]
RSP: 0018:ffff8800699f3af8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffffffffffffffff RCX: 0000000000000000
RDX: 0000000000001000 RSI: 0000000000001000 RDI: ffff8800693d0f78
RBP: ffff8800699f3b18 R08: 0000000000001000 R09: 0000000000000000
R10: 2222222222222222 R11: 0000000000000000 R12: ffff880068de70c0
R13: 0000000000001000 R14: 0000000000000000 R15: ffff8800689cb000
FS: 00007fa93f4e5700(0000) GS:ffff880001880000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 00000000695a0000 CR4: 00000000000406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process modprobe (pid: 867, threadinfo ffff8800699f2000, task ffff8800694f4740)
Stack:
ffff880068de73c0 ffff880068de70c0 ffff8800689cb000 0000000000001000
<0> ffff8800699f3b68 ffffffffa0299f63 ffff8800693d0f78 0000120068de70c0
<0> ffff8800689cb000 ffff880068de73c0 ffff880068de70c0 ffff8800689cb000
Call Trace:
[<ffffffffa0299f63>] i915_gem_object_bind_to_gtt+0x83/0x360 [i915]
[<ffffffffa029a2e5>] i915_gem_object_pin+0xa5/0xb0 [i915]
[<ffffffffa029a3c5>] i915_gem_init_ringbuffer+0xd5/0x510 [i915]
[<ffffffffa028dbee>] i915_driver_load+0x4ce/0xd00 [i915]
[<ffffffffa0205d37>] ? drm_sysfs_device_add+0x87/0xb0 [drm]
[<ffffffffa0203363>] ? drm_get_minor+0x1d3/0x330 [drm]
[<ffffffffa02037e6>] drm_get_dev+0x326/0x580 [drm]
[<ffffffffa02bc0a5>] i915_pci_probe+0x10/0xd0 [i915]
[<ffffffff811e98a2>] local_pci_probe+0x12/0x20
[<ffffffff811ea8e0>] pci_device_probe+0x80/0xb0
[<ffffffff8127b12a>] ? driver_sysfs_add+0x5a/0x90
[<ffffffff8127b273>] driver_probe_device+0x93/0x1a0
[<ffffffff8127b413>] __driver_attach+0x93/0xa0
[<ffffffff8127b380>] ? __driver_attach+0x0/0xa0
[<ffffffff8127a8f8>] bus_for_each_dev+0x68/0x90
[<ffffffff8127b0c9>] driver_attach+0x19/0x20
[<ffffffff8127a0ad>] bus_add_driver+0xcd/0x2d0
[<ffffffff8127b718>] driver_register+0x78/0x140
[<ffffffff811eab91>] __pci_register_driver+0x51/0xd0
[<ffffffffa02d6000>] ? i915_init+0x0/0x52 [i915]
[<ffffffffa01fdc31>] drm_init+0x111/0x120 [drm]
[<ffffffff810eb0cd>] ? register_shrinker+0x4d/0x60
[<ffffffffa02d6000>] ? i915_init+0x0/0x52 [i915]
[<ffffffffa02d6050>] i915_init+0x50/0x52 [i915]
[<ffffffff81002047>] do_one_initcall+0x37/0x1a0
[<ffffffff8108ed17>] sys_init_module+0xd7/0x250
[<ffffffff81009fc2>] system_call_fastpath+0x16/0x1b
Code: eb 29 49 8b 41 28 31 d2 49 f7 f5 85 d2 74 39 44 89 c0 29 d0 48 89 c2 48 01 f2 49 39 d2 73 29 0f 1f 00 49 89 da 4c 89 d3 4d 89 d9 <4d> 8b 19 49 39 f9 41 0f 18 0b 74 2b 4d 8b 51 30 4d 89 cc 49 39
RIP [<ffffffffa0207589>] drm_mm_search_free+0x49/0x90 [drm]
RSP <ffff8800699f3af8>
CR2: 0000000000000000

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
05ea893c46805b2981ea8ba6df881e3d65edd63b 19-May-2010 Dave Airlie <airlied@redhat.com> Merge remote branch 'anholt/drm-intel-next' into drm-next

* anholt/drm-intel-next: (515 commits)
drm/i915: Fix out of tree builds
drm/i915: move fence lru to struct drm_i915_fence_reg
drm/i915: don't allow tiling changes on pinned buffers v2
drm/i915: Be extra careful about A/D matching for multifunction SDVO
drm/i915: Fix DDC bus selection for multifunction SDVO
drm/i915: cleanup mode setting before unmapping registers
drm/i915: Make fbc control wrapper functions
drm/i915: Wait for the GPU whilst shrinking, if truly desperate.
drm/i915: Use spatio-temporal dithering on PCH
[MTD] Remove zero-length files mtdbdi.c and internal.ho
pata_pcmcia / ide-cs: Fix bad hashes for Transcend and kingston IDs
libata: Fix several inaccuracies in developer's guide
slub: Fix bad boundary check in init_kmem_cache_nodes()
raid6: fix recovery performance regression
KEYS: call_sbin_request_key() must write lock keyrings before modifying them
KEYS: Use RCU dereference wrappers in keyring key type code
KEYS: find_keyring_by_name() can gain access to a freed keyring
ALSA: hda: Fix 0 dB for Packard Bell models using Conexant CX20549 (Venice)
ALSA: hda - Add quirk for Dell Inspiron 19T using a Conexant CX20582
ALSA: take tu->qlock with irqs disabled
...
eb1f8e4f3be898df808e2dfc131099f5831d491d 07-May-2010 Dave Airlie <airlied@redhat.com> drm/fbdev: rework output polling to be back in the core. (v4)

After thinking it over a lot it made more sense for the core to deal with
the output polling especially so it can notify X.

v2: drop plans for fake connector - per Michel's comments - fix X patch sent to xorg-devel, add intel polled/hpd setting, add initial nouveau polled/hpd settings.

v3: add config lock take inside polling, add intel/nouveau poll init/fini calls

v4: config lock was a bit agressive, only needed around connector list reading.
otherwise it could re-enter.

glisse: discard drm_helper_hpd_irq_event

v3: Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
34dc4d4423dc342848d72be764832cbc0852854a 07-May-2010 Eric Anholt <eric@anholt.net> Merge remote branch 'origin/master' into drm-intel-next

Conflicts:
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/radeon/r300.c

The BSD ringbuffer support that is landing in this branch
significantly conflicts with the Ironlake PIPE_CONTROL fix on master,
and requires it to be tested successfully anyway.
3d8620cc5f8538364ee152811e2bd8713abb1d58 26-Mar-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: cleanup mode setting before unmapping registers

We'll turn off outputs etc at unload time, so don't unmap the registers
before doing it.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
ee5382aedf669127bf672a3fc5313247fc288e26 23-Apr-2010 Adam Jackson <ajax@redhat.com> drm/i915: Make fbc control wrapper functions

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
20bf377e679208ba9ae0edcb8c70a8f6d33d17f9 21-Apr-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: cleanup FBC buffers at unload time

This keeps the memory manager from complaining when we take it down.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
7fff400be6fbf64f10abca9939718aaf1d61c255 20-Apr-2010 Dave Airlie <airlied@redhat.com> Merge branch 'drm-fbdev-cleanup' into drm-core-next

* drm-fbdev-cleanup:
drm/fb: remove drm_fb_helper_setcolreg
drm/kms/fb: use slow work mechanism for normal hotplug also.
drm/kms/fb: add polling support for when nothing is connected.
drm/kms/fb: provide a 1024x768 fbcon if no outputs found.
drm/kms/fb: separate fbdev connector list from core drm connectors
drm/kms/fb: move to using fb helper crtc grouping instead of core crtc list
drm/fb: fix fbdev object model + cleanup properly.

Conflicts:
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/nouveau/nouveau_drv.h
97921a5b03d40681b3aed620a5e719710336c6df 20-Apr-2010 Dave Airlie <airlied@redhat.com> Merge remote branch 'anholt/drm-intel-next' of /home/airlied/kernel/drm-next into drm-core-next

* 'anholt/drm-intel-next' of /home/airlied/kernel/drm-next: (48 commits)
agp/intel-gtt: kill previous_size assignments
agp/intel-gtt: kill intel_i830_tlbflush
agp/intel: split out gmch/gtt probe, part 1
agp/intel: kill mutli_gmch_chip
agp/intel: uncoditionally reconfigure driver on resume
agp/intel: split out the GTT support
agp/intel: introduce intel-agp.h header file
drm/i915: Don't touch PORT_HOTPLUG_EN in intel_dp_detect()
drm/i915/pch: Use minimal number of FDI lanes (v2)
drm/i915: Add the support of memory self-refresh on Ironlake
drm/i915: Move Pineview CxSR and watermark code into update_wm hook.
drm/i915: Only save/restore FBC on the platform that supports FBC
drm/i915: Fix the incorrect argument for SDVO SET_TV_format command
drm/i915: Add support of SDVO on Ibexpeak PCH
drm/i915: Don't enable pipe/plane/VCO early (wait for DPMS on).
drm/i915: do not read uninitialized ->dev_private
Revert "drm/i915: Use a dmi quirk to skip a broken SDVO TV output."
drm/i915: implement multifunction SDVO device support
drm/i915: remove unused intel_pipe_get_connector()
drm/i915: remove connector object in old output structure
...
ea059a1ec4496a10f94ca9d0c1b530faf1b85dce 08-Apr-2010 Luca Tettamanti <kronos.it@gmail.com> drm/i915: do not read uninitialized ->dev_private

->dev_private at that point is NULL and is initialied only a few lines
later.

Signed-off-by: Luca Tettamanti <kronos.it@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
3bad0781832e4e8c9a532f1169bfcd7257bcfd9e 07-Apr-2010 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: Probe for PCH chipset type

PCH is the new name for south bridge from Ironlake/Sandybridge,
which contains most of the display outputs except eDP. This one
adds a probe function to detect current PCH type, and method to
detect Cougarpoint PCH.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
386516744ba45d50f42c6999151cc210cb4f96e4 30-Mar-2010 Dave Airlie <airlied@redhat.com> drm/fb: fix fbdev object model + cleanup properly.

The fbdev layer in the kms code should act like a consumer of the kms services and avoid having relying on information being store in the kms core structures in order for it to work.

This patch

a) removes the info pointer/psuedo palette from the core drm_framebuffer structure and moves it to the fbdev helper layer, it also removes the core drm keeping a list of kernel kms fbdevs.
b) migrated all the fb helper functions out of the crtc helper file into the fb helper file.
c) pushed the fb probing/hotplug control into the driver
d) makes the surface sizes into a structure for ease of passing
This changes the intel/radeon/nouveau drivers to use the new helper.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
/drivers/gpu/drm/i915/i915_dma.c
f05dd2f09cac422c423dae8f9b8e2be13df05a8f 26-Feb-2010 Eric Anholt <eric@anholt.net> drm/i915: Don't bother with the BKL for GEM ioctls.

We probably don't need it for most of the other driver ioctls as well,
but we explicitly did locking when doing the GEM pieces. On CPU-bound
graphics tasks, the BKL was showing up as 1-2% of CPU time.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
1c62233508ef7104f8a78e571fdf5c72d0dc0200 01-Mar-2010 Dave Airlie <airlied@redhat.com> Merge branch 'gpu-switcher' of /ssd/git//linux-2.6 into drm-next-stage

* 'gpu-switcher' of /ssd/git//linux-2.6:
vga_switcheroo: initial implementation (v15)
fb: for framebuffer handover don't exit the loop early.

Conflicts:
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/radeon/Makefile
drivers/gpu/drm/radeon/radeon.h
6a9ee8af344e3bd7dbd61e67037096cdf7f83289 01-Feb-2010 Dave Airlie <airlied@linux.ie> vga_switcheroo: initial implementation (v15)

Many new laptops now come with 2 gpus, one to be used for low power
modes and one for gaming/on-ac applications. These GPUs are typically
wired to the laptop panel and VGA ports via a multiplexer unit which
is controlled via ACPI methods.

4 combinations of systems typically exist - with 2 ACPI methods.
Intel/ATI - Lenovo W500/T500 - use ATPX ACPI method
ATI/ATI - some ASUS - use ATPX ACPI Method
Intel/Nvidia - - use _DSM ACPI method
Nvidia/Nvidia - - use _DSM ACPI method.

TODO:
This patch adds support for the ATPX method and initial bits
for the _DSM methods that need to written by someone with
access to the hardware.
Add a proper non-debugfs interface - need to get some proper
testing first.

v2: add power up/down support for both devices
on W500 puts i915/radeon into D3 and cuts power to radeon.

v3: redo probing methods, no DMI list, drm devices call to
register with switcheroo, it tries to find an ATPX method on
any device and once there is two devices + ATPX it inits the
switcher.

v4: ATPX msg handling using buffers - should work on more machines

v5: rearchitect after more mjg59 discussion - move ATPX handling to
radeon driver.

v6: add file headers + initial nouveau bits (to be filled out).

v7: merge delayed switcher code.

v8: avoid suspend/resume of gpu that is off

v9: rearchitect - mjg59 is always right. - move all ATPX code to
radeon, should allow simpler DSM also proper ATRM handling

v10: add ATRM support for radeon BIOS, add mutex to lock vgasr_priv

v11: fix bug in resuming Intel for 2nd time.

v12: start fixing up nvidia code blindly.

v13: blindly guess at finishing nvidia code

v14: remove radeon audio hacks - fix up intel resume more like upstream

v15: clean up printks + remove unnecessary igd/dis pointers

mount debugfs

/sys/kernel/debug/vgaswitcheroo/switch - should exist if ATPX detected
+ 2 cards.

DIS - immediate change to discrete
IGD - immediate change to IGD
DDIS - delayed change to discrete
DIGD - delayed change to IGD
ON - turn on not in use
OFF - turn off not in use

Tested on W500 (Intel/ATI) and T500 (Intel/ATI)

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
14bc490bbdf1b194ad1f5f3d2a0a27edfdf78986 10-Nov-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915, agp/intel: Fix stolen memory size on Sandybridge

New memory control config reg at 0x50 should be used for stolen
memory size detection on Sandybridge.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
21099537dbacc5c8999d833e6bfd1b72edd89189 09-Nov-2009 Eric Anholt <eric@anholt.net> drm/i915: Correct locking in the modesetting failure path, fixing a BUG_ON.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
bad720ff3e8e47a04bd88d9bbc8317e7d7e049d3 23-Oct-2009 Eric Anholt <eric@anholt.net> drm/i915: Add initial bits for VGA modesetting bringup on Sandybridge.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
9df30794f609d9412f14cfd0eb7b45dd64d0b14e 18-Feb-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Record batch buffer following GPU error

In order to improve our diagnostic capabilities following a GPU hang
and subsequent reset, we need to record the batch buffer that triggered
the error. We assume that the current batch buffer, plus a few details
about what else is on the active list, will be sufficient -- at the very
least an improvement over nothing.

The extra information is stored in /debug/dri/.../i915_error_state
following an error, and may be decoded using
intel_gpu_tools/tools/intel_error_decode.

v2: Avoid excessive work under spinlocks.
v3: Include ringbuffer for later analysis.
v4: Use kunmap correctly and record more buffer state.
v5: Search ringbuffer for current batch buffer
v6: Use a work fn for the impossible IRQ error case.
v7: Avoid non-atomic paths whilst in IRQ context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
b5e50c3f56ee4aa0d0168eab5ece413ac5df76aa 05-Feb-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: provide FBC status in debugfs

Tools like powertop want to check the current FBC status and report it
to the user. So add a debugfs file indicating whether FBC is enabled,
and if not, why.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
c4804411691bdd7d8a57e942cbb502fd52a90074 17-Dec-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: Keep MCHBAR always enabled

As we need more and more controls within MCHBAR for memory config and
power management, this trys to keep MCHBAR enabled from driver load and
only tear down in driver unload.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
a40e8d3139e9eb54bf1d29f91639a6c5e05f652e 09-Feb-2010 Owain Ainsworth <zerooa@googlemail.com> drm/i915: Correctly return -ENOMEM on allocation failure in cmdbuf ioctls.

Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
9b974cc17166d31afed2638d56bdbf9829afbfaa 05-Jan-2010 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: enable 36bit physical address for hardware status page

This enables possible 36bit address mask on 965G that use physical
address for hw status page.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
2c1f1895ef2aa8f0e5497893eff71304aef332e1 07-Jan-2010 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
drm/radeon/kms: rs600: use correct mask for SW interrupt
gpu/drm/radeon/radeon_irq.c: move a dereference below a NULL test
drm/radeon/radeon_device.c: move a dereference below a NULL test
drm/radeon/radeon_fence.c: move a dereference below the NULL test
drm/radeon/radeon_connectors.c: add a NULL test before dereference
drm/radeon/kms: fix memory leak
drm/kms: Fix &&/|| confusion in drm_fb_helper_connector_parse_command_line()
drm/edid: Fix CVT width/height decode
drm/edid: Skip empty CVT codepoints
drm: remove address mask param for drm_pci_alloc()
drm/radeon/kms: add missing breaks in i2c and ss lookups
drm/radeon/kms: add primary dac adj values table
drm/radeon/kms: fallback to default connector table
e6be8d9d17bd44061116f601fe2609b3ace7aa69 05-Jan-2010 Zhenyu Wang <zhenyu.z.wang@intel.com> drm: remove address mask param for drm_pci_alloc()

drm_pci_alloc() has input of address mask for setting pci dma
mask on the device, which should be properly setup by drm driver.
And leave it as a param for drm_pci_alloc() would cause confusion
or mistake would corrupt the correct dma mask setting, as seen on
intel hw which set wrong dma mask for hw status page. So remove
it from drm_pci_alloc() function.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
29bd0ae25f8cb96b63560c2cbccec77b425e1603 17-Nov-2009 Andrew Morton <akpm@linux-foundation.org> drm/i915: fix unused var

drivers/gpu/drm/i915/i915_dma.c: In function 'i915_driver_load':
drivers/gpu/drm/i915/i915_dma.c:1114: warning: 'll_base' may be used uninitialized in this function

Partly this is because gcc isn't smart enough. But `ll_base' does get used
uninitialised in the DRM_DEBUG() call.

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
76446cac68568fc7f5168a27deaf803ed22a4360 18-Dec-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: execbuf2 support

This patch adds a new execbuf ioctl, execbuf2, for use by clients that
want to control fence register allocation more finely. The buffer
passed in to the new ioctl includes a new relocation type to indicate
whether a given object needs a fence register assigned for the command
buffer in question.

Compatibility with the existing execbuf ioctl is implemented in terms
of the new code, preserving the assumption that fence registers are
required for pre-965 rendering commands.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: Remove pre-emptive clear_fence_reg()]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
[anholt: Removed dmesg spam]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
b01f2c3a4a37d09a47ad73ccbb46d554d21cfeb0 11-Dec-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: only enable hotplug for detected outputs

This patch changes around our hotplug enable code a bit to only enable
it for ports we actually detect and initialize. This prevents problems
with stuck or spurious interrupts on outputs that aren't actually wired
up, and is generally more correct.

Fixes FDO bug #23183.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
b295d1b6e3e3f240d27cbe556d33ff5eb54721a7 16-Dec-2009 Kristian Høgsberg <krh@bitplanet.net> drm/i915: Track whether cursor needs physical address in intel_device_info

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
cfdf1fa23f4074c9f8766dc67a928bbf680b1ac9 16-Dec-2009 Kristian Høgsberg <krh@bitplanet.net> drm/i915: Implement IS_* macros using static tables

Instead of using the IS_I9XX etc macros that expand to a ton of
comparisons, use new struct intel_device_info to capture the
capabilities of the different chipsets. The drm_i915_private struct
will be initialized to point to the device info that correspond to
the actual device and this way, testing for a specific capability is
just a matter of checking a bit field.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
f2b115e69d46344ae7afcaad5823496d2a0d8650 03-Dec-2009 Adam Jackson <ajax@redhat.com> drm/i915: Fix product names and #defines

IGD* isn't a useful name. Replace with the codenames, as sourced from
pci.ids.

Signed-off-by: Adam Jackson <ajax@redhat.com>
[anholt: Fixed up for merge with pineview/ironlake changes]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
e9560f7cb20722e0e7db46bbb6f43c2194a238d5 19-Nov-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add GETPARAM request for page flipping

Add a GETPARAM request for checking if page flipping is supported.
Useful for the 2D driver to enable the flipping path.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
6363ee6f496eb7e3b3f78dc105e522c7b496089b 24-Nov-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: parse child device from VBT

On some laptops there is no HDMI/DP. But the xrandr still reports
several disconnected HDMI/display ports. In such case the user will be
confused.
>DVI1 disconnected (normal left inverted right x axis y axis)
>DP1 disconnected (normal left inverted right x axis y axis)
>DVI2 disconnected (normal left inverted right x axis y axis)
>DP2 disconnected (normal left inverted right x axis y axis)
>DP3 disconnected (normal left inverted right x axis y axis)

This patch set is to use the child device parsed in VBT to decide whether
the HDMI/DP/LVDS/TV should be initialized.

Parse the child device from VBT.

The device class type is also added for LFP, TV, HDMI, DP output.

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

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
01c66889c14aa163c49355b3be2ccfb214500599 28-Oct-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Add ACPI OpRegion support for Ironlake

Add the support of ACPI opregion on Ironlake so that the backlight
brightness can be adjusted by using ACPI interface
>/sys/class/backlight/acpi_video0/brightness

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Zhao Yakui <yakui.zhao@intel.com>
[zhenyuw: cleanups, fix typo for checking GSE irq and convert to
current irq handling logic.]
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
aed5f1dc264e2bc87e8656dd6945e4b1e72ebdbc 14-Oct-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use a single thread workqueue

Our work is serialised so allocating per-cpu workqueues is overkill and
a waste of resources.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
44d98a614267c81a04ba9c7a0427c3a628985b7d 09-Oct-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Replace DRM_DEBUG with DRM_DEBUG_DRIVER

Replace the DRM_DEBUG with DRM_DEBUG_DRIVER in generic i915 driver.
Then the debug info can be obtained by adding the boot option of
"drm.debug=0x02".

At the same time the debug info in increase/decrease clock is also
printed by using DRM_DEBUG_DRIVER instead of DRM_DEBUG_KMS.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
02e792fbaadb75dec8e476a05b610e49908fc6a4 15-Sep-2009 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: implement drmmode overlay support v4

This implements intel overlay support for kms via a device-specific
ioctl. Thomas Hellstrom brought up the idea of a general ioctl (on
dri-devel). We've reached the conclusion that such an infrastructure
only makes sense when multiple kms overlay implementations exists,
which atm don't (and it doesn't look like this is gonna change).

Open issues:
- Runs in sync with the gpu, i.e. unnecessary waiting. I've decided
to wait on this because the hw tends to hang when changing something
in this area. I left some dummy functions as infrastructure.
- polyphase filtering uses a static table.
- uses uninterruptible sleeps. Unfortunately the alternatives may
unnecessarily wedged the hw if/when we timeout too early (and
userspace only overloaded the batch buffers with stuff worth a few
secs of gpu time).

Changes since v1:
- fix off-by-one misconception on my side. This fixes fullscreen
playback.
Changes since v2:
- add underrun detection as spec'ed for i965.
- flush caches properly, fixing visual corruptions.
Changes since v4:
- fix up cache flushing of overlay memory regs.
- killed require_pipe_a logic - it hangs the chip.

Tested-By: diego.abelenda@gmail.com (on a 865G)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[anholt: Resolved against the MADVISE ioctl going in before this one]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
9216d44dc13b5e858253f06d83ceea25a9b72f4f 10-Oct-2009 Shaohua Li <shaohua.li@intel.com> drm/i915: disable FBC for Pineview, fixing a boot hang.

Pineview doesn't have this FBC mechanism, so this code doesn't apply.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
9d34e5db07303c9609053e2e651aa6d1fc74e923 24-Sep-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Enable irq to trace batch buffer completion.

If we trigger a tracepoint for batch buffer submission, it is a reasonable
assumption that we wish to also trace the batch buffer completion. So in
order to capture the completion events, we need to enable irqs... However,
we cannot rely on the completion event to disable the irq later, so we
defer the irq disable to the retire request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
94e0fb086fc5663c38bbc0fe86d698be8314f82f 24-Sep-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'drm-intel-next' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel

* 'drm-intel-next' of git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel: (57 commits)
drm/i915: Handle ERESTARTSYS during page fault
drm/i915: Warn before mmaping a purgeable buffer.
drm/i915: Track purged state.
drm/i915: Remove eviction debug spam
drm/i915: Immediately discard any backing storage for uneeded objects
drm/i915: Do not mis-classify clean objects as purgeable
drm/i915: Whitespace correction for madv
drm/i915: BUG_ON page refleak during unbind
drm/i915: Search harder for a reusable object
drm/i915: Clean up evict from list.
drm/i915: Add tracepoints
drm/i915: framebuffer compression for GM45+
drm/i915: split display functions by chip type
drm/i915: Skip the sanity checks if the current relocation is valid
drm/i915: Check that the relocation points to within the target
drm/i915: correct FBC update when pipe base update occurs
drm/i915: blacklist Acer AspireOne lid status
ACPI: make ACPI button funcs no-ops if not built in
drm/i915: prevent FIFO calculation overflows on 32 bits with high dotclocks
drm/i915: intel_display.c handle latency variable efficiently
...

Fix up trivial conflicts in drivers/gpu/drm/i915/{i915_dma.c|i915_drv.h}
1c5d22f76dc721f3acb7a3dadc657a221e487fb7 25-Aug-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Add tracepoints

By adding tracepoint equivalents for WATCH_BUF/EXEC we are able to monitor
the lifetimes of objects, requests and significant events. These events can
then be probed using the tracing frameworks, such as systemtap and, in
particular, perf.

For example to record the stack trace for every GPU stall during a run, use

$ perf record -e i915:i915_gem_request_wait_begin -c 1 -g

And

$ perf report

to view the results.

[Updated to fix compilation issues caused.]
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Ben Gamari <bgamari@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
/drivers/gpu/drm/i915/i915_dma.c
74dff282237ea8c0a5df1afd8526eac4b6cee063 15-Sep-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: framebuffer compression for GM45+

Add support for framebuffer compression on GM45 and above. Removes
some unnecessary I915_HAS_FBC checks as well (this is now part of the
FBC display function).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
28d520433b6375740990ab99d69b0d0067fd656b 21-Sep-2009 Dave Airlie <airlied@redhat.com> drm/vgaarb: add VGA arbitration support to the drm and kms.

VGA arb requires DRM support for non-kms drivers, to turn on/off
irqs when disabling the mem/io regions.

VGA arb requires KMS support for GPUs where we can turn off VGA
decoding. Currently we know how to do this for intel and radeon
kms drivers, which allows them to be removed from the arbiter.

This patch comes from Fedora rawhide kernel.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
3ef94daae7530b4ebcd2e5f48f1028cd2d2470ba 14-Sep-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Add ioctl to set 'purgeability' of objects

Similar to the madvise() concept, the application may wish to mark some
data as volatile. That is in the event of memory pressure the kernel is
free to discard such buffers safe in the knowledge that the application
can recreate them on demand, and is simply using these as a cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
11ed50ec2a316928c2bacc1149bded86c6a96068 14-Sep-2009 Ben Gamari <bgamari.foss@gmail.com> drm/i915: Implement GPU reset on i965

This patch puts in place the machinery to attempt to reset the GPU. This
will be used when attempting to recover from a GPU hang.

Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
f65d94211e2bcba17faf05a6a3809af0e4217767 14-Sep-2009 Ben Gamari <bgamari.foss@gmail.com> drm/i915: Add hangcheck timer

We set a periodic timer to check on the GPU, resetting it every time a
batch is completed. If the timer elapses, we check acthd. If acthd
hasn't changed in two timer periods, we assume the chip is wedged.

This is implemented in such a way that it leaves the option open to
employ adaptive timer intervals in the future. One could wait until
several timer periods have elapsed before declaring the chip dead. If
the chip comes back after several periods but before the "dead"
threshold, the timer interval or dead threshold could be raised.

It is important to note that while checking for active requests, we need
to account for the fact that requests are removed from the list (i.e.
retired) in a deferred work queue handler. This means that merely
checking for an empty request_list is insufficient; the list could be
non-empty yet the GPU still idle, causing the hangcheck timer to
incorrectly mark the GPU as wedged (it took me a while to figure that
out---sigh...)

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
6f465a8925016633891f5bf030f9c37036529b39 17-Sep-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: fix typo in compressed buffer setup

We want the compressed line length buffer address, not the framebuffer
address.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
8082400327d8d2ca54254b593644942bed0edd25 11-Sep-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: framebuffer compression for pre-GM45

This patch adds framebuffer compression (good for about ~0.5W power
savings in the best case) support for pre-GM45 chips. GM45+ have a new,
more flexible FBC scheme that will be added in a separate patch.

FBC can't always be enabled: the compressed buffer must be physically
contiguous and reside in stolen space. So if you have a large display
and a small amount of stolen memory, you may not be able to take
advantage of FBC. In some cases, a BIOS setting controls how much
stolen space is available. Increasing this to 8 or 16M can help.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
ec2a4c3fdc8e82fe82a25d800e85c1ea06b74372 04-Aug-2009 Dave Airlie <airlied@redhat.com> drm/i915: get the bridge device once.

The driver gets the bridge device in a number of places, upcoming
vga arb code paths need the bridge device, however they need it in
under a lock, and the pci lookup can allocate memory. So clean
this code up before then and get the bridge once for the driver lifetime.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
11670d3c93210793562748d83502ecbef4034765 07-Sep-2009 Dave Airlie <airlied@redhat.com> Merge intel drm-intel-next branch

Merge remote branch 'anholt/drm-intel-next' of ../anholt-2.6 into drm-next

Conflicts:
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_sdvo.c
0ef82af7253c1929a3995f271b8b0db462d1a0c3 05-Sep-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Pad ringbuffer with NOOPs before wrapping

According to the docs, the ringbuffer is not allowed to wrap in the middle
of an instruction.

G45 PRM, Vol 1b, p101:
While the “free space” wrap may allow commands to be wrapped around the
end of the Ring Buffer, the wrap should only occur between commands.
Padding (with NOP) may be required to follow this restriction.

Do as commanded.

[Having seen bug reports where there is evidence of split commands, but
apparently the GPU has continued on merrily before a bizarre and untimely
death, this may or may not fix a few random hangs.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
CC: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
785b93ef8c309730c2de84ce9c229e40e2d01480 28-Aug-2009 Dave Airlie <airlied@redhat.com> drm/kms: move driver specific fb common code to helper functions (v2)

Initially I always meant this code to be shared, but things
ran away from me before I got to it.

This refactors the i915 and radeon kms fbdev interaction layers
out into generic helpers + driver specific pieces.

It moves all the panic/sysrq enhancements to the core file,
and stores a linked list of kernel fbs. This could possibly be
improved to only store the fb which has fbcon on it for panics
etc.

radeon retains some specific codes used for a big endian
workaround.

changes:
fix oops in v1
fix freeing path for crtc_info

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
51c8b4071d84d46cc100baa5931ad06b2a823c95 20-Aug-2009 Dave Airlie <airlied@redhat.com> Merge Linus master to drm-next

linux-next conflict reported needed resolution.

Conflicts:
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_bo.c
9c9fe1f841745184bbc5460c6f3909fded3b929b 04-Aug-2009 Eric Anholt <eric@anholt.net> drm/i915: Use our own workqueue to avoid wedging the system along with the GPU.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
8a4c47f346cc7a12d0897c05eb3cc1add26b487f 20-Jul-2009 Zhao Yakui <yakui.zhao@intel.com> drm: Remove the unused prefix in DRM_DEBUG_KMS/DRIVER/MODE

We will have to add a prefix when using the macro defintion of DRM_DEBUG_KMS
/DRM_DEBUG_DRIVER/MODE. It is not convenient. We should use the DRM_NAME
as default prefix.
So remove the prefix in the macro definition of DRM_DEBUG_KMS/DRIVER/MODE.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
2a34f5e6b61c7e8f3b6f25847bcda88511b0ead4 02-Jul-2009 Eric Anholt <eric@anholt.net> drm/i915: Disable GEM when a broken video BIOS takes up the whole aperture.

This is seen on some G41 systems, where the BIOS will consume all but
a few KB of the aperture. This should be bad for all operating systems, as
it means that the OS can't dynamically manage memory between graphics and
the rest of the system, and OSes that did static memory management
statically add memory in addition to the BIOS allocation anyway. So, instead
of working around it, just fail out verbosely.

fd.o bug #21574

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
/drivers/gpu/drm/i915/i915_dma.c
1ae8c0a56eeb3ed358b78ccadd024d6b721f26bc 29-Jun-2009 Keith Packard <keithp@keithp.com> drm/i915: Make driver less chatty

Convert many printk calls to DRM_DEBUG calls to reduce kernel log noise
for normal activities. Switch other printk calls to DRM_ERROR or DRM_INFO.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
7662c8bd6545c12ac7b2b39e4554c3ba34789c50 26-Jun-2009 Shaohua Li <shaohua.li@intel.com> drm/i915: add FIFO watermark support

This patch from jbarnes and myself adds FIFO watermark control to the
driver. This is needed for both power saving features on new platforms
with the so-called "big FIFO" and for controlling FIFO allocation
between pipes in multi-head configurations.

It's also necessary infrastructure to support things like framebuffer
compression and configuration supportability checks (i.e. checking a
configuration against available bandwidth).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
63eeaf38251183ec2b1caee11e4a2c040cb5ce6c 19-Jun-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: enable error detection & state collection

This patch enables error detection by enabling several types of error
interrupts. When an error interrupt is received, the interrupt
handler captures the error state; hopefully resulting in an accurate
set of error data (error type, active head pointer, etc.). The new
record is then available from sysfs. The current code will also dump
the error state to the system log.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
95934f939c46ea2b37f3c91a4f8c82e003727761 19-Jun-2009 Dave Airlie <airlied@redhat.com> drm/i915: enable GEM on PAE.

In theory now that the AGP subsystem is using struct page, we should
have on problems enabling GEM on PAE systems.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
9a298b2acd771d8a5c0004d8f8e4156c65b11f6b 24-Mar-2009 Eric Anholt <eric@anholt.net> drm: Remove memory debugging infrastructure.

It hasn't been used in ages, and having the user tell your how much
memory is being freed at free time is a recipe for disaster even if it
was ever used.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
6b702462cbe5b6f372966a53f4465d745d86b65c 13-Jun-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (50 commits)
drm: include kernel list header file in hashtab header
drm: Export hash table functionality.
drm: Split out the mm declarations in a separate header. Add atomic operations.
drm/radeon: add support for RV790.
drm/radeon: add rv740 drm support.
drm_calloc_large: check right size, check integer overflow, use GFP_ZERO
drm: Eliminate magic I2C frobbing when reading EDID
drm/i915: duplicate desired mode for use by fbcon.
drm/via: vfree() no need checking before calling it
drm: Replace DRM_DEBUG with DRM_DEBUG_DRIVER in i915 driver
drm: Replace DRM_DEBUG with DRM_DEBUG_MODE in drm_mode
drm/i915: Replace DRM_DEBUG with DRM_DEBUG_KMS in intel_sdvo
drm/i915: replace DRM_DEBUG with DRM_DEBUG_KMS in intel_lvds
drm: add separate drm debugging levels
radeon: remove _DRM_DRIVER from the preadded sarea map
drm: don't associate _DRM_DRIVER maps with a master
drm: simplify kcalloc() call to kzalloc().
intelfb: fix spelling of "CLOCK"
drm: fix LOCK_TEST_WITH_RETURN macro
drm/i915: Hook connector to encoder during load detection (fixes tv/vga detect)
...
be25ed9c5cc06e1d17aa97e41daf88f0b46143e6 02-Jun-2009 yakui_zhao <yakui.zhao@intel.com> drm: Replace DRM_DEBUG with DRM_DEBUG_DRIVER in i915 driver

Replace the DRM_DEBUG with the DRM_DEBUG_DRIVER to print the debug info
in i915 driver.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
036a4a7d9272582fc7370359515d807393e2f728 08-Jun-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: handle interrupt on new chipset

Update interrupt handling methods for IGDNG with new registers
for display and graphics interrupt functions. As we won't use
irq-based vblank sync in dri2, so display interrupt on new chip
will be used for hotplug only in future.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
42c2798b35b95c471877133e19ccc3cab00e9b65 05-May-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: apply G45 vblank count code to all G4x chips and fix max_frame_count

All G4x and newer chips use the new style frame count register, with a
full 32 bit frame count. Update the code to reflect this.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
2c07245fb8f7f0a282282e5a9747e46defdb2cc7 05-Jun-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: enable kernel modesetting on IGDNG

This adds kernel mode setting on IGDNG with VGA output support.
Note that suspend/resume doesn't work yet.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
e170b030dcd6aed11dde2d124c09991ec771f529 05-Jun-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: Disable opregion on IGDNG for now

Disable OpRegion support for now until verified on new chipsets.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
b962442e46a9340bdbc6711982c59ff0cc2b5afb 03-Jun-2009 Eric Anholt <eric@anholt.net> drm/i915: Change GEM throttling to be 20ms like the comment says.

keithp didn't like the original 20ms plan because a cooperative client could
be starved by an uncooperative client. There may even have been problems
with cooperative clients versus cooperative clients. So keithp changed
throttle to just wait for the second to last seqno emitted by that client.
It worked well, until we started getting more round-trips to the server
due to DRI2 -- the server throttles in BlockHandler, and so if you did more
than one round trip after finishing your frame, you'd end up unintentionally
syncing to the swap.

Fix this by keeping track of the client's requests, so the client can wait
when it has an outstanding request over 20ms old. This should have
non-starving behavior, good behavior in the presence of restarts, and less
waiting. Improves high-settings openarena performance on my GM45 by 50%.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
b8da7de56ca0ad34726478a50d138a29a9ff76cb 02-Jun-2009 Dave Airlie <airlied@redhat.com> drm: fix irq naming for kms drivers.

allocating devname in the i915 driver was a hack originally and I
forgot to figure out how to do this properly back then.

So this is the cleaner version that just picks devname or driver name
in the irq code.

It removes the devname allocs from the i915 driver.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
08d7b3d1edff84bd673d9e9ab36b5aa62e1ba903 29-Apr-2009 Carl Worth <cworth@cworth.org> drm/i915: Add new GET_PIPE_FROM_CRTC_ID ioctl.

This allows userlevel code to discover the pipe number corresponding
to a given CRTC ID. This is necessary for doing pipe-specific
operations such as waiting for vblank on a given CRTC. Failure to use
the right pipe mapping can result in GPU hangs, or at least failure
to actually sync to vblank.

Signed-off-by: Carl Worth <cworth@cworth.org>
[anholt: Style touchups from review]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
13f4c435ebf2a7c150ffa714f3b23b8e4e8cb42f 13-May-2009 Eric Anholt <eric@anholt.net> drm/i915: Don't allow binding objects into the last page of the aperture.

This should avoid a class of bugs where the hardware prefetches past the
end of the object, and walks into unallocated memory when the object is
bound to the last page of the aperture.

fd.o bug #21488

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
355d7f370b51bbb6f31aaf9f98861057e1e6bbb2 17-Apr-2009 Chris Wright <chrisw@sous-sol.org> drm/i915: fix up error path leak in i915_cmdbuffer

Commit 201361a5 introduces a leak when unwinding on error. Reorder
unwind, and eliminate leak.

Cc: Eric Anholt <eric@anholt.net>
Cc: Keith Packard <keithp@keithp.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
[anholt: fixed uninit variable use introduced in original patch]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
3b1c1c1118880921da1188b7245e0470742802f8 01-Apr-2009 Matthew Garrett <mjg59@srcf.ucam.org> drm/i915: Unregister ACPI video driver when exiting

The i915 DRM triggers registration of the ACPI video driver on load. It
should unregister it at unload in order to avoid generating backtraces on
being reloaded.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
478c6a43fcbc6c11609f8cee7c7b57223907754f 05-Apr-2009 Len Brown <len.brown@intel.com> Merge branch 'linus' into release

Conflicts:
arch/x86/kernel/cpu/cpufreq/longhaul.c

Signed-off-by: Len Brown <len.brown@intel.com>
5f3dbedf2770cf6aeb5547b3c56734dee4e5186b 03-Apr-2009 Dave Airlie <airlied@redhat.com> Merge branch 'drm-intel-next' of ../anholt-2.6 into drm-linus
7a1fb5d06d3936c0982e2cf8b53b046244a9aad6 27-Mar-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm: remove unused "can_grow" parameter from drm_crtc_helper_initial_config

Cleanup some leftovers from the X port.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
5ca58282089b11f64b911618036ee7676f12735b 31-Mar-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add VGA hotplug support for 945+

Add VGA port hotplug detection to the i915 driver. When KMS is enabled,
plugging in or removing a VGA cable from the VGA connector will
generate a uevent, which indicates to userspace that it should re-probe
outputs on this device (to determine modes, etc.).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[anholt: dropped extra PORT_HOTPLUG_STAT clear with ack from jbarnes]
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
4a8df45894d26dc503013ea630927731c24be6b8 13-Mar-2009 Shaohua Li <shaohua.li@intel.com> drm/i915: correctly set IGD device's gtt size for KMS.

IGD device only has last 1 page used by GTT. This should match the AGP gart
code.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
90f959bcb386da2c71613dcefc6a285e054a539e 29-Mar-2009 Dave Airlie <airlied@redhat.com> drm: merge Linux master into HEAD

Conflicts:
drivers/gpu/drm/drm_info.c
drivers/gpu/drm/drm_proc.c
drivers/gpu/drm/i915/i915_gem_debugfs.c
74a365b3f354fafc537efa5867deb7a9fadbfe27 19-Mar-2009 Matthew Garrett <mjg59@srcf.ucam.org> ACPI: Populate DIDL before registering ACPI video device on Intel

Intel graphics hardware that implements the ACPI IGD OpRegion spec
requires that the list of display devices be populated before any ACPI
video methods are called. Detect when this is the case and defer
registration until the opregion code calls it. Fixes crashes on HP
laptops.

http://bugzilla.kernel.org/show_bug.cgi?id=11259

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Len Brown <len.brown@intel.com>
/drivers/gpu/drm/i915/i915_dma.c
98787c057fdefdce6230ff46f2c1105835005a4c 07-Mar-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Check for dev->primary->master before dereference.

I've hit the occasional oops inside i915_wait_ring() with an indication of
a NULL derefence of dev->primary->master. Adding a NULL check is
consistent with the other potential users of dev->primary->master.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
201361a54ed187d8595a283e3a4ddb213bc8323b 11-Mar-2009 Eric Anholt <eric@anholt.net> drm/i915: Fix lock order reversal with cliprects and cmdbuf in non-DRI2 paths.

This introduces allocation in the batch submission path that wasn't there
previously, but these are compatibility paths so we care about simplicity
more than performance.

kernel.org bug #12419.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
/drivers/gpu/drm/i915/i915_dma.c
d883f7f1b75c8dcafa891f7b9e69c5a2f0ff6d66 02-Feb-2009 Benjamin Herrenschmidt <benh@kernel.crashing.org> drm: Use resource_size_t for drm_get_resource_{start, len}

The DRM uses its own wrappers to obtain resources from PCI devices,
which currently convert the resource_size_t into an unsigned long.

This is broken on 32-bit platforms with >32-bit physical address
space.

This fixes them, along with a few occurences of unsigned long used
to store such a resource in drivers.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
040aefa263aa9cd7bd5df50586c35e1e15e77f84 10-Mar-2009 Eric Anholt <eric@anholt.net> drm/i915: Fix bad \n in MTRR failure notice.

Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
535d8e8f19376518e52e64f511440e502acda150 28-Feb-2009 Linus Torvalds <torvalds@linux-foundation.org> Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86: enable DMAR by default
xen: disable interrupts early, as start_kernel expects
gpu/drm, x86, PAT: io_mapping_create_wc and resource_size_t
gpu/drm, x86, PAT: Handle io_mapping_create_wc() errors in a clean way
x86, Voyager: fix compile by lifting the degeneracy of phys_cpu_present_map
x86, doc: fix references to Documentation/x86/i386/boot.txt
6644107d57a8fa82b47e4c55da4d9d91a612f29c 25-Feb-2009 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> gpu/drm, x86, PAT: Handle io_mapping_create_wc() errors in a clean way

io_mapping_create_wc can return NULL on error and io_mapping_free() should be
called on one of the error-cleanup path.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
/drivers/gpu/drm/i915/i915_dma.c
dd0910b3c71b253c08111110f0399b924a8d5853 25-Feb-2009 Dave Airlie <airlied@linux.ie> drm/i915: make hw page ioremap use ioremap_wc

However we still have another issue with ioremap_wc not falling back
properly or somehow doing something else stupid, this probably needs
to be tracked down.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
6fb88588555a18792a27f483887fe1f2af5f9c9b 23-Feb-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: fix WC mapping in non-GEM i915 code.

[airlied - taken from mailing list posting]

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
9880b7a527ffbb52f65c2de0a8d4eea86e24775e 06-Feb-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add get_vblank_counter function for GM45

As discussed in the long thread about vblank related timeouts, it turns out
GM45 has different frame count registers than previous chips. This patch
adds support for them, which prevents us from waiting on really stale
sequence values in drm_wait_vblank (which rather than returning immediately
ends up timing out or getting interrupted).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
122ee2a63bc49d21f402f6b6d2208306cdcc98c1 03-Feb-2009 Eric Anholt <eric@anholt.net> drm/i915: Quiet the message on get/setparam ioctl with an unknown value.

Getting an unknown get/setparam used to be more significant back when they
didn't change much. However, now that we're in the git world we're using
them instead of a monotonic version number to signal feature availability,
so clients ask about unknown params on older kernels more often.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
0f973f27888e4664b253ab2cf69c67c2eb80ab1b 27-Jan-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add fence register management to execbuf

Adds code to set up fence registers at execbuf time on pre-965 chips as
necessary. Also fixes up a few bugs in the pre-965 tile register support
(get_order != ffs). The number of fences available to the kernel defaults
to the hw limit minus 3 (for legacy X front/back/depth), but a new parameter
allows userspace to override that as needed.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
ab657db12d7020629f26f30d287558a8d0e32b41 23-Jan-2009 Eric Anholt <eric@anholt.net> drm/i915: Set up an MTRR covering the GTT at driver load.

We'd love to just be using PAT, but even on chips with PAT it gets disabled
sometimes due to an errata. It would probably be better to have pat_enabled
exported and only bother with this when !pat_enabled.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
2906f0258770d3a9c4e65364df8acc904e148bbe 21-Jan-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: Fix cursor physical address choice to match the 2D driver.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
/drivers/gpu/drm/i915/i915_dma.c
ed2dd4b0cc1494c27478f4ea8452f68d2037a60c 22-Jan-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: remove unnecessary debug output in KMS init

We don't really need to print out the FB BAR...

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
71acb5eb8d95b371f4cdd88a47f3c83c870d1c8f 30-Dec-2008 Dave Airlie <airlied@linux.ie> drm/i915: add support for physical memory objects

This is an initial patch to do support for objects which needs physical
contiguous main ram, cursors and overlay registers on older chipsets.

These objects are bound on cursor bin, like pinning, and we copy
the data to/from the backing store object into the real one on attach/detach.

notes:
possible over the top in attach/detach operations.
no overlay support yet.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
3a03ac1a0223f779a3de313523408ddb099e5679 11-Jan-2009 Dave Airlie <airlied@linux.ie> drm/i915: setup sarea properly in master_priv

If we are running DRI1 userspace, we really need to set the sarea up properly.

thanks to Richard for finding/testing this.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
241fa85b2bb655224357d713c251077dee3585ce 03-Jan-2009 Eric Anholt <eric@anholt.net> drm/i915: Respect the other stolen memory sizes we know of.

fd.o bug #19336.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
aa5966296675a5092505f68d72563d5939a92353 29-Dec-2008 Dave Airlie <airlied@linux.ie> drm/i915: fix modeset devname allocation + agp init return check.

devname needs to be allocated before the irq is installed, so the
irq routines get the correct name in /proc.

Also check the return value from the AGP init function, and
fixup the exit points.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
bae7ec657305def791a946f5d791054c48a5f081 19-Dec-2008 Eric Anholt <eric@anholt.net> drm/i915: Delete unused, pointless i915_driver_firstopen.

Thanks to Hannes Eder for pointing out that this code was dead according to
sparse.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
b358d0a6252d8ed16afb20caaec35b24c76074bb 18-Dec-2008 Hannes Eder <hannes@hanneseder.net> drm/i915: fix sparse warnings: make symbols static

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
60fd99e3682c5acc74d58ed61dac93526d6976f7 04-Dec-2008 Eric Anholt <eric@anholt.net> drm/i915: Fix stolen memory detection on G45 and GM45.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
79e539453b34e35f39299a899d263b0a1f1670bd 07-Nov-2008 Jesse Barnes <jbarnes@virtuousgeek.org> DRM: i915: add mode setting support

This commit adds i915 driver support for the DRM mode setting APIs.
Currently, VGA, LVDS, SDVO DVI & VGA, TV and DVO LVDS outputs are
supported. HDMI, DisplayPort and additional SDVO output support will
follow.

Support for the mode setting code is controlled by the new 'modeset'
module option. A new config option, CONFIG_DRM_I915_KMS controls the
default behavior, and whether a PCI ID list is built into the module for
use by user level module utilities.

Note that if mode setting is enabled, user level drivers that access
display registers directly or that don't use the kernel graphics memory
manager will likely corrupt kernel graphics memory, disrupt output
configuration (possibly leading to hangs and/or blank displays), and
prevent panic/oops messages from appearing. So use caution when
enabling this code; be sure your user level code supports the new
interfaces.

A new SysRq key, 'g', provides emergency support for switching back to
the kernel's framebuffer console; which is useful for testing.

Co-authors: Dave Airlie <airlied@linux.ie>, Hong Liu <hong.liu@intel.com>

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
de151cf67ce52ed2d88083daa5e60c7858947329 12-Nov-2008 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: add GEM GTT mapping support

Use the new core GEM object mapping code to allow GTT mapping of GEM
objects on i915. The fault handler will make sure a fence register is
allocated too, if the object in question is tiled.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
7c1c2871a6a3a114853ec6836e9035ac1c0c7f7a 28-Nov-2008 Dave Airlie <airlied@redhat.com> drm: move to kref per-master structures.

This is step one towards having multiple masters sharing a drm
device in order to get fast-user-switching to work.

It splits out the information associated with the drm master
into a separate kref counted structure, and allocates this when
a master opens the device node. It also allows the current master
to abdicate (say while VT switched), and a new master to take over
the hardware.

It moves the Intel and radeon drivers to using the sarea from
within the new master structures.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
ac5c4e76180a74c7f922f6fa71ace0cef45fa433 19-Dec-2008 Dave Airlie <airlied@redhat.com> drm/i915: GEM on PAE has problems - disable it for now.

On PAE systems, GEM allocates pages using shmem, and passes these
pages to be bound into AGP, however the AGP interfaces + the x86
set_memory interfaces all take unsigned long not dma_addr_t.

The initial fix for this was a mess, so we need to do this correctly
for 2.6.29.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
b60678a75d44fa9d5969f79781bd856ad5858609 08-Dec-2008 Keith Packard <keithp@keithp.com> drm/i915: Disable the GM965 MSI errata workaround.

Since applying the fix suggested by the errata (disabling MSI), we've had
issues with interrupts being stuck on despite IIR being 0 on GM965 hardware.
Most reporters of the issue have confirmed that turning MSI back on fixes
things, and given the difficulties experienced in getting reliable MSI working
on Linux, it's believable that the errata was about software issues and not
actual hardware issues.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
52440211dcdc52c0b757f8b34d122e11b12cdd50 18-Nov-2008 Keith Packard <keithp@keithp.com> drm: move drm vblank initialization/cleanup to driver load/unload

drm vblank initialization keeps track of the changes in driver-supplied
frame counts across vt switch and mode setting, but only if you let it by
not tearing down the drm vblank structure.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
0baf823a10bd4131f70e9712d1f02de3c247f1df 08-Nov-2008 Keith Packard <keithp@keithp.com> drm/i915: Move legacy breadcrumb out of the reserved status page area

Addresses in the hardware status page below index 0x20 are reserved for use
by the hardware. The legacy breadcrumb was sitting at index 5. Move it to
index 0x21, and make sure everyone uses the defined value instead of
hard-coded constants.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
d3e74d0237b102d34979015fbf6df02ca4413074 03-Nov-2008 Eric Anholt <eric@anholt.net> i915: Don't whine when pci_enable_msi() fails.

This probably just means the chipset doesn't support MSI, which is fine.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
ad42ca8f4490de06462aee234ea0083cbd8b46aa 03-Nov-2008 Keith Packard <keithp@keithp.com> i915: Clean up sarea pointers on leavevt

This corresponds to the setup of the sarea pointers in DMA initialization,
though neither is exactly the point at which the sarea is set up or torn down.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
5a125c3c79167e78ba44efef03af7090ef28eeaf 23-Oct-2008 Eric Anholt <eric@anholt.net> i915: Add GEM ioctl to get available aperture size.

This will let userland know when to submit its batchbuffers, before they get
too big to fit in the aperture.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
d1ed629f44b3a4108d5c445971535f05f441fce7 17-Oct-2008 Keith Packard <keithp@keithp.com> i915: Disable MSI on GM965 (errata says it doesn't work)

Current Intel errata for the GM965 says that using MSI may cause interrupts
to be delayed or lost. The only workaround offered is to not use it.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
4b40893918203ee1a1f6a114316c2a19c072e9bd 17-Oct-2008 Matthias Hopf <mhopf@suse.de> drm/i915: fix ioremap of a user address for non-root (CVE-2008-3831)

Olaf Kirch noticed that the i915_set_status_page() function of the i915
kernel driver calls ioremap with an address offset that is supplied by
userspace via ioctl. The function zeroes the mapped memory via memset
and tells the hardware about the address. Turns out that access to that
ioctl is not restricted to root so users could probably exploit that to
do nasty things. We haven't tried to write actual exploit code though.

It only affects the Intel G33 series and newer.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
2bdf00b22154023ac312481583603f4724eb1401 07-Oct-2008 Dave Airlie <airlied@redhat.com> i915: fixup permissions on gem ioctls.

init/entervt/leavevt should be root-only master ioctls.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
3043c60c485ad694392d3f71bd7ef9f5c5f7cfdd 02-Oct-2008 Eric Anholt <eric@anholt.net> drm: Clean up many sparse warnings in i915.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
c99b058f132388a666544d293392d52d1def6b12 20-Aug-2008 Kristian Høgsberg <krh@redhat.com> i915: Make use of sarea_priv conditional.

We fail ioctls that depend on the sarea_priv with EINVAL.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
546b0974c39657017407c86fe79811100b60700d 02-Sep-2008 Eric Anholt <eric@anholt.net> i915: Use struct_mutex to protect ring in GEM mode.

In the conversion for GEM, we had stopped using the hardware lock to protect
ring usage, since it was all internal to the DRM now. However, some paths
weren't converted to using struct_mutex to prevent multiple threads from
concurrently working on the ring, in particular between the vblank swap handler
and ioctls.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
ed4c9c4acf948b42b138747fcb8843ecb1a24ce4 20-Aug-2008 Kristian Høgsberg <krh@redhat.com> i915: Add chip set ID param.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
673a394b1e3b69be886ff24abfd6df97c52e8d08 30-Jul-2008 Eric Anholt <eric@anholt.net> drm: Add GEM ("graphics execution manager") to i915 driver.

GEM allows the creation of persistent buffer objects accessible by the
graphics device through new ioctls for managing execution of commands on the
device. The userland API is almost entirely driver-specific to ensure that
any driver building on this model can easily map the interface to individual
driver requirements.

GEM is used by the 2d driver for managing its internal state allocations and
will be used for pixmap storage to reduce memory consumption and enable
zero-copy GLX_EXT_texture_from_pixmap, and in the 3d driver is used to enable
GL_EXT_framebuffer_object and GL_ARB_pixel_buffer_object.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
0a3e67a4caac273a3bfc4ced3da364830b1ab241 30-Sep-2008 Jesse Barnes <jbarnes@virtuousgeek.org> drm: Rework vblank-wait handling to allow interrupt reduction.

Previously, drivers supporting vblank interrupt waits would run the interrupt
all the time, or all the time that any 3d client was running, preventing the
CPU from sleeping for long when the system was otherwise idle. Now, interrupts
are disabled any time that no client is waiting on a vblank event. The new
method uses vblank counters on the chipsets when the interrupts are turned
off, rather than counting interrupts, so that we can continue to present
accurate vblank numbers.

Co-author: Michel Dänzer <michel@tungstengraphics.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
8ee1c3db9075cb3211352e737e0feb98fd733b20 05-Aug-2008 Matthew Garrett <mjg59@srcf.ucam.org> Add Intel ACPI IGD OpRegion support

This adds the support necessary for allowing ACPI backlight control to
work on some newer Intel-based graphics systems. Tested on Thinkpad T61
and HP 2510p hardware.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
/drivers/gpu/drm/i915/i915_dma.c
398c9cb20b5c6c5d1313912b937d653a46fec578 30-Jul-2008 Keith Packard <keithp@keithp.com> i915: Initialize hardware status page at device load when possible.

Some chips were unstable with repeated setup/teardown of the hardware status
page.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
d3a6d4467ca44833bcb4ba1893a7aeaae939e4d5 30-Jul-2008 Keith Packard <keithp@keithp.com> i915: Track progress inside of batchbuffers for determining wedgedness.

This avoids early termination for long-running commands.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
ed4cb4142b242d8090d3811d5eb4abf6aa985bc8 29-Jul-2008 Eric Anholt <eric@anholt.net> i915: Add support for MSI and interrupt mitigation.

Previous attempts at interrupt mitigation had been foiled by i915_wait_irq's
failure to update the sarea seqno value when the status page indicated that
the seqno had already been passed. MSI support has been seen to cut CPU
costs by up to 40% in some workloads by avoiding other expensive interrupt
handlers for frequent graphics interrupts.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
585fb111348f7cdc30c6a1b903987612ddeafb23 29-Jul-2008 Jesse Barnes <jbarnes@virtuousgeek.org> i915: Use more consistent names for regs, and store them in a separate file.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
962d4fd7273e144ae003ddb90138ae4b80567c70 30-Jul-2008 Keith Packard <keithp@keithp.com> i915: Ignore X server provided mmio address

It is already correctly detected by the kernel for use in suspend/resume.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
0790d5e148c0747499742a3c09ba5f1c07f9ed0d 30-Jul-2008 Keith Packard <keithp@keithp.com> i915: remove settable use_mi_batchbuffer_start

The driver can know what hardware requires MI_BATCH_BUFFER vs
MI_BATCH_BUFFER_START; there's no reason to let user mode configure this.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c
80a914dc05683ecfc98f9e1887fd6564846ffbec 16-Oct-2008 Harvey Harrison <harvey.harrison@gmail.com> misc: replace __FUNCTION__ with __func__

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
/drivers/gpu/drm/i915/i915_dma.c
c0e09200dc0813972442e550a5905a132768e56c 29-May-2008 Dave Airlie <airlied@redhat.com> drm: reorganise drm tree to be more future proof.

With the coming of kernel based modesetting and the memory manager stuff,
the everything in one directory approach was getting very ugly and
starting to be unmanageable.

This restructures the drm along the lines of other kernel components.

It creates a drivers/gpu/drm directory and moves the hw drivers into
subdirectores. It moves the includes into an include/drm, and
sets up the unifdef for the userspace headers we should be exporting.

Signed-off-by: Dave Airlie <airlied@redhat.com>
/drivers/gpu/drm/i915/i915_dma.c