platform/upstream/xf86-video-intel.git
11 years agosna: Add a DBG breadcrumb to kgem_bo_convert_to_gpu()
Chris Wilson [Wed, 6 Nov 2013 15:04:24 +0000 (15:04 +0000)]
sna: Add a DBG breadcrumb to kgem_bo_convert_to_gpu()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Use tiling BLT fallback for BLT composite operations
Chris Wilson [Wed, 6 Nov 2013 14:51:42 +0000 (14:51 +0000)]
sna: Use tiling BLT fallback for BLT composite operations

This avoid a circuituous route through the render pathways and multiple
levels of tiling fallbacks to accomplish the same copy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Trim create flags if tiled sizes are too large
Chris Wilson [Wed, 6 Nov 2013 13:42:27 +0000 (13:42 +0000)]
sna: Trim create flags if tiled sizes are too large

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fences are power-of-two sizes
Chris Wilson [Wed, 6 Nov 2013 13:41:39 +0000 (13:41 +0000)]
sna: Fences are power-of-two sizes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fixup unwind checks for future BLT commands
Chris Wilson [Wed, 6 Nov 2013 11:38:53 +0000 (11:38 +0000)]
sna: Fixup unwind checks for future BLT commands

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Clear the execlist if we completely unwind a batch after using 8x8 tiling
Chris Wilson [Wed, 6 Nov 2013 09:05:05 +0000 (09:05 +0000)]
sna: Clear the execlist if we completely unwind a batch after using 8x8 tiling

Another location, but the right function this time!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Move initialisation of loop counter to common code
Chris Wilson [Wed, 6 Nov 2013 09:40:56 +0000 (09:40 +0000)]
sna: Move initialisation of loop counter to common code

It was only being defined in x86-64 and left unitialized for x86-32.

Fixes regression from
commit 587c4866652e40e1e228b333028114766a6d3b08
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Nov 4 15:10:40 2013 +0000

    sna: Promote uint16_t to a full int to avoid overflow in computing w*h in memcpy_xor

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71286
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Clear the execlist if we completely unwind a batch after using 8x8 tiling
Chris Wilson [Wed, 6 Nov 2013 09:05:05 +0000 (09:05 +0000)]
sna: Clear the execlist if we completely unwind a batch after using 8x8 tiling

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Be more pessimistic for tiling sizes on older gen
Chris Wilson [Wed, 6 Nov 2013 08:56:01 +0000 (08:56 +0000)]
sna: Be more pessimistic for tiling sizes on older gen

On the older generation, we have severe alignment penalties for fenced
regions which dramatically reduce the amount of space we can effectively
use in a batch. To accommodate this, reduce the tiling step size.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only operate inplace if no existing CPU damage for a read
Chris Wilson [Tue, 5 Nov 2013 22:41:06 +0000 (22:41 +0000)]
sna: Only operate inplace if no existing CPU damage for a read

With a large object, we try harder to operate inplace (to avoid creating
a second large CPU bo). This introduced an issue where we tried to read
from the GPU bo when there was already existing damage in the CPU -
triggering an assertion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Trim the overestimate of required aperture space for fence alignment
Chris Wilson [Tue, 5 Nov 2013 21:59:37 +0000 (21:59 +0000)]
sna: Trim the overestimate of required aperture space for fence alignment

We can optimistically only require that we waste the largest fence
region in a batch, as all other fences will then be naturally aligned as
well. So long as the kernel succeeds in defragmenting the aperture...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Mark partial move_area_to_gpu with MOVE_READ on promotion to move_to_gpu
Chris Wilson [Tue, 5 Nov 2013 21:33:18 +0000 (21:33 +0000)]
sna: Mark partial move_area_to_gpu with MOVE_READ on promotion to move_to_gpu

When promoting a partial move_area_to_gpu to a full move_to_gpu, we have
to disable certain optimisations that we try to use if MOVE_READ==0.

Reported-and-tested-by: Matti Hamalainen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71198
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Submit execution on the bo before changing its caching status
Chris Wilson [Tue, 5 Nov 2013 18:36:45 +0000 (18:36 +0000)]
sna: Submit execution on the bo before changing its caching status

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Clear snoop flag after converting from a CPU bo
Chris Wilson [Tue, 5 Nov 2013 18:29:46 +0000 (18:29 +0000)]
sna: Clear snoop flag after converting from a CPU bo

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Use an inplace exchange for large untiled BO
Chris Wilson [Tue, 5 Nov 2013 08:49:28 +0000 (08:49 +0000)]
sna: Use an inplace exchange for large untiled BO

