platform/upstream/xf86-video-intel.git
11 years agosna: Fix inconsistency in has_coherent_ptr assertion
Chris Wilson [Tue, 22 Oct 2013 15:59:29 +0000 (16:59 +0100)]
sna: Fix inconsistency in has_coherent_ptr assertion

We occasionally will read from an "incoherent" ptr in the belief that
the clflush hit will be worth it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage
Chris Wilson [Tue, 22 Oct 2013 13:22:14 +0000 (14:22 +0100)]
sna: Remove the move-to-gpu shortcircuiting for partial GPU, no CPU damage

Otherwise we may not correctly undo COW or pending move-to-gpu updates.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Make sure CPU damage is flushed to the TearFree shadow
Chris Wilson [Tue, 22 Oct 2013 12:33:06 +0000 (13:33 +0100)]
sna: Make sure CPU damage is flushed to the TearFree shadow

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only force the TearFree exchange before a write
Chris Wilson [Tue, 22 Oct 2013 06:58:03 +0000 (07:58 +0100)]
sna: Only force the TearFree exchange before a write

We can read from the current scanout buffer without incurring a visual
tear, so delay the GPU bo exchange until we see a write to the object.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoxvmc: Handle errors along allocation path
Chris Wilson [Tue, 22 Oct 2013 14:54:59 +0000 (15:54 +0100)]
xvmc: Handle errors along allocation path

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Free our CRTC private after failing to create the xf86Crtc
Chris Wilson [Tue, 22 Oct 2013 14:35:31 +0000 (15:35 +0100)]
sna: Free our CRTC private after failing to create the xf86Crtc

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Fix inversion of initialisation test for triangles
Chris Wilson [Tue, 22 Oct 2013 14:32:23 +0000 (15:32 +0100)]
sna/trapezoids: Fix inversion of initialisation test for triangles

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Ignore overflow in CPU count rather than abort
Chris Wilson [Tue, 22 Oct 2013 14:30:05 +0000 (15:30 +0100)]
sna: Ignore overflow in CPU count rather than abort

If there are more processors than we ever expect, good! Just use lots of
them, rather than none at all.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Move gc back to GPU after failure to move it to CPU
Chris Wilson [Tue, 22 Oct 2013 14:19:15 +0000 (15:19 +0100)]
sna: Move gc back to GPU after failure to move it to CPU

As the failure in gc move-to-cpu occurs late, i.e. after the function
pointers are updated to point to CPU functions, we need to undo those
changes, i.e. call move-to-gpu for the GC on failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Discard GPU bo when failing to setup the shared pixmap
Chris Wilson [Tue, 22 Oct 2013 14:02:53 +0000 (15:02 +0100)]
sna: Discard GPU bo when failing to setup the shared pixmap

If we fail to mmap the pixmap when preparing it for use with prime, be
sure to throw away the now lost priv->gpu_bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Free bo along unlikely one-off error path
Chris Wilson [Tue, 22 Oct 2013 14:00:16 +0000 (15:00 +0100)]
sna: Free bo along unlikely one-off error path

Add a missing free for a never-hit error.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Enable TearFree rendering for transformed scanouts
Chris Wilson [Mon, 21 Oct 2013 22:44:29 +0000 (23:44 +0100)]
sna: Enable TearFree rendering for transformed scanouts

References: https://bugs.freedesktop.org/show_bug.cgi?id=22969
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Eliminate the synchronous wait from inside TearFree
Chris Wilson [Mon, 21 Oct 2013 17:55:23 +0000 (18:55 +0100)]
sna: Eliminate the synchronous wait from inside TearFree

Defer the actual wait until the next use of the screen pixmap, and then
if needed replace the GPU bo with an alternative back buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Improve handling of blit fallbacks for untransfomed large scanouts
Chris Wilson [Mon, 21 Oct 2013 16:52:05 +0000 (17:52 +0100)]
sna: Improve handling of blit fallbacks for untransfomed large scanouts

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tweak opportunistic flushing to reduce power consumption
Chris Wilson [Mon, 21 Oct 2013 14:31:44 +0000 (15:31 +0100)]
sna: Tweak opportunistic flushing to reduce power consumption

