History log of /drivers/gpu/drm/i915/intel_overlay.c
Revision Date Author Comments
de67cba65944f26c0f147035bd62e30c5f456b96 15-Feb-2012 Danny Kukawka <danny.kukawka@bisect.de> Revert "drivers/gpu/drm/i915/intel_overlay.c needs seq_file.h"

This reverts commit e167976ee7f5fe4b80f7e8f55e087f6c67cf9562,
Since this was already fixed in commit
3bd3c9329973a93fa3ef5e9840f2fd6fa2889e3f some days before this
commit cause seq_file.h to be included twice.

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
75c13993db592343bda1fd62f2555fea037d56bd 28-Jan-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: fixup overlay checks for interlaced modes

The drm core _really_ likes to frob around with the crtc timings and
put halfed vertical timings (in fields) in there. Which confuses the
overlay code, resulting in it's refusal to display anything at the
lower half of an interlaced pipe.

Tested-by: Christopher Egert <cme3000@gmail.com>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
ca9bfa7eed20ea34e862804e62aae10eb159edbb 28-Jan-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: fixup interlaced vertical timings confusion, part 1

We have a pretty decent confusion about vertical timings of interlaced
modes. Peter Ross has written a patch that makes interlace modes work
on a lot more platforms/output combinations by doubling the vertical
timings.

The issue with that patch is that core drm _does_ support specifying
whether we want these vertical timings in fields or frames, we just
haven't managed to consistently use this facility. The relavant
function is drm_mode_set_crtcinfo, which fills in the crtc timing
information.

The first thing to note is that the drm core keeps interlaced modes in
frames, but displays modelines in fields. So when the crtc modeset
helper copies over the mode into adjusted_mode it will already contain
vertical timings in half-frames. The result is that the fixup code in
intel_crtc_mode_fixup doesn't actually do anything (in most cases at
least).

Now gen3+ natively supports interlaced modes and wants the vertical
timings in frames. Which is what sdvo already fixes up, at least under
some conditions.

There are a few other place that demand vertical timings in fields
but never actually deal with interlaced modes, so use frame timings
for consistency, too. These are:
- lvds panel,
- dvo encoders - dvo is the only way gen2 could support interlaced
mode, but currently we don't support any encoders that do.
- tv out - despite that the tv dac sends out an interlaced signal it
expects a progressive mode pipe configuration.
All these encoders enforce progressive modes by resetting
interlace_allowed.

Hence we always want crtc vertical timings in frames. Enforce this in
our crtc mode_fixup function and rip out any redudant timing
computations from the encoders' mode_fixup function.

v2-4: Adjust the vertical timings a bit.

v5: Split out the 'subtract-one for interlaced' fixes.

v6: Clarify issues around tv-out and gen2.

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Christopher Egert <cme3000@gmail.com>
Tested-by: Alfonso Fiore <alfonso.fiore@gmail.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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>
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>
79d2427338e8da362678de32a1c8af1dc8a9810a 28-Jun-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Fix unpinning along init error paths

As pointed out by Dan Carpenter, it was seemingly possible to hit an error
whilst mapping the buffer for the regs (except the only likely error
returns should not happen during init) and so leak a pin count on the
bo. To handle this we would need to reacquire the struct mutex, so for
simplicity rearrange for the lock to be held for the entire function.
For extra pedagogy, test that we only call init once.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
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>
1e5216e43846b7758b2a04b3612c475608a4b708 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: Keith Packard <keithp@keithp.com>
2da3b9b940e2a18147422c54ed8b29d01e1ade88 14-Apr-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Combine pinning with setting to the display plane

We need to perform a few operations in order to move the object into the
display plane (where it can be accessed coherently by the display
engine) that are important for future safety to forbid whilst pinned. As a
result, we want to need to perform some of the operations before pinning,
but some are required once we have been bound into the GTT. So combine
the pinning performed by all the callers with set_to_display_plane(), so
this complication is contained within the single function.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
c411964209508e32cf36f6512ed339996751f55f 30-Mar-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Mark the cursor and the overlay as being part of the display planes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
ce453d81cb0397aa7d5148984f51907e14072d74 21-Feb-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use a device flag for non-interruptible phases

The code paths for modesetting are growing in complexity as we may need
to move the buffers around in order to fit the scanout in the aperture.
Therefore we face a choice as to whether to thread the interruptible status
through the entire pinning and unbinding code paths or to add a flag to
the device when we may not be interrupted by a signal. This does the
latter and so fixes a few instances of modesetting failures under stress.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
c87252266352c5201e2925740018f52578fa92bb 19-Feb-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Protect against drm_gem_object not being the first member