On older architectures, large BO have to be untiled and so we can reuse
an existing CPU bo by adjusting its caching mode.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70924
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Be move conservative with tiling sizes for older fenced gen
Chris Wilson [Tue, 5 Nov 2013 08:38:22 +0000 (08:38 +0000)]
sna: Be move conservative with tiling sizes for older fenced gen

The older generations have stricter requirements for alignment of fenced
GPU surfaces, so accommodate this by reducing our estimate available
space for the temporary tile.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agotest
Chris Wilson [Mon, 4 Nov 2013 22:14:05 +0000 (22:14 +0000)]
test

11 years agosna: Check for loss of state after setting up a fill BLT op
Chris Wilson [Mon, 4 Nov 2013 16:45:00 +0000 (16:45 +0000)]
sna: Check for loss of state after setting up a fill BLT op

If we install a BLT fill operation early in the drawing sequence (i.e.
before calling a mi routine), we may lose our state to delayed
initialisation of sources and so need to subsequently recheck.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: s/active/busy/ to silence compiler warning
Chris Wilson [Mon, 4 Nov 2013 15:17:51 +0000 (15:17 +0000)]
sna: s/active/busy/ to silence compiler warning

kgem.c: In function 'kgem_check_bo':
kgem.c:4768:7: warning: declaration of 'active' shadows a global declaration [-Wshadow]
kgem.c:692:21: warning: shadowed declaration is here [-Wshadow]
kgem.c: In function 'kgem_check_many_bo_fenced':
kgem.c:4907:7: warning: declaration of 'active' shadows a global declaration [-Wshadow]
kgem.c:692:21: warning: shadowed declaration is here [-Wshadow]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Promote uint16_t to a full int to avoid overflow in computing w*h in memcpy_xor
Chris Wilson [Mon, 4 Nov 2013 15:10:40 +0000 (15:10 +0000)]
sna: Promote uint16_t to a full int to avoid overflow in computing w*h in memcpy_xor

Reported-by: Conley Moorhous <conleymoorhous@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70527
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Apply the BLT source offset for individual copies
Chris Wilson [Mon, 4 Nov 2013 12:57:01 +0000 (12:57 +0000)]
sna: Apply the BLT source offset for individual copies

Following a complex path through multiple layers of indirections and
tiling fallbacks, resulted in hitting a path where the source offset was
subsequently ignored. This leads to the operation reading from invalid
memory (or hitting the assert warning about the same).

References: https://bugs.freedesktop.org/show_bug.cgi?id=70924
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only use the simple stipple upload path if wholly contained
Chris Wilson [Mon, 4 Nov 2013 11:48:04 +0000 (11:48 +0000)]
sna: Only use the simple stipple upload path if wholly contained

If the stipple box is outside of the stipple pixmap, we need to
carefully upload the stipple using the modulus operation.

Buzilla: https://bugs.launchpad.net/bugs/1247785
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Update DBG formats for larger BO offset integers
Chris Wilson [Mon, 4 Nov 2013 11:47:29 +0000 (11:47 +0000)]
sna: Update DBG formats for larger BO offset integers

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Remove the replace indirection prior to performing write_boxes
Chris Wilson [Mon, 4 Nov 2013 11:30:39 +0000 (11:30 +0000)]
sna: Remove the replace indirection prior to performing write_boxes

As write_boxes itself decides whether or not to stage the upload into
the destination bo, we can destroy the temporary allocation along the
write_boxes fallback path (i.e. after failing to map the destination
bo).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only destroy the old GPU after successfully replacing it
Chris Wilson [Mon, 4 Nov 2013 11:12:30 +0000 (11:12 +0000)]
sna: Only destroy the old GPU after successfully replacing it

Along the sna_replace__xor path we destroyed the priv->gpu_bo twice upon
successfully replacing it.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70527
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Rename the two variants of pwrite so very relative dangers are obvious
Chris Wilson [Mon, 4 Nov 2013 09:34:25 +0000 (09:34 +0000)]
sna: Rename the two variants of pwrite so very relative dangers are obvious