When trying to conserve power, reduce the number of small batches we
emit - trying to maximise GPU efficacy and minimise CPU overhead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Set the canonical name for the current mode if none match
Chris Wilson [Mon, 21 Oct 2013 12:35:24 +0000 (13:35 +0100)]
sna: Set the canonical name for the current mode if none match

Always give the mode a name for pretty printing for the user.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Copy the EDID mode name for the current CRTC mode
Chris Wilson [Mon, 21 Oct 2013 12:25:01 +0000 (13:25 +0100)]
sna: Copy the EDID mode name for the current CRTC mode

As the kernel does not preserve the name and driver type when returning
the current CRTC mode, we need to reconstruct those from the EDID mode
when available.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix typo inside an assertion
Chris Wilson [Mon, 21 Oct 2013 10:16:02 +0000 (11:16 +0100)]
sna: Fix typo inside an assertion

Use the right dst_priv variable instead of priv!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Suppress log messages for unchanging EDID
Chris Wilson [Mon, 21 Oct 2013 10:06:30 +0000 (11:06 +0100)]
sna: Suppress log messages for unchanging EDID

Whenever we reprobe an unchanging output and re-read its EDID, we emit a
useless log message. Previously this was squelched by trying to spot
when an EDID was unchanged through the use of its blob.id, however we
need to do a complete check on the contents in case the kernel returns
us a new EDID with the old id. So make a temporary copy of the current
EDID data and only squelch the log messages if the new EDID is an exact
match.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix the addition of the current output Mode to the probed lists
Chris Wilson [Sun, 20 Oct 2013 08:03:47 +0000 (09:03 +0100)]
sna: Fix the addition of the current output Mode to the probed lists

We need to add the current mode to the Modes list and not directly to
the output->probed_modes as that gets overwritten.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Unmap pixmap prior to release GPU bo
Chris Wilson [Sat, 19 Oct 2013 21:38:15 +0000 (22:38 +0100)]
sna: Unmap pixmap prior to release GPU bo

As the unmap routine will deference the GPu bo in its debugging code, we
need to be sure that the pointer is still valid at the time of
unmapping. Hence unmap before release.

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>
11 years agosna: Do a quick pass on dirty damage before reduction
Chris Wilson [Fri, 18 Oct 2013 16:30:18 +0000 (17:30 +0100)]
sna: Do a quick pass on dirty damage before reduction

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Drop now obsolete assertion
Chris Wilson [Fri, 18 Oct 2013 16:27:27 +0000 (17:27 +0100)]
sna: Drop now obsolete assertion

We no longer unconditionally clear the CPU hint when moving to the GPU
for readonly updates, so we can no longer assert that the priv->cpu ==
false afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tighten pixmap map assertions
Chris Wilson [Fri, 18 Oct 2013 10:12:51 +0000 (11:12 +0100)]
sna: Tighten pixmap map assertions

We need to also take account of upload buffers which include an offset
to the base map. To do so, we also need to stop conflating the cpu hint
with the current mapping flag.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/glyphs: Remove glyph_approx_extents
Chris Wilson [Fri, 18 Oct 2013 08:19:14 +0000 (09:19 +0100)]
sna/glyphs: Remove glyph_approx_extents

It didn't consider the height of the glyph above the baseline, i.e. it
was fundamentally flawed. The only thing to do is to make sure that
glyph_extents() is sufficiently fast never to show up in profiles.
(Until then QA should spot the ~10% regression.) An alternative would be
to feed the drawable clip extents to the render engine and avoid manual
clipping if the clip region covers the whole drawable.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70552
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoRemove defunct file 'brw_eu_util.c' from git
Chris Wilson [Fri, 18 Oct 2013 07:33:58 +0000 (08:33 +0100)]
Remove defunct file 'brw_eu_util.c' from git

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Check return of source_bo for a potential failure
Chris Wilson [Thu, 17 Oct 2013 16:16:56 +0000 (17:16 +0100)]
sna: Check return of source_bo for a potential failure

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix computation of clip boxes for stipple uploads
Chris Wilson [Thu, 17 Oct 2013 16:14:13 +0000 (17:14 +0100)]
sna: Fix computation of clip boxes for stipple uploads

