Commit Graph

9028 Commits

Author SHA1 Message Date
Chris Wilson 4c17a20a71 sna/dri2: Keep the async swap event alive until the copy is complete
Although we are ordered wrt to the client, there is no point allowing
the client to continue submitting rendering and eventually blocking
whilst we are still waiting for the previous frame to be shown.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 13:44:41 +01:00
Chris Wilson fc137ae504 sna/dri2: Avoid touching shared gpu_bo->flush between dri2/dri3
Not only is the pixmap->flush flag shared, but so is the lower level
gpu_bo->flush flag, so further to

commit 19d1e4ee19
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jun 11 13:43:10 2015 +0100

    sna/dri2: Be wary of interactions with DRI3 and sna_pixmap->flush

we need to be more careful when asserting the state of gpu_bo->flush

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 13:24:10 +01:00
Chris Wilson b6a635baf3 sna/dri2: Move the backbuffer cache from the event chain to the window
We still only keep it alive whilst the event chain is in progress, but
moving the cache onto the window allows us to reuse it easily for triple
buffer window swaps as well as full screen flips.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 12:46:38 +01:00
Chris Wilson a00d9999f4 sna: Fix tiling trapezoids
When the trapezoid is rendering to a surface larger than the 3D pipe can
handle, we split it into tiles. However, the code to do so insisted on
passing along the wrong pointer and consequently crashed.

Based on the patch by Carl Michal.

Reported-by: Carl Michal <michal@physics.ubc.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90940
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 12:09:58 +01:00
Chris Wilson dcb4d323ca sna/dri2: Mark the pending backbuffer copy as active
In order to perform swap elision for windows, we defer the blit until
the next vblank and then do whatever was the last buffer to be presented
by the client. Whilst that copy is pending, in the same manner as a
pending flip, we cannot hand that buffer back to the client for use (or
else they will render over top of it before we copy from it, or even
worse we copy from it in the middle of rendering).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 12:09:52 +01:00
Chris Wilson 19d1e4ee19 sna/dri2: Be wary of interactions with DRI3 and sna_pixmap->flush
Since both DRI2 and DRI3 manipulate the sna_pixmap->flush flag, we have
to relaxation assertions that it is wholly owned by DRI2.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-11 13:43:10 +01:00
Chris Wilson f71148a8b7 sna/present: Downgrade a known assert failure to a warning
We know Present is sending garbage msc into the wait_vblank, so just
warn about the error so that we do not prevent usage of --enable-debug
due to somebody else's bug.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-11 13:07:13 +01:00
Damien Lespiau 6651a03e62 Add Broxton PCI ids
Syncs up to

kernel commit ee87697f8bc4da0aea6fe1a825c734fb5e4a5b3b
Author: Damien Lespiau <damien.lespiau@intel.com>
Date:   Fri May 15 19:43:56 2015 +0100

    drm/i915/bxt: Update the Broxton PCI ids

and, importantly, including

kernel commit 1347f5b46a270db1991625f9f57af91e23a4b512
Author: Damien Lespiau <damien.lespiau@intel.com>
Date:   Tue Mar 17 11:39:27 2015 +0200

    drm/i915/bxt: Add BXT PCI id

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-11 10:11:54 +01:00
Chris Wilson 4c0d0f4d38 sna: Increase assertion to cater for concurrent & recursion vblank/flip handlers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-10 17:56:51 +01:00
Sedat Dilek 76be878272 Fix typos found with codespell v1.7
To get codespell v1.7 check [2].

[1] https://github.com/lucasdemarchi/codespell
[2] https://github.com/lucasdemarchi/codespell/releases

Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
2015-06-09 20:46:12 +01:00
Chris Wilson 5f626e1241 sna: Pass scanout flag when creating PRIME bo
For PRIME bo, we need to use uncached render targets so that any writes
are flushed out to main memory where they can be immediately read by a
PCI device. For simplicity, we just request that PRIME bo be also
SCANOUTs as that ensures that they will be created with the right
attributes for coherent main memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-09 08:40:47 +01:00
Chris Wilson 7fba4aa54d sna: Flush SlavePixmap dirty rects before calling ProcessPending
As the slave may use the ProcessPending damage callback to do its own
copying, we need to flush before.

Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-09 08:40:47 +01:00
Chris Wilson 46d74edf99 sna: Only add the COW to the flush write if exported for writing
If the source is only being exported for reading, we can skip adding it
to the flush list only to perform a no-op.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-05 17:43:22 +01:00
Chris Wilson ada30742ec sna: Add COW source pixmap to flushing list
In the case of an exported pixmap, e.g. with DRI3, it is possible for
the client to render into the pixmap whilst we are unaware. To serialise
the xserver and the client, we flush all operations on exported pixmaps
before talking to the client. In the case of COW however, we did not
flush the copy-on-write when transferring control to the client, and
thereby we could capture the modified contents.