Dave Airlie spotted that we had a potential bug should we ever rearrange
the drm_i915_gem_object so not the base drm_gem_object was not its first
member. He noticed that we often convert the return of
drm_gem_object_lookup() immediately into drm_i915_gem_object and then
check the result for nullity. This is only valid when the base object is
the first member and so the superobject has the same address. Play safe
instead and use the compiler to convert back to the original return
address for sanity testing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>
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>
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>
d9e86c0ee60f323e890484628f351bf50fa9a15d 10-Nov-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Pipelined fencing [infrastructure]

With this change, every batchbuffer can use all available fences (save
pinned and scanout, of course) without ever stalling the gpu!

In theory. Currently the actual pipelined update of the register is
disabled due to some stability issues. However, just the deferred update
is a significant win.

Based on a series of patches by Daniel Vetter.

The premise is that before every access to a buffer through the GTT we
have to declare whether we need a register or not. If the access is by
the GPU, a pipelined update to the register is made via the ringbuffer,
and we track the last seqno of the batches that access it. If by the
CPU we wait for the last GPU access and update the register (either
to clear or to set it for the current buffer).

One advantage of being able to pipeline changes is that we can defer the
actual updating of the fence register until we first need to access the
object through the GTT, i.e. we can eliminate the stall on set_tiling.
This is important as the userspace bo cache does not track the tiling
status of active buffers which generate frequent stalls on gen3 when
enabling tiling for an already bound buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
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>
75e9e9158f38e5cb21eff23b30bafa6f32e0a606 04-Nov-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: kill mappable/fenceable disdinction

a00b10c360b35d6431a "Only enforce fence limits inside the GTT" also
added a fenceable/mappable disdinction when binding/pinning buffers.
This only complicates the code with no pratical gain:

- In execbuffer this matters on for g33/pineview, as this is the only
chip that needs fences and has an unmappable gtt area. But fences
are only possible in the mappable part of the gtt, so need_fence
implies need_mappable. And need_mappable is only set independantly
with relocations which implies (for sane userspace) that the buffer
is untiled.

- The overlay code is only really used on i8xx, which doesn't have
unmappable gtt. And it doesn't support tiled buffers, currently.

- For all other buffers it's a bug to pass in a tiled bo.

In short, this disdinction doesn't have any practical gain.

I've also reverted mapping the overlay and context pages as possibly
unmappable. It's not worth being overtly clever here, all the big
gains from unmappable are for execbuf bos.

Also add a comment for a clever optimization that confused me
while reading the original patch by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>
920afa77ced7124c8bb7d0c4839885618a3b4a54 16-Sep-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: range-restricted bind_to_gtt

Like before add a parameter mappable (also to gem_object_pin) and
set it depending upon the context. Only bos that are brought into
the gtt due to an execbuffer call can be put into the unmappable
part of the gtt, everything else (especially pinned objects) need
to be put into the mappable part of the gtt.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
3cce469cab880ef8990d2d16d745bf85443fc998 27-Oct-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Propagate error from failing to queue a request

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
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>
8f28f54aad8bcf52a47afb6447fac34f96597b6f 27-Oct-2010 Dan Carpenter <error27@gmail.com> i915: signedness bug in check_overlay_src()

"depth" should be signed in case packed_depth_bytes() returns -EINVAL.

This probably doesn't make a difference at runtime. In the original
code we would return -EINVAL later if (rec->offset_Y % 4294967274) is
non-zero.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
3e4d3af501cccdc8a8cca41bdbe57d54ad7e7e73 26-Oct-2010 Peter Zijlstra <a.p.zijlstra@chello.nl> mm: stack based kmap_atomic()

Keep the current interface but ignore the KM_type and use a stack based
approach.

The advantage is that we get rid of crappy code like:

#define __KM_PTE \
(in_nmi() ? KM_NMI_PTE : \
in_irq() ? KM_IRQ_PTE : \
KM_PTE0)

and in general can stop worrying about what context we're in and what kmap
slots might be appropriate for that.

The downside is that FRV kmap_atomic() gets more expensive.

For now we use a CPP trick suggested by Andrew:

#define kmap_atomic(page, args...) __kmap_atomic(page)

to avoid having to touch all kmap_atomic() users in a single patch.

[ not compiled on:
- mn10300: the arch doesn't actually build with highmem to begin with ]

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix up drivers/gpu/drm/i915/intel_overlay.c]
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Miller <davem@davemloft.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dave Airlie <airlied@linux.ie>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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>
f7abfe8b281991c66406c42c1a6c6c9ee0daa0ff 13-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Fix an overlay regression from 7e7d76c

When separating out the prepare/commit into its own separate functions
we overlooked that the intel_crtc->dpms_mode was being used elsewhere to
check on the actual status of the pipe.