References: https://bugs.freedesktop.org/show_bug.cgi?id=67865
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Assert mapped state
Chris Wilson [Thu, 17 Oct 2013 11:01:02 +0000 (12:01 +0100)]
sna: Assert mapped state

When mapped, assert that we point to the expected mapping of the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/dri: Refactor to use the common GPU damage routine
Chris Wilson [Thu, 17 Oct 2013 10:32:39 +0000 (11:32 +0100)]
sna/dri: Refactor to use the common GPU damage routine

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/glyphs: Fix computation of extents for long strings
Chris Wilson [Wed, 16 Oct 2013 21:39:54 +0000 (22:39 +0100)]
sna/glyphs: Fix computation of extents for long strings

And make sure we consider such overflowing strings for correct clipping
against Windows.

To offset the cost of doing a full extents check (~10% on aa10text), we
introduce an approximate extents query (~1% on aa10text). The disparity
should be rare, and should be an overestimate to force redundant
clipping.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70541
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix inverted tiled CPU map check in has_coherent_ptr()
Chris Wilson [Wed, 16 Oct 2013 11:43:43 +0000 (12:43 +0100)]
sna: Fix inverted tiled CPU map check in has_coherent_ptr()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only carry 32/64-bit compat wrapper for drm_mode_get_connector
Chris Wilson [Wed, 16 Oct 2013 08:52:14 +0000 (09:52 +0100)]
sna: Only carry 32/64-bit compat wrapper for drm_mode_get_connector

This is the only structure we care about that has u64 and its size is
not a multiple of u64s.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Expand packed KMS structs for 64-bit alignment
Chris Wilson [Tue, 15 Oct 2013 20:53:16 +0000 (21:53 +0100)]
sna: Expand packed KMS structs for 64-bit alignment

Pavel Roskin found that with a 32-bit build of the DDX with a 64-bit
kernel that the call to GETCONNECTOR was overwriting the 4 bytes beyond
the end of the drm_mode_get_connector structure. This would appear to be
due to the surreptious padding inserted by the compiler so that the
structure would be naturally aligned on a 64-bit system. To compenstate
we need to insert padding between the adjacent 32-bit structures on the
stack.

As usual, be paranoid and make sure that all the adjacent KMS structs we
use are padded out to an 64-bit boundary.

Reported-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Add DBG along all output init failure paths
Chris Wilson [Tue, 15 Oct 2013 15:21:41 +0000 (16:21 +0100)]
sna: Add DBG along all output init failure paths

Suggested-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Allow read-mappings for has_coherent_ptr() assert
Chris Wilson [Tue, 15 Oct 2013 13:39:13 +0000 (14:39 +0100)]
sna: Allow read-mappings for has_coherent_ptr() assert

The assertion was a little too specific and disallowed us to have a CPU
read-only mapping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Speed up inplace copies from SHM pixmaps to GPU bo
Chris Wilson [Tue, 15 Oct 2013 13:30:41 +0000 (14:30 +0100)]
sna: Speed up inplace copies from SHM pixmaps to GPU bo

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoRevert "sna: Preserve the user backlight value for get_property calls"
Chris Wilson [Tue, 15 Oct 2013 11:48:27 +0000 (12:48 +0100)]
Revert "sna: Preserve the user backlight value for get_property calls"

This reverts commit 41b6b792d8e9c84c0a71a4bd7600e1c42e86b5bd in favour
of the better fix to not ask RRChangeOutputProperty to reset the known
hardware values.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Disable updating properties upon reading their values
Chris Wilson [Tue, 15 Oct 2013 11:46:09 +0000 (12:46 +0100)]
sna: Disable updating properties upon reading their values

When we assign the hardware values to the output properties, we do not
need to process the set_property callback to write those values back to
hardware. This callback is triggered by the pending update flag passed
to RRChangeOutputProperty.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70406
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Preserve the user backlight value for get_property calls
Chris Wilson [Tue, 15 Oct 2013 10:23:19 +0000 (11:23 +0100)]
sna: Preserve the user backlight value for get_property calls

