platform/upstream/xf86-video-intel.git
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>
10 years agosna/gen6: Serialise write to DERRMR register using STORE_REGISTER_MEM
Chris Wilson [Tue, 11 Feb 2014 11:23:37 +0000 (11:23 +0000)]
sna/gen6: Serialise write to DERRMR register using STORE_REGISTER_MEM

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Remove damaged region after converting CPU bo to GPU bo
Chris Wilson [Mon, 10 Feb 2014 16:42:06 +0000 (16:42 +0000)]
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>
10 years agosna: Check for overwriting damage before applying clear
Chris Wilson [Mon, 10 Feb 2014 16:37:38 +0000 (16:37 +0000)]
sna: Check for overwriting damage before applying clear

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Clear GPU damage flag for 1x1 writes onto a clear buffer
Chris Wilson [Mon, 10 Feb 2014 14:19:53 +0000 (14:19 +0000)]
sna: Clear GPU damage flag for 1x1 writes onto a clear buffer

An optimisation for 1x1 reads of a clear buffer lead to a bug whereby
the damage for a 1x1 write would not be tracked correctly (conflicting
full GPU damage vs partial CPU damage).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years ago2.99.910 snapshot 2.99.910
Chris Wilson [Mon, 10 Feb 2014 09:35:11 +0000 (09:35 +0000)]
2.99.910 snapshot

10 years agosna/gen6: Restore stall dropped when not flushing instead
Chris Wilson [Sun, 9 Feb 2014 12:28:27 +0000 (12:28 +0000)]
sna/gen6: Restore stall dropped when not flushing instead

commit 82e6d41c2f4f343bd1854d3d8ee4b624b5d68971
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Oct 31 13:35:59 2013 +0000

    sna/gen6: Tweak flush around CC state changes

Replaced the pipeline stall with a flush - but only when the target was
dirty. The missing stall however seems to be required as well.

v2: Actually emit the stall for all CC state changes [Ilia Mirkin]

Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72375
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: And clear drawable->id on reused pixmaps
Chris Wilson [Thu, 6 Feb 2014 10:13:41 +0000 (10:13 +0000)]
sna: And clear drawable->id on reused pixmaps

References: https://bugs.freedesktop.org/show_bug.cgi?id=74550
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agouxa: Do not expose TextureVideo Xv adapters when acceleration is disabled
Chris Wilson [Thu, 6 Feb 2014 09:24:17 +0000 (09:24 +0000)]
uxa: Do not expose TextureVideo Xv adapters when acceleration is disabled

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add some DBG to clarify the source pixmap (for tiles)
Chris Wilson [Thu, 6 Feb 2014 09:04:30 +0000 (09:04 +0000)]
sna: Add some DBG to clarify the source pixmap (for tiles)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Reset composite offsets when reusing freed pixmaps
Chris Wilson [Thu, 6 Feb 2014 08:29:20 +0000 (08:29 +0000)]
sna: Reset composite offsets when reusing freed pixmaps

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74550
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add some DBG around tiled blts
Chris Wilson [Wed, 5 Feb 2014 15:30:30 +0000 (15:30 +0000)]
sna: Add some DBG around tiled blts

References: https://bugs.freedesktop.org/show_bug.cgi?id=74550
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Pass read hints from move-to-cpu to wait_for_shadow
Chris Wilson [Wed, 5 Feb 2014 11:41:42 +0000 (11:41 +0000)]
sna: Pass read hints from move-to-cpu to wait_for_shadow

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Tweak assert_bo_retired() to be callable on cached bo
Chris Wilson [Tue, 4 Feb 2014 20:57:24 +0000 (20:57 +0000)]
sna: Tweak assert_bo_retired() to be callable on cached bo

References: https://bugs.freedesktop.org/show_bug.cgi?id=73406
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Rearrange assertion to ease use of substitute cached bo
Chris Wilson [Tue, 4 Feb 2014 17:51:51 +0000 (17:51 +0000)]
sna: Rearrange assertion to ease use of substitute cached bo