Since we extend the write in the cache-aligned routine, it runs the risk
of reading from beyond the end of the allocation. As such, callers
should be carefully vetted to make sure that their allocations are
already cache-aligned (typically page-aligned). To make it obvious that
this complexity exists, rename the routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Use the unoptimized pwrite for general buffers
Chris Wilson [Mon, 4 Nov 2013 09:31:05 +0000 (09:31 +0000)]
sna: Use the unoptimized pwrite for general buffers

When we call kgem_bo_write() we have less control over the allocation of
the buffer, and do not ensure it meets the alignment criteria required
for the cacheline optimisation. So use the simple pwrite routine to
avoid reading beyond the end of the allocation.

Reported-and-tested-by: Mark Kettenis <mark.kettenis@xs4all.nl>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Use fast-path target placement if we are also IGNORE_CPU
Chris Wilson [Sun, 3 Nov 2013 22:07:22 +0000 (22:07 +0000)]
sna: Use fast-path target placement if we are also IGNORE_CPU

If we are ignoring CPU damage, we also need only to check GPU damage
when considering placement of the target bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Wrap staging buffer access with sigtrap handler
Chris Wilson [Sun, 3 Nov 2013 19:51:56 +0000 (19:51 +0000)]
sna: Wrap staging buffer access with sigtrap handler

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Discard bo->exec when unwinding a glyph no-op
Chris Wilson [Sat, 2 Nov 2013 21:45:00 +0000 (21:45 +0000)]
sna: Discard bo->exec when unwinding a glyph no-op

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Eliminate the redundancy between is_mappable/can_map
Chris Wilson [Sat, 2 Nov 2013 21:13:45 +0000 (21:13 +0000)]
sna: Eliminate the redundancy between is_mappable/can_map

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Jump to the right escape target when bypassing a self-copy
Chris Wilson [Sat, 2 Nov 2013 21:01:26 +0000 (21:01 +0000)]
sna: Jump to the right escape target when bypassing a self-copy

Another fix for

commit e3f15cbf39696edae9f716bdcfbb7032ec7d7e3f [2.99.905]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Oct 22 15:19:15 2013 +0100

    sna: Move gc back to GPU after failure to move it to CPU

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Add some more asserts around inactive VMA lists
Chris Wilson [Sat, 2 Nov 2013 15:12:51 +0000 (15:12 +0000)]
sna: Add some more asserts around inactive VMA lists

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tweak estimate of maximum usable aperture for strict fencing
Chris Wilson [Sat, 2 Nov 2013 14:43:49 +0000 (14:43 +0000)]
sna: Tweak estimate of maximum usable aperture for strict fencing

Old generations have very strict alignment requirements even for
unfenced tiled accesses which restricts the amount of aperture space
available for use, and in the process estimate for the effect of
framebuffer fragmentation on the mappable aperture.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoPrepare for changes in the BLT unit on future generations
Chris Wilson [Fri, 30 Nov 2012 16:28:02 +0000 (16:28 +0000)]
Prepare for changes in the BLT unit on future generations

Adapt the legacy BLT commands in preparation for future changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fallback when wedged and trying to use the BLT copy routines
Chris Wilson [Sat, 2 Nov 2013 13:11:31 +0000 (13:11 +0000)]
sna: Fallback when wedged and trying to use the BLT copy routines

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Guard the replace-with-xor fallback path
Chris Wilson [Fri, 1 Nov 2013 15:57:56 +0000 (15:57 +0000)]
sna: Guard the replace-with-xor fallback path

Before attempting to map the destination for uploading into after a
failure to use the BLT, we need to recheck that it is indeed mappable.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70924
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Process all clip boxes when rastering segments
Chris Wilson [Fri, 1 Nov 2013 14:30:14 +0000 (14:30 +0000)]
sna: Process all clip boxes when rastering segments

The macro still had buried returns which were no longer valid after the
translation to handle clipping. They needed to be breaks from the inner
most loops to the outer clip box instead.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70802
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen7: Undo overzealous flushing
Chris Wilson [Fri, 1 Nov 2013 12:49:36 +0000 (12:49 +0000)]
sna/gen7: Undo overzealous flushing

