Commit Graph

7908 Commits

Author SHA1 Message Date
Chris Wilson 9c2c485df9 sna: Validate that the reg/insn size is well defined
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 14:31:34 +00:00
Chris Wilson 263d109986 sna: Clamp downsampling tile size
For very large scale factors, it is possible for the current calculation
to underflow and try negative tile sizes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 13:26:46 +00:00
Chris Wilson 88e9bb760f sna: Explicitly disable unused pipes after an output reconfiguration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 10:54:14 +00:00
Chris Wilson ddf5feba78 sna: Generate a backtrace on assertion failures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 10:00:32 +00:00
Chris Wilson e12ec452a9 sna: Cancel pending mode change notification
Along a couple of paths, we either do not care about the notification
(i.e. during suspend) or do it explicitly. There we should mark the work
as done.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 09:46:20 +00:00
Chris Wilson 700c036d18 sna: Reject modesets with 0 outputs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 09:31:41 +00:00
Chris Wilson dd421005ca sna: Add a few more asserts to sna_crtc_flip()
Check that we are updating an active CRTC with a valid mode and
associated outputs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 09:29:07 +00:00
Chris Wilson 104517507f sna: Do not post shadow updates in the middle of output reconfiguration
Wait until the screens and framebuffers settle before we start updating.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 09:26:29 +00:00
Chris Wilson faef6e5e1a sna: Clean up DBG compile warnings
Including a potential crash due to using a unspecified string, oops.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 08:29:47 +00:00
Chris Wilson 0bec625cc4 sna: Report when we disable TearFree due to an error in operation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-01 08:13:18 +00:00
Chris Wilson 6059b51b59 sna: Reject attempts to set an invalid mode
Let's be sure the mode has been established before we attempt to apply
it to a CRTC - just in case the kernel tries to use the invalid mode and
blows up.

References: https://bugs.freedesktop.org/show_bug.cgi?id=86679
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-28 07:35:26 +00:00
Chris Wilson 0f15b8b45b sna/transform: Correctly check for imprecise fractional translations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-20 13:26:29 +00:00
Chris Wilson 7725c423cd sna/dri2: Improve precision of completion event for no-op swaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-20 13:26:29 +00:00
Chris Wilson f367f3dee5 sna/dri2: Add more DBG to explain invalid frames
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-20 13:26:28 +00:00
Chris Wilson 05a1aba1ab sna: DBG compile fix
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-20 13:26:28 +00:00
Chris Wilson a90cc3b388 sna: Tweak alignment constraints on gen8 to allow BLT
The previous commits prevent us from using the BLT if the destination
address is misaligned. Honour that restriction when creating buffers as
well, so that they are always usuable by the BLT.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-19 13:41:16 +00:00
Chris Wilson 8dee529978 sna: Add more checks and asserts for BLT capable bo
Before we use the BLT for core acceleration, double check that we can.
This should catch the case where we attempt to operate on SHM pixmaps
which do not meet the restrictions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-19 13:38:20 +00:00
Mika Kuoppala 3a22b6f6d5 sna: gen8 BLT broken when address has bit 4 set
With bit 4 set in address, the gen8 blitter fails and blits errorneously
into the cacheline preceeding the destination and similarly when reading from
the source, corrupting memory.

v2: Update the destination base offset pattern as revealed
    by igt/tests/gem_userptr_blits/destination-bo-align

v3: Check base address as well

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79053
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: xunx.fang@intel.com [v2]
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
2014-11-19 13:20:51 +00:00
Chris Wilson 29aab766f4 sna/dri2: Remove unused function
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-19 13:15:36 +00:00
Chris Wilson 6c2707d7bb sna: Unroll pwrite using our cached mmappings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-14 12:39:29 +00:00
Chris Wilson f9f85b8803 sna: Reorder PARAMs based on upstream inclusion
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-12 11:51:32 +00:00
Chris Wilson 13fa1f1a26 sna/gen7: Be paranoid and force a pipecontrol stall at least every 4 flushes
The documentation warns of potential GPU hangs if we emit more than 4
pipecontrol flushes without a CS stall. This is highly unlikely given
how frequently we must inject stalls into the pipeline, but force a
stall just in case!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-12 11:51:32 +00:00
Chris Wilson b2492fa45b sna: Only reshow unhidden cursors after modesetting
Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-11-10 13:37:26 +00:00
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
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