Commit Graph

8266 Commits

Author SHA1 Message Date
Chris Wilson 4cc2fb8fbf sna: Add logging for set-tiling failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-24 11:39:53 +01:00
Chris Wilson f252dba9da sna: Use DBG_NO_TILING to disable all fencing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-24 11:34:25 +01:00
Chris Wilson ad20fd401b sna: Ensure that DRI2 buffers are created with a fence
We use the fence as a backchannel to commuicated the tiling mode to the
DRI2 client, so in such cases we cannot tolerate a failure to set the
tiling mode.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c114
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-24 11:30:46 +01:00
Chris Wilson a29e765ec0 sna: Fix the last character before a colon in the fake-edid paths
I chopped off one too many characters when creating the path in the
presence of a colon-delimited list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-22 11:34:51 +01:00
Chris Wilson 8d9e496670 sna/dri2: Take over the placeholder vblank
If we are doing synchronous but immediate swaps, we may notice that we
have a vblank placeholder from the last swap. If so, we can replace it
with the swap we need to perform on the next vblank.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-22 11:27:29 +01:00
Chris Wilson 18b947b999 sna: Abort output construction on allocation failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-21 14:05:40 +01:00
Chris Wilson 6742fea212 sna: Terminate the fake-edid path correctly
An off-by-one on the NUL terminator placed it after the path string.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-21 13:52:23 +01:00
Chris Wilson 2cd7cb9e93 sna: Allow user override of EDID for an output
As a slightly more convenient approach than loading the EDID on the
kernel command line, allow the user to specify the EDID path in the
Device section of xorg.conf, e.g.

Section "Device"
	Identifier "igfx"
	Option "CustomEDID" "DP1:/path/to/dp1.edid,DP2:/path/to/dp2.edid"
EndSection

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89945
2015-07-18 12:07:48 +01:00
Chris Wilson 5772556417 sna/dri2: Fix vblank keepalive signalling
When emitting the keepalive, it helps to actually request the signal
from the kernel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-17 08:51:09 +01:00
Chris Wilson 6d38029728 sna: Block cursor signals during modeset
Modesetting can be slow, and we certainly don't want to have to keep
restarting it due to an interrupt from an invisible cursor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-16 14:31:50 +01:00
Chris Wilson 6f4a143032 sna: Stop trying to CPU mmap a prime object after failure
If we fail to CPU mmap an object, mark it as inaccessible and never try
again. The likely scenario is that is it a PRIME object not backed by
our shmemfs storage and so unmappable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-16 10:33:03 +01:00
Chris Wilson b549b4fd38 sna: Add a DBG option to control native rotations for testing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-16 10:16:07 +01:00
Martin Peres 2c5063938c uxa: fix the call to PixmapSyncDirtyHelper, broken by xserver's 90db5ed
[ickle: switch to HAS_DIRTYTRACKING_ROTATION as suggested by Dave Airlie]
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
2015-07-10 10:24:16 +01:00
Chris Wilson 15d8b06d54 sna: Prevent a crash from an invalid EDID read
Suppose that the kernel reported a truncated EDID, we will eventually
crash by trying to access invalid memory. Prevent the crash by fixing up
the EDID header to fit the size read from the kernel (though we don't
fixup the checksum, so strict conformance tests will still complain, but
we won't crash.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-10 10:22:02 +01:00
Chris Wilson e5c6e48cc9 sna/dri2: Discard backbuffer cache on Window resize
After the Window resizes, we should never hand back a buffer of the old
size or else we end up rendering garbage - with the possibilty of GPU
hangs or memory corruption.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91036
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-28 18:25:37 +01:00
Chris Wilson 41f401ae27 sna/dri2: Early return for empty DRI2CopyRegion
It's possible if the Window is redirected whilst the client render for
its backbuffer to no longer overlap with the visible Window. In this
case, we attempt to copy an empty region, but it debugging is enabled
this throws an assert.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91120
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-27 20:24:45 +01:00
Chris Wilson 6fc7b16b93 sna/dri2: Remove overzealous assertion
sna_dri2_xchg() is also called on the flip path to do an immediate swap
of a hidden buffer, in which case can_xchg() returns false as it
believes that the swap requires a flip.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c109
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-25 17:08:59 +01:00
Chris Wilson f97c6ba9dc sna/dri2: Track original allocated size for copies
When we record the next scanout for display after the following vblank,
note the size of the allocation as well as its name and bo et al.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c105
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-25 11:47:25 +01:00
Chris Wilson 990499c6d9 sna/gen3: Allow gen3 to use smaller vbo if already available in cache
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-24 14:37:53 +01:00
Chris Wilson f414ed4e40 sna: Fix misspelling of "caching"
Apply s/cacheing/caching/ because I am alone in my belief of how to
spell cacheing correctly :)

Suggested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-24 11:02:28 +01:00
Chris Wilson 2d263ff7e6 sna/gen4: Fix larger than 3D pipeline fills
If we need to handle a FillRectangles request that is larger than the 3D
pipeline can handle, we need to split that operation up into smaller
chunks. This is achieved by redirecting the rendering through a view of
the surface (offset so that coordinates are within range), or else we
have to fallback to creating temporary surfaces.