Since we call kgem_bo_submit() along one path when synchronising a
cached bo (which is known to be inactive) but still want to keep the
assertion on the refcnt, simply rearrange the code to only assert on the
active path.

References: https://bugs.freedesktop.org/show_bug.cgi?id=73406
Reported-by: Matti Hamalainen <ccr@tnsp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen4: Disable use of pipecontrol invalidates again
Chris Wilson [Tue, 4 Feb 2014 10:36:21 +0000 (10:36 +0000)]
sna/gen4: Disable use of pipecontrol invalidates again

One day, just not today, we may make gen4 work correctly, efficiently and
fast. Today, we can barely pick one.

References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/glyphs: Reset composite state between switching glyph formats
Chris Wilson [Tue, 4 Feb 2014 08:51:17 +0000 (08:51 +0000)]
sna/glyphs: Reset composite state between switching glyph formats

One path uses the mask channel, the other does not. We cannot rely on
overwriting all reused state in this case, and so we must clear the
composite state prior to use each time.

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74494
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Arkadiusz Miskiewicz <arekm@maven.pl>
10 years agosna/gen4,5: Fix setting pipe control cache flush bits
Edward Sheldrake [Mon, 3 Feb 2014 09:34:33 +0000 (09:34 +0000)]
sna/gen4,5: Fix setting pipe control cache flush bits

Cache flush bits are on dword 0, not 1, on gen4 and gen5. Also texture
cache invalidate is only available from Cantiga onwards.

10 years agosna: Reconstruct damage for the partially replaced discarded CPU bo
Chris Wilson [Sun, 2 Feb 2014 03:52:11 +0000 (03:52 +0000)]
sna: Reconstruct damage for the partially replaced discarded CPU bo

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: If IGNORE_CPU is not set we must mark the move as MOVE_READ
Chris Wilson [Sat, 1 Feb 2014 21:55:09 +0000 (21:55 +0000)]
sna: If IGNORE_CPU is not set we must mark the move as MOVE_READ

Logic reversal in discarding CPU damage. An old bug revealed by the more
aggressive attempts to discard CPU damage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add some more DBG for choosing render targets
Chris Wilson [Sat, 1 Feb 2014 21:54:43 +0000 (21:54 +0000)]
sna: Add some more DBG for choosing render targets

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Skip discarding CPU bo when using as a render target
Chris Wilson [Sat, 1 Feb 2014 21:38:47 +0000 (21:38 +0000)]
sna: Skip discarding CPU bo when using as a render target

The issue with unwanted serialisation does not affect the async
move-to-cpu of a render target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Allow more inplace promotions of CPU to GPU bo
Chris Wilson [Sat, 1 Feb 2014 21:37:41 +0000 (21:37 +0000)]
sna: Allow more inplace promotions of CPU to GPU bo

If the CPU bo is wholly damaged, then it makes an ideal candidate for
simply converting into the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Undo region translation before returning
Chris Wilson [Sat, 1 Feb 2014 20:13:53 +0000 (20:13 +0000)]
sna: Undo region translation before returning

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years ago2.99.909 snapshot 2.99.909
Chris Wilson [Sat, 1 Feb 2014 17:59:29 +0000 (17:59 +0000)]
2.99.909 snapshot

10 years agosna: Apply drawable offsets to partial CPU damage being replaced
Chris Wilson [Sat, 1 Feb 2014 18:57:06 +0000 (18:57 +0000)]
sna: Apply drawable offsets to partial CPU damage being replaced

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Don't discard the GPU prior to using it for stashing CPU damage
Chris Wilson [Sat, 1 Feb 2014 18:13:04 +0000 (18:13 +0000)]
sna: Don't discard the GPU prior to using it for stashing CPU damage

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Remark the region as damaged after uploading the rest to the GPU
Chris Wilson [Sat, 1 Feb 2014 17:56:58 +0000 (17:56 +0000)]
sna: Remark the region as damaged after uploading the rest to the GPU

