Commit Graph

8626 Commits

Author SHA1 Message Date
Chris Wilson 0267f5902d sna: Check after filtering points before submitting boxes to be drawn
As we clip the points when converting them into GPU boxes, check that we
have something to draw before submitting the commands.

Reported-by: Ian Gay <gay@sfu.ca>
References: https://bugs.freedesktop.org/show_bug.cgi?id=86075
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-10 07:46:53 +00:00
Chris Wilson 9ea242c275 sna: Check picture format on destination before beginning a GPU operation
This is more important in the multiple stage operations like glyph
rendering where we do not want to initiate an operation on the GPU only
then to fallback due to an incompatible destination.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-10 07:46:39 +00:00
Sedat Dilek e96520327b sna: wc-mmap: Fix warning in configure
This fixes the following warning due to a typo:

configure: WARNING: unrecognized options: --enable-wc-map
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
2014-11-07 10:05:59 +00:00
Chris Wilson ab6680375c sna/xv: Give the illusion of hardware progress
The number of ports we provide for Xv textured video is arbitrary. The
main cost is reservation of a number of XIDs and preallocation of a
block of memory. Whatever value we pick, someone will always want
more...

References: https://bugs.freedesktop.org/show_bug.cgi?id=85974
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-07 09:57:07 +00:00
Chris Wilson 0aa2edbd29 Remove defunct glamor support
It never was a stable or complete replacement, and now it is
incorporated in Xorg itself!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-06 16:55:46 +00:00
Chris Wilson 4281bbdd5b sna: Fix debug mmapping of active + released aux buffers
The debug code wants to print the batch and the aux buffers. To do so,
it needs to bypass the assertions on the lifetime of the buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-06 16:55:46 +00:00
Chris Wilson 87802b3402 sna: Experimental support for write-combining mmaps
If we have a linear buffer, we can request the kernel mmap it directly
with write-combining without having to pin it into the GTT. This allows
us to efficiently upload very large buffers, and can avoid the dreaded
aperture thrashing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-06 16:55:46 +00:00
Chris Wilson 33764685cb sna: Wrap prefaulting with sigtrap()
Handle a potential SIGBUS due to kernel bugs when prefaulting the
scanout surface.

References: https://bugs.freedesktop.org/show_bug.cgi?id=85959
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-06 12:42:13 +00:00
Rodrigo Vivi 97fe3c1c86 sna: Use VMask in 3DSTATE_PS
Using dispatch mask cause hangs waiting PS Done on some cases like bug #83207,
with larger screen or when scaling it.

Also mesa uses VMask instead of Dmask for 3DSTATE_PS because in some cases
they were getting incorrect derivatives for subspans.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83207
Cc: Timo Aaltonen <tjaalton@ubuntu.com>
Cc: Gary Wang <gary.c.wang@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Tested-by: Timo Aaltonen <tjaalton@ubuntu.com>
2014-11-06 10:43:17 +00:00
Chris Wilson 0532a3313a sna/gen8: Clear instancing enabled bit between batches
gen8 sets the instancing bit relative to the vertex element, but we were
clearing it for the vertex buffer. As the maximum number of vertex
elements is fixed, just clear them all when emitting our header. Note
that VF_SGVS is not sufficient by itself to disable all side-effects of
instancing.

Thanks to Kenneth Graunke for pointing out the change from vertex buffer
to vertex element of the instancing enable bit.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84958
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-05 21:06:57 +00:00
Chris Wilson ba408bf21c sna: Correct units for videoRam
The mappable aperture size is stored as a page count, videoRam expects
size in KiB.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-04 13:40:35 +00:00
Chris Wilson 7ed5b1156c sna: Reuse the queried aperture size for videoRam determination
Rather than repeat our derivation of how much RAM we can map, just reuse
the already determined value.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-04 12:55:53 +00:00
Chris Wilson a972c9886e sna: Use v2 of get_tiling ioctl to check for bit17 swizzling
With the new version of the get_tiling ioctl we can reliably detect if
we can use manual detiling (i.e. CPU mmaps) on older gen.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-04 10:37:48 +00:00
Chris Wilson 7ecc778691 backlight: bl_power uses 0 for on and 4 for off
The backlight/bl_power file didn't obey the obvious semantics, but
instead operates using some interesting framebuffer API. Oh well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-04 10:37:48 +00:00
Chris Wilson cc3b8a542e sna: Treat external bo carefully when marking as idle
When we flag a bo as being externally modified, we set a special flag on
its request pointer. This forces us to inspect whether the bo is busy
before accessing it the next, and if it is idle, we must be careful that
we then do not dereference the special request.

