Commit Graph

7788 Commits

Author SHA1 Message Date
Chris Wilson 0075c90d31 sna/gen2: Fix alpha blending with 8bit destination surfaces
On gen2 (like gen3), 8-bit destination surfaces are read into the Green
channel (and written to from the Green channel). Therefore the expected
alpha blending must instead be converted to colour blending.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75818
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-10 14:54:53 +00:00
Chris Wilson f0b70ca660 sna: Unroll finding bbox of points
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-10 14:54:38 +00:00
Chris Wilson 928453b1bc sna: Emit points using the BLT primitive when appropriate
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-10 14:54:38 +00:00
Chris Wilson a2b4f2657f sna/gen8: Correct MOCS settings for render targets
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-05 09:51:24 +00:00
Chris Wilson a7123410a3 NEWS: Fix dates for 2014
It has come to my attention that between December and January is
traditionally a New Year.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-03 10:12:11 +00:00
Chris Wilson a3bfb4d3c1 sna: Reorder writes during thread task decoupling
So that the lockless reads do not see the task complete signal prior to
marking the task as successful. Otherwise, we falsely detect that the
thread trapped a signal and kill them all.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-28 08:50:06 +00:00
Chris Wilson 37d080929a sna: Limit the WHOLE_HINT to large PutImages
The goal here is to predict when we are uploading an entire image though
multiple PutImage requests. If the image is small enough, then the
PutImage will be contained within a single request and the damage
tracking will be accurate.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-27 08:37:44 +00:00
Chris Wilson 27ac9f574f sna: Avoid promoting region-to-whole migration and discarding damage
Fixes regression from
commit 1de1104064
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Feb 21 22:43:04 2014 +0000

    sna: Use a hint to do whole image uploads inplace

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75549
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-27 08:33:52 +00:00
Chris Wilson ff49944928 sna: Tighten assertion for tiling blt fallbacks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:53:07 +00:00
Chris Wilson cf4683209d sna/gen6+: Add missing DBG argument
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:53:07 +00:00
Chris Wilson a4d23ff3b2 sna: Add DBG for why trapezoids may be preferred inplace
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:53:07 +00:00
Chris Wilson d316d14283 sna: Include mono/precise hints in trapezoids DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:53:07 +00:00
Chris Wilson 2a144baec8 sna: Add a little more DBG to watch the flow of allocated bo sizes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:53:07 +00:00
Chris Wilson 921e9aff3f sna: Avoid signed overflow when printing allocated bytes in DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:53:06 +00:00
Chris Wilson b0b6c043c9 sna: Cleanup caches if execbuf fails
One of the failure modes for execbuf is running out of memory - often
this is reported as a false ENOSPC (thanks shmemfs!). Because of this,
we should try to resubmit after we purge our caches.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-23 07:52:02 +00:00
Chris Wilson bfef991612 sna: Propagate thread signals for extra DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-22 18:13:22 +00:00
Chris Wilson 64fc1bb9c8 sna: Allow SIGBUS/SEGV to kill the thread
To handle sigtrapping of the threads, we allow the threads to handle
their async signals and upon hitting the trap, we kill the thread. All
the rest of the threads are reaped by the main xserver thread
afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-22 16:58:58 +00:00
Chris Wilson 900499bff9 sna: Move sigtrap wrapping closer to threaded sw composite
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-22 14:35:10 +00:00
Chris Wilson aae3bfeb28 sna: Assert that sigtrap is active
Curiouser and curiouser.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-22 14:35:10 +00:00
Chris Wilson 75cff26eba sna: Apply the dst offset for pixman fills
Along one of the sw blt paths we failed to apply the offset for
Composite redirection.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73811
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-22 10:05:41 +00:00
Chris Wilson 59d471de7f sna: Handle asynchronous signals from threads
By killing the threads and leaking their allocations - marginally
preferrable to losing the entire Xserver.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-22 09:39:35 +00:00
Chris Wilson 1de1104064 sna: Use a hint to do whole image uploads inplace
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 22:43:04 +00:00
Chris Wilson 2c0aacb869 sna: Allow allocation to fail even when debugging
Let the malloc failure propagate rather than assert.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 21:48:36 +00:00
Chris Wilson cb87b17953 sna: Wrap inplace trapezoid operators with SIGBUS protection
For the moment, this still leaves open the vexing question of how to
protect the multi-threaded variants, but it should provide more shelter
for extreme OOM.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 21:41:52 +00:00
Chris Wilson b6fc46d63c sna: Tighten assertion for tiling blt fallbacks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 21:22:23 +00:00
Chris Wilson be6d218c68 sna: Do not attempt fallback configuration without any CRTCs
The fallback xf86InitialConfiguration() is another function that may
explode if called without any CRTCs attached.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 19:44:05 +00:00
Chris Wilson 769a959d84 sna: Do not register colormaps without any CRTCs
The xserver may crash if we try to setup colormap handling without any
CRTCs, so don't.

Suggested-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-21 13:47:45 +00:00
Chris Wilson 0b92b1285c backlight: Make search routine for device specific backlight common
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-20 19:22:03 +00:00
Chris Wilson caaf528340 sna: Query cursor size from the kernel
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-20 07:51:40 +00:00
Mark Kettenis c91af569ee backlight: Build fixes for OpenBSD
Chris would like to humbly apologise for making these changes to the
OpenBSD code blind, and to thank Mark and Jonathan for their support
and understanding.
2014-02-18 19:04:09 +00:00
Chris Wilson ecc20fbcf8 intel-virtual-output: Discard unwanted events from the mouse recorder
X always sends MappingNotify events (there is no way for the client
to ignore them). In particular, MappingNotify would be sent after a VT
switch, and this would knock out our ability to track the cursor..