If we upload outside of the replaced region to the GPU, we need to
remark the region of operation as dirty.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Only discard CPU damage for an replacing region
Chris Wilson [Sat, 1 Feb 2014 17:37:42 +0000 (17:37 +0000)]
sna: Only discard CPU damage for an replacing region

When considering move-region-to-cpu, we need to take into account that
the region may not replace the whole drawable, in which case we cannot
simply dispose of an active CPU bo.

Reported-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reported-by: Conley Moorhous <conleymoorhous@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74327
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoglamor: Enable Xv support
Chris Wilson [Sat, 1 Feb 2014 16:55:32 +0000 (16:55 +0000)]
glamor: Enable Xv support

In addition to the UXA texture paths (which in theory support VSync) and
direct overlay support, create a textured video paths that utilize the
glamor acceleration code.

Requested-by: Fabio Pedretti <fabio.ped@libero.it>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74311
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years ago2.99.908 snapshot 2.99.908
Chris Wilson [Fri, 31 Jan 2014 17:59:30 +0000 (17:59 +0000)]
2.99.908 snapshot

10 years agosna: remove short-circuit for move-to-CPU when damage covers region
Chris Wilson [Fri, 31 Jan 2014 20:02:44 +0000 (20:02 +0000)]
sna: remove short-circuit for move-to-CPU when damage covers region

The short-circuit path missed translating the damage from drawable space
into the pixmap (for Composite setups) which may have resulted in
corruption. The path was also failing to consider the impact of reusing
an active CPU bo when it could be discarding the unwanted damage and
reallocating.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Use 24bpp rendering by default for gen2 again
Chris Wilson [Fri, 31 Jan 2014 18:02:51 +0000 (18:02 +0000)]
sna: Use 24bpp rendering by default for gen2 again

Too many users where unhappy that their software was broken. Too bad the
same software is also broken at high bit depths as well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=73877
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Balance memory accounting for buffer objects
Chris Wilson [Fri, 31 Jan 2014 16:42:46 +0000 (16:42 +0000)]
sna: Balance memory accounting for buffer objects

A couple bugs ended up with CPU bo gradually accumulating whilst the
overall number of bo vanished.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Reorder assignments vs DBG
Chris Wilson [Fri, 31 Jan 2014 15:39:23 +0000 (15:39 +0000)]
sna: Reorder assignments vs DBG

It helps reading the debug log if what we print is correct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Actually reuse pixmap headers for ordinary pixmaps
Chris Wilson [Fri, 31 Jan 2014 15:03:43 +0000 (15:03 +0000)]
sna: Actually reuse pixmap headers for ordinary pixmaps

commit 3dbf17f00e200e864818b0b8ca762183cff9085f [2.99.907]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 3 12:10:01 2013 +0000

    sna: Mark up an ordinary pixmap for reuse

started to put the frequently allocated pixmaps into the object cache -
but as those frequent allocations themselves did not use the cache, the
cache kept growing.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1272338
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Tidy up pixmap header allocations
Chris Wilson [Fri, 31 Jan 2014 14:28:56 +0000 (14:28 +0000)]
sna: Tidy up pixmap header allocations

Refactor some more of the common code, and add some debug tracking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Show the memory debug info again
Chris Wilson [Fri, 31 Jan 2014 14:10:36 +0000 (14:10 +0000)]
sna: Show the memory debug info again

This needs to be visible whenever we --enable-debug=memory. Make it so,
and trim it to a single line in the process.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Silence a compiler warning for mismatching const strings
Chris Wilson [Thu, 30 Jan 2014 12:19:04 +0000 (12:19 +0000)]
sna: Silence a compiler warning for mismatching const strings

sna_display.c: In function 'preferred_mode':
sna_display.c:3393:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
  mode = xf86GetOptValString(output->options, OPTION_PREFERRED_MODE);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Suppress warning for freeing a "constant" string
Chris Wilson [Thu, 30 Jan 2014 12:18:05 +0000 (12:18 +0000)]
sna: Suppress warning for freeing a "constant" string

