]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
13 years agodrm/i915: Don't disable panel for modesetting if pfit hasn't changed
Matthew Garrett [Tue, 18 May 2010 17:53:16 +0000 (13:53 -0400)]
drm/i915: Don't disable panel for modesetting if pfit hasn't changed

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

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

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

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

Make them match the others and add BPP definitions.

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

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

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

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

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

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

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

References:

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

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

and many others.

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

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

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

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

References:

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

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

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

Fixes:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

References:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ickle: Keep i915_gem_object_set_to_display_plane() uninterruptible.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: add MMIO debug output
Jesse Barnes [Fri, 13 Aug 2010 22:50:28 +0000 (15:50 -0700)]
drm/i915: add MMIO debug output

Useful for capturing register read/write traces to send to the hw guys.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915/sdvo: Preserve pixel-multiplier
Chris Wilson [Wed, 25 Aug 2010 09:05:17 +0000 (10:05 +0100)]
drm/i915/sdvo: Preserve pixel-multiplier

Store the pixel-multiplier on the adjusted mode and avoid modifying the
requested mode.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Sanity check user framebuffer parameters on creation
Chris Wilson [Sun, 8 Aug 2010 11:34:44 +0000 (12:34 +0100)]
drm/i915: Sanity check user framebuffer parameters on creation

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915/tv: Mark the format names as constant and so avoid the memleak
Chris Wilson [Sat, 4 Sep 2010 23:52:34 +0000 (00:52 +0100)]
drm/i915/tv: Mark the format names as constant and so avoid the memleak

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915/tv: Poll for DAC state change
Chris Wilson [Sat, 4 Sep 2010 23:44:20 +0000 (00:44 +0100)]
drm/i915/tv: Poll for DAC state change

Instead of sleeping for an arbitrary length of time (the documentation
fails to specify how long to wait for) wait until the load detection has
changed state (or at most the 20ms as before).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915/tv: Preserve reserved DAC bits during mode-setting
Chris Wilson [Sat, 4 Sep 2010 23:43:42 +0000 (00:43 +0100)]
drm/i915/tv: Preserve reserved DAC bits during mode-setting

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Revert extra intel_wait_for_vblank to prevent stalls.
Sitsofe Wheeler [Tue, 24 Aug 2010 15:56:16 +0000 (16:56 +0100)]
drm/i915: Revert extra intel_wait_for_vblank to prevent stalls.

With the extra intel_wait_for_vblank added in commit
9d0498a2bf7455159b317f19531a3e5db2ecc9c4 periodic stalls were being
triggered (which were detected by i915_hangcheck_elapsed). Partially
revert this change for now.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Ironlake page-flipping is per-plane not per-pipe
Chris Wilson [Thu, 2 Sep 2010 16:59:39 +0000 (17:59 +0100)]
drm/i915: Ironlake page-flipping is per-plane not per-pipe

Fix a minor confusion between intel_page_flip_finish(pipe) and
intel_page_flip_finish_plane(plane) -- should have no effect as
currently we map pipe 0 to plane 0 (and pipe 1 to plane 1).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Addin-offset is an unreliable indicator of LVDS presence (v2)
Chris Wilson [Sun, 22 Aug 2010 17:21:42 +0000 (18:21 +0100)]
drm/i915: Addin-offset is an unreliable indicator of LVDS presence (v2)

My Samsung N210 has a VBT with DEVICE_TYPE_INT_LFP with a zero
addin-offset. With the check in place, the panel was declared absent.