When querying the current backlight value, be sure not to overwrite the
last user set value by the call to RRChangeOutputProperty.
RRChangeOutputProperty calls into set_backlight_property, tricking us
into believing that the user has set a new backlight value. The result
is that we end up believing that the user chooses a 0 backlight if she
should happen to query the property whilst the output is disabled.

Reported-by: reztho@archlinux.us
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70406
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Initialise force_fallback
Chris Wilson [Tue, 15 Oct 2013 09:42:16 +0000 (10:42 +0100)]
sna/trapezoids: Initialise force_fallback

Remember to set it initially to false so that we randomly do not start
using fallbacks.

Fixes regression from
commit 0cd2c43fa8f3a66d612589ad1163a90e427668ac
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Oct 13 14:46:45 2013 +0100

    sna/trapezoids: Use the aligned fast path for fallbacks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Assert that the mode/ring are set when marking active bo
Chris Wilson [Mon, 14 Oct 2013 22:16:48 +0000 (23:16 +0100)]
sna: Assert that the mode/ring are set when marking active bo

As we use the current ring to encode upon the bo relocs, we need that
ring to be properly setup prior to performing relocations.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen6: Fix the invert fix
Chris Wilson [Mon, 14 Oct 2013 10:54:35 +0000 (11:54 +0100)]
sna/gen6: Fix the invert fix

Eek, missed that 8-wide dispatch branch still had the opposite fix that I was
testing first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen6+: Fix calculation of 1/z for projective textures
Chris Wilson [Sun, 13 Oct 2013 13:39:30 +0000 (14:39 +0100)]
sna/gen6+: Fix calculation of 1/z for projective textures

A typo crept in causing the shader to read from the wrong temporaries
for the invert operation.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tighten has_coherent_ptr() assertion
Chris Wilson [Mon, 14 Oct 2013 08:33:52 +0000 (09:33 +0100)]
sna: Tighten has_coherent_ptr() assertion

Pass along the flags for read/write direction so that we know whether or
not we expect the gpu bo to be in the CPU write domain.

Reported-by: Pavel Ondračka <pavel.ondracka@email.cz>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70436
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix typo in DBG
Chris Wilson [Sun, 13 Oct 2013 17:50:03 +0000 (18:50 +0100)]
sna: Fix typo in DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Use the aligned fast path for fallbacks
Chris Wilson [Sun, 13 Oct 2013 13:46:45 +0000 (14:46 +0100)]
sna/trapezoids: Use the aligned fast path for fallbacks

Route the fallback methods through the force_fallback aligned fast
paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Cleanup up unused variables
Chris Wilson [Sun, 13 Oct 2013 12:39:04 +0000 (13:39 +0100)]
sna: Cleanup up unused variables

commit 951f969fa63defbe7cfa52ca97c8985b157bbed0
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Oct 13 12:47:20 2013 +0100

    sna: Update DPMS on attached outputs before disabling the CRT

left behind a couple of variables now deceased.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Update DPMS on attached outputs before disabling the CRTC
Chris Wilson [Sun, 13 Oct 2013 11:47:20 +0000 (12:47 +0100)]
sna: Update DPMS on attached outputs before disabling the CRTC

We may want to take action such as preserving the current user value of
the backlight before disabling it whilst forcing a CRTC off. This
requires us to record that value first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Cleanup allocation of sna_output after late syscall fail
Chris Wilson [Sun, 13 Oct 2013 10:04:02 +0000 (11:04 +0100)]
sna: Cleanup allocation of sna_output after late syscall fail

If the second syscall fails (presumably as a deferred allocation failure
check), cleanup the allocations made so far before reporting the
failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agouxa: Check for allocation failure in i915 video
Chris Wilson [Sun, 13 Oct 2013 09:36:35 +0000 (10:36 +0100)]
uxa: Check for allocation failure in i915 video

For a large screen, we have to create a temporary surface for rendering
the textured video. If this pixmap creation fails we may be left with a
system memory only pixmap leading to a segfault.

