Commit Graph

8390 Commits

Author SHA1 Message Date
Chris Wilson f68d363a23 backlight: Remove unused 'original' member from structure
This was accidentally added with no users.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 22:12:33 +01:00
Chris Wilson 5935c93ce7 sna: Keep the backlight at the same brightness when switching away
Before VT switching, we disable all the outputs. This has the
side-effect of disabling the backlight, but commonly the console does
not set the backlight brightness itself and so we re-enable the
backlight on its behalf. Rather than set the backlight to max
brightness, reset it to the last user value, as maximum can be very
bright!

Reported-by: Mark Kettenis <mark.kettenis@xs4all.nl
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 21:59:20 +01:00
Chris Wilson f9e7ac7db7 backlight: Set structure to safe values when not initialised
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 21:58:05 +01:00
Chris Wilson bc50dff844 sna: Disable rendering with the DRM device whilst away from VT
As root, X gets away with many things, including submitting commands to
the DRM device whilst it is no longer authorised (i.e. when it has
relinquished master to another client across a VT switch). In the
non-root future, if we attempt to use the device whilst unauthorized the
rendering will be lost and we will mark the device as unusable. So flush
our render queue to the device around a VT switch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 21:43:02 +01:00
Chris Wilson 8d95e90b7b 2.99.914 snapshot 2014-07-23 16:43:38 +01:00
Chris Wilson 57f0e65d51 sna/dri2: Compile fix for old xorg/dri2
We have to do conditional compilation as we touch structure members that
may not exist in older Xserver headers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 16:43:38 +01:00
Chris Wilson 4ed0937640 Add automake magic required for libobj/
So libobj/ wasn't included in the tarball, and nor was the compatability
functions being added to the driver when they were needed. The oddity is
that using the ./configure script (and thus make distcheck) succeeds. It
was only when 'autoreconf -fi' was run was the first error encoutered.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Tobias Klausmann
2014-07-23 16:02:47 +01:00
Chris Wilson dcf9ce4a9f Fix compile failure on old Xorg with XF86_ALLOCATE_GPU_SCREEN
Sigh, a late fix was not compile checked against xorg-1.7.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 15:44:21 +01:00
Chris Wilson 1c5e20716f 2.99.913 snapshot 2014-07-23 14:45:19 +01:00
Chris Wilson d242965979 sna: Skip performing an async flip after fixup
After the first async failure and we fix up the CRTC, ordinary we queue
a no-op flip in order to queue the event. For async flips, we do not
want that event so just skip the flip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 14:45:19 +01:00
Chris Wilson 4153d4b430 sna/dri2: Tidy freeing the queued frame events
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 13:55:39 +01:00
Chris Wilson f2b2b6eda0 test/dri2: Use the right device node
Use the device node as instructed by Xorg.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 13:55:39 +01:00
Chris Wilson 65c2376730 sna: Add a DBG message for slave damage propagation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 13:55:39 +01:00
Chris Wilson 95c059b330 sna: Reorder disabling scanout pixmap when updating slave
The assertion caught that we would unregister an invalid drawable on
older Xorg.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 11:04:54 +01:00
Chris Wilson d6830190bc sna: Disable all outputs when initializing as a slaved output provider
When we are constructed as a slaved device, we need to disable all
outputs or else they are not correctly hooked into the master device
upon startup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 11:04:54 +01:00
Chris Wilson 70868c7aa8 sna/dri2: Recreate buffer in reuse rather than force recreate
By marking the buffer->attachment as invalid we forced the recreation of
the buffer on the next DRI2GetBuffers. The only small problem with that
was that the client didn't always immediately call DRI2GetBuffers after
the invalidation - and if they did a DRI2CopyRegion with its stale
buffers the unfound attachment would generate a BadValue and kill the
client. So instead of messing around with the attachment, explicitly
recreate the buffer if we attempt to reuse a buffer of the wrong size.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23 08:43:02 +01:00
Chris Wilson aa5351dbbe sna: Ensure errno is set after failure before reporting a modeset failure
A few paths we report a sanity check failure which do not set errno, but
we then print out the errno as part of our message to the user. Set it
to a sane value in those cases.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-22 09:41:24 +01:00
Chris Wilson feba651db8 sna: Remove %# from DBG messages
LogF doesn't support the 0x-prefix instruction.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-22 09:15:43 +01:00
Chris Wilson 13e20c7f61 sna: Assert that we do not overwrite an earlier COW entry
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-22 09:00:46 +01:00
Chris Wilson d8b0a8fa03 sna/dri3: Don't forget to add SHM pixmaps to the list of exported DRI3 bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-22 09:00:46 +01:00
Chris Wilson bfccacf745 sna/video: Bump the maximum size for sprites
A sprite plane is limited by the display engine who's maximum resolution
has increased since the 2kx2k limitations of 8xx, so let's set it
correctly to the reported maximum CRTC size (since we have no individual
query for maximum sprite plane sizes).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-20 07:34:16 +01:00
Chris Wilson 9bb2818a7d dri3-test: Print line number for shm failures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-20 07:28:34 +01:00
Chris Wilson 4ae346e764 configure: Double check xinerama's headers
Having the pkgconfig present doesn't always necessarily imply the
headers are installed correctly - just fail over gracefully for xinerama
and intel-virtual-output

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-18 07:38:59 +01:00
Chris Wilson fac6845820 sna/dri2: Protect compsiteext.h include with build check
We shouldn't include calls to the composite extension if it has not been
built.

Reported-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-18 07:37:20 +01:00
Chris Wilson 923e098f5f sna: Fix compilation with older Xorg
sna_display.c: In function 'sna_crtc_disable_shadow':
sna_display.c:1375:39: error: dereferencing pointer to incomplete type
   DamageUnregister(&crtc->slave_damage->drawable, crtc->slave_damage);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 17:10:39 +01:00
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