commit d580a30aaf97687f9669ea72fbc3310c2fea26f1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Oct 31 15:58:47 2013 +0000

    sna/gen7: Flush render cache when changing CC state

ultimately doesn't prevent the issue and in the process adversely
affects perforamnce.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Scale uses of aperture_mappable by PAGE_SIZE
Chris Wilson [Fri, 1 Nov 2013 10:48:06 +0000 (10:48 +0000)]
sna: Scale uses of aperture_mappable by PAGE_SIZE

After converting aperture_mappable to count in pages, there were a few
residual users expecting a byte count.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71117
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen7: Flush render cache when changing CC state
Chris Wilson [Thu, 31 Oct 2013 15:58:47 +0000 (15:58 +0000)]
sna/gen7: Flush render cache when changing CC state

References: https://bugs.freedesktop.org/show_bug.cgi?id=68410
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen6: Tweak flush around CC state changes
Chris Wilson [Thu, 31 Oct 2013 13:35:59 +0000 (13:35 +0000)]
sna/gen6: Tweak flush around CC state changes

In order to fix some font corruption, it appears that we need an extra
flush in the Sandybridge pipeline when we change the CC stage and the
render cache is dirty. We previously triggered a full pipeline stall
for this case.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tweak deletion of used buffers
Chris Wilson [Thu, 31 Oct 2013 10:32:46 +0000 (10:32 +0000)]
sna: Tweak deletion of used buffers

Make sure we never unwind a used buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Allow limited recursion within sigtrapped routines
Chris Wilson [Wed, 30 Oct 2013 18:48:10 +0000 (18:48 +0000)]
sna: Allow limited recursion within sigtrapped routines

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoRevert "sna: Detect and handle mi recursion"
Chris Wilson [Wed, 30 Oct 2013 18:42:06 +0000 (18:42 +0000)]
Revert "sna: Detect and handle mi recursion"

This reverts commit c6b0e3fe0c299488932ba0392847f1faf298d079.

11 years agosna: Assert that the batch is in the correct mode prior to inserting BLT commands
Chris Wilson [Wed, 30 Oct 2013 13:26:23 +0000 (13:26 +0000)]
sna: Assert that the batch is in the correct mode prior to inserting BLT commands

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Detect and handle mi recursion
Chris Wilson [Wed, 30 Oct 2013 11:52:05 +0000 (11:52 +0000)]
sna: Detect and handle mi recursion

Some of the mi routines recuse back into the generic accel routines and
so confuse our trapping of SIGBUS. Add extra assertions to pinpoint the
recursion and unwrap sufficiently to avoid that recursion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Queue retirement when placing a BO on the deferred flushing list
Chris Wilson [Wed, 30 Oct 2013 10:02:28 +0000 (10:02 +0000)]
sna: Queue retirement when placing a BO on the deferred flushing list

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Check for wedged after submitting
Chris Wilson [Wed, 30 Oct 2013 09:55:57 +0000 (09:55 +0000)]
sna: Check for wedged after submitting

If we submit prior to an operation, check that we didn't just wedge the
GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Wrap access of upload buffers with sigtrap
Chris Wilson [Tue, 29 Oct 2013 21:19:02 +0000 (21:19 +0000)]
sna: Wrap access of upload buffers with sigtrap

For an extra layer of paranoia, catch any sigbus when trying to upload
a bitmap, and convert it to a no-op.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen7: Refactor BYT vsync using IVB routines
Chris Wilson [Tue, 29 Oct 2013 20:16:06 +0000 (20:16 +0000)]
sna/gen7: Refactor BYT vsync using IVB routines

The BYT vsync is closer to the IVB vsync, and using gen6 is just
erroneous. Apparently. At least that is what is in bspec today.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix assertion checks for fake flushing requests
Chris Wilson [Tue, 29 Oct 2013 18:27:41 +0000 (18:27 +0000)]
sna: Fix assertion checks for fake flushing requests

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Remove an overzealous assert
Chris Wilson [Tue, 29 Oct 2013 18:00:49 +0000 (18:00 +0000)]
sna: Remove an overzealous assert