Reported-by: Bas Wijnen <wijnen@debian.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agouxa: Abort CreateScreenResources after allocation failure
Chris Wilson [Sun, 13 Oct 2013 09:34:50 +0000 (10:34 +0100)]
uxa: Abort CreateScreenResources after allocation failure

One of UXA's invarients is that the ScreenPixmap is complete (i.e. has
an intel_pixmap private with a bo attached). If we fail to create that
private during CreateScreenResources we will die very soon afterwards,
so just report the failure and shutdown gracefully.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoconfigure: Allow manual specification of intel-gen4asm path
Chris Wilson [Thu, 10 Oct 2013 16:14:36 +0000 (17:14 +0100)]
configure: Allow manual specification of intel-gen4asm path

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Populate bo->size from dma-buf
Chris Wilson [Thu, 10 Oct 2013 21:16:53 +0000 (22:16 +0100)]
sna: Populate bo->size from dma-buf

Recent kernels gained the ability to report the actual size of the
dma-buf through an lseek. We can use this to set the correct size of the
bo when available, overriding the guess provided by the caller.

Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Sanitize output->crtc before falling back oto xf86InitialConfiguration
Chris Wilson [Thu, 10 Oct 2013 15:22:45 +0000 (16:22 +0100)]
sna: Sanitize output->crtc before falling back oto xf86InitialConfiguration

During initialisation, we stash the currently attached CRTC id in
output->crtc. This is fine as ordinarily we would not dereference
output->crtc until after it had been assigned a real CRTC. However,

commit 6fda305e2f2f991b39d09e67d0b17c8c3d50f9a4
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Oct 9 15:59:42 2013 +0100

    sna: Append the current mode to the output list if not found

introduces such an early dereference and causes a crash if we fail to
probe the KMS configuration (usually due to a user override).

Reported-by: Łukasz Maśko <ed@yen.ipipan.waw.pl>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoconfigure: Add xfixes to X11 pkg check
Daniel Martin [Thu, 10 Oct 2013 13:24:26 +0000 (15:24 +0200)]
configure: Add xfixes to X11 pkg check

Add xfixes to the list of PKG_CHECK_MODULES for X11. '-lXfixes' was
hardcoded in test/Makefile.am before. This could lead to a broken build
in very rare cases where the build environment has all specified X
libraries but Xfixes.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
11 years agosna/gen4+: Share a few common routines
Chris Wilson [Thu, 10 Oct 2013 11:42:12 +0000 (12:42 +0100)]
sna/gen4+: Share a few common routines

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen6+: Share the common routines for ring preferrence
Chris Wilson [Thu, 10 Oct 2013 11:35:28 +0000 (12:35 +0100)]
sna/gen6+: Share the common routines for ring preferrence

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen6+: Only allow switching to BLT for fills if we have semaphores
Chris Wilson [Thu, 10 Oct 2013 11:18:31 +0000 (12:18 +0100)]
sna/gen6+: Only allow switching to BLT for fills if we have semaphores

An extra caveat to these generations for

commit 97d809c26bec2c0120f2dc0bcfd840379bd996fa
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Oct 10 00:15:55 2013 +0100

    sna: Pass usage hint down to render fill routines

is that we don't want to incur ring switch overheads that may overwhelm
any advantages from using the BLT.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Prevent changes in tiling/pitch of existing framebuffers
Chris Wilson [Thu, 10 Oct 2013 07:32:51 +0000 (08:32 +0100)]
sna: Prevent changes in tiling/pitch of existing framebuffers

Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Pass usage hint down to render fill routines
Chris Wilson [Wed, 9 Oct 2013 23:15:55 +0000 (00:15 +0100)]
sna: Pass usage hint down to render fill routines

For the scanlines emitted for rendering Core drawing primitives, it is
preferable to use the BLT engine, so pass those hints down.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Upon unwinding operations, also check for exec objects to clear
Chris Wilson [Wed, 9 Oct 2013 22:54:57 +0000 (23:54 +0100)]
sna: Upon unwinding operations, also check for exec objects to clear

