platform/upstream/xf86-video-intel.git
10 years agointel-virtual-output: Mode names are freed with ScreenResources
Chris Wilson [Fri, 14 Mar 2014 14:34:48 +0000 (14:34 +0000)]
intel-virtual-output: Mode names are freed with ScreenResources

So we have to be careful not to continue to reference the strings after
they may be freed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Allow some leeway when deciding to discard common translations
Chris Wilson [Fri, 14 Mar 2014 13:08:43 +0000 (13:08 +0000)]
sna: Allow some leeway when deciding to discard common translations

Under PictFilterNearest, we can ignore fractional translations (not all
renderers discard those.) And if we are being approximate, we can loosen
our tolerance as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Ensure we flush SHM pixmaps if rendering to a GPU shadow
Chris Wilson [Fri, 14 Mar 2014 11:32:38 +0000 (11:32 +0000)]
sna: Ensure we flush SHM pixmaps if rendering to a GPU shadow

Normally, we try to render into the CPU bo of a SHM pixmap. However, under
the right circumstances we may try to do a series of rendering into the
GPU bo and then copy it back to the CPU bo. In that case, we need to be
sure to mark the pixmap as requiring the flush.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Include extra debug information for modesets
Chris Wilson [Fri, 14 Mar 2014 09:17:36 +0000 (09:17 +0000)]
intel-virtual-output: Include extra debug information for modesets

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Disable remote CRTCs at startup
Chris Wilson [Fri, 14 Mar 2014 07:42:32 +0000 (07:42 +0000)]
intel-virtual-output: Disable remote CRTCs at startup

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agouxa: Enable BLT acceleration on Broadwell.
Kenneth Graunke [Thu, 6 Mar 2014 21:12:32 +0000 (13:12 -0800)]
uxa: Enable BLT acceleration on Broadwell.

This supports solid, copy, put_image, and get_image acceleration via the
BLT engine.  RENDER acceleration (composite) and Xv would be piles of work,
which is not worth doing since SNA exists, and Glamor is coming.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agouxa: Remove implicit length from BLT command #defines.
Kenneth Graunke [Thu, 6 Mar 2014 21:12:31 +0000 (13:12 -0800)]
uxa: Remove implicit length from BLT command #defines.

These command packets grew on Gen8.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agosna/gen6+: Simplify BLT vs RENDER decisions for fill ops
Chris Wilson [Thu, 13 Mar 2014 08:52:45 +0000 (08:52 +0000)]
sna/gen6+: Simplify BLT vs RENDER decisions for fill ops

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Nullify extra fill.ops
Chris Wilson [Thu, 13 Mar 2014 08:51:29 +0000 (08:51 +0000)]
sna: Nullify extra fill.ops

I forgot that the initial memset(&fill, 0, sizeof(fill)) was no longer
performed and we rely on explicit initialisation during the setup, so
add the missing fields.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76088
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Fallback to drmGetDeviceNameFromFd()
Chris Wilson [Thu, 13 Mar 2014 08:14:48 +0000 (08:14 +0000)]
intel: Fallback to drmGetDeviceNameFromFd()

If we are not supplied the path, call the libdrm function to search for
the canonical name for our device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Restore asserts that we do not map a freed buffer
Chris Wilson [Wed, 12 Mar 2014 23:57:04 +0000 (23:57 +0000)]
sna: Restore asserts that we do not map a freed buffer

The complication comes with stolen bo that we treat as purged (because
they have no backing storage we can access) and so require an extra
caveat.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add DBG around using pixman's glyph cache
Chris Wilson [Wed, 12 Mar 2014 17:37:01 +0000 (17:37 +0000)]
sna: Add DBG around using pixman's glyph cache

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Only couple up a proxy->rq when inserting into the request->buffers list
Chris Wilson [Wed, 12 Mar 2014 12:17:55 +0000 (12:17 +0000)]
sna: Only couple up a proxy->rq when inserting into the request->buffers list

Otherwise, we may never decouple it again afterwards leading to a
dangling pointer dereference.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1289923
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Simplify code when no 64-bit registers are available in the ISA
Chris Wilson [Wed, 12 Mar 2014 10:51:56 +0000 (10:51 +0000)]
sna: Simplify code when no 64-bit registers are available in the ISA

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Missing fixes for using BLT points
Chris Wilson [Fri, 7 Mar 2014 13:18:07 +0000 (13:18 +0000)]
sna: Missing fixes for using BLT points