Testing with a slow gen2 triggers this harmless assertion, so drop it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Handle deferred retiring of active-buffers
Chris Wilson [Tue, 29 Oct 2013 16:59:57 +0000 (16:59 +0000)]
sna: Handle deferred retiring of active-buffers

Yikes, the new assertions found cases where we would retain an active
buffer even though it was still owned by the next batch. Fortunately,
this should only be a bookkeeping issue rather than lead to corruption.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Always run the retire_buffers during ring_idle
Chris Wilson [Tue, 29 Oct 2013 16:20:14 +0000 (16:20 +0000)]
sna: Always run the retire_buffers during ring_idle

As we know that we had a request to retire, we know that we may make
progress retiring active buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Perform an explicit retire for old active upload buffers
Chris Wilson [Tue, 29 Oct 2013 14:53:02 +0000 (14:53 +0000)]
sna: Perform an explicit retire for old active upload buffers

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Check for retired upload buffers after checking for an idle ring
Chris Wilson [Tue, 29 Oct 2013 15:12:17 +0000 (15:12 +0000)]
sna: Check for retired upload buffers after checking for an idle ring

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: asserts bitmap uploads are correct
Chris Wilson [Tue, 29 Oct 2013 13:50:51 +0000 (13:50 +0000)]
sna: asserts bitmap uploads are correct

Place guards around the pointer accesses to verify that they are within
the bitmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Don't attempt to move the GC back to the GPU before it is moved away
Chris Wilson [Tue, 29 Oct 2013 12:46:09 +0000 (12:46 +0000)]
sna: Don't attempt to move the GC back to the GPU before it is moved away

Fixes regression from

commit e3f15cbf39696edae9f716bdcfbb7032ec7d7e3f [2.99.905]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Oct 22 15:19:15 2013 +0100

    sna: Move gc back to GPU after failure to move it to CPU

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Try harder to complete writes
Chris Wilson [Tue, 29 Oct 2013 09:56:10 +0000 (09:56 +0000)]
sna: Try harder to complete writes

Expunge our caches if we fail to write into a bo (presuming that
allocation failure is the likely fixable cause).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Quieten a couple of valgrind warnings about unknown ioctls
Chris Wilson [Mon, 28 Oct 2013 20:48:17 +0000 (20:48 +0000)]
sna: Quieten a couple of valgrind warnings about unknown ioctls

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tidy RegionNil checks
Chris Wilson [Mon, 28 Oct 2013 13:06:16 +0000 (13:06 +0000)]
sna: Tidy RegionNil checks

After computing the clip intersection, we immediately check for the
empty result, so refactor the check into the common routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: And be pessimistic when checking aperture limits
Chris Wilson [Mon, 28 Oct 2013 11:29:13 +0000 (11:29 +0000)]
sna: And be pessimistic when checking aperture limits

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Account for extra guard pages around snooped BO in aperture checks
Chris Wilson [Mon, 28 Oct 2013 11:28:01 +0000 (11:28 +0000)]
sna: Account for extra guard pages around snooped BO in aperture checks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Defer opportunistic flush if all bo are current on the GPU
Chris Wilson [Mon, 28 Oct 2013 11:16:29 +0000 (11:16 +0000)]
sna: Defer opportunistic flush if all bo are current on the GPU

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Leave extra room in the mappable aperture for fence alignment
Chris Wilson [Mon, 28 Oct 2013 10:33:57 +0000 (10:33 +0000)]
sna: Leave extra room in the mappable aperture for fence alignment

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Use page-count for mappable aperture size
Chris Wilson [Mon, 28 Oct 2013 10:45:52 +0000 (10:45 +0000)]
sna: Use page-count for mappable aperture size

For consistency with the other aperture metrics and correctness when
passing around required number of pages.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fallthrough to opportunistic flushing after aperture checks
Chris Wilson [Sun, 27 Oct 2013 16:45:53 +0000 (16:45 +0000)]
sna: Fallthrough to opportunistic flushing after aperture checks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Handle transient TearFree flip failures
Chris Wilson [Sun, 27 Oct 2013 15:33:13 +0000 (15:33 +0000)]
sna: Handle transient TearFree flip failures