If we cancel an operation after partially committing it, we may leave
the batch bookkeeping in an inconsistent state with an exec object with
a zero-length batch. Ordinarily, this would not be an issue as we could
pass the extra object to the next batch. However, if we switch rings, we
need to clear the extra objects as they are currently flagged as being
on the wrong ring, leading to hilarity.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years ago2.99.904 snapshot 2.99.904
Chris Wilson [Wed, 9 Oct 2013 16:18:43 +0000 (17:18 +0100)]
2.99.904 snapshot

11 years agosna: Steal the current mode name
Chris Wilson [Wed, 9 Oct 2013 15:22:59 +0000 (16:22 +0100)]
sna: Steal the current mode name

Rather than duplicating a string, we can simply transfer ownership from
the temporary mode to the mode list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Append the current mode to the output list if not found
Chris Wilson [Wed, 9 Oct 2013 14:59:42 +0000 (15:59 +0100)]
sna: Append the current mode to the output list if not found

If for some reason the current mode on the CRTC (inherited most likely
from fastboot) doesn't match any of the modes reported by the output, we
end up with a stray mode that the client cannot control.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70132
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen3+: Flush vertex buffer after computing resize
Chris Wilson [Wed, 9 Oct 2013 09:32:02 +0000 (10:32 +0100)]
sna/gen3+: Flush vertex buffer after computing resize

Upon aligning the buffer, we may enlarge the vbo to accomodate the
vertex alignment and push the current index past the end of the buffer.
Move the space check from before the alignment computation to
afterwards.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=47597
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Emit DBG for when we fallback to xf86InitialConfig detection
Chris Wilson [Tue, 8 Oct 2013 15:12:06 +0000 (16:12 +0100)]
sna: Emit DBG for when we fallback to xf86InitialConfig detection

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Rework the num_threads refinement to avoid the division
Chris Wilson [Tue, 8 Oct 2013 08:40:34 +0000 (09:40 +0100)]
sna: Rework the num_threads refinement to avoid the division

We can replace the division by a multiplication.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Recompute num_threads to match range
Chris Wilson [Mon, 7 Oct 2013 22:21:38 +0000 (23:21 +0100)]
sna/trapezoids: Recompute num_threads to match range

We need to be careful not to execute threads past the end of the alloted
buffer by making sure the clip extents correctly align.

Reported-by: Joseph Yasi <joe.yasi@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70204
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Trim color cache allocation to a single page
Chris Wilson [Mon, 7 Oct 2013 21:04:22 +0000 (22:04 +0100)]
sna: Trim color cache allocation to a single page

Instead trying to allocate 4100 bytes, fix the logic to only require a
maximum of 4096 bytes in the cache buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Only use a single thread to emit rectilinear spans
Chris Wilson [Mon, 7 Oct 2013 13:06:31 +0000 (14:06 +0100)]
sna/trapezoids: Only use a single thread to emit rectilinear spans

If the trapezoids are rectilinear, they should hit a fast path through
the span compositors and so threading them seems pointless. Expect
possibily for inplace pixman operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen7: Rename debug option ALWAYS_FLUSH to ALWAYS_INVALIDATE
Chris Wilson [Mon, 7 Oct 2013 10:56:23 +0000 (11:56 +0100)]
sna/gen7: Rename debug option ALWAYS_FLUSH to ALWAYS_INVALIDATE

This allows us to distinguish between the texture cache invalidation
stage versus the opportunistic flushing, and test either.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen7: Tweak flushing
Chris Wilson [Mon, 7 Oct 2013 10:54:59 +0000 (11:54 +0100)]
sna/gen7: Tweak flushing

We pre-emptively flush the render cache before reads as that seems to
improve performance. Now try not flushing if we don't subsequently need
to read from the render cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Restore overflow check
Chris Wilson [Mon, 7 Oct 2013 09:30:20 +0000 (10:30 +0100)]
sna/trapezoids: Restore overflow check

The range can indeed overflow, so promote the assertion back into a
check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Fix overstepping vertical edges
Chris Wilson [Mon, 7 Oct 2013 09:04:15 +0000 (10:04 +0100)]
sna/trapezoids: Fix overstepping vertical edges

Regression from

commit c98b770a87a5ec5ed9dc0aa375ad173b0e98322e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Oct 4 18:37:01 2013 +0100

    sna/trapezoids: Add a precise scan converter

