Commit Graph

8365 Commits

Author SHA1 Message Date
Chris Wilson 7026ffe560 sna: Support TearFree on slaved outputs
By always forcing the shadow intermediatory, we can enable TearFree even
ona slave scanout.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 17:04:02 +01:00
Chris Wilson 3140d72826 backlight: Prevent dereference of potential NULL argv
Adam Sampson spotted that

"It's possible (but not very sensible) to exec a program with an empty
argument list, so argv[0] is not necessarily a valid pointer. For
example:

$ cat exec0.c

int main(int argc, char *argv[]) {
    char *empty[1] = { NULL };
    execvp(argv[1], empty);
    perror("execvp");
    return 1;
}
$ ./exec0 /usr/libexec/xf86-video-intel-backlight-helper
Usage: (null) <iface>
"

He sensibly suggested that we hardcode the program name to avoid the
NULL dereference. Being the paranoid type, we should also be careful not
to write to any file descriptors outside of our control (i.e. stderr),
so disable the messages unless we are debugging.

Reported-by: Adam Sampson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 16:14:16 +01:00
Chris Wilson bcd09ff6eb sna: Assert that we never attempt to flip the slave scanout
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 15:23:46 +01:00
Chris Wilson 129656e4a8 sna/dri2: Disable SwapLimit buffers with buggy prime implementations
If there is a GPU screen, we have to assume that the DRI2 code may pass
around the wrong pointers to ReuseBufferNotify until the fix is
released:

commit 4d92fab39c4225e89f2d157a1f559cb0618a6eaa
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 18 11:14:43 2014 +0100

    dri2: Use the PrimeScreen when creating/reusing buffers

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 15:20:05 +01:00
Chris Wilson a45b2ea11c sna: Handle rotated slaved scanouts
As per the usual handling of rotated scanouts with unsupported
rotations, we stage the drawing onto a backbuffer then rotate onto the
crtc later. The difference here is that we must read the contents from
the master pixmap rather than our own screen pixmap.

Spotted was looking at slaved scanouts mistakenly setting the CRTC
transformed flag.

Reported-by: Tomas Pruzina <pruzinat@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81383
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 15:20:05 +01:00
Chris Wilson 339c9dd0d5 sna: Add missing DBG parameters
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 12:54:47 +01:00
Chris Wilson 62f62f70ed sna: Avoid confusing failure to flip and flipping zero CRTC
During the present unflip path we blindly try to restore the original
mode after a flip failure. However, it confuses flipping zero CRTC with
a genuine failure. This has the result of undoing a DPMS change (e.g.
xset dpms force dpms) under a DRI3 compositor.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81456
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 10:06:06 +01:00
Chris Wilson 95f08c171e sna: Busy-wait for the kernel to catch up when flipping
If the kernel reports that it is busy, it has not yet finished
processing a pending flip and we have multiple CRTC queued, just wait
for the kernel to clear its backlog before submitting the next flip. On
the other hand, if we can just overwrite the pending flip results.
However, the EBUSY may actually be a genuine report by the kernel of an
error, so check for an invalid CRTC first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 09:30:32 +01:00
Chris Wilson 0a9d3dd8c8 sna: Silence valgrind when reading plane properties
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 09:30:31 +01:00
Chris Wilson 0a57b55f0f sna: Remove extraneous function wrapping
Since we only have the single callsite for do_page_flip, the wrapper is
not adding any meaningful information.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 09:30:30 +01:00
Chris Wilson f33d44f41e sna: And remove new bogus assertion
We assert that damage is valid as we delete the Pixmap, and so we cannot
assert that the Pixmap is still valid itself.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-16 12:53:02 +01:00
Chris Wilson dd9df24eb5 sna: Make the damage check more verbose
Print out the pixmap number and the damage extents for when the
assertion fails.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-16 08:13:35 +01:00
Chris Wilson 34ada63118 sna/gen2+: Remove assertion on draw->type for fills
I overlooked the tiling-fill path passing down a temporary DrawableRec
into the fill_boxes callback - invalidating the assertion.

Fixes regression from
commit 43176b9bfa
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 30 21:01:11 2014 +0100

    sna/dri2: Pass around the correct DrawableRec for sampling from the foriegn bo

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70461#c62
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-16 07:19:03 +01:00
Chris Wilson 4422b18542 sna: Use a stricter test for determining CRTC off before updating the cursor
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11 22:23:55 +01:00
Chris Wilson e0523ade28 sna: Reduce reflections onto rotations
In order to support a wider range of rotation/reflections, perform a
simple reduction of the requested rotation first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11 08:06:02 +01:00
Chris Wilson 251bcc32ee configure: Provide a poor man's replacement for getline()
uClibc is one such library that doesn't implement getline()

Reported-by: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-11 08:06:02 +01:00
Chris Wilson 8587b2fff2 sna: Rewrite rotation setup on top of universal drm planes
The kernel interface has changed slightly since the early proposals. Now
the rotation property is only on the plane and so we have to lookup the
primary prime as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-08 14:18:10 +01:00
Chris Wilson f24a9d3352 sna: Fix a couple of DBG messages
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-08 13:07:11 +01:00
Chris Wilson 790e7492bd test/lowlevel-blt-bench: Add common PDF operators
Applications are starting to use PDF operators, so far I have spotted
multiply, dodge and lighten.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-08 13:07:11 +01:00
Matthieu Herrb 8fa22964f6 backlight: Fix security issues in handling of the interface path name.
- don't allow '/' in the interface name to avoid escaping the /sys
  hierarchy
- check snprintf() return value for overflow.