If we get a pageflip fail when trying to do a TearFree update, just
fallback to a copy (before turning off the display for complete
failure). The rare tearing copy should mar the user experience far less.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Trim usuable fenced aperture by unfenced usage
Chris Wilson [Fri, 25 Oct 2013 14:09:19 +0000 (15:09 +0100)]
sna: Trim usuable fenced aperture by unfenced usage

This will overcount buffers that both fenced and unfenced (likely most
fenced buffers!) but is required to prevent ENOSPC due to alignment
issues.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Don't assert indirect GPU state
Chris Wilson [Fri, 25 Oct 2013 13:27:21 +0000 (14:27 +0100)]
sna: Don't assert indirect GPU state

kgem_check_bo_fenced queries whether the GPU is idle, and so its result
is timing dependent and not suitable for assertion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Remove stale mappings when replacing GPU bo
Chris Wilson [Fri, 25 Oct 2013 13:22:05 +0000 (14:22 +0100)]
sna: Remove stale mappings when replacing GPU bo

References: https://bugs.freedesktop.org/show_bug.cgi?id=70527
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix overallocation of fences for BLT commands (gen2/3)
Chris Wilson [Fri, 25 Oct 2013 12:20:10 +0000 (13:20 +0100)]
sna: Fix overallocation of fences for BLT commands (gen2/3)

Fixes a regression introduced in
commit 4d2840919fd00e4ae0bf1957f66009f55a01eb7b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Sep 26 15:30:58 2013 +0100

    sna: In desperation, query the actual available aperture space

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Add a line of DBG for when we discard uploads into CPU bo
Chris Wilson [Fri, 25 Oct 2013 10:35:39 +0000 (11:35 +0100)]
sna: Add a line of DBG for when we discard uploads into CPU bo

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/io: Propagate failure to XOR uploads
Chris Wilson [Fri, 25 Oct 2013 10:23:21 +0000 (11:23 +0100)]
sna/io: Propagate failure to XOR uploads

Similar to the handling required for the normal upload paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/io: Wrap the XOR upload paths with SIGBUS handling
Chris Wilson [Fri, 25 Oct 2013 10:03:05 +0000 (11:03 +0100)]
sna/io: Wrap the XOR upload paths with SIGBUS handling

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoman: Mention the new default accel
Chris Wilson [Thu, 24 Oct 2013 18:45:30 +0000 (19:45 +0100)]
man: Mention the new default accel

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoman: State the negative aspects of TearFree
Chris Wilson [Thu, 24 Oct 2013 18:38:53 +0000 (19:38 +0100)]
man: State the negative aspects of TearFree

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Do not apply drawable offsets to DamageRegionAppend
Chris Wilson [Thu, 24 Oct 2013 14:42:12 +0000 (15:42 +0100)]
sna: Do not apply drawable offsets to DamageRegionAppend

DamageRegionAppend() will itself apply the drawable offsets, so we need
to pass it the untransformed region. This also fixes an issue where we
might fallback without applying any Damage.

Reported-by: Christian Nassau <nassau@nullhomotopie.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32734
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix canonical mode name to correctly use asprintf
Chris Wilson [Thu, 24 Oct 2013 12:05:16 +0000 (13:05 +0100)]
sna: Fix canonical mode name to correctly use asprintf

Whoops. Only the kernel sprintf() accepts NULL as a valid target string,
not libc's.

Reported-by: Jay Little <jaylittle@jaylittle.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70835
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage
Chris Wilson [Tue, 22 Oct 2013 13:22:14 +0000 (14:22 +0100)]
sna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage

Otherwise we may not correctly undo COW or pending move-to-gpu updates.

v2: goto move_to_gpu instead for correcting the damage handling.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70821
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoRevert "sna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage"
Chris Wilson [Thu, 24 Oct 2013 06:28:18 +0000 (07:28 +0100)]
Revert "sna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage"

This reverts commit bccbbf8a68faf7aac274efd289d4916083b1a1e3.

11 years agoman: Describe the TearFree option
Chris Wilson [Wed, 23 Oct 2013 15:15:35 +0000 (16:15 +0100)]
man: Describe the TearFree option

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Reset bo after allocation failure during wait-for-shadow
Chris Wilson [Wed, 23 Oct 2013 10:15:28 +0000 (11:15 +0100)]
sna: Reset bo after allocation failure during wait-for-shadow