Bugzilla: https://bugs.kde.org/show_bug.cgi?id=340202
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90836
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-05 16:54:01 +01:00
Chris Wilson 4a67c534ab sna: Fix definition for testing BLT with y-tiling
commit d1bf75f155
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 1 08:56:43 2015 +0000

    sna: Compilation fixes for stable distros

caused an apparent regression by using the wrong ring for detecting
whether we could program the BCS tiling registers.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-05 15:34:04 +01:00
Chris Wilson 7398cc4801 sna/dri2: Flag APPLY_DAMAGE for stable distros
commit d1bf75f155
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 1 08:56:43 2015 +0000

    sna: Compilation fixes for stable distros

set the flag incorrectly - only future Xorg will do the damage
application itself.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-05 12:45:20 +01:00
Chris Wilson 7d30ccea21 sna: Ensure compat_output is sane after sorting outputs
We always arrange for the panels to be first, and we want to use that
for our compat output.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-04 11:32:41 +01:00
Chris Wilson 1525b01778 intel-virtual-output: Fix cloning fixed mode outputs
When using a fixed mode, e.g. a Display without RandR support like
Xnest, we have to remember to hook up the connection during
recofiguration of VIRTUAL outputs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-03 13:14:01 +01:00
Chris Wilson d0ba02666d sna: Force a configuration reprobe if we detect a mismatch in initial state
If we find that the kernel has more active CRTC than we successfully
enable, something is amiss and more importantly we are leaving an
existing active CRTC blank. As a failsafe, if we detect this, fallback
to doing a full probe for the initial configuration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-03 13:07:03 +01:00
Chris Wilson b0aa9d349d sna: Reorder can-fence test to account for bit17 swizzling
References: https://bugs.freedesktop.org/show_bug.cgi?id=90725#c40
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-02 11:57:18 +01:00
Chris Wilson 6ee41d1450 sna: Add some DBG output for can-fence in kgem_init_swizzling()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-02 11:55:18 +01:00
Chris Wilson dbfbbcb4b3 sna: Mark GPU as wholly damage when replacing a drawable
References: https://bugs.freedesktop.org/show_bug.cgi?id=90725#c37
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-02 11:50:40 +01:00
Chris Wilson c692691029 sna: Ensure damage is set to full when marking as clear
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-02 11:42:08 +01:00
Chris Wilson 2fa48450c7 sna: Avoid using NULL pointer inside DBG
When pretty printing the format for DBG, make sure it is not NULL!

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90725#c32
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-02 09:15:09 +01:00
Chris Wilson 189ad44c94 sna/dri2: Only attempt to change tiling when required
If we have no fence, we then try to discard the tiling. However, the
change_tiling routine assumes that it is only called when a change is
actually required. Make it so for dri2.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 17:10:08 +01:00
Chris Wilson d1bf75f155 sna: Compilation fixes for stable distros
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 11:02:15 +01:00
Chris Wilson 7a371f6bef Merge branch 'master' of 192.168.1.213:/usr/src/xf86-video-intel 2015-06-01 08:50:31 +00:00
Chris Wilson b792b2c0b8 sna/dri2+: The DRI2/DRI3 protocol requires fenced tiling
If we export a surface over DRI2/DRI3, we have to use explicit tiling
via the kernel. :(

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 09:11:59 +01:00
Chris Wilson 085efe6817 sna: Force Linear FB when swizzling is unknown and fencing disabled
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 08:59:30 +01:00
Chris Wilson e08589de09 sna: Disable tiling assertion with unknown swizzling and white lies
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 08:54:19 +01:00
Chris Wilson d1479d8d03 sna: Double check that a tiling change request results in a change
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 08:42:28 +01:00
Chris Wilson 67185f54ba sna: Disable existing GTT mmap when switching to unknown swizzle + tiling
As a consequence of using GPU swizzling without telling the kernel is
that we must disable GTT access -- especially if we already have a
linear mmapping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 08:35:10 +01:00
Chris Wilson 14b5ab3fef sna: Enable use of GPU tiling even when SET_TILING fails
On gen4+, we no longer need to setup a fence for tiled operations and so
can program the GPU irrespective of the kernel tiled settings. However,
this means that we then cannot access the object through a GTT mmapping
(as we have no fence to do detiling) and nor can we use a WC mmap as the
swizzle is unknown.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-01 08:25:12 +01:00
Chris Wilson 834bdb0344 sna: Relax a couple of tiling assertions
Along a couple of passes, we have to set pitch back to 0 when reusing a
linear surface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-31 19:11:54 +01:00
Chris Wilson db78a3449c sna: Keep pitch even for I915_TILING_NONE surfaces
We have to ignore the return value of the pitch for untiled 2D surfaces
(since the kernel clears the tiling stride parameter).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-31 12:34:45 +01:00
Chris Wilson 9a6c77d7ad sna: Add a few more asserts for clearing tiling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-31 12:10:32 +01:00
Chris Wilson 0cd01c04fa sna: Always apply the SET_TILING results to the bo
Since the kernel can silently change the tiling on the object
irrespectie of the ioctl's request, we have to double check and remove
any such invalid object from our lists.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-31 09:16:36 +01:00
Chris Wilson ce4836b091 sna: Detect when SET_TILING fails to change tiling
If the swizzling is unknown, the SET_TILING ioctl silently converts the
request back to I915_TILING_NONE. In order to detect this, we need to
double check the ioctl parameters.

References: https://bugs.freedesktop.org/show_bug.cgi?id=90725#c21
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-31 08:58:02 +01:00
Chris Wilson 401b9deef0 sna: Flag disabled CRTC to xrandr
If we disable a CRTC, mark it as such and send an XRR event so that
userspace can do any recovery, and so that hopefully xrandr remains
consistent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-28 11:30:14 +01:00
Chris Wilson 5fa114d945 sna: sna_set_desired_mode() always returns true, make it void
Since sna_set_desired_mode() always returns true, we can make it void
and remove some unreachable code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-28 11:23:35 +01:00
Chris Wilson fb1643f0f9 sna/dri2: Refine ring selection with multiple active rings
The preference given multiple rings is to the previous writer, or if
none, to the render ring if active.

References: https://bugs.freedesktop.org/show_bug.cgi?id=90671
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-27 08:08:11 +01:00
Chris Wilson a6dd2655cb sna: Clear encoders request field when updating properties
Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-25 08:27:18 +01:00
Chris Wilson 8b7bdff750 sna: Initialise no-op callbacks early
In case of error, we try to free up memory before trying again. This
involves callbacks into higher level code - but if we fail early, we
will not have those hooks installed. Set no-ops stubs early to prevent
untimely crashes.

References: https://bugs.freedesktop.org/show_bug.cgi?id=90622#c1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-25 08:02:46 +01:00
Chris Wilson e617c1941c sna: Force restoration of SW cursor after HW cursor fails
In order to reset the SW cursor, we need to call xf86CursorSetCursor.
However, the parameters we need to call SetCursor with are not exposed
we need to be a little tricky and call a pair of functions that will
save and then restore the cursor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-19 12:44:26 +01:00
Chris Wilson 276a628827 sna: Disable HW cursor if we fail to update it
If we cannot control the HW cursor, flag it as invalid and enable the SW
cursor next time. The flag will remain set until the next modeset and we
then try the HW cursor again.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-19 11:20:31 +01:00
Chris Wilson 324ba96520 tests/render-trapezoid: Add edge tests
Check fidelity of edge rendering, just a variant of render-triangle

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-19 10:45:37 +01:00
Chris Wilson 3852977f14 test: Add a fidelity test for triangle edge rendering
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-18 13:14:42 +01:00
Chris Wilson fe64672c83 sna: Wrap GetImage with sigtrap
Mostly for completeness, though it is still remotely possibly for the
dst pointer to raise a SIGBUS (just less likely since it is not a i915
bo).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-18 09:18:41 +01:00
Chris Wilson d4c82a16bc test: Remove the blit through a temporary Pixmap
Originally this was inplace so that we wouldn't simply migrate the
target away from the GPU whenever we inspected results. That is no
longer a problem and so we can speed up the tests by skipping the
temporary.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-18 09:16:12 +01:00
Chris Wilson b10ef9cf5c sna/glyphs: Improve handling of low bitdepth mask format conversions
We shouldn't just discard the mask if the user requests that we render
the glyphs through a low bitdepth mask - and in doing so we should also
be careful not to improve the bitdepth of that mask (since we don't take
into account the extra quantisation desired).

Testcase: render-glyphs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-18 09:05:30 +01:00