On a lone machine I had a vital fix for setting the destination tiling
bit inside the XY_PIXEL_BLT command. Sadly, I forgot about the fix before
the patch from another machine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/glyphs: Add a smattering of DBG for validating the glyph mask
Chris Wilson [Tue, 11 Mar 2014 11:37:01 +0000 (11:37 +0000)]
sna/glyphs: Add a smattering of DBG for validating the glyph mask

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Avoid using the wrong pitch for comparing replacement sizes
Chris Wilson [Tue, 11 Mar 2014 10:46:06 +0000 (10:46 +0000)]
sna: Avoid using the wrong pitch for comparing replacement sizes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Assert that the pixmap pitch is initialised before use
Chris Wilson [Tue, 11 Mar 2014 10:44:52 +0000 (10:44 +0000)]
sna: Assert that the pixmap pitch is initialised before use

This is a sanity check that the pixmap is mapped for use by the CPU
prior to us actually using it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Protect against a NULL platform device with server fd
Chris Wilson [Tue, 11 Mar 2014 10:06:24 +0000 (10:06 +0000)]
intel: Protect against a NULL platform device with server fd

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Fix versioning of SUPPORTS_SERVER_FD
Chris Wilson [Tue, 11 Mar 2014 10:00:27 +0000 (10:00 +0000)]
intel: Fix versioning of SUPPORTS_SERVER_FD

The current snapshot is 1.15.99.901, which means that the new feature
will first be available in 1.15.99.902.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Be defensive when applying size restrictions to bo
Chris Wilson [Tue, 11 Mar 2014 07:33:09 +0000 (07:33 +0000)]
sna: Be defensive when applying size restrictions to bo

The assumption that all paths prevalidate the restrictions upon creation
the bo are false. Some important paths try to force the bo creation in
order to meet client expectations (e.g. DRI). So we are faced with
impossible requests which must fail, so make sure we do report those
failures.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1289049
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Supply a fallback guess for the device path
Chris Wilson [Fri, 7 Mar 2014 19:44:07 +0000 (19:44 +0000)]
intel: Supply a fallback guess for the device path

If for some reason we have an fd, but no device path, use the likely
default path (derived from and validated against the major/minor of the
open device fd).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel: Add support for server managed fds
Hans de Goede [Fri, 7 Mar 2014 13:13:38 +0000 (14:13 +0100)]
intel: Add support for server managed fds

In the post-modern world, the platform device nodes are handed to a
non-privileged Xserver by systemd/logind. We can then query the core for
our assigned fd rather than try to open the device for ourselves (which
would fail when trying to obtain DRM_MASTER status). A consequence is
that we then do not directly control DRM_MASTER status and must act as a
delegate of systemd.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
10 years agosna: DBG compilation fixups
Chris Wilson [Mon, 10 Mar 2014 22:12:39 +0000 (22:12 +0000)]
sna: DBG compilation fixups

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Pass render hints for migration based on source location
Chris Wilson [Mon, 10 Mar 2014 16:39:50 +0000 (16:39 +0000)]
sna: Pass render hints for migration based on source location

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/glyph: Release the pixman glyph cache along the error paths
Chris Wilson [Mon, 10 Mar 2014 16:38:54 +0000 (16:38 +0000)]
sna/glyph: Release the pixman glyph cache along the error paths

If we lock the glyph cache and then hit an error, we must make sure we
release our lock. An easy way would be not to lock when we may err.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen2: Fix build after last minute patch editing
Chris Wilson [Mon, 10 Mar 2014 15:01:10 +0000 (15:01 +0000)]
sna/gen2: Fix build after last minute patch editing

Whoops, the selective editing of the patch left a trailing '{' and
breaking the build.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen2: Tidy blend factor selection for the source
Chris Wilson [Mon, 10 Mar 2014 15:20:16 +0000 (15:20 +0000)]
sna/gen2: Tidy blend factor selection for the source

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen2: Fix alpha blending with 8bit destination surfaces
Chris Wilson [Mon, 10 Mar 2014 15:17:51 +0000 (15:17 +0000)]
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>
10 years agosna: Unroll finding bbox of points
Chris Wilson [Fri, 7 Mar 2014 08:16:50 +0000 (08:16 +0000)]
sna: Unroll finding bbox of points

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Emit points using the BLT primitive when appropriate
Chris Wilson [Fri, 7 Mar 2014 08:15:21 +0000 (08:15 +0000)]
sna: Emit points using the BLT primitive when appropriate

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen8: Correct MOCS settings for render targets
Chris Wilson [Wed, 5 Mar 2014 09:51:24 +0000 (09:51 +0000)]
sna/gen8: Correct MOCS settings for render targets

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoNEWS: Fix dates for 2014
Chris Wilson [Mon, 3 Mar 2014 10:12:11 +0000 (10:12 +0000)]
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>
10 years agosna: Reorder writes during thread task decoupling
Chris Wilson [Fri, 28 Feb 2014 08:47:21 +0000 (08:47 +0000)]
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>
10 years agosna: Limit the WHOLE_HINT to large PutImages
Chris Wilson [Thu, 27 Feb 2014 08:36:40 +0000 (08:36 +0000)]
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>
10 years agosna: Avoid promoting region-to-whole migration and discarding damage
Chris Wilson [Thu, 27 Feb 2014 08:33:52 +0000 (08:33 +0000)]
sna: Avoid promoting region-to-whole migration and discarding damage