v2: Only trust BIOS writers that have graduated to writing OpRegions.
(We are all doomed.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Zhao Yakui <yakui.zhao@intel.com>
Cc: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
13 years agodrm/i915: Use the VBT from OpRegion when available (v3)
Chris Wilson [Thu, 19 Aug 2010 15:09:23 +0000 (16:09 +0100)]
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>
13 years agodrm/i915: Rename i915_opregion.c to intel_opregion.c
Chris Wilson [Tue, 24 Aug 2010 08:02:58 +0000 (09:02 +0100)]
drm/i915: Rename i915_opregion.c to intel_opregion.c

It's part of the generic Intel driver infrastructure so rename it in
prepreparation for using it for VBT.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915/crt: Flush register prior to waiting for vblank.
Chris Wilson [Mon, 9 Aug 2010 13:50:53 +0000 (14:50 +0100)]
drm/i915/crt: Flush register prior to waiting for vblank.

If we don't flush the write then we can not be sure that the border
colour will have taken effect by the time we try to read it back.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Avoid using msleep under kdb and wait_for()
Chris Wilson [Sat, 7 Aug 2010 11:16:25 +0000 (12:16 +0100)]
drm/i915: Avoid using msleep under kdb and wait_for()

wait_for() uses msleep() to yield the cpu whilst spinning waiting for a
register to change. kdb asserts that mode changes are atomic and so
prohibits msleep. The alternative would be to use mdelay or to simply
probe the register more often instead of busy waiting.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Drop the msleep parameter to wait_for()
Chris Wilson [Mon, 23 Aug 2010 16:43:35 +0000 (17:43 +0100)]
drm/i915: Drop the msleep parameter to wait_for()

Jesse's feedback from using the wait_for() macro was that the msleep
argument was that it was superfluous and made the macro more difficult
to use and to read. As the actually amount of time to sleep is not
critical, the crucial part is to sleep and let the processor schedule
something else whilst we wait for the event, replace the argument with a
hardcoded value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agodrm/i915: unload: fix retire_work races
Daniel Vetter [Fri, 20 Aug 2010 22:25:16 +0000 (00:25 +0200)]
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>
13 years agodrm/i915: unload: ensure that gem is idle
Daniel Vetter [Fri, 20 Aug 2010 19:23:20 +0000 (21:23 +0200)]
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>
13 years agodrm/i915: unload: fix unpin_work related races
Daniel Vetter [Fri, 20 Aug 2010 20:26:30 +0000 (22:26 +0200)]
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>
13 years agodrm/i915: unload: fix idle_timer/idle_work races
Daniel Vetter [Fri, 20 Aug 2010 19:40:52 +0000 (21:40 +0200)]
drm/i915: unload: fix idle_timer/idle_work races

idle_work wasn't cleaned up at all. It takes &dev->struct_mutex, but
accesss the mode_config crtc list (without any other locking!). Hence
this work needs to be canceled before calling drm_mode_config_cleanup.

As evidenced by the kernel's object debuggin code, the current code
also cleans up the timer to early (it gets rearmed). So move it right
before the final cleanup (it seems to work).

Also unconditionally set up the idle_timer in intel_increase_pllclock.
If we're unlucky the timer might fire right away, rendering the call
in the modesetting teardown pointless.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: unload: don't leak error state
Daniel Vetter [Fri, 20 Aug 2010 19:25:11 +0000 (21:25 +0200)]
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>
13 years agodrm/i915: unload: fix hotplug_work races
Daniel Vetter [Fri, 20 Aug 2010 16:26:46 +0000 (18:26 +0200)]
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>
13 years agodrm/i915: unload: fix error_work races
Daniel Vetter [Fri, 20 Aug 2010 16:18:48 +0000 (18:18 +0200)]
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>
13 years agodrm/i915: unload: fix intel dp encoder cleanup
Daniel Vetter [Fri, 20 Aug 2010 16:08:28 +0000 (18:08 +0200)]
drm/i915: unload: fix intel dp encoder cleanup

struct intel_dp contains both struct intel_encoder at the beginning (as
it's base-class) and an i2c adapater. When initializing, the i2c adapter
gets assigned

intel_encoder->ddc_adaptor = &intel_dp->adapter

and the generic intel_encode_destroy happily calls kfree on this pointer.
Ouch. Fix this by using a dp specific cleanup function.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoMerge remote branch 'airlied/drm-core-next' into HEAD
Chris Wilson [Wed, 8 Sep 2010 09:13:14 +0000 (10:13 +0100)]
Merge remote branch 'airlied/drm-core-next' into HEAD

13 years agoRevert "drm/i915: Warn if we run out of FIFO space for a mode"
Chris Wilson [Wed, 8 Sep 2010 08:14:08 +0000 (09:14 +0100)]
Revert "drm/i915: Warn if we run out of FIFO space for a mode"

This reverts commit b9421ae8f30958deea98d71477b4a77a066856b4.

This warning was so prelevant, even for apparently working machines,
that it was just causing fear, anxiety and panic.

The root cause still remains, so we will add some better debugging when
we focus on fixing it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=17021
Reported-by: Maciej Rutecki <maciej.rutecki@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoRevert "drm/i915: Allow LVDS on pipe A on gen4+"
Chris Wilson [Tue, 7 Sep 2010 22:39:28 +0000 (23:39 +0100)]
Revert "drm/i915: Allow LVDS on pipe A on gen4+"

This reverts commit 0f3ee801b332d6ff22285386675fe5aaedf035c3.

Enabling LVDS on pipe A was causing excessive wakeups on otherwise idle
systems due to i915 interrupts. So restrict the LVDS to pipe B once more,
whilst the issue is properly diagnosed.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16307
Reported-and-tested-by: Enrico Bandiello <enban@postal.uv.es>
Poked-by: Florian Mickler <florian@mickler.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Adam Jackson <ajax@redhat.com>
Cc: stable@kernel.org
13 years agoRevert "drm/i915: Enable RC6 on Ironlake."
Chris Wilson [Tue, 7 Sep 2010 20:51:02 +0000 (21:51 +0100)]
Revert "drm/i915: Enable RC6 on Ironlake."

This reverts commit ce17178094f368d9e3f39b2cb4303da5ed633dd4.

This commit has been independently bisected a few times as being the cause
of a s2ram failure.

Reported-and-tested-by: Kyle McMartin <kyle@mcmartin.ca>
Reported-and-tested-by: Andy Isaacson <adi@hexapodia.org>
Cc: Zou Nan hai <nanhai.zou@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agointel_agp,i915: Add more sandybridge graphics device ids
Zhenyu Wang [Tue, 7 Sep 2010 05:45:32 +0000 (13:45 +0800)]
intel_agp,i915: Add more sandybridge graphics device ids

New pci ids for GT2 and GT2+ on desktop and mobile sandybridge,
and graphics device ids for server sandybridge. Also rename original
ids string to reflect GT1 version.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Enable MI_FLUSH on Sandybridge
Zhenyu Wang [Mon, 30 Aug 2010 08:12:42 +0000 (16:12 +0800)]
drm/i915: Enable MI_FLUSH on Sandybridge

MI_FLUSH is being deprecated, but still available on Sandybridge.
Make sure it's enabled as userspace still uses MI_FLUSH.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoagp/intel: Fix cache control for Sandybridge
Zhenyu Wang [Fri, 27 Aug 2010 03:08:57 +0000 (11:08 +0800)]
agp/intel: Fix cache control for Sandybridge

Sandybridge GTT has new cache control bits in PTE, which controls
graphics page cache in LLC or LLC/MLC, so we need to extend the mask
function to respect the new bits.

And set cache control to always LLC only by default on Gen6.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoagp/intel: use #ifdef idiom for intel-agp.h
Zhenyu Wang [Fri, 27 Aug 2010 03:06:48 +0000 (11:06 +0800)]
agp/intel: use #ifdef idiom for intel-agp.h

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoagp/intel: fix physical address mask bits for sandybridge
Zhenyu Wang [Mon, 23 Aug 2010 06:37:52 +0000 (14:37 +0800)]
agp/intel: fix physical address mask bits for sandybridge

It should shift bit 39-32 into pte's bit 11-4.

Reported-by:Takashi Iwai <tiwai@suse.de>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@kernel.org
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Prevent double dpms on
Chris Wilson [Mon, 6 Sep 2010 15:17:22 +0000 (16:17 +0100)]
drm/i915: Prevent double dpms on

Arguably this is a bug in drm-core in that we should not be called twice
in succession with DPMS_ON, however this is still occuring and we see
FDI link training failures on the second call leading to the occassional
blank display. For the time being ignore the repeated call.

Original patch by Dave Airlie <airlied@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
13 years agodrm/i915: Avoid use of uninitialised values when disabling panel-fitter
Chris Wilson [Sun, 5 Sep 2010 09:01:13 +0000 (10:01 +0100)]
drm/i915: Avoid use of uninitialised values when disabling panel-fitter

We were passing garbage values into the panel-fitter control register
when disabling it on Ironlake - those values (filter modes and reserved
MBZ bits) would have then be re-used the next time panel-fitting was
enabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Avoid pageflipping freeze when we miss the flip prepare interrupt
Simon Farnsworth [Wed, 1 Sep 2010 16:47:52 +0000 (17:47 +0100)]
drm/i915: Avoid pageflipping freeze when we miss the flip prepare interrupt

When we miss the flip prepare interrupt, we never get into the
software state needed to restart userspace, resulting in a freeze of a
full-screen OpenGL application (such as a compositor).

Work around this by checking DSPxSURF/DSPxBASE to see if the page flip
has actually happened. If it has, do the work we would have done when
the flip prepare interrupt comes in.

Also, add debugfs information to tell us what's going on (based on the
patch from Chris Wilson attached to bugs.fdo bug #29798).

Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Tightly scope intel_encoder to prevent invalid use
Chris Wilson [Sun, 22 Aug 2010 09:54:23 +0000 (10:54 +0100)]
drm/i915: Tightly scope intel_encoder to prevent invalid use

We reset intel_encoder for every matching encoder whilst iterating over
the encoders attached to this crtc when changing mode. As such in a
cloned configuration intel_encoder may not correspond to the correct
is_edp encoder.

By scoping intel_encoder to the loop, not only is the compiler able to
spot this mistake, we also improve readiability for ourselves.
[It might not be a mistake, within this function it is unclear as to
whether it is permissable for eDP to be cloned...]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agodrm/i915: Allocate the PCI resource for the MCHBAR
Chris Wilson [Fri, 20 Aug 2010 13:36:45 +0000 (14:36 +0100)]
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>
13 years agodrm/i915/dp: Really try 5 times before giving up.
Chris Wilson [Wed, 18 Aug 2010 17:12:56 +0000 (18:12 +0100)]
drm/i915/dp: Really try 5 times before giving up.

Only stop trying if the aux channel sucessfully reports that the
transmission was completed, otherwise try again. On the 5th failure,
bail and report that something is amiss.

This fixes a sporadic failure in reading the EDID for my external panel
over DP.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
13 years agodrm/i915/sdvo: Restore guess of the DDC bus in absence of VBIOS
Chris Wilson [Thu, 12 Aug 2010 14:26:41 +0000 (15:26 +0100)]
drm/i915/sdvo: Restore guess of the DDC bus in absence of VBIOS

If the VBIOS tells us the mapping of the SDVO device onto the DDC bus,
use it. However, if there is no VBIOS available that mapping is
uninitialised and we should fallback to our earlier guess.

Fix regression introduced in b1083333 (which in turn is a fix for the
regression caused by the introduction of this guess, 14571b4).

References:

  Bug 29499 - [945GM] Screen disconnected because of missing VBIOS
  https://bugs.freedesktop.org/show_bug.cgi?id=29499

  Bug 15109 - i945GM fails to detect EDID on DVI port
  https://bugzilla.kernel.org/show_bug.cgi?id=15109

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-and-tested-by: Paul Neumann <paul104x@yahoo.de>
Cc: Adam Jackson <ajax@redhat.com>
Cc: Zhenyu Wang <zhenyuw@linux.intel.com>
Cc: stable@kernel.org
13 years agodrm/i915/dp: Boost timeout for enabling transcoder to 100ms
Chris Wilson [Mon, 9 Aug 2010 16:21:44 +0000 (17:21 +0100)]
drm/i915/dp: Boost timeout for enabling transcoder to 100ms

Adam Hill reported that his Arrandale system required a much longer, up
to 200x500us, wait for the panel to initialise or else modesetting would
fail.

References:

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-and-tested-by: Adam Hill <sidepipeuk@yahoo.co.uk>
13 years agodrm/i915: Re-use set_base_atomic to share setting of the display registers
Chris Wilson [Sun, 8 Aug 2010 12:20:19 +0000 (13:20 +0100)]
drm/i915: Re-use set_base_atomic to share setting of the display registers

Lets try to avoid repeating old bugs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agodrm/i915: Fix offset page-flips on i965+
Chris Wilson [Sun, 8 Aug 2010 09:15:59 +0000 (10:15 +0100)]
drm/i915: Fix offset page-flips on i965+

i965 uses the Display Registers to compute the offset from the display
base so the new base does not need adjusting when flipping. The older
chipsets use a fence to access the display and so do perceive the
surface as linear and have a single base register which is reprogrammed
using the flip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Reported-by: Marty Jack <martyj19@comcast.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agodrm/i915: Include a generation number in the device info
Chris Wilson [Wed, 11 Aug 2010 08:59:24 +0000 (09:59 +0100)]
drm/i915: Include a generation number in the device info

To simplify the IS_GEN[234] macros and to enable switching.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoi915: return -EFAULT if copy_to_user fails
Dan Carpenter [Wed, 23 Jun 2010 17:03:01 +0000 (19:03 +0200)]
i915: return -EFAULT if copy_to_user fails

copy_to_user() returns the number of bytes remaining to be copied and
I'm pretty sure we want to return a negative error code here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
13 years agoi915: return -EFAULT if copy_to_user fails
Dan Carpenter [Sat, 19 Jun 2010 13:12:51 +0000 (15:12 +0200)]
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
13 years agoagp/intel: Promote warning about failure to setup flush to error.
Chris Wilson [Sat, 4 Sep 2010 13:57:27 +0000 (14:57 +0100)]
agp/intel: Promote warning about failure to setup flush to error.

Make sure we always detect when we fail to correctly allocate the Isoch
Flush Page and print an error to warn the user about the likely memory
corruption that will result in invalid rendering or worse.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
13 years agodrm/i915: overlay on gen2 can't address above 1G
Daniel Vetter [Mon, 30 Aug 2010 19:25:23 +0000 (21:25 +0200)]
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>
13 years agodrm/i915: Clear the vblank status bit before polling for the next vblank
Chris Wilson [Sun, 5 Sep 2010 19:25:43 +0000 (20:25 +0100)]
drm/i915: Clear the vblank status bit before polling for the next vblank

The vblank status bit is a sticky bit that must be cleared with a write
of '1' prior to polling for the next vblank.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
jbarnes: I'd still rather see a lock, but I think you're right that
we don't generally wait in code that needs not to miss an interrupt.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
13 years agoi915: Fix spurious TV detection after 9d0498a2bf + 9559fcdbff
Pekka Enberg [Sat, 4 Sep 2010 16:24:04 +0000 (19:24 +0300)]
i915: Fix spurious TV detection after 9d0498a2bf + 9559fcdbff

Partial revert of 9d0498a2bf.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Tested-by: Hugh Dickins <hughd@google.com>
Tested-by: Sven Joachim <svenjoac@gmx.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoi915: revert some checks added by commit 32aad86f
Pavel Roskin [Thu, 2 Sep 2010 18:46:34 +0000 (14:46 -0400)]
i915: revert some checks added by commit 32aad86f

This fixes blur-like screen corruption on the following card:

VGA compatible controller [0300]: Intel Corporation 82G33/G31 Express
Integrated Graphics Controller [8086:29c2] (rev 10)

intel_sdvo_mode_set() should not return prematurely just because some
features are not supported.

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

Signed-off-by: Pavel Roskin <proski@gnu.org>
Reported-by: Jonathan Corbet <corbet@lwn.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[ickle: Relax a couple more checks for failing LVDS modesetting]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
13 years agoRevert "drm/i915: Unreference object not handle on creation"
Chris Wilson [Mon, 6 Sep 2010 13:44:14 +0000 (14:44 +0100)]
Revert "drm/i915: Unreference object not handle on creation"

This reverts commit 86f100b136626e91f4f66f3776303475e2e58998.

The kref API requires the handlecount to be initialised to one on object
creation (so that kref_get() doesn't complain upon first use) so the
dalliance in the drivers is required in order to sink the initial
floating reference.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
13 years agodrivers/gpu/drm/i915/intel_overlay.c needs seq_file.h
Andrew Morton [Tue, 24 Aug 2010 23:35:52 +0000 (16:35 -0700)]
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>
13 years agodrm: kill get_reg_ofs callback
Daniel Vetter [Mon, 23 Aug 2010 20:53:28 +0000 (22:53 +0200)]
drm: kill get_reg_ofs callback

Every driver used the default implementation. Fold that one into
the only callsite and drop the callback.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agodrm: kill dev->timer
Daniel Vetter [Mon, 23 Aug 2010 20:53:32 +0000 (22:53 +0200)]
drm: kill dev->timer

Totally unused.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agodrm: kill agp indirection mess
Daniel Vetter [Mon, 23 Aug 2010 20:53:36 +0000 (22:53 +0200)]
drm: kill agp indirection mess

There's no point in jumping through two indirections. So kill one
and call the kernels agp functions directly.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agodrm: replace drawable ioctl by noops
Daniel Vetter [Mon, 23 Aug 2010 20:53:31 +0000 (22:53 +0200)]
drm: replace drawable ioctl by noops

The information supplied by userspace through these ioctls is only
accessible by dev->drw_idr. But there's no in-tree user of that.
Also userspace does not really care about return values of these ioctls,
either. Only hw/xfree86/dri/dri.c from the xserver actually checks the
return from adddraw and keeps on trying to create a kernel drawable
every time somebody creates a dri drawable. But since that's now a noop,
who cares.

Therefore it's safe to replace these three ioctls with noops and rip
out the implementation.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
13 years agodrm: don't export dri1 locking functions
Daniel Vetter [Mon, 23 Aug 2010 20:53:34 +0000 (22:53 +0200)]
drm: don't export dri1 locking functions

Only used by ioctl, not by any in-tree drivers.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>