Problems reported by  Adam Sampson. Thanks.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-04 20:33:29 +01:00
Chris Wilson 6a64a3ae55 sna: Discard operations to either CPU or GPU bo when overwriting with RenderRectangles
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 13:04:02 +01:00
Chris Wilson 2c8ab77fcd sna: Tweak number of threads for short areas
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 12:43:55 +01:00
Chris Wilson d3ccb3f3b2 sna: Convert a clear tile into a solid fill
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 12:39:01 +01:00
Chris Wilson 2e0763088f sna: Fix typo s/num_threads/max_threads/
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 12:26:43 +01:00
Chris Wilson 04ddea075e sna: Do a quirk early check for short areas before threading
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 12:19:25 +01:00
Chris Wilson 228a22fe8d sna: Disable use of threaded compositor when using threaded renderer
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 12:19:25 +01:00
Chris Wilson 64bcb91f58 sna: Utilise existing cached upload for promoting to GPU bo
If we already have a buffer that represents the data on the GPU, we can
simply use that when we need to promote the pixmap onto the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 11:25:28 +01:00
Chris Wilson 821ef20b27 sna: Promote tile pixmaps to GPU when reused
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 10:44:04 +01:00
Chris Wilson c6407f7380 sna/gen8: Disable the unaligned check
Note sure if this is strictly required -- but at the moment it fails for
1x1R solids, causing us to skip glyphs. The simulator doesn't complain,
so just skip the check for now.

Reported-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 10:14:54 +01:00
Chris Wilson e64d14d7bc sna: Tighten assertions for using upload proxies concurrently with CPU reads
After relaxing some of the rules on when to discard the upload proxies,
we also need to relax some of the complementary asserts.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 09:55:04 +01:00
Chris Wilson 4e12d5ca26 sna: Prevent creating a GPU bo for an inplace read
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-04 09:48:53 +01:00
Chris Wilson 18ae7722db sna: Wrap xf86DPMSSet
We need to wrap xf86DPMSSet() so that we can reintialize our bookkeeping
and auxiliary planes after disabling/re-enabling CRTC during DPMS
operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-03 18:18:04 +00:00
Chris Wilson 57d0cc82d8 sna: Clear the cursor reference from the CRTC if the update fails
This should allow it to be restored correctly the next time it gets
shown.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-03 09:11:32 +01:00
Chris Wilson 24c9bac7eb sna: Limit the size of the tiling object to be smaller than either the originals
When we tile, we do so in order to fit an operation involving two
objects larger than the aperture. If we then choose an intermediate
tiling object that is larger than either of those two, the error will
persist and we will be forced to recuse.

In the worst case, this will provide an upper bound to the recursion.

Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-02 21:23:17 +01:00
Chris Wilson 710bb0d37c test: Create separate SHM segments for ref/out
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-02 12:55:34 +01:00
Chris Wilson 87e659b887 sna: Use the threaded compositor for picture conversions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-02 12:47:14 +01:00
Chris Wilson 2bf36d54eb sna/gen6+: Tweak consideration of compositing on BLT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-02 12:47:14 +01:00
Chris Wilson 732cd11cf0 sna: Fix typo in LinearFramebuffer handling
Eeek, when not using LinearFramebuffer we still want to create the GPU
bo: s/,/;/

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01 17:55:32 +01:00
Chris Wilson b5fa463b90 sna: Correct migration flags for initial scanout creation
We want to preserve any contents preloaded (not that there should be
any...)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01 17:54:29 +01:00
Chris Wilson b88866aa5e sna/dri2: Add a DBG option to select copy method
Often when debugging it is useful to force either use of the BLT or 3D
pipelines for copies.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01 17:00:25 +01:00
Chris Wilson a10781b70f sna: Enforce LinearFramebuffer option
This option should only be used for compatibility. Previously this was
done at a high level, this changes it to enforce the tiling as we apply
the CRTC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01 16:52:35 +01:00
Chris Wilson 75745cd586 sna/dri2: Use CPU fallback if possible
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01 14:31:32 +01:00
Chris Wilson 02715490db sna/dri2: Set depth/bpp on scratch DrawableRec
We need to initialise both depth and bitsPerPixel on the drawable struct
we pass around as they are used for selecting for the format when
copying.

Reported-by: Vedran Rodic <vrodic@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-01 13:15:44 +01:00
Damien Lespiau e6e5330857 intel: Use the i845 info structure for INTEL_I845G_IDS()
I assume the intention was to provide a different structure for each of
the gen 2 devices.

This doesn't change anything really.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2014-06-30 21:20:27 +01:00
Chris Wilson e1c3e6ce79 sna: Add DBG breadcrumbs before flushes in BLT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 21:18:58 +01:00
Chris Wilson 43176b9bfa sna/dri2: Pass around the correct DrawableRec for sampling from the foriegn bo
One day, we will move the width/height/bpp to the bo itself...

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 21:18:43 +01:00
Chris Wilson 6c3399715e sna/dri2: Apply the paraniod buffer clip in the correct coordinate system
We need to only clip to the extents of the copy in the buffer space -
which implies that we need to translate the region into that space before
doing the clip.

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 16:38:29 +01:00
Chris Wilson c25fa2216a sna: Tweak preference for small GPU bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 15:44:04 +01:00
Chris Wilson 19a62e088f test/lowlevel-blt-bench: Update progress more frequently
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 15:43:57 +01:00
Chris Wilson fab3bc70a4 sna: Reduce assertion when using asynchronous CPU access
If we are not actually accessing the memory through the pointer, we do
not care if it not currently coherent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 11:05:33 +01:00