Track that bit of logic separately from the actual dpms mode, so there
is no confusion should we be able to handle multiple dpms modes, nor
any semantic conflict between prepare/commit and dpms.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
e9e331a8abeece1565d383510ed985945132ffe3 13-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/lvds: Ensure panel is unlocked for Ironlake or the panel fitter

Commit 77d07fd9d73ef28689737c0952dbd5d6a5017743 introduced a regression
where by not waiting for the panel to be turned off, left the panel and
PLL registers locked across the modeset. Thus the panel remaining blank.

As pointed out by Daniel Vetter, when testing LVDS it helps to open the
laptop and look at the actual panel you are purporting to test.

A second issue with the patch was that in order to modify the panel
fitter before gen5, the pipe and the panel must have be completely
powered down. So we wait.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
5eddb70ba2b8cdbbdd563f5cb04e26fdc9b017f7 11-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use macros to switch between equivalent pipe registers

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

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
3bd3c9329973a93fa3ef5e9840f2fd6fa2889e3f 19-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Compile out error state without DEBUG_FS

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

Reported-by: Alexander Lam <lambchop468@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
b303cf9542b016e2af3b9d17255a7f93cd790ef5 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Use a continuation hook to finish work after a flip.

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
23f09ce31ca68af3728ac5eed3e3efb03c5f990a 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Make the overlay control struct opaque.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5dcdbcb06badbdf2faa698bf3198e421a1e12840 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Pass interruptible to switch_off()

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
106dadacbeeea92f61a2c32f3651ee31c1b34e31 16-Jul-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Workaround i830 overlay activation bug.

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

References:

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
5fe82c5ee1ba2d04183c376038c5d233a0311ec9 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Make do_put_image() as static

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8dc5d14741dc1ee0074a14b360993a10c2c02d24 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Preallocate requests

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
5cd68c9864d65e49c910c701716e4e94e09f7ce0 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Tidy release_old_vid()

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8dfbc3403113bcc51f0350c3471fa1abf664305f 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Combine SWITCH_OFF into a single step

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9bb2ff731b32c023e7a502efdc0dee46157290d5 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Explicitly pass regs from map to unmap

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
b6c028e00445de9dfde2cd0c26521ac53965320a 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Refactor do_wait_request()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9f7c3f442bb7c0d0a0ed25cc287932450a1f2bab 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Tidy check_overlay_dst()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
446d2183af68c0fd2772f5ef97a033efe69904a5 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Tidy update_pfit_vscale_ratio()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
7340ea7dcf32227a77ed9df154fc2b2f00ad2fb1 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Remove duplicated definition of OFC_UPDATE

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
62cf4e6fef35b4422e206b63b7f0ac90261d4ad9 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Destroy reg_bo on shutdown.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
a29301288f1840bdf9c5456da9cd7c944436edd5 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Use the recommended page alignment for physical regs

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
60fc332cb5ab19e5a86d696b210df65814b2ad8a 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Tidy attribute checking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8d74f656dd78ae1ba813389cd46197c6329696bc 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Use non-atomic mappings for the common case.

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
31578148b2c62612f9516fdcf5ebb64ab32ed12d 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Move capabilities bits to common info block.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
0ddc1289f3ffd779779ddd3922f26ae7d0a21604 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Ensure that the reg_bo is in the GTT prior to writing.

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=24977
Cc: stable@kernel.org
6ba3ddd9838f5e4d6ac7c6dce95648d205e11bff 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Missing breaks between case statements for color depth

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
722506f04dae7c88193dab2fc836ff15070190f0 12-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/overlay: Whitespace

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
8a1a49f954734040dbc7b87e3b1221a050045e43 11-Feb-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: move flushing list processing to i915_retire_commands

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

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

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

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
e167976ee7f5fe4b80f7e8f55e087f6c67cf9562 25-Aug-2010 Andrew Morton <akpm@linux-foundation.org> drivers/gpu/drm/i915/intel_overlay.c needs seq_file.h

drivers/gpu/drm/i915/intel_overlay.c: In function 'intel_overlay_print_error_state':

drivers/gpu/drm/i915/intel_overlay.c:1467: error: implicit declaration of function 'seq_printf'

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

Reported-by: Martin Ziegler <ziegler@uni-freiburg.de>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>
Cc: Dave Airlie <airlied@linux.ie>
Cc: Andre Muller <andremuellerster@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
6eeefaf3c86b8937db8ad930c48bfb592fc5e32e 07-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Apply i830 errata for cursor alignment

i830 requires 32bpp cursors to be aligned to 16KB, so we have to expose
the alignment parameter to i915_gem_attach_phys_object().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
6ef3d4278034982c13df87c4a51e0445f762d316 04-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Capture the overlay status upon a GPU hang.