Reported-by: Raul Dias <raul@dias.com.br>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75115
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-18 07:56:07 +00:00
Hans de Goede e860b3eaed backlight-helper: Simplify reading the level from stdin
Since the helper is a standalone app, the usual xserver rules of not using
stdio because of signal handling don't apply.

And since the helper does run with elevated rights, it is important to keep
the code KISS so that it can be audited easily.

This commit replaces the hard to read "raw" read loop with a much simpler
loop using fgets, improving readability of the code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-17 18:38:54 +00:00
Hans de Goede b5229c6e15 backlight: Drop rights before executing pkexec
Event though we've failed to open the backlight normally, we may still be
running under a suid-root xserver, so drop any elevated rights before
executing what we hope will be pkxec.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-17 18:38:54 +00:00
Hans de Goede 27a9dc4ce8 backlight: Use System instead of system when checking for pkexec
Even though we've failed to open the backlight normally, we may still be
running under a suid-root xserver, so use the servers build in System instead
of system so as to properly drop root rights.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-17 18:38:45 +00:00
Hans de Goede 06066b7269 backlight: Explain better why we support both pkexec and suid root for the helper
Update the comment about trying suid-root first with some explanations of
why pkexec may be preferable in some cases.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-17 17:02:01 +00:00
Chris Wilson 6b5c2b4515 backlight: tidy use of BACKLIGHT_CLASS
Use string concantenation to simply the sprintf slightly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15 21:03:49 +00:00
Chris Wilson eb7d2b19e2 backlight: Reject user overrides on OpenBSD
We only handle the singular wscons OpenBSD interface for backlight, so
explicitly reject any user requests for something else.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15 21:02:11 +00:00
Chris Wilson 268842a47f backlight: Amalgamate hardcoded priority tables
Our fallback path for finding the backlight interface uses a hardcoded
table of known backlight controllers in proirity order. Rather than
maintain this table twice in the midst of the KMS logic, push it to the
new set of common backlight routines.

This incorporates bugfixes from SNA to handle unknown backlights, but
usable, gracefully.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15 20:56:24 +00:00
Jan Alexander Steffens (heftig) b71f3d8bd4 Backlight helper build fixes
Don't hardcode $(prefix)/libexec

Fix install hook when DESTDIR is set

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75028
2014-02-15 17:39:01 +00:00
Chris Wilson 3d629c91cf intel: Add a helper for setting backlight without root rights
Once the xserver stops running as root on kms capabable systems, we will need
some other way to access the backlight.

The approach taken in this patch moves most of the heavy lifting to a
helper that runs with root privileges and pipes our requested brightness
into the sysfs backlight interface. Where required, we use pkexec to
launch the helper with the elevated privilege.

v2: Amalgamate much more of the duplicate code.
    Keep the daemon and pipe alive for the lifetime of the backlight interface.
    Provide an alternative for systems without PolicyKit.

Signed-off-by: Hans de Goede <hdegoede@redhat.com> [v1]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-15 15:33:47 +00:00
Hans de Goede a01548ccf1 intel: export fd_set_cloexec / fd_set_nonblock
Allow fd_set_cloexec / fd_set_nonblock to be used outside of intel_device.c.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-15 02:32:25 +00:00
Hans de Goede 5601f8cc33 intel: Fix fd_set_nonblock
O_NONBLOCK is a status flag not a descriptor flag, so F_GETFL / F_SETFL should
be used to modify it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-15 00:01:30 +00:00
Chris Wilson 8eb6335653 sna: Inherit the native rotation on initial output probing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-14 19:39:22 +00:00
Chris Wilson 5f87143357 sna: Reorganise native rotation ioctls to compile on old Linux
It is not just the BSDs that lack these ioctls in their userspace
headers, but everything older than about a year...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-14 16:30:19 +00:00
Chris Wilson 699bde3991 sna: Guard use of DRM_MODE_OBJECT type ids
These are not currently exported on OpenBSD and cause the build to fail.
Hide their use behind an ifdef guard for the time being.

"I noticed the following when trying to compile xf86-video-intel git on OpenBSD:

/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2106: error: 'DRM_MODE_OBJECT_CRTC' undeclared (first use in this function)
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2106: error: (Each undeclared identifier is reported only once
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2106: error: for each function it appears in.)
/usr/users/jsg/src/xf86-video-intel/src/sna/sna_display.c:2107: error: 'DRM_MODE_OBJECT_PLANE' undeclared (first use in this function)"

Reported-by: Jonathan Gray
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-14 15:12:27 +00:00
Chris Wilson 37dbd66941 sna: Check that the backlight interface is in sysfs before access
Before we write values into the file, we want to be sure that it is our
sysfs backlight interface, and not some ordinary file we are about to
destroy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-14 14:55:37 +00:00
Chris Wilson 3a893d14cd sna: Increase the acceptable screen size range
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 22:48:09 +00:00
Chris Wilson 2d9fcb3f72 sna: Filter out requests to create a 0x0 frontbuffer
Attempting to create a 0x0 frontbuffer results in erroneous pixmap
generation, and is liable to explode at a random point in future, so
just reject it outright.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 22:48:09 +00:00
Chris Wilson 1037a1a3f6 sna: Fix comparison of previous BLT commands
After altering the command bits to accommodate Broadwell, we needed to
fixup the comparison of previous BLT commands to detect overwritten
commands.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 22:48:09 +00:00
Chris Wilson 9a9f6a9487 uxa: Check for access to backlight interface
Before attaching properties to any connector, check that we can indeed
control the backlight through the sysfs interface by doing an access
check. If the xserver is started without root privileges, we cannot
write through /sys/class/backlight and so should take care not to
advertise that we can.

Reported-by: Hans de Geode <hdegeode@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 16:26:49 +00:00