Commit Graph

7764 Commits

Author SHA1 Message Date
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
Chris Wilson 611490a176 sna: 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:18:43 +00:00
Chris Wilson 83d17cded8 sna: Clear DPMS tracking on VT switch
Assume the worst and force us to reset the property when we restore
control.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 14:55:30 +00:00
Chris Wilson 135da29410 sna: Extend native rotation support to sprites
The sprite plane can be independently rotated to the CRTC primary plane.
To rotate the sprite plane, we just set a property on the plane similar
to how we rotate the CRTC, so we can refactor them together to use the
same routines.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 14:55:30 +00:00
Chris Wilson e35017e36e sna: Enable coordinate transforms for native CRTC rotation
Otherwise X tells Clients that the cursor is still in the unrotated
location when it appears rotated on the display.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 14:55:30 +00:00
Chris Wilson 72e909953c Revert "uxa: Do not change DPMS mode on unconnected outputs"
This reverts commit 4497212307.

Unfortunately, this simple fix does not work for UXA as DPMS is used by
the xserver to turn off CRTCs and outputs. Since UXA does not implement
CRTC DPMS, this commit causes us to fail to turn off outputs.

The kernel has been fixed up in the meantime and that commit has been
recommended to be backported to all stable kernels:

commit c9976dcf55c8aaa7037427b239f15e5acfc01a3a
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Sep 29 19:15:07 2013 +0100

    drm/i915: Only apply DPMS to the encoder if enabled

so it should be safe for UXA to rely on its old behaviour.

Bugzilla: https://code.google.com/p/chromium/issues/detail?id=341135
References: https://bugs.freedesktop.org/show_bug.cgi?id=68030
Suggested-by: Dominik Behr <dbehr@google.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 09:52:32 +00:00
Chris Wilson 1c5ccf5d9d sna: Always assign a name to the modes
In some cases, such as querying the mode from the CRTC, we may not have
a name associated with the mode. However, RandR always expects a valid
name. To satisfy this requirement, always generate the canonical mode
name if no other is specified.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70132
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-13 01:10:48 +00:00
Chris Wilson fb89bfc73f sna/gen5: Flush the render cache between operations
When we change the blend mode between operations, it appears that we
must flush the render cache or else we risk render corruption. This is
usually noticeable in rendering of single glyphs.

This was originally fixed for bug 51422, but was reintroduced by
commit 37eb7343be
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Dec 1 09:40:11 2012 +0000

    sna/gen5: Inspired by gen4, reorder the flushing
and the desire to reduce the impact of this w/a.

Reported-by: itumaykin@gmail.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74882
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 16:46:04 +00:00
Chris Wilson 564a766a6b intel-virtual-output: Do not resize the screen whilst all outputs are off
If all the outputs are off, we try to resize the screen to 1x1, which is
typically illegal. So, just keep the existing screen and xfer buffer for
next time it is enabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 16:21:30 +00:00
Chris Wilson 87b9d9f507 intel-virtual-output: Force an output probe on initial connection to remote display
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 15:56:45 +00:00
Chris Wilson dda57f2e28 intel-virtual-output: Fix checking for no change in output modes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 15:56:45 +00:00
Chris Wilson 94e5ca3d5a intel-virtual-output: Always requery modes after OutputNotify
References: https://bugs.freedesktop.org/show_bug.cgi?id=74800
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 15:13:42 +00:00
Chris Wilson d84940cc9d intel-virtul-output: Double check timestamps
Compare both res->timestamp and res->configTimestamp for changes in
state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 14:48:24 +00:00
Chris Wilson 607737cc47 sna: Support native primary plane rotations
Use the display hardware for simple rotations, when exported through the
rotation property on the CRTC.

As the kernel support is not yet merged upstream, the feature is hidden
behind --enable-rotation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 14:26:21 +00:00
Chris Wilson 3b43630f55 Revert "sna/gen6: Serialise write to DERRMR register using STORE_REGISTER_MEM"
This reverts commit 2a5ad9c015.

Oops, pushed from the wrong machine and merged in a incomplete bugfix
branch.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 10:44:46 +00:00
Chris Wilson fb69bd16a3 sna/gen5: Use the DBG option ALWAYS_FLUSH to force a full flush
When flushing between operations, we can choose between doing a full
flush to memory, or just a pipeline flush. For debugging it is better to
do the full flush to rule out cache effects.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 10:34:34 +00:00
Chris Wilson 77f8d9ca84 Merge branch 'master' of hsw:/usr/src/xf86-video-intel 2014-02-12 10:32:50 +00:00
Chris Wilson 27663f3116 sna/gen5: Add a DBG option to force flushes between operations
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 09:58:06 +00:00
Chris Wilson 834e8078fc sna: Retrieve tiling for fbcon
Yikes, there appear to be tiled fbcon framebuffers on the horizon.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 09:50:35 +00:00
Chris Wilson 69d4c15d52 sna: Delete redundant branch
The MOVE_READ else branch is repeated immediately below when marking up
damage for MOVE_WRITE, so remove it for simplicity.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-12 08:00:44 +00:00
Chris Wilson ec39adc93a Record Video ABI version that we configure against
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-11 23:08:35 +00:00
Chris Wilson 3fb39d4779 Merge branch 'master' of hsw:/usr/src/xf86-video-intel 2014-02-11 21:57:23 +00:00
Chris Wilson c02067dcf5 sna: Defer move-to-gpu until we need to transfer GPU damage to CPU
When preparing a pixmap for CPU rendering, one of the last steps is to
copy the outstanding GPU damage back to the CPU. Currently, we flush any
outstanding pageflips (for TearFree) and in the process accidentally
destroy the shadow buffer if there is no outstanding GPU damage. Rearrange
the code to avoid tripping over that by only processing the move-to-gpu if
we need to touch the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-11 21:32:04 +00:00
Chris Wilson 2a5ad9c015 sna/gen6: Serialise write to DERRMR register using STORE_REGISTER_MEM
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-11 11:23:37 +00:00
Chris Wilson 5142d1ca3f sna: Remove damaged region after converting CPU bo to GPU bo
Reported-by: Jiri Slaby <jirislaby@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-10 16:42:06 +00:00