Fixes regression from
commit 9115406b65
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Oct 30 19:21:02 2014 +0000

    sna: Retire all requests when a bo is found to be not busy

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 20:40:59 +00:00
Chris Wilson 122f606560 sna: Fix forced fallbacks from init
As we now override a few hooks when we mark the GPU as wedged, we also
need to preserve those overrides during initialisation. Fixes DBG_NO_HW.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 16:57:14 +00:00
Chris Wilson d959014c10 sna: Modicum of extra DBG for transformed redisplay
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 16:20:25 +00:00
Chris Wilson 1040d92e31 sna/gen6+: Fix projective sample coordinates
Reported-by: "Ding, Chi" <chix.ding@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 16:20:25 +00:00
Chris Wilson 30fded8dfa sna/brw: Fix EU tests to select the right gen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 16:20:25 +00:00
Chris Wilson 71d79daf45 sna: Remove extraneous tab whitespace before parameter name
Reported-by: Arthur Koziol
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 08:45:09 +00:00
Chris Wilson 9115406b65 sna: Retire all requests when a bo is found to be not busy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-31 08:45:09 +00:00
Chris Wilson 9d48d28179 sna: Reuse the same fence until retired
In order to reduce the number of breadcrumbs the kernel must emit to
track our batches, reuse the last query until it has retired.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-29 16:55:58 +00:00
Chris Wilson 61436c2fab sna: Fix build for GC API changes in Xorg-1.16.99.901
The GC struct was changed in

commit 73e2383b7350723256894c5076d0c731aec5cd1f
Author: Adam Jackson <ajax@redhat.com>
Date:   Fri Jun 20 13:31:20 2014 -0400

    dix: Always store GC client clip as a region (v2)

update to match.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85581
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-29 16:55:58 +00:00
Chris Wilson d08a5f555a sna/trapezoids: Prevent overflow of edge gradient in mono rasteriser
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c76
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-24 09:55:50 +01:00
Chris Wilson f611f95804 sna/trapezoids: Difference between two 32-bit quantities is 33-bits in size
When computing the edge distance, we subtract on 32-bit quantity from
another. This requires 33-bits to store the full result so promote the
subtraction to 64-bits (rather than the result of that subtraction as
done currently).

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c76
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-24 09:44:34 +01:00
Chris Wilson 4df0052a21 sna: Update the reloc->delta for the shrunk batch
As well as actually updating the value in the batch for the relocation
address, we need to tell the kernel in case it has to update the
address.

Another regression from
commit b4872f74c0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Oct 21 10:38:22 2014 +0100

    sna: Avoid pwriting large batches

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85389
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-24 09:18:52 +01:00
Chris Wilson 8df8618c62 sna: Adapt to changes in internal render API in Xorg-1.17
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-24 08:04:27 +01:00
Chris Wilson a8d1eaf6ee sna: Fix use of uninitialized value when handling migration for PRIME
sna_accel.c: In function 'sna_pixmap_undo_cow':
sna_accel.c:1933:11: warning: 'create' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-22 21:13:25 +01:00
Chris Wilson e46f26b9e2 sna/gen8: Load the sampler result directly into the fb write message
With the unified register file (from gen6+), we no longer need to copy
the sample results into the final write message.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-22 19:41:26 +01:00
Chris Wilson dee9ea2991 sna/gen8: Override the URB output from the VS
Using the override seems to be marginally faster.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-22 19:41:19 +01:00
Chris Wilson 7a9bdadd71 sna/gen8: Clamp URB allocations for GT3
GT3 requires some reserved space in the URB allocation and so we must
reduce the amount we allocate to our vertices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81583
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-22 19:39:59 +01:00
Chris Wilson de54a93217 sna/gen8: Annotate more 64bit pointer locations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-22 19:39:59 +01:00
Chris Wilson 2114b54a0b sna: Fix double application of batch shrinking to relocation targets
Fixes regression from

commit b4872f74c0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Oct 21 10:38:22 2014 +0100

    sna: Avoid pwriting large batches

NB: Remember to check your tree before pushing a simple bug fix.

