summaryrefslogtreecommitdiff
path: root/src/sna/sna_dri2.c
AgeCommit message (Collapse)Author
2015-11-05sna/dri2: Update TearFree recursion preventionChris Wilson
Some time past, we switched to a seperate boolean to mark when the shadow is no longer accessible due to recursion - but I missed an important check inside the vblank handler. Reported-by: Joe Peterson <joe@wildlava.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92751#c5 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-08sna/dri2: Update the swap_limit on each ScheduleSwapChris Wilson
In order to catch transitions between SwapInterval 0 and 1 in the middle of a flip sequence, we need to reset our swap_limit every time. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22sna/dri2: Stop trying to attach vblank events to pixmapsChris Wilson
Once again I tried to add an event to a pixmap, but only Windows carry the CRTC tracking information. Stop it. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22sna/dri2: Do not attempt to queue an off-screen vblank if the primary is offChris Wilson
Even though the kernel reports and error and we skip the queuing, we have information to avoid the roundtrip through the kernel. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22sna/dri2: Report an error if WaitMSC/GetMSC are called without any CRTCsChris Wilson
On a headless or hosted system, we do not have any CRTC on which to report or queue the vblank. Reporting a BadDrawable is evil (as clients never expect the error) but is better than crashing the Xserver. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22sna/dri2: Fix back buffer reuse for simple blitsChris Wilson
Along the blit swap path, we expect the buffer to not be scanout compatible and not have the same pitch as the front buffer. The reuse logic failed to take this into account! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Don't queue a vblank delay for a pixmap swapChris Wilson
Otherwise we raise assertions about trying to attach events to an illegal Window. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Look for potential flip targets when recreating backbuffersChris Wilson
As the window may be reparented during its swap lifetime, we may be able to recreate the backbuffer ready for flipping next swap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Extend the active buffer tracking to TearFreeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Remove stale active buffer assertChris Wilson
Since the DRI2BufferPtr destruction may be delayed, by the time we do free it, the state may no longer be accurate. (At this level at least, there is a later assertion to the same regard just as we think we are releasing the buffer.) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Consolidate vblank queueing into a couple of helpersChris Wilson
With the rigamorale of assertions, using the vblank is no longer trivial. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Also track the front bo as an active bufferChris Wilson
This so that we permanently exclude the active front buffer from the set of triple buffer replacements. References: https://bugs.freedesktop.org/show_bug.cgi?id=91658 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Initialise scratch.pScreen for copyingChris Wilson
Down one particular patch (overlapping render copies) the scratch.pScreen is dereferenced (to create a temporary Pixmap). Ensure that we populate it before hand. References: https://bugs.freedesktop.org/show_bug.cgi?id=91658 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Remove unused local variable in normal buildsChris Wilson
The local was only used in debug builds, so remove it to squash the compiler warning. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19sna/dri2: Move the pending swap from the buffer to the eventChris Wilson
To ease tracking of the next swap, stash it on the event (which is then reused) rather than the back buffer (which changes frequently). In addition, add debug flags and assertions to track event stages (such as making sure we do not decouple/free an event that we have sent a signal back to the client). References: https://bugs.freedesktop.org/show_bug.cgi?id=91658 References: https://bugs.freedesktop.org/show_bug.cgi?id=70461 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18sna/dri2: Transfer the pending back to the new back following the xchgChris Wilson
Third time lucky at getting the pending copy swap with the real back correct? References: https://bugs.freedesktop.org/show_bug.cgi?id=70461 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18sna/dri2: Do full exchanges of back/pending around deferred swapsChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=91658 References: https://bugs.freedesktop.org/show_bug.cgi?id=70461 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18sna/dri2: Immediately complete a stale swap if any are queuedChris Wilson
If we don't control the vblank for the window, we cannot use the vblank signal as it ends up being queued as well. References: https://bugs.freedesktop.org/show_bug.cgi?id=91658 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-17sna/dri2: Avoid pushing the triple buffer into the cache list twiceChris Wilson
A side effect of commit 4cea8037984c3d5e171be22710384f66660ca4c6 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Sat Aug 8 22:10:20 2015 +0100 sna/dri2: Restore caching of fullscreen triple buffers was that we discovered that we had been inserting the buffer into the cache list multiple times. Reported-by: Dan Doel <dan.doel@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=91658#c5 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-17sna/dri2: Check that the copy succeeds before associating the requestChris Wilson
If the DRI2 copy ends up on the CPU, then we will not have a GPU request for the operation. Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-16sna/dri2: Flush the pending flip when a client disappearsChris Wilson
If a client dies with a pending flip, we have to complete it so that the scanout matches the frontbuffer again. This requires one last flip following the client disapparance. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14sna/dri2: Use the primary CRTC for swap completion for offscreen WindowsChris Wilson
Letting GL clients run amok when offscreen (or when hidden) has unexpected UX behaviour. Instead we can elect to throttle them to the nearest CRTC and keep the desktop running smoothly. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-11sna/dri2: Keep the most-recent back buffer cache when reaping on idleChris Wilson
When the client misses a swap, we consider it idle and unlikely to swap again for a while. We try to take advantage of that and remove the old back buffers. But it is likely to swap again and so having some of that cache around would be advantageous. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08sna/dri2: Restore caching of fullscreen triple buffersChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08sna/dri2: Add the old buffer from a chain swap to the swap cacheChris Wilson
Rather than just discarding the old buffer, we want to add it to the swap cache and so hand it back to the client in the near future. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07sna/dri2: Make event chaining DBG clearerChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-24sna: Ensure that DRI2 buffers are created with a fenceChris Wilson
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-22sna/dri2: Take over the placeholder vblankChris Wilson
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-17sna/dri2: Fix vblank keepalive signallingChris Wilson
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-06-28sna/dri2: Discard backbuffer cache on Window resizeChris Wilson
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-27sna/dri2: Early return for empty DRI2CopyRegionChris Wilson
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-25sna/dri2: Remove overzealous assertionChris Wilson
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-25sna/dri2: Track original allocated size for copiesChris Wilson
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-24sna: Fix misspelling of "caching"Chris Wilson
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-23sna/dri2: Rearrange proxy tracking for single-CRTC flippingChris Wilson
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-22sna/dri2: Rearrange assert to avoid false-positiveChris Wilson
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-19sna/dri2: Stop leaking the cache entry when unable to reuse the old backbufferChris Wilson
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-19sna/dri2: Add a bit of paranoia required for a wedged GPUChris Wilson
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-16sna/dri2: Handle intermixing of exchanges and blitsChris Wilson
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 72d208a7f2f0e8f2d93483e535154f34a8a26d81 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-13sna/dri2: Destroy the right boChris Wilson
Fixes copy'n'paste error in commit d46c793663d2b1b5ffb923500111b7affa8402b6 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-13sna/dri2: SWAP_THROTTLE is also used for a delayed SWAPChris Wilson
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 dcb4d323ca19f86fbe0230378ac9035161a70f9e 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-13sna/dri2: Extend keepalives out to 100msChris Wilson
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-13sna/dri2: Extend keepalives to windowed swapsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12sna/dri2: Record fence bo by inspecting the dst_boChris Wilson
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-12sna/dri2: Correct a couple of DBG statements for copy_regionChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12sna/dri2: Remove the active_scanout flag when deleting the eventChris Wilson
If we cancel the event, make sure we remove active_scanout marker. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-12sna/dri2: Keep the async swap event alive until the copy is completeChris Wilson
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-12sna/dri2: Avoid touching shared gpu_bo->flush between dri2/dri3Chris Wilson
Not only is the pixmap->flush flag shared, but so is the lower level gpu_bo->flush flag, so further to commit 19d1e4ee19a93905d8d2496f856a18eb07bc23d6 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-12sna/dri2: Move the backbuffer cache from the event chain to the windowChris Wilson
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-12sna/dri2: Mark the pending backbuffer copy as activeChris Wilson
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>