We allocated and own the string, so we can free it!

sna_display.c: In function 'sna_output_get_modes':
sna_display.c:2314:4: warning: passing argument 1 of 'free' discards 'const' qualifier from pointer target type [enabled by default]
    free(current->name);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Handle char *backlight_iface
Chris Wilson [Thu, 30 Jan 2014 12:17:02 +0000 (12:17 +0000)]
sna: Handle char *backlight_iface

The backlight_iface is a freeable string, in places we were assigning a
constant string and later freeing it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Constify GCFunc to quieten the compiler.
Chris Wilson [Thu, 30 Jan 2014 12:13:16 +0000 (12:13 +0000)]
sna: Constify GCFunc to quieten the compiler.

We keep a pointer to the old funcs when wrapping, this now needs to be const.

sna_accel.c: In function 'sna_gc_move_to_cpu':
sna_accel.c:4008:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
  sgc->old_funcs = gc->funcs;

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Fix format specifier typo ('%D') in DBG
Chris Wilson [Wed, 29 Jan 2014 16:48:21 +0000 (16:48 +0000)]
sna: Fix format specifier typo ('%D') in DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Always clear the domain even only a potential sync
Chris Wilson [Wed, 29 Jan 2014 13:42:50 +0000 (13:42 +0000)]
sna: Always clear the domain even only a potential sync

It helps to keep the domain-tracking bookkeeping consistent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: We can only retire a bo if is not referenced by the current batch
Chris Wilson [Wed, 29 Jan 2014 13:39:20 +0000 (13:39 +0000)]
sna: We can only retire a bo if is not referenced by the current batch

Fixes regression from
commit 8b0ebebcab21647348f769c25ca0c1d81d169e75
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 28 16:30:47 2014 +0000

    sna: Be a little more assertive in retiring after set-domain

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74176
Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Add assertions for set/get binding
Chris Wilson [Wed, 29 Jan 2014 13:15:43 +0000 (13:15 +0000)]
sna: Add assertions for set/get binding

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen4+: Assert that the cached binding location is valid
Chris Wilson [Wed, 29 Jan 2014 13:06:08 +0000 (13:06 +0000)]
sna/gen4+: Assert that the cached binding location is valid

We can at least check that it is in the right region (i.e. not past
where the current surface has been allocated from).

References: https://bugs.freedesktop.org/show_bug.cgi?id=74176
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Do not use color corrected pixel values for comparing against gc
Chris Wilson [Wed, 29 Jan 2014 11:15:45 +0000 (11:15 +0000)]
sna: Do not use color corrected pixel values for comparing against gc

Dashed zero-width lines devolve into two passes (first to draw the
foreground dashes, and then to draw the gaps). The code was using the
pixel value to decide which phase was being drawn -- however the color
on the gc is not always bit exact (e.g. alpha channel) with the pixel
value. As a result, we would oft miss drawing anything when rendering
into the scanout.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1059152
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen6+: Encourage inplace uploads for Composite
Chris Wilson [Wed, 29 Jan 2014 05:40:00 +0000 (05:40 +0000)]
sna/gen6+: Encourage inplace uploads for Composite

First try using the blt path for a potential inplace upload for a
simple composite operation copying from a ShmPixmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Skip undamaged TearFree redisplays
Chris Wilson [Wed, 29 Jan 2014 05:32:25 +0000 (05:32 +0000)]
sna: Skip undamaged TearFree redisplays

If we have not had cause to flush the wait_for_shadow buffer during the
course of the rendering, then we never wrote to the backbuffer and its
contents are still identical to the current frontbuffer. So if the
wait_for_shadow is still flagged as required on the scanout, we know we
can safely discard the redisplay request.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70905
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agoAllow selection of glamor as the default acceleration method
Chris Wilson [Tue, 28 Jan 2014 21:56:23 +0000 (21:56 +0000)]
Allow selection of glamor as the default acceleration method

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74162
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Check for a hang after a spurious error return from set-domain-ioctl
Chris Wilson [Tue, 28 Jan 2014 19:17:14 +0000 (19:17 +0000)]
sna: Check for a hang after a spurious error return from set-domain-ioctl