If we fail to allocate an alternate bo to replace the still visible
scanout bo, we stall and were supposed to continue using the old
wait->bo. However, we chose to use NULL instead which is going to lead
to an eventual crash.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years ago2.99.905 snapshot 2.99.905
Chris Wilson [Wed, 23 Oct 2013 08:50:24 +0000 (09:50 +0100)]
2.99.905 snapshot

11 years agosna: Tidy opportunistic flushing
Chris Wilson [Wed, 23 Oct 2013 07:40:43 +0000 (08:40 +0100)]
sna: Tidy opportunistic flushing

Rearrange the common code so that it should be tail-call optimised.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Flush the pending move-to-gpu upon Pixmap free
Chris Wilson [Tue, 22 Oct 2013 16:36:58 +0000 (17:36 +0100)]
sna: Flush the pending move-to-gpu upon Pixmap free

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Handle pending move-to-gpu for userptr uploads
Chris Wilson [Tue, 22 Oct 2013 16:35:33 +0000 (17:35 +0100)]
sna: Handle pending move-to-gpu for userptr uploads

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Pass the async hint when pushing GPU damage for redisplay
Chris Wilson [Tue, 22 Oct 2013 16:34:59 +0000 (17:34 +0100)]
sna: Pass the async hint when pushing GPU damage for redisplay

So that we don't accidentally clear any other hints.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix inconsistency in has_coherent_ptr assertion
Chris Wilson [Tue, 22 Oct 2013 15:59:29 +0000 (16:59 +0100)]
sna: Fix inconsistency in has_coherent_ptr assertion

We occasionally will read from an "incoherent" ptr in the belief that
the clflush hit will be worth it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage
Chris Wilson [Tue, 22 Oct 2013 13:22:14 +0000 (14:22 +0100)]
sna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage

Otherwise we may not correctly undo COW or pending move-to-gpu updates.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Make sure CPU damage is flushed to the TearFree shadow
Chris Wilson [Tue, 22 Oct 2013 12:33:06 +0000 (13:33 +0100)]
sna: Make sure CPU damage is flushed to the TearFree shadow

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only force the TearFree exchange before a write
Chris Wilson [Tue, 22 Oct 2013 06:58:03 +0000 (07:58 +0100)]
sna: Only force the TearFree exchange before a write

We can read from the current scanout buffer without incurring a visual
tear, so delay the GPU bo exchange until we see a write to the object.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoxvmc: Handle errors along allocation path
Chris Wilson [Tue, 22 Oct 2013 14:54:59 +0000 (15:54 +0100)]
xvmc: Handle errors along allocation path

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Free our CRTC private after failing to create the xf86Crtc
Chris Wilson [Tue, 22 Oct 2013 14:35:31 +0000 (15:35 +0100)]
sna: Free our CRTC private after failing to create the xf86Crtc

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Fix inversion of initialisation test for triangles
Chris Wilson [Tue, 22 Oct 2013 14:32:23 +0000 (15:32 +0100)]
sna/trapezoids: Fix inversion of initialisation test for triangles

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Ignore overflow in CPU count rather than abort
Chris Wilson [Tue, 22 Oct 2013 14:30:05 +0000 (15:30 +0100)]
sna: Ignore overflow in CPU count rather than abort

If there are more processors than we ever expect, good! Just use lots of
them, rather than none at all.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Move gc back to GPU after failure to move it to CPU
Chris Wilson [Tue, 22 Oct 2013 14:19:15 +0000 (15:19 +0100)]
sna: Move gc back to GPU after failure to move it to CPU

As the failure in gc move-to-cpu occurs late, i.e. after the function
pointers are updated to point to CPU functions, we need to undo those
changes, i.e. call move-to-gpu for the GC on failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Discard GPU bo when failing to setup the shared pixmap
Chris Wilson [Tue, 22 Oct 2013 14:02:53 +0000 (15:02 +0100)]
sna: Discard GPU bo when failing to setup the shared pixmap

If we fail to mmap the pixmap when preparing it for use with prime, be
sure to throw away the now lost priv->gpu_bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Free bo along unlikely one-off error path
Chris Wilson [Tue, 22 Oct 2013 14:00:16 +0000 (15:00 +0100)]
sna: Free bo along unlikely one-off error path

Add a missing free for a never-hit error.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>