summaryrefslogtreecommitdiff
path: root/src/sna/sna_dri2.c
AgeCommit message (Collapse)Author
2019-09-19sna: Annotate more fall throughsVille Syrjälä
Sprinkle fall through comments where needed. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-09-19sna: Replace fall through comments with standard formVille Syrjälä
gcc doesn't like extra stuff in the fall through comments. Replace them with the standard form. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-07-24sna/dri2: Relinquish back-buffer cache on change of scanout statusChris Wilson
If we change scanout status (i.e. whether or not this flip chain may be presented directly on the CRTC), throwaway the previous back buffer cache as those buffers may not be suitable for presentation. Reported-by: Jiri Slaby <jirislaby@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=111197 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-07-24sna/dri2: Skip asserting distinct front/back for stale swapsChris Wilson
If the backbuffer is stale (i.e. the client didn't call DRI2GetBuffers before swapping) the front/back bo may not be distinct. Move the assertion for a valid swap after the handling of a stale swap so that the assertions are more robust for a client error. References: https://bugs.freedesktop.org/show_bug.cgi?id=111197 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2019-07-24sna/dri2: Skip stale client swap before assertingChris Wilson
Check for a stale backbuffer (the client didn't call DRI2GetBuffers between DRI2SwapBuffers) before asserting so that we should be more resilient with asserts enabled for client errors. References: https://bugs.freedesktop.org/show_bug.cgi?id=111197 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-28sna/dri2: Clip application of damage to windowed swapbuffersChris Wilson
Since forever we have been passing region=NULL when doing a windowed swapbuffer on vblank, and using that to mark the entire pixmap as being damaged. For an uncomposited window, this is incorrect as it points to a clipped region of the ScreenPixmap and so we were marking the entire ScreenPixmap as being flushed, but only having operated on the windowed region. Instead pass along the clip extents if region is unset. References: https://bugs.freedesktop.org/show_bug.cgi?id=105720 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-08-22sna/dri2: Defer the drawable flushChris Wilson
Just flag the DRI2 flush to occur on the next callback flush, as per normal, instead of manually emitting the batch. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-07-28sna/dri2: Don't cache allocate-as-scanout flagChris Wilson
commit 74c1e45ed579 ("sna/dri2: Look for potential flip targets when recreating backbuffers") cached the decision on whether to create the new back buffer as a scanout target believing that we would always get notified when the DRI2 drawable size changed. However, this is only true inside a composited environment where we see a change in the Window's pixmap. In a bare environment, we either need to chain into the screen->ResizeWindow or check every time whether we think a new backbuffer should be pre-allocated for use on the scanout. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-06-07sna/dri2: Check active state on front/back before swapChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-25sna: Protect against RROutputPrimary being on a slaveChris Wilson
RandR allows the Primary output to belong to a slave GPU, i.e. with the condition that screen->primaryOutput->screen != screen. When we fallback to using the PrimaryOutput, we therefore have to check that the output belong to us before treating it as a sna_output. Reported-by: Peter Wu <peter@lekensteyn.nl> Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100382 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-03sna/dri2: Don't request a signal following a dead flip completionChris Wilson
If we do flip to restore the bo after the current Window is destroyed, we should not request that we send an event back to the client. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-03sna/dri2: Complete the final flip in a chain after the window is destroyedChris Wilson
When the pending flip is queued, we update all the Windows to use the next bo as their rendering target. However, that bo is not yet the scanout until the future flip is performed. If the current fullscreen Window is destroyed, we still must allow that flip to proceed or else the old bo is left on the scanout. And yes, this is indeed a fix to one of the debug patches that intended to detect the error causing #93844. Irony. Fixes: 7817949314a2 ("sna/dri2: Avoiding marking a pending-signal on a dead Drawable") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93844 Reported-by: Diego Viola <diego.viola@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-04sna/dri2: Assert signal is unset before settingChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-07sna/dri2: Fix busy engine checkChris Wilson
We should be using the kernel's exec-id and not our own index. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-17sna/dri2: Ensure the DRI pixmap is flushed before replyingChris Wilson
As we only ensure the flush before damage is sent, we also need to flush any CPU shadows before the reply to GetBuffers. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-12sna/dri2: Force the render to be flushed after DRI2CopyRegionChris Wilson
After doing the copy, we need to be sure that it is submitted to hardware before the reply is sent to the client. Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Fixes: 1f6dfc9df678 ("sna: Only flush GPU bo for a damage event") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-12sna/dri2: Force the render to be flushed before reporting new buffersChris Wilson
When filling out the set of buffers for the DRI2GetBuffers request, ensure that any pending rendering to them is flushed to hardware. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-11sna: Avoid recursing whilst waiting for events within TearFreeChris Wilson
Occasionally TearFree likes to flushing pending event to try and avoid a stall or a reallocation of a buffer. When it does so, we must avoid processing vblanks as they may cause an update to the frontbuffer re-entering the TearFree handler. Instead of deferring the obvious recursions until the next vblank, buffer the events temporarily whilst we wait inside TearFree. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-03sna/dri2: Flush rendering to a reused front buffer before reportingChris Wilson
When the client calls DRI2GetBuffers it expects the buffer to be coherent, that is all X rendering to it flushed to hardware for it to be able to read back. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-02sna: Split SHM and DRI flush trackingChris Wilson
Tracking SHM flushes precludes some of the optimisations we can make in future for tracking DRI flushes, so split the two paths. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-28sna/dri2: Only force the TearFree/swcursor hack when using TearFreeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-04sna: Restore local damage processing for TearFree/DRI2/swcursor earlyChris Wilson
We currently hack TearFree/DRI2/swcursor to avoid recursion from inside the SwapBuffers to handle the swcursor. This has the issue of a trailing cursor on the boundary of the DRI2 drawable, but prevents the explosion from swapping TearFree buffers from within the TearFree handler (i.e. recursion). This only has to apply to the damage processing before the swap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-28sna: Avoid recursion by testing shadow.waitChris Wilson
References: https://bugs.freedesktop.org/show_bug.cgi?id=96695 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22sna/dri2: Avoid chaining swaps across a mode changeChris Wilson
If the pixmap on a drawable changes between swap events, just queue a normal vblank event rather than chaining up. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-14sna/dri2: Refactor open-coded __kgem_bo_is_busyChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-14sna/dri2: Force blocking wait if vblank queue failsChris Wilson
Whilst waiting for the previous blit to complete, if we fail to queue the vblank to wake up on the next frame, block before replying the blit is complete. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-09sna/dri2: Enforce swap-limits on stale buffersChris Wilson
If the client sends an out-of-date swap request, first make sure that we don't cause an error by chasing a NULL CRTC and secondly force them to wait for a whole vblank before the next swap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07sna/dri2: Force consideration of the DRI2CopyRegion source as uncleanChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-30sna/dri2: Free the pending back buffer after useChris Wilson
The pending back buffer is only the pending copy, the actual info->back stores the client's view of the current back buffer which may be more recent than the pending copy. So store the current back buffer, swap in the pending to do the normal swap, then free the resultant back (which may have been exchanged with the front), before restoring the client's current back buffer. References: https://bugs.freedesktop.org/show_bug.cgi?id=95200 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-16sna: Relax tiling requirements to cope with kernel errorsChris Wilson
If the kernel can't accept our tiling requirements, don't fret until we actually need that fence! If we do, then we either stop tiling with the buffer or we use another. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-16sna/dri2: Flush outstanding signals when decoupling inflight eventsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-16sna/dri2: Release the dangling chain after decouplingChris Wilson
After releasing the list, we need to mark it as freed. Oversight from commit a11cbb6954f08edd0d8fb5eeca1debb289fdb9af Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Tue Mar 15 21:11:48 2016 +0000 sna/dri2: Cancel all pending events when the window is resized which reused the code for destroying the window (where priv->chain will not be accessed again afterwards). Reported-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-15sna/dri2: Prevent starting a swap chain for a decoupled PixmapChris Wilson
When a Window is resized, a new Pixmap is attached to the Window and the DRI2 buffers invalidated. However, the client may have requested a swap before it is notified of the resize and so we have to discard the stale swap. In doing so, we do not want to start a swap chain as it references the wrong frontbuffer and causes dire confusion when we start swapping for real. Reported-by: Jiri Slaby <jirislaby@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c131 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-15sna/dri2: Cancel all pending events when the window is resizedChris Wilson
Kill the events early for simplicity. References: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c138 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-15sna/dri2: Rearrange "impossible" paths to avoid an assertChris Wilson
Ensure that we don't try and double-free the decoupled vblank event by checking whether it is still pending first. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-24sna/dri2: Add active-scanout tracking to single CRTC flipsChris Wilson
When we do a partial flip (one CRTC of many) we install a fake frontbuffer for the window. This needs to be included in the active-scanout tracking like a normal frontbuffer to avoid being recycled too early. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-23sna/dri2: Reset front pointer on frame event across a modesetChris Wilson
If the root window's pixmap is changed (e.g. to resizing the framebuffer) then an outstanding flip becomes invalid. The invalid flip is marked as having a stale front, and that triggers an assertion if the user then tries to schedule flip before the pending flip event is processed. References: https://bugs.freedesktop.org/show_bug.cgi?id=9425 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-23sna/dri2: Ensure the flipqueue is drained on pageflip failureChris Wilson
If we fail to queue a flip for a CRTC, we attempt to restore the original mode. However, if the failure is on a second CRTC, the queued flip on the first will still complete causing us to process the event twice. References: https://bugs.freedesktop.org/show_bug.cgi?id=94250 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-02-13sna/dri2: Initialize priv->cache_sizeChris Wilson
Silence a valgrind warning, though it should have no runtime impace. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-27sna/dri2: Avoiding marking a pending-signal on a dead DrawableChris Wilson
If the Drawable is gone, we cannot send it a frame-complete signal, and in particular we cannot continue the pending flip-chain. References: https://bugs.freedesktop.org/show_bug.cgi?id=93844 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-25sna/dri2: Guard signalling swap completion after a FLIPChris Wilson
Before sending the frame swap complete signal after a FLIP, make sure the client didn't die in the meantime. Reported-by: Diego Viola <diego.viola@gmail.com> References: https://bugs.freedesktop.org/show_bug.cgi?id=93844 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-22sna/dri2: Tweak enginement placement on inherited render targetsChris Wilson
The main motivation is try and isolate from an upcoming API change in busy-ioctl, but is also based on the observation that we now only care about write-synchronisation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-19sna/dri2: Catch setting signal=true when we have no drawableChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-06sna/dri2: Ignore pending SwapComplete events when the window is destroyedChris Wilson
Since we need the drawable to call DRI2SwapComplete/DRI2WakeClient, if the window is destroyed that becomes inoperable (as we are called late in the chain). Let's hope the client isn't blocked. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-12-02sna/dri2: Emit the outstanding signal when eliding a swapChris Wilson
When we do the exchange for the next swap, we should emit any pending completion signal for the previous buffer. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-13sna/dri2: Don't try and destroy the NULL pointerChris Wilson
From the previous commit, we have to check for NULL before the dereference. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-13sna/dri2: Drop the reference on the fence when completeChris Wilson
Fixes regression from commit 8d9e496670f48b4eec64dfe1bcedb49793cf3073 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Wed Jul 22 11:14:01 2015 +0100 sna/dri2: Take over the placeholder vblank After noting the fence was complete, we would clear it. But I forgot that we actually held a reference on to it, and so we would leak the 64k batch, and starve the system of available memory in about 18 minutes of SwapBuffers. Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92911 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-10sna/dri2: Flip logic for shadow_waitChris Wilson
Simply sedding the name over to the new variable was insufficient as it is now the logical opposite. Fixes commit 64dbcdd4de1fe1941196265d054272d7d93e5d59 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Tue Nov 10 09:56:07 2015 +0000 sna/dri2: Add a specific recursion indicator for TearFree/DRI2 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-10sna/dri2: Add a specific recursion indicator for TearFree/DRI2Chris Wilson
Avoid conflating the DRI3/Present flag for controlling TearFree by adding a separate flag to indicate when we are waiting inside the TearFree shadow handler to avoid recursion in DRI2. Reported-by: Andreas Reis <andreas.reis@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92873 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-11-06sna/dri2: Protect against a new possible recursion during TearFreeChris Wilson
With the introduction of a new SwapEvent that may trigger a copy, we need to add another check for recursion from a TearFree flip event. References: https://bugs.freedesktop.org/show_bug.cgi?id=92751#c14 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>