If we fail to do so, we should hit an assertion that the render target
fits within the 3D pipeline inside gen4_emit_drawing_rectangle()

Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-24 10:21:20 +01:00
Chris Wilson 293450a23d sna/dri2: Rearrange proxy tracking for single-CRTC flipping
Looks like amalgamating the per-CRTC xchg with the blit caused a few
regressions with TearFree single monitor flipping.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91066
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-23 17:55:23 +01:00
Chris Wilson ac2aee9f5a sna/dri2: Rearrange assert to avoid false-positive
One assert(active_scanout) was firing when feed in an old flip bo, which
in hindsight was quite expected.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-22 14:36:35 +01:00
Chris Wilson 87b5ca2c3e sna/dri2: Stop leaking the cache entry when unable to reuse the old backbuffer
If we cannot cache the current backbuffer, due to either it not fitting
or because a reference to it still exists, delete the cache entry we
were holding for it - or else we slowly leak the cache list and
gradually get slower and slower walking along the growing chain.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-19 16:01:38 +01:00
Chris Wilson fa1b405898 sna/dri2: Add a bit of paranoia required for a wedged GPU
We can fail to submit the batch if the GPU is wedged (or the driver
upset), in which case the bo will be NULL and we should not blindly
dereference it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-19 15:31:44 +01:00
Chris Wilson b24e7581bd backlight: Factor known names into preferred interfaces
Since the /sys/device/backlight never turned up we face an issue with
disambiguating the backlight on multi-GPU devices. Both intel_backlight
and nv_backlight are presented are raw interfaces, and on modern systems
the ACPI interface is defunct, so we need a way to distinguish them. So,
we fallback to our priority table of known interfaces and rank them
accordingly, first by class (platform, native, raw) and then by priority.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-17 17:58:28 +01:00
Chris Wilson f1f2e72028 sna/dri2: Handle intermixing of exchanges and blits
Since there were two paths performing similar tasks for swapping a
windowed buffer, they would get easily confused and queue themselves in
conflict with each other as they behaved slightly differently wrt to rapid
swaps. Almagamate the two paths such that the behaviour is the same -
with the complication being in tracking the spare active buffer.

Fixes (some at least!) flickering from
commit 72d208a7f2
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Mar 5 12:26:15 2015 +0000

    sna/dri2: Perform swap elision on windows for swap-interval==0

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-16 17:11:49 +01:00
Chris Wilson 7d9a74622e sna: Be robust in handling DPMS failures
If we fail to turn off an output via DPMS, disable the entire CRTC in
order to blank the output and save the screeen/power.

Reported-by: Lukas Hejtmanek  <xhejtman@fi.muni.cz>
References: https://bugs.freedesktop.org/show_bug.cgi?id=90179
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-15 14:16:34 +01:00
Chris Wilson 670d05f438 sna/dri2: Destroy the right bo
Fixes copy'n'paste error in

commit d46c793663
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jun 12 13:50:35 2015 +0100

    sna/dri2: Remove the active_scanout flag when deleting the event

Reported-by: Andreas Reis <andreas.reis@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90968#c8
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-13 18:43:57 +01:00
Chris Wilson ed7bcae0ab sna/dri2: SWAP_THROTTLE is also used for a delayed SWAP
If there is already a pending operation on the drawable, the swap is
queued. It is queued with SWAP_THROTTLE which classes with the
vblank_mode=0 chaining, so the choice is to either review all other uses
of SWAP_THROTTLE and duplicate the chain swap handling, or to choose when
use to the alternate copy or back buffer. This patch opts for the
latter.

Fixes regression from
commit dcb4d323ca
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Jun 11 13:54:49 2015 +0100

    sna/dri2: Mark the pending backbuffer copy as active

Reported-by: Christoph Haag <haagch@frickel.club>
Reported-by: Andreas Reis <andreas.reis@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90968
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-13 13:19:40 +01:00
Chris Wilson 7e965a45d1 sna/dri2: Extend keepalives out to 100ms
Keep the swap cache around for 100ms, so only if the app drops below
10fps do we start having to recreate buffers on the fly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-13 13:09:14 +01:00
Chris Wilson a0af3d1856 sna/dri2: Extend keepalives to windowed swaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-13 13:09:14 +01:00
Chris Wilson 92a2773221 sna/dri2: Record fence bo by inspecting the dst_bo
As the backend may submit the batch as it completes the copy, we need to
look at what request the dst_bo is in rather than assuming it is the
next_request.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 14:44:23 +01:00
Chris Wilson dc9ee01d12 sna/dri2: Correct a couple of DBG statements for copy_region
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 14:26:56 +01:00
Chris Wilson d46c793663 sna/dri2: Remove the active_scanout flag when deleting the event
If we cancel the event, make sure we remove active_scanout marker.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12 14:03:27 +01:00
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