Commit Graph

9028 Commits

Author SHA1 Message Date
Chris Wilson 928ff25430 tools: Add rudimentary dri3info
A simple tool just to check if the target Xserver offers dri3.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 17:09:55 +00:00
Chris Wilson f7f68d5079 sna: Convert pixel values into ARGB values for render operations
When converting from a Pixmap into a Solid, we need to remember to
convert from the stored pixel format into the a8r8g8b8 used by the solid
fill.

This was exposed by

commit aef2f99d05
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Feb 3 21:31:16 2015 +0000

    sna: Convert CompositeRectangles ADD white to SRC white

but is a regression from

commit 31a4c7bc13 [2.99.912]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Apr 4 10:46:48 2014 +0100

    sna/gen2+: Replace composite sources with solids where possible

Reported-by: andrew@atomspring.com
Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89030
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 10:38:50 +00:00
Chris Wilson 733a88bda7 sna: Tidy composite operator reduction for CompositeRectangles
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 10:36:23 +00:00
Chris Wilson 111847108d sna: Match more classes of opaque composite masks
If we apply the mask clipping first, we can be sure that the samples are
all from an untransformed mask and so we can check the is-clear? hint.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 10:36:23 +00:00
Chris Wilson 5b033d638b sna: Avoid accessing past the end of the clip boxes for incremental clipping
During incremental clipping of the trapezoids, we can assign the end
BoxPtr to begin, and so we should be careful not to dereference that
pointer (as it points passed the end of the clip boxes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08 22:13:35 +00:00
Chris Wilson 357a798156 sna: Check against last clip box (not past the end of the boxes)
The end BoxPtr actually points to one past the end of the clip boxes, so
in order to inspect whether the line is after the clip region, we want
to look at the last box, i.e. the box before. We also only want to
ignore the clip if we do not intersect at all, otherwise we need to find
the start of the clip row.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08 22:01:09 +00:00
Chris Wilson 0c2ff5532c sna/present: Fallback to first available CRTC if none overlap Window
In order to handle PRIME offscreen Windows nicely, tie their
presentation into the Primary CRTC (if available).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-08 15:53:56 +00:00
Chris Wilson bc8c161801 sna/present: Always store sna backpointer in vblank event closure
This is primarily defensive paranoia in case we see multiple unflip
requests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 21:08:38 +00:00
Chris Wilson ae05f74e4e sna/present: Try to use async flips for unflip
If possible, we want the restoration of the Screen Pixmap to be fast,
and so we want to preferably use the immediate asynchronous flip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 21:08:38 +00:00
Chris Wilson 6e3f45e028 sna: Use PrimaryOutput as CRTC source when drawable is offscreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 21:08:38 +00:00
Chris Wilson 26ba2ba6e7 uxa/present: Fix flip_count for aborting on failed flip request
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-07 00:04:55 +00:00
Chris Wilson c7517c4fe2 sna/present: Restrict pending flip check to enqueueing
Present checks for a flip-compatible Pixmap prior to deciding whether to
queue the flip after a pending flip, and at that point we do not want to
reject a potential flip due to outstanding flips. That is only of
restriction only applies when we request the kernel to perform the flip,
so more the check to the corresponding position.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06 22:18:43 +00:00
Chris Wilson 934733e7c7 sna: Separate per-CRTC client bo from the TearFree cache
Using the same member as both an override and a cache in different
modes leads unsurprisingly to confusion.

Fixes regression from
commit 3cfde9f043
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 13 13:50:08 2015 +0000

    sna: Only instantiate the frontbuffer on the GPU if used

Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89007
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06 21:08:51 +00:00
Chris Wilson 5ed8368772 sna/trapezoids: Use incremental region clipping for spans
Within a span, we have the advantage of knowing that we only need to
intersect one box with the clip region, and that box has monotonically
increasing y. This avoid having to compute RegionIntersect for every
span element which was very slow (e.g. libreoffice).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06 21:07:50 +00:00
Chris Wilson e0d9953e3b sna: Only do COW creation on read-only migration if forced
For reads, we can use the existing clone -- except if the migration is
required to return a unique GPU handle to the pixmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06 12:27:48 +00:00
Chris Wilson 4c9af31477 uxa/present: Do flip returns 0 on failure
Oops, inverted error handling lead to use-after-free and calamity.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-06 08:05:15 +00:00
Chris Wilson ee42e106fe test: Tighten present checks to catch CRTC interchange bug in a single pass
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05 13:41:13 +00:00
Chris Wilson ca71ee0685 uxa/present: Do not allow the unflip to fail
As we cannot propagate the failure for unflipping back to the caller, we
must ensure that the CRTCs are correctly reset if the attempt to flip
back to normality fails.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05 08:50:10 +00:00
Chris Wilson cec34132a7 sna: Add some DBG for why a DoCopy might be skipped
This captures a bug in transitioning from gdm to gnome-shell where the
present_unflip copy back onto the Screen Pixmap fails.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05 08:34:39 +00:00
Chris Wilson 7dd16e5684 sna: Clear the resized framebuffer if wedged
We always try to make sure the scanout is initialised before use, but if
the GPU is wedged we need to fallback to use the CPU to do the clears.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05 08:34:39 +00:00
Chris Wilson f93aab9bbc sna/present: Queue the unflip if we have flips outstanding
Rather than synchronously wait in the unflip for the pageflips to complete
by forcing the modeset, try to queue the unflip to happen after the pending
flip completes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-05 08:34:39 +00:00
Chris Wilson 6ba3bd9dfd sna: Use local defines for compilation on older distributions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 12:12:13 +00:00
Chris Wilson c6dd23ce11 sna: Always mark the virtual outputs as disconnected until used
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 11:13:19 +00:00
Chris Wilson 5fad8d8527 sna: Mark initial output status as unknown
References: https://bugs.freedesktop.org/show_bug.cgi?id=88960
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 11:07:19 +00:00
Chris Wilson d7bcb7bcbf sna/trapezoids: Amalgamate adjacent lines
If we have two scanlines with identical extents and coverage, we can
amalgamate them into a set of multi-row boxes. For simplicity, we only
compare with the last box (assuming that the majority of such cases are
"rounded-rectangles" where we have a large vertical area with no
variation and can coalesce into a single box). This operates as a second
pass to the scanline converter itself coalescing pure-vertical regions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 10:44:33 +00:00
Chris Wilson db629a3834 Allow runtime selection between DRI levels
Rather than imposing a maximum DRI level at compile time by compiling
out unwanted protocol handlers, default to limiting it at runtime so
that we can switch between any level.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-04 09:55:54 +00:00
Chris Wilson aef2f99d05 sna: Convert CompositeRectangles ADD white to SRC white
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-03 21:31:16 +00:00
Chris Wilson 3855a728e5 sna: Always restore the scanout on DPMS on
As we may exchange the frontbuffer whilst the outputs are hidden (DPMS
off), when we turn them back on, unless we force the CRTCs to be
updated, we may end up simply showing a stale scanout buffer not the
current frontbuffer. If the two are same, it will just be a kernel
no-op.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88826
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-03 20:26:41 +00:00
Chris Wilson 70cb682662 uxa/dri2: Recreate the triple buffer across a mode change
If the mode changes whilst we have a pending flip, we may reinstall the
previous scanout buffer as our next back buffer despite it no longer
matching.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-02 10:03:33 +00:00
Chris Wilson 6d2754b190 Unify Option "DRI" parsing
Allow Option "DRI" "[23]" to also work with UXA.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31 21:46:09 +00:00
Chris Wilson dac01d0839 sna: Mark the bo as clean after the kernel reports it idle
After querying for an idle bo and retiring the associated requests, we
must be careful not to confuse ourselves with exported bo becoming busy
again.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c83
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31 10:55:44 +00:00
Chris Wilson 5edab91b1e intel: Try to load one AccelMethod if the .conf doesn't match
If you mistype or make the wrong selection in the AccelMethod override,
you can end up with a non-booting system, so lets always try to start
something!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31 01:30:09 +00:00
Chris Wilson 6db906ea81 uxa/dri2: Reimplement triple buffer support
Since xorg-server-1.12.0, Xorg has supported adjusting the client swap
limits allowing us the implemention of triple buffered flipping with
accurate event timestamps. Given that the current implemention has an
issue tracking the right GEM name across composite unredirection, it is
an approximate juncture to tackle both bugs.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=742911#c1
Testcase: dri2-race + gnome-shell
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31 01:27:49 +00:00
Chris Wilson 102a091f5a sna/dri2: Rearrange asserts for greater coverage
Always check that the reused DRI2Buffer matches the associated name, and
not just for back buffers of a window.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-31 00:21:29 +00:00
Chris Wilson e427bb4e41 test/dri2-race: Race against CloseDisplay and also test WaitMSC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-30 14:49:02 +00:00
Chris Wilson d909c46074 uxa: Fix error handling for failed pageflips
Lots of issues found when trying dri2-race, mostly resulting from
queueing too many flips at one - which itself is buggy. However, we
crashed whilst trying to recover from the kernel reporting the error.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-30 13:24:42 +00:00
Chris Wilson c2f30a539c uxa/dri2: Make vblank/flip handlers static
These are no longer called directly from outside intel_dri.c and so we
can make them static.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-30 13:12:20 +00:00
Chris Wilson fa5a8c61d1 uxa/dri2: Reset swap_info->type after a failed flip submission
As we set the type prior to attempting to queue a flip, we need to then
reset the type if that attempt fails and we need to fall back to a
vblank handler.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-30 13:10:55 +00:00
Chris Wilson c0610c76b7 sna/dri2: Smooth out delivery of triple buffer SwapCompletions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 23:56:06 +00:00
Chris Wilson dc51886c0c sna/dri2: Fix use of stale flip_pending after removing window
Testcase: dri2-race
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 23:55:19 +00:00
Chris Wilson 1030705cdc sna/dri2: Fix interoperation between keepalive and fake-triple-buffering
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 23:11:49 +00:00
Chris Wilson 58fe408978 sna/dri2: Keep the per-drawable swap cache alive for 50ms
The purpose is to keep the recent history of buffers for a DRI client
for tracking the relevant age.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-29 16:40:15 +00:00
Chris Wilson 2e7ae76038 test/dri2: Use xcb for more accurate timing of SwapBuffers
To do SwapBuffers correctly requires a Swap/Get buffers combination, and
this is easiest using xcb rather than xlib.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-28 11:46:43 +00:00
Chris Wilson 6f6190abcf sna: Clear the per-crtc shadow buffer if they are clipped
Before we present a buffer on the CRTC, we try to make sure it is
initialised with the current contents. However, if it is larger than the
screen then not all the buffer may be initialised and so we need to
clear it first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-28 11:24:09 +00:00
Chris Wilson 4bbd102367 sna/dri2: Check for comparable back/front pitches more carefully
Suppose for a moment that we don't have a DRI2Buffer associated with the
Drawable just yet... This could happen after a Composite redirect as the
front buffer may created (and so associated with the new Pixmap) after
the back buffer is recreated.

Reported-by: Tomas Pruzina <pruzinat@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88814
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-27 12:01:12 +00:00
Chris Wilson b8d52b0edd sna: Log maximum number of CPU threads
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 21:40:20 +00:00
Chris Wilson d2b7d78064 sna/dri2: Use existing busy state if semaphores are disabled
Undo d16ac1f30b (sna/dri2: Prefer to use normal selection criteria for
CopyRegion on small GT) to keep on the current ring as the external bo
if semaphores are disabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 21:31:44 +00:00
Chris Wilson 64e9c79017 legacy/i810: Expand mask to match unsigned long
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 13:18:56 +00:00
Chris Wilson 33f7d5e428 sna: Expand mask to match uintptr_t
Let's make sure we mask all the uintptr_t bits.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-26 13:10:21 +00:00
Patrick Welche 53e825d6cf configure.ac: pwd doesn't take an argument
bash built-in doesn't give an error, but real pwd does, and the
argument is unnecessary.

Signed-off-by: Patrick Welche <prlw1@cam.ac.uk>
2015-01-26 12:47:03 +00:00