Reported-by: Joseph Yasi <joe.yasi@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70204
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen7: Add a always-stall debug option
Chris Wilson [Sun, 6 Oct 2013 16:27:22 +0000 (17:27 +0100)]
sna/gen7: Add a always-stall debug option

References: https://bugs.freedesktop.org/show_bug.cgi?id=68410
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Filter out the control bit from the device minor
Chris Wilson [Sat, 5 Oct 2013 22:00:49 +0000 (23:00 +0100)]
intel: Filter out the control bit from the device minor

When computing the render node for the device, filter out the potential
control node.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agocompat-api: Map changes of DamageUnregister API in 1.14.99.2
Chris Wilson [Sat, 5 Oct 2013 17:42:24 +0000 (18:42 +0100)]
compat-api: Map changes of DamageUnregister API in 1.14.99.2

Reported-by: Emmanuel Benisty <benisty.e@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Do not pass invalid trapezoids to pixman
Chris Wilson [Sat, 5 Oct 2013 08:48:03 +0000 (09:48 +0100)]
sna/trapezoids: Do not pass invalid trapezoids to pixman

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1197921
Link: http://lists.x.org/archives/xorg-devel/2013-October/037996.html
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/trapezoids: Add a precise scan converter
Chris Wilson [Fri, 4 Oct 2013 17:37:01 +0000 (18:37 +0100)]
sna/trapezoids: Add a precise scan converter

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Start splitting the trapezoids megafile into parseable blocks
Chris Wilson [Fri, 4 Oct 2013 14:43:43 +0000 (15:43 +0100)]
sna: Start splitting the trapezoids megafile into parseable blocks

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Fix FillRectangles intersection with complex clip
Chris Wilson [Fri, 4 Oct 2013 15:12:17 +0000 (16:12 +0100)]
sna: Fix FillRectangles intersection with complex clip

Lesson 2: Use the right variables.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Tidy up FillRectangles intersection with complex clip
Chris Wilson [Fri, 4 Oct 2013 15:12:17 +0000 (16:12 +0100)]
sna: Tidy up FillRectangles intersection with complex clip

Lesson 1: do not accidentally overwrite the loop count inside the loop.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/dri: Only move the scanout to the flip cache if destroyed
Chris Wilson [Fri, 4 Oct 2013 13:14:19 +0000 (14:14 +0100)]
sna/dri: Only move the scanout to the flip cache if destroyed

Under certain circumstances, we can retire the pageflip before the
client has updated its back buffers. This leads us to pre-emptively
moving the scanout to the cache, when all we need to do (and will do) is
report the same back buffer back to the client.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Add a few more DBG to track refcnts
Chris Wilson [Fri, 4 Oct 2013 13:13:50 +0000 (14:13 +0100)]
sna: Add a few more DBG to track refcnts

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna/gen5: Replace pipe-control with full MI_FLUSH for required CS stall
Chris Wilson [Fri, 4 Oct 2013 08:36:49 +0000 (09:36 +0100)]
sna/gen5: Replace pipe-control with full MI_FLUSH for required CS stall

It appears that we need top-of-pipe synchronisation for changing of
certain state, and that the gen5 pipecontrol instruction is
insufficient. So we have to fall back on the good old MI_FLUSH in order
to make sure that the GPU invalidates its state correctly.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51422
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: The device fd is marked as non-blocking so beware the busy-wait
Chris Wilson [Fri, 4 Oct 2013 08:07:30 +0000 (09:07 +0100)]
sna: The device fd is marked as non-blocking so beware the busy-wait

During redisplay we wait for the pageflip result. If the fd is marked as
non-blocking this results in a busy-wait, so insert a poll first to
remove the busy-wait.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel-virtual-overlay: Error out if no X11 SHM header is defined
Chris Wilson [Fri, 4 Oct 2013 07:40:49 +0000 (08:40 +0100)]
intel-virtual-overlay: Error out if no X11 SHM header is defined

Make the error explicit rather than dieing later with unknown constants.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoconfigure: Disable building tools if prerequisite headers not found
Chris Wilson [Fri, 4 Oct 2013 07:37:48 +0000 (08:37 +0100)]
configure: Disable building tools if prerequisite headers not found