Fixes regression from
commit 1de1104064b5898cbed37e836901694a381c1266
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>
10 years agosna: Tighten assertion for tiling blt fallbacks
Chris Wilson [Fri, 21 Feb 2014 21:21:46 +0000 (21:21 +0000)]
sna: Tighten assertion for tiling blt fallbacks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen6+: Add missing DBG argument
Chris Wilson [Sat, 22 Feb 2014 20:17:08 +0000 (20:17 +0000)]
sna/gen6+: Add missing DBG argument

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add DBG for why trapezoids may be preferred inplace
Chris Wilson [Sat, 22 Feb 2014 19:35:40 +0000 (19:35 +0000)]
sna: Add DBG for why trapezoids may be preferred inplace

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Include mono/precise hints in trapezoids DBG
Chris Wilson [Sat, 22 Feb 2014 19:31:39 +0000 (19:31 +0000)]
sna: Include mono/precise hints in trapezoids DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add a little more DBG to watch the flow of allocated bo sizes
Chris Wilson [Sat, 22 Feb 2014 19:19:11 +0000 (19:19 +0000)]
sna: Add a little more DBG to watch the flow of allocated bo sizes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Avoid signed overflow when printing allocated bytes in DBG
Chris Wilson [Sat, 22 Feb 2014 18:29:27 +0000 (18:29 +0000)]
sna: Avoid signed overflow when printing allocated bytes in DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Cleanup caches if execbuf fails
Chris Wilson [Sat, 22 Feb 2014 18:22:38 +0000 (18:22 +0000)]
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>
10 years agosna: Propagate thread signals for extra DBG
Chris Wilson [Sat, 22 Feb 2014 18:12:24 +0000 (18:12 +0000)]
sna: Propagate thread signals for extra DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Allow SIGBUS/SEGV to kill the thread
Chris Wilson [Sat, 22 Feb 2014 14:34:05 +0000 (14:34 +0000)]
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>
10 years agosna: Move sigtrap wrapping closer to threaded sw composite
Chris Wilson [Sat, 22 Feb 2014 13:58:11 +0000 (13:58 +0000)]
sna: Move sigtrap wrapping closer to threaded sw composite

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Assert that sigtrap is active
Chris Wilson [Sat, 22 Feb 2014 12:44:16 +0000 (12:44 +0000)]
sna: Assert that sigtrap is active

Curiouser and curiouser.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Apply the dst offset for pixman fills
Chris Wilson [Sat, 22 Feb 2014 10:05:41 +0000 (10:05 +0000)]
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>
10 years agosna: Handle asynchronous signals from threads
Chris Wilson [Sat, 22 Feb 2014 08:35:50 +0000 (08:35 +0000)]
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>
10 years agosna: Use a hint to do whole image uploads inplace
Chris Wilson [Fri, 21 Feb 2014 22:43:04 +0000 (22:43 +0000)]
sna: Use a hint to do whole image uploads inplace

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Allow allocation to fail even when debugging
Chris Wilson [Fri, 21 Feb 2014 21:48:36 +0000 (21:48 +0000)]
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>
10 years agosna: Wrap inplace trapezoid operators with SIGBUS protection
Chris Wilson [Fri, 21 Feb 2014 21:41:52 +0000 (21:41 +0000)]
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>
10 years agosna: Tighten assertion for tiling blt fallbacks
Chris Wilson [Fri, 21 Feb 2014 21:21:46 +0000 (21:21 +0000)]
sna: Tighten assertion for tiling blt fallbacks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Do not attempt fallback configuration without any CRTCs
Chris Wilson [Fri, 21 Feb 2014 19:43:30 +0000 (19:43 +0000)]
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>
10 years agosna: Do not register colormaps without any CRTCs
Chris Wilson [Fri, 21 Feb 2014 13:43:09 +0000 (13:43 +0000)]
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>
10 years agobacklight: Make search routine for device specific backlight common
Chris Wilson [Thu, 20 Feb 2014 19:18:46 +0000 (19:18 +0000)]
backlight: Make search routine for device specific backlight common

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Query cursor size from the kernel
Chris Wilson [Thu, 20 Feb 2014 07:51:40 +0000 (07:51 +0000)]
sna: Query cursor size from the kernel

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agobacklight: Build fixes for OpenBSD
Mark Kettenis [Tue, 18 Feb 2014 19:02:14 +0000 (19:02 +0000)]
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.