Signed-off-by: root <root@huronriver.alporthouse.com>
2014-10-22 18:51:39 +01:00
Chris Wilson 6e486e11a5 sna/dri2: Fix interoperation with PRIME and older Xorg
When using the fake triple buffer implementation with recent enough Xorg
to support both real triple buffering and PRIME, we have to disable use
of SwapLimit as that freezes the client when we are instead faking the
triple buffer. (We have to use the fake support on those Xservers to
workaround crashes inside the Xserver.)

Reported-by: Paulo Dias <paulo.miguel.dias@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85144#c12
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-22 07:24:10 +01:00
Chris Wilson de96fbf66c sna/trapezoids: Prefer GPU for AddTraps()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-21 20:30:21 +01:00
Chris Wilson b4872f74c0 sna: Avoid pwriting large batches
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-21 20:30:21 +01:00
Chris Wilson 83a3d91473 sna: Prefer the GPU for wide lines and arcs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-20 21:21:50 +01:00
Chris Wilson 316155db98 sna/gen6: Apply gen7 flushing
Clemens Eisserer noticed that glyphs would randomly disapper whilst
being rendered on his Sandybridge, a sign that the GPU is not flushing
its internal state on pipeline changes. As a precaution, adopt the
Ivybridge flush semantics (whilst preserving the required Sandybridge
workarounds).

Reported-and-tested-by: Clemens Eisserer <linuxhippy@gmail.com>
Reported-and-tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
References: https://bugs.freedesktop.org/show_bug.cgi?id=85158
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-20 21:20:12 +01:00
Chris Wilson bf7b5a24bb sna/dri2: Exchange pitches as well
When swapping over the names, we also need to swap the pitches exposed
through the protocol as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-18 10:13:31 +01:00
Chris Wilson 6b98f16241 sna: Allow TearFree updates to continue even when the GPU is wedged
Even if we cannot render using the GPU, we should still be able to
request that the outputs be flipped. So try, and only if that fails,
resort to writing directly into the scanout.

References: https://bugs.freedesktop.org/show_bug.cgi?id=85058
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-16 09:39:50 +01:00
Chris Wilson c896f249c7 sna: Fixup a failed per-CRTC TearFree flip
If we fail to flip onto a new per-CRTC bo, first try a normal modeset.
This catches instances where the pitch changes for example.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-16 08:17:09 +01:00
Chris Wilson 3812dfce17 sna: Replace GPU render operations with CPU callbacks after wedged
If we find the GPU is wedged, replace some of the lowlevel render
operations with CPU equivalents to simplify some fallbacks that still
need to operate on GPU bo (such as copying DRI buffers).

References: https://bugs.freedesktop.org/show_bug.cgi?id=85058
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-16 07:48:27 +01:00
Chris Wilson 9a5ca59d2b sna: Prevent recursion during last-gasp disabling of outputs
If we fail an execbuffer, we disable outputs and try again. (In case we
have severe fragmentation issues and need to rearrange the scanouts in
GTT.) Afterwards we re-enable the outputs, but this causes us to flush
the pending rendering and so recurse into the execbuffer. Prevent this
with a slight hack during enabling of outputs.

References: https://bugs.freedesktop.org/show_bug.cgi?id=85058
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-15 16:56:02 +01:00
Rodrigo Vivi 49cf2803d3 sna: a bit of cleanup on gen8_render.h
Removing bits that become reserved on bdw and organizing 3DSTATE_PS header.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2014-10-14 08:01:00 +01:00
Rodrigo Vivi f5935aa4bb sna: Fix URB offset shift on 3DSTATE_SBE
Unfortunatelly this doesn't the bug I was hunting, but let's follow
the spec.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2014-10-14 08:00:16 +01:00
Chris Wilson 2c227f391a sna: Drain all udev events before checking output status
As libudev only pulls off events one by one and we may need to process
several for a MST topology change, keep polling until complete.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-13 09:26:12 +01:00
Chris Wilson 49376ba3bd backlight: Open bl_power using WRONLY for writing.
Jan spotted that we open the bl_power file using O_RDONLY and then attempt
to write the new power state into it. This fails...

Reported-by: Jan Steffens
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-11 21:36:11 +01:00
Chris Wilson 70a1710e18 sna/trapezoids: Sacrifice precision to avoid 64bit overflow
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c71
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-11 16:15:56 +01:00
Chris Wilson 069f7878dc sna/trapezoids: Treat mono-edges within a single column as vertical
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-11 16:15:56 +01:00
Chris Wilson 0c1b4f913c sna: Log if we disable the backlight after failure to switch it on
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-11 16:15:56 +01:00