After the pkg-config checks, we then probe the headers. If those probes
fail, we obviously wish to prevent building the tools as the build will
fail.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Allow opening the device only through platform information
Chris Wilson [Thu, 3 Oct 2013 13:52:11 +0000 (14:52 +0100)]
intel: Allow opening the device only through platform information

Only fail to open the device based on the PCI address, if and only if we
do not have sufficient platform information to find the correct system
device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Handle fallback probing without match_data
Chris Wilson [Thu, 3 Oct 2013 14:58:26 +0000 (15:58 +0100)]
intel: Handle fallback probing without match_data

One extreme fallback path through the xf86PlatformProbe results in a
call without any match data. As we have a device by this point, we can
simply do a reverse match.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Remove dependence upon having PciInfo
Chris Wilson [Thu, 3 Oct 2013 14:35:54 +0000 (15:35 +0100)]
intel: Remove dependence upon having PciInfo

After some probing mechanisms, we may end up with a valid device without
knowing its PCI address a priori. Having a valid device, we can just
query it for the correct device id, and can safely abort any path that
requires PCI information that we don't have. (Those paths are not valid
under such hosting anyway - if it may be required, we could reconstruct
the address.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: And restore PlatformProbe to working order
Chris Wilson [Thu, 3 Oct 2013 13:42:45 +0000 (14:42 +0100)]
intel: And restore PlatformProbe to working order

In the saga of the untested WIP patches for hosted device probing, was
the failure in logic to detect a valid device during probing. Yikes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Querying device attributes must be non-NULL
Chris Wilson [Thu, 3 Oct 2013 13:08:36 +0000 (14:08 +0100)]
intel: Querying device attributes must be non-NULL

Check first for a NULL platform device before querying the attributes or
else suffer a segfault during PCI probing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Fix fallout from accident push of ODEV_ATTRIB_FD
Chris Wilson [Thu, 3 Oct 2013 12:36:46 +0000 (13:36 +0100)]
intel: Fix fallout from accident push of ODEV_ATTRIB_FD

This is WIP for passing along a hosted fd. It wasn't meant to be pushed
along with the bug fix this morning.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Restart timer evaluations if the BlockHandler takes too long
Chris Wilson [Thu, 3 Oct 2013 07:29:08 +0000 (08:29 +0100)]
sna: Restart timer evaluations if the BlockHandler takes too long

Rather than passing a negative timeout to select, if we detect that we
expired our timeout during the processing of the BlockHandler, restart.

More worrying is that something in the BlockHandler took longer than 3ms
to process.

Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Link: http://article.gmane.org/gmane.comp.freedesktop.xorg.devel/37388
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Query platform fd
Chris Wilson [Wed, 2 Oct 2013 17:29:38 +0000 (18:29 +0100)]
intel: Query platform fd

Under a compositor, we wish to use the pre-authorized fd passed to us by
the host, stashed away in the platform device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agointel: Pass the platform device along to the open routines
Chris Wilson [Wed, 2 Oct 2013 17:19:44 +0000 (18:19 +0100)]
intel: Pass the platform device along to the open routines

This allows us to pass along more metadata along with the platform
device in future. Currently we pass the device path, but in a hosted
environment we should be passing along the authorized fd from the host.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agoconfigure: Error out if glamor request but UXA is disabled
Chris Wilson [Wed, 2 Oct 2013 15:17:35 +0000 (16:17 +0100)]
configure: Error out if glamor request but UXA is disabled

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
11 years agosna: Only delete unused io buffers
Chris Wilson [Wed, 2 Oct 2013 13:59:11 +0000 (14:59 +0100)]
sna: Only delete unused io buffers

Before deleting the io buffer, we need to check that it is not active.
Currently we check that it is not pending use in the current batch, but
we also need to double check that it does not have outstanding use by
the GPU. Failing to do so could mean overwriting the data prior to it
being read by the GPU, a very small race but often hit!

Reported-by: Vedran Rodic <vrodic@gmail.com> # and many others
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66990
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>