set-domain-ioctl should only ever fail for invalid user input, beyond
the normal signal handling. As such if we do find a spurious error
return from the kernel, check for a GPU hang.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Be a little more assertive in retiring after set-domain
Chris Wilson [Tue, 28 Jan 2014 16:30:47 +0000 (16:30 +0000)]
sna: Be a little more assertive in retiring after set-domain

After a successful set-domain for writing with the CPU, we know that the
buffer is idle so remove it from our request tracking. (External clients
complicate matters in that they may keep the bo active even after our
set-domain.) On the contrary, because of read-read optimisations a bo
may still be active after a set-domain for reading by the CPU, in which
we need to remain conservative in retiring the bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Cancel the backlight change if set-property(DPMS) fails
Chris Wilson [Tue, 28 Jan 2014 12:51:00 +0000 (12:51 +0000)]
sna: Cancel the backlight change if set-property(DPMS) fails

If the kernel reports an error from setting the DPMS property, we need
to undo the local changes and propagate back the error to the caller.
Although the latter is prevented by the RandR API, we can at least
restore the backlight.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Rearrange damage allocation to handle malloc failure more gracefully
Chris Wilson [Mon, 27 Jan 2014 21:48:33 +0000 (21:48 +0000)]
sna: Rearrange damage allocation to handle malloc failure more gracefully

If we fail to allocate new damage boxes, first try collescing the
existing boxes to free up memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Use signal-safe DBG
Chris Wilson [Mon, 27 Jan 2014 21:20:40 +0000 (21:20 +0000)]
sna: Use signal-safe DBG

Otherwise we end up confusing the core Xserver functions when called
from auxilliary threads.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen3+: Allow for spill when aligning vertices
Chris Wilson [Fri, 24 Jan 2014 14:21:44 +0000 (14:21 +0000)]
sna/gen3+: Allow for spill when aligning vertices

We need to flush the batch if we run out of space aligning our vertex
buffer - but the test must anticipate the space required for the new
alignment.

Reported-by: Arkadiusz Miskiewicz
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen2+: Inspect composite flags to discard unneeded CPU damage
Chris Wilson [Fri, 24 Jan 2014 11:29:26 +0000 (11:29 +0000)]
sna/gen2+: Inspect composite flags to discard unneeded CPU damage

We can now check whether the Composite operation will require existing
CPU damage and if not discard it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna/gen2,3: Don't set BLT_DST_TILED
Chris Wilson [Thu, 23 Jan 2014 19:04:27 +0000 (19:04 +0000)]
sna/gen2,3: Don't set BLT_DST_TILED

This bit only exists for gen4+ so avoid setting it on gen2 and gen3,
whilst setting it doesn't seem to cause any harm, there is no reason to
risk it...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Protect against fake CRTCs during initial probe
Chris Wilson [Thu, 23 Jan 2014 16:30:07 +0000 (16:30 +0000)]
sna: Protect against fake CRTCs during initial probe

Reported-by: Nick Bowler <nbowler@draconx.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73981
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
10 years agosna: Avoid erroneous discarding operations for partial composites
Chris Wilson [Thu, 23 Jan 2014 17:30:29 +0000 (17:30 +0000)]
sna: Avoid erroneous discarding operations for partial composites

Composite operations were presumed to cover their entire width x height
area. However, a few paths submit boxes that do not cover the clip
region and so the optimisation made during prepare to discard completely
overwritten data is incorrect (and leads to corruption - stale data is
seen which the client expected to have been overdrawn). So along these
more unusual paths, we must add a flag to prevent the overzealous
discard. Notably, xfce4 triggers this as it uses a lot of unantialiased
trapezoids in its theme drawing.

References: https://bugs.freedesktop.org/show_bug.cgi?id=69528
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>