10 years agointel-virtual-output: Discard unwanted events from the mouse recorder
Chris Wilson [Tue, 18 Feb 2014 07:56:07 +0000 (07:56 +0000)]
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>
10 years agobacklight-helper: Simplify reading the level from stdin
Hans de Goede [Mon, 17 Feb 2014 12:16:54 +0000 (13:16 +0100)]
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>
10 years agobacklight: Drop rights before executing pkexec
Hans de Goede [Mon, 17 Feb 2014 12:16:53 +0000 (13:16 +0100)]
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>
10 years agobacklight: Use System instead of system when checking for pkexec
Hans de Goede [Mon, 17 Feb 2014 12:16:52 +0000 (13:16 +0100)]
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>
10 years agobacklight: Explain better why we support both pkexec and suid root for the helper
Hans de Goede [Mon, 17 Feb 2014 12:16:51 +0000 (13:16 +0100)]
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>
10 years agobacklight: tidy use of BACKLIGHT_CLASS
Chris Wilson [Sat, 15 Feb 2014 21:03:49 +0000 (21:03 +0000)]
backlight: tidy use of BACKLIGHT_CLASS

Use string concantenation to simply the sprintf slightly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agobacklight: Reject user overrides on OpenBSD
Chris Wilson [Sat, 15 Feb 2014 21:00:57 +0000 (21:00 +0000)]
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>
10 years agobacklight: Amalgamate hardcoded priority tables
Chris Wilson [Sat, 15 Feb 2014 19:54:30 +0000 (19:54 +0000)]
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>
10 years agoBacklight helper build fixes
Jan Alexander Steffens (heftig) [Sat, 15 Feb 2014 16:53:16 +0000 (17:53 +0100)]
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

10 years agointel: Add a helper for setting backlight without root rights
Chris Wilson [Sat, 15 Feb 2014 14:55:09 +0000 (14:55 +0000)]
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>
10 years agointel: export fd_set_cloexec / fd_set_nonblock
Hans de Goede [Fri, 14 Feb 2014 23:02:36 +0000 (00:02 +0100)]
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>
10 years agointel: Fix fd_set_nonblock
Hans de Goede [Fri, 14 Feb 2014 23:02:35 +0000 (00:02 +0100)]
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>
10 years agosna: Inherit the native rotation on initial output probing
Chris Wilson [Fri, 14 Feb 2014 19:36:47 +0000 (19:36 +0000)]
sna: Inherit the native rotation on initial output probing

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Reorganise native rotation ioctls to compile on old Linux
Chris Wilson [Fri, 14 Feb 2014 16:18:34 +0000 (16:18 +0000)]
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>
10 years agosna: Guard use of DRM_MODE_OBJECT type ids
Chris Wilson [Fri, 14 Feb 2014 15:11:21 +0000 (15:11 +0000)]
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>
10 years agosna: Check that the backlight interface is in sysfs before access
Chris Wilson [Fri, 14 Feb 2014 14:53:14 +0000 (14:53 +0000)]
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>
10 years agosna: Increase the acceptable screen size range
Chris Wilson [Thu, 13 Feb 2014 22:46:22 +0000 (22:46 +0000)]
sna: Increase the acceptable screen size range

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Filter out requests to create a 0x0 frontbuffer
Chris Wilson [Thu, 13 Feb 2014 22:36:36 +0000 (22:36 +0000)]
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>
10 years agosna: Fix comparison of previous BLT commands
Chris Wilson [Thu, 13 Feb 2014 21:36:26 +0000 (21:36 +0000)]
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>
10 years agouxa: Check for access to backlight interface
Chris Wilson [Thu, 13 Feb 2014 16:18:43 +0000 (16:18 +0000)]
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>
10 years agosna: Check for access to backlight interface
Chris Wilson [Thu, 13 Feb 2014 16:18:43 +0000 (16:18 +0000)]
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>
10 years agosna: Clear DPMS tracking on VT switch
Chris Wilson [Thu, 13 Feb 2014 12:57:50 +0000 (12:57 +0000)]
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>
10 years agosna: Extend native rotation support to sprites
Chris Wilson [Thu, 13 Feb 2014 11:58:15 +0000 (11:58 +0000)]
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>
10 years agosna: Enable coordinate transforms for native CRTC rotation
Chris Wilson [Thu, 13 Feb 2014 14:46:39 +0000 (14:46 +0000)]
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>
10 years agoRevert "uxa: Do not change DPMS mode on unconnected outputs"
Chris Wilson [Thu, 13 Feb 2014 09:46:13 +0000 (09:46 +0000)]
Revert "uxa: Do not change DPMS mode on unconnected outputs"

