Commit Graph

7467 Commits

Author SHA1 Message Date
Chris Wilson 7f901495cd 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>
2013-11-06 09:01:17 +00:00
Chris Wilson 736b496b45 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>
2013-11-06 09:00:33 +00:00
Chris Wilson 723f17ca4f sna: Submit execution on the bo before changing its caching status
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-05 18:36:45 +00:00
Chris Wilson 10b573c508 sna: Clear snoop flag after converting from a CPU bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-05 18:29:46 +00:00
Chris Wilson dc61705a6e 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>
2013-11-05 09:06:19 +00:00
Chris Wilson f3225fcb38 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>
2013-11-05 08:38:22 +00:00
Chris Wilson 93193aaf7d test 2013-11-04 22:14:05 +00:00
Chris Wilson a0d1de962a 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>
2013-11-04 17:07:53 +00:00
Chris Wilson fcd081ca77 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>
2013-11-04 15:18:08 +00:00
Chris Wilson 587c486665 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>
2013-11-04 15:12:37 +00:00
Chris Wilson 8f6e227ba8 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>
2013-11-04 13:56:37 +00:00
Chris Wilson 82b646a42f 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>
2013-11-04 11:48:04 +00:00
Chris Wilson e678cead11 sna: Update DBG formats for larger BO offset integers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-04 11:47:29 +00:00
Chris Wilson 94f9beb8fb 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>
2013-11-04 11:30:39 +00:00
Chris Wilson ad3959324c 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>
2013-11-04 11:12:30 +00:00
Chris Wilson 8d067e9619 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>
2013-11-04 09:34:25 +00:00
Chris Wilson 7050c8da56 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>
2013-11-04 09:31:05 +00:00
Chris Wilson 10023bf8f5 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>
2013-11-03 22:07:22 +00:00
Chris Wilson 08d8a47e7c sna: Wrap staging buffer access with sigtrap handler
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-03 19:51:56 +00:00
Chris Wilson 4a7217b05c sna: Discard bo->exec when unwinding a glyph no-op
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-02 21:45:00 +00:00
Chris Wilson add663919e sna: Eliminate the redundancy between is_mappable/can_map
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-02 21:39:13 +00:00
Chris Wilson d41f847c75 sna: Jump to the right escape target when bypassing a self-copy
Another fix for

commit e3f15cbf39 [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>
2013-11-02 21:09:01 +00:00
Chris Wilson 7c143ba65c sna: Add some more asserts around inactive VMA lists
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-02 15:46:39 +00:00
Chris Wilson 1c34ea0894 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>
2013-11-02 15:46:04 +00:00
Chris Wilson d507b6b982 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>
2013-11-02 13:50:15 +00:00
Chris Wilson 9681b1422e sna: Fallback when wedged and trying to use the BLT copy routines
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-11-02 13:38:07 +00:00
Chris Wilson 6cb84c8d55 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>
2013-11-01 15:57:56 +00:00
Chris Wilson 5da329735c 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>
2013-11-01 14:30:14 +00:00
Chris Wilson 0d93b0ef34 sna/gen7: Undo overzealous flushing
commit d580a30aaf
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>
2013-11-01 12:49:36 +00:00
Chris Wilson 6b1a6f3217 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>
2013-11-01 11:05:34 +00:00
Chris Wilson d580a30aaf 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>
2013-10-31 15:58:47 +00:00
Chris Wilson 82e6d41c2f 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>
2013-10-31 13:37:51 +00:00
Chris Wilson 5cdc2bbc9c sna: Tweak deletion of used buffers
Make sure we never unwind a used buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-31 13:35:37 +00:00
Chris Wilson ed16e34c00 sna: Allow limited recursion within sigtrapped routines
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-30 18:52:14 +00:00
Chris Wilson 426efd5f4b Revert "sna: Detect and handle mi recursion"
This reverts commit c6b0e3fe0c.
2013-10-30 18:52:14 +00:00
Chris Wilson ed28245624 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>
2013-10-30 13:42:44 +00:00
Chris Wilson c6b0e3fe0c 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>
2013-10-30 13:42:44 +00:00
Chris Wilson 4d13d52258 sna: Queue retirement when placing a BO on the deferred flushing list
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-30 13:42:44 +00:00
Chris Wilson 59531ba31a 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>
2013-10-30 13:42:44 +00:00
Chris Wilson 87655e7df4 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>
2013-10-29 21:19:02 +00:00
Chris Wilson 0e69280005 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>
2013-10-29 20:19:24 +00:00
Chris Wilson 9352769eee sna: Fix assertion checks for fake flushing requests
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-29 18:27:41 +00:00
Chris Wilson eddd80c44d 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>
2013-10-29 18:00:49 +00:00
Chris Wilson 9f36e83d76 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>
2013-10-29 17:01:27 +00:00
Chris Wilson d26036d40e 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>
2013-10-29 16:20:14 +00:00
Chris Wilson 72544ad5d1 sna: Perform an explicit retire for old active upload buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-29 15:41:08 +00:00
Chris Wilson d86b36dc41 sna: Check for retired upload buffers after checking for an idle ring
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-29 15:34:43 +00:00
Chris Wilson 0e6aca90c7 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>
2013-10-29 14:05:27 +00:00
Chris Wilson 56e3761dec sna: Don't attempt to move the GC back to the GPU before it is moved away
Fixes regression from

commit e3f15cbf39 [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>
2013-10-29 12:46:58 +00:00
Chris Wilson 4f41bf3de0 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>
2013-10-29 09:56:28 +00:00