v2: Add the interrupt status and address.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
fca3ec01e0b40cab82cac7745e154b01969e6219 04-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm,io-mapping: Specify slot to use for atomic mappings

This is required should we ever attempt to use an io-mapping where
KM_USER0 is verboten, such as inside an IRQ context.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
d79613643b4512962b2be5262a09b6694dd96101 13-Jul-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Typo in (unused) register mask for overlay.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
a1efd14a99483a4fb9308902397ed86b69454c99 12-Jul-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Check overlay stride errata for i830 and i845

Apparently i830 and i845 cannot handle any stride that is not a multiple
of 256, unlike their brethren which do support 64 byte aligned strides.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Eric Anholt <eric@anholt.net>
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>
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>
a8089e849a32c5b6bfd6c88dbd09c0ea4a779b71 09-Apr-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: drop pointer to drm_gem_object

Luckily the change is quite a little bit less invasive than I've
feared.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
ac52bc56de25535a907ef07f8755f1387b89b0f5 09-Apr-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: introduce i915_gem_alloc_object

Just preparation, no functional change.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
23010e43b353c2cdc9725cbedc7e364708039bf7 08-Mar-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: introduce to_intel_bo helper

This is a purely cosmetic change to make changes in this area easier.
And hey, it's not only clearer and typechecked, but actually shorter,
too!

[anholt: To clarify, this is a change to let us later make
drm_i915_gem_object subclass drm_gem_object, instead of having
drm_gem_object have a pointer to i915's private data]

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
915a428e43acfd05e4ffeaf40549b0cf163eebe2 06-Mar-2010 Dan Carpenter <error27@gmail.com> drm/i915: fix small leak on overlay error path

We should free "params" before returning.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Daniel Vetter <daniel@ffwll.ch>
Cc: stable@kernel.org (for .33)
Signed-off-by: Eric Anholt <eric@anholt.net>
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>
4f8a567c4666c73284832240db89fdadb2c50bd5 11-Feb-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: overlay: drop superflous gpu flushes

Cache-coherency is maintained by gem. Drop these leftover MI_FLUSH
commands from the userspace code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
4667a4a52ffc3789c45f46096cdffb053591a8e1 11-Feb-2010 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: overlay: nuke readback to flush wc caches

I retested this and whatever this papered over, the problem doesn't seem
to exist anymore.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
[anholt: fixed up compile warning]
Signed-off-by: Eric Anholt <eric@anholt.net>
bc9025bdc4e2b591734cca17697093845007b63d 09-Feb-2010 Luca Barbieri <luca@luca-barbieri.com> Use drm_gem_object_[handle_]unreference_unlocked where possible

Mostly obvious simplifications.

The i915 pread/pwrite ioctls, intel_overlay_put_image and
nouveau_gem_new were incorrectly using the locked versions
without locking: this is also fixed in this patch.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
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>
9bedb9743fd906e4160468663ee6e1bbdc4412b8 30-Nov-2009 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: fixup interrupted overlay switch off calls

When switching to interruptible sleeps in the overlay code, I've
forgotten to recover from interruptions at one site. This
resulted in the overlay still running when it should have been
switched off. This in turn caused a hang on resume because it
tried to disable the (not-running) overlay in preparation for the
resume modeset.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=24980
Tested-by: maximlevitsky@gmail.com

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
12ca45fea91cfbb09df828bea958b47348caee6d 25-Apr-2037 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: overlay: extract some duplicated code

I've suspected some bug there wrt to suspend, but that was not
the case. Clean up the code anyway.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
5c5a4359fe392b52b444134877fc4002be542b42 04-Oct-2009 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: overlay: kill one more unnecessary uninterruptible sleep

I've simply overlooked one case in the conversion to interruptible
sleeps. Rectify this.

Also delete a leftover debug printk.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
03f77ea5972e6a2363152aec692744cac824daba 15-Sep-2009 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: implement interruptible sleeps in the overlay code

At least for the common case of userspace ioctls. When doing a
modeset operation, the wait is still uninterruptible. But considering
that failing to turn off the overlay when switching off the crtc it's
running on hangs the chip, it doesn't complicate matters _very_
much. There's just an unkillable X in addition to a black screen.
BUG() about it and explain in the code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
5a5a0c64a99d7542c48c99d1a8bbb49e665842be 15-Sep-2009 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: implement fastpath for overlay flip waiting

As long as the gpu can keep up, neither the cpu (waiting for gpu)
nore the gpu (waiting for vblank to do an overlay flip) stalls.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
240a2d12dfff98f8fa1332dc8424284d96f0801e 15-Sep-2009 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: fully switch off overlay when not in use

Now that the cache flushing of the memory based overlay regs works,
we can safely switch off the overlay. Beforehand it was only disabled
(like in userspace).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
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>