This reverts commit 4497212307dee5e35bc6836201738a2fdb559020.

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>
10 years agosna: Always assign a name to the modes
Chris Wilson [Thu, 13 Feb 2014 01:06:41 +0000 (01:06 +0000)]
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>
10 years agosna/gen5: Flush the render cache between operations
Chris Wilson [Wed, 12 Feb 2014 16:41:51 +0000 (16:41 +0000)]
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 37eb7343be1aeeb90a860096756603a577df1a77
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>
10 years agointel-virtual-output: Do not resize the screen whilst all outputs are off
Chris Wilson [Wed, 12 Feb 2014 16:19:25 +0000 (16:19 +0000)]
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>
10 years agointel-virtual-output: Force an output probe on initial connection to remote display
Chris Wilson [Wed, 12 Feb 2014 15:48:20 +0000 (15:48 +0000)]
intel-virtual-output: Force an output probe on initial connection to remote display

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Fix checking for no change in output modes
Chris Wilson [Wed, 12 Feb 2014 15:47:00 +0000 (15:47 +0000)]
intel-virtual-output: Fix checking for no change in output modes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agointel-virtual-output: Always requery modes after OutputNotify
Chris Wilson [Wed, 12 Feb 2014 15:13:42 +0000 (15:13 +0000)]
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>
10 years agointel-virtul-output: Double check timestamps
Chris Wilson [Wed, 12 Feb 2014 14:48:24 +0000 (14:48 +0000)]
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>
10 years agosna: Support native primary plane rotations
Chris Wilson [Wed, 12 Feb 2014 11:33:45 +0000 (11:33 +0000)]
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>
10 years agoRevert "sna/gen6: Serialise write to DERRMR register using STORE_REGISTER_MEM"
Chris Wilson [Wed, 12 Feb 2014 10:43:46 +0000 (10:43 +0000)]
Revert "sna/gen6: Serialise write to DERRMR register using STORE_REGISTER_MEM"

This reverts commit 2a5ad9c015bbb41550536dd3cf4ad18b7f21fd80.

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

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen5: Use the DBG option ALWAYS_FLUSH to force a full flush
Chris Wilson [Wed, 12 Feb 2014 10:34:34 +0000 (10:34 +0000)]
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>
10 years agoMerge branch 'master' of hsw:/usr/src/xf86-video-intel
Chris Wilson [Wed, 12 Feb 2014 10:32:50 +0000 (10:32 +0000)]
Merge branch 'master' of hsw:/usr/src/xf86-video-intel

10 years agosna/gen5: Add a DBG option to force flushes between operations
Chris Wilson [Wed, 12 Feb 2014 09:58:06 +0000 (09:58 +0000)]
sna/gen5: Add a DBG option to force flushes between operations

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Retrieve tiling for fbcon
Chris Wilson [Wed, 12 Feb 2014 09:50:35 +0000 (09:50 +0000)]
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>
10 years agosna: Delete redundant branch
Chris Wilson [Wed, 12 Feb 2014 07:56:10 +0000 (07:56 +0000)]
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>
10 years agoRecord Video ABI version that we configure against
Chris Wilson [Tue, 11 Feb 2014 23:08:35 +0000 (23:08 +0000)]
Record Video ABI version that we configure against

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoMerge branch 'master' of hsw:/usr/src/xf86-video-intel
Chris Wilson [Tue, 11 Feb 2014 21:57:23 +0000 (21:57 +0000)]
Merge branch 'master' of hsw:/usr/src/xf86-video-intel

10 years agosna: Defer move-to-gpu until we need to transfer GPU damage to CPU
Chris Wilson [Tue, 11 Feb 2014 21:21:17 +0000 (21:21 +0000)]
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>