Commit Graph

9364 Commits

Author SHA1 Message Date
Chris Wilson 52d3a026bb sna: Split SHM and DRI flush tracking
Tracking SHM flushes precludes some of the optimisations we can make in
future for tracking DRI flushes, so split the two paths.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-02 13:03:49 +01:00
Chris Wilson 1f6dfc9df6 sna: Only flush GPU bo for a damage event
Based on xf86-video-ati

commit 9a1afbf61fbb2827c86bd86d295fa0848980d60b
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Mon Jul 11 12:22:09 2016 +0900

    Use EventCallback to avoid flushing every time in the FlushCallback

reports seeing an improvement in reducing flushes at the expense of
checking every event for a DamageNotifyEvent. Since we also mix
rendering with SHM buffers, we have a more diverse set of conditions
under which to flush - but maybe we will see enough of a win for DRI to
merit. So far seeing improvement of ~20% for series of small operations
under the compositor without seeing any regressions, should benefit
composited desktop users. The biggest danger here is missed flushes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-02 13:03:26 +01:00
Chris Wilson 49daf5df12 sna: Use GCC pragma to enable SSE2 blt routines
Rather than use per-function attributes, if we set the target for the
block using a pragma we can compile the SSE2 routines on 32bit ISA as
well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-29 17:41:55 +01:00
Chris Wilson 24f613cae4 sna: Hide the hardware cursor when switching back after an error
If the kernel complains when trying to move the cursor, we disable the
hwcursor and switch to swcursor. However, if the kernel is still showing
the hwcursor we end up with multiple visible cursors. Attempt to disable
the hwcursor (that may or may not work) as we switch over.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-28 22:42:28 +01:00
Chris Wilson 8bfac0f21a sna/dri2: Only force the TearFree/swcursor hack when using TearFree
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-28 19:43:01 +01:00
Chris Wilson ab57363a1c sna: Enable kernel fail logging for cursors
Log the kernel messages when we fail to set a cursor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-28 19:42:25 +01:00
Chris Wilson 6988b873b0 sna: Unregister the BlockHandler on close
Now that we register a callback with an external stack and not the
screen, we have to remove it when the screen is destroyed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-21 12:53:56 +01:00
Chris Wilson d39197bb10 legacy/i810: Fix compilation with Video ABI 23 changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-21 12:33:29 +01:00
Chris Wilson 4eaab17aec Adapt to libXfont2 ABI changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-20 11:29:20 +01:00
Chris Wilson 24ab9145c7 Update to ABI 22 and NotifyFd
ABI 22 brings in a new BlockHandler/WakeupHandler interface
(SetNotifyFd) and throws out the current interface (albeit without
delivering any improvements).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-20 11:29:20 +01:00
Hans de Goede df0b2ce823 intel: Fix fd (and mem) leak when intel_scrn_create fails
The probe functions in intel_module.c call intel_open_device() before
calling intel_scrn_create(), but if the later fails because of e.g.
an allocation failure they were not cleaning up the resources
claimed by intel_open_device(), esp. leaking the fd is a problem
because this breaks the fallback to the modesetting driver.

This commit fixes this by adding a intel_close_device() cleanup
function and calling that when intel_scrn_create() fails.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-07-14 21:49:27 +01:00
Adam Jackson 6d8a19910a uxa: Don't bother with xf86GARTCloseScreen
We only ever use xserver's AGP support from the i810 driver.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2016-07-14 21:43:26 +01:00
Ville Syrjälä 1c449ffa58 sna/gen2/video: Implement textured video support
Add textured video support for gen2. The hardware can only deal with
packed YUV formats, so only those will be exposed.

Modelled after the gen3 textured video code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-07-14 20:44:56 +01:00
Ville Syrjälä 01e5845421 sna/gen2: Don't pass sna_composite_op to gen2_emit_target()
Instead of passing sna_composite_op to gen2_emit_target(), pass all the
parameters (bo,width,height,format) directly. This makes it possible to
use gen2_emit_target() when we don't have an sna_composite_op.

This matches how gen3_emit_target() works.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-07-14 20:40:14 +01:00
Chris Wilson 26f8ab5429 sna: Restore local damage processing for TearFree/DRI2/swcursor early
We currently hack TearFree/DRI2/swcursor to avoid recursion from inside
the SwapBuffers to handle the swcursor. This has the issue of a trailing
cursor on the boundary of the DRI2 drawable, but prevents the explosion
from swapping TearFree buffers from within the TearFree handler (i.e.
recursion). This only has to apply to the damage processing before the
swap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-04 10:11:50 +01:00
Chris Wilson 4556ac396e sna: Track TearFree shadow as an active scanout
Don't allow DRI2 to hand back the current shadow buffer as a Drawable's
next back buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-04 10:07:51 +01:00
Chris Wilson 9154dff9ae DRI3 is not supported by mesa/i915
Since mesa requires __DRI2_FLUSH version 4 for its DRI3 support and
mesa/i915 only provides version 3, libGL fails to load (not even falling
back to DRI2). Workaround this by not enabling DRI3.

References: https://bugs.freedesktop.org/show_bug.cgi?id=96783
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-02 17:30:50 +01:00
Rodrigo Vivi 784dc0228a pciids: Removing PCI IDs that are no longer listed as Kabylake.
This is unusual. Usually IDs listed on early stages of platform
definition are kept there as reserved for later use.

However these IDs here are not listed anymore in any of steppings
and devices IDs tables for Kabylake on configurations overview
section of BSpec.

So it is better removing them before they become used in any
other future platform.

It reflects kernel:
commit a922eb8d4581c883c37ce6e12dca9ff2cb1ea723
Author: Rodrigo Vivi <rodrigo.vivi@intel.com>
Date:   Thu Jun 23 14:50:36 2016 -0700
    drm/i915: Removing PCI IDs that are no longer listed as Kabylake.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-01 17:24:59 +01:00
Rodrigo Vivi 97be00cb38 pciids: Add more Kabylake PCI IDs.
The spec has been updated adding new PCI IDs.

In parity with kernel:
commit 33d9391d3020e069dca98fa87a604c037beb2b9e
Author: Rodrigo Vivi <rodrigo.vivi@intel.com>
Date:   Thu Jun 23 14:50:35 2016 -0700

    drm/i915: Add more Kabylake PCI IDs.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-07-01 17:24:00 +01:00
Chris Wilson bc369bbf4a sna: Avoid recursion by testing shadow.wait
References: https://bugs.freedesktop.org/show_bug.cgi?id=96695
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-28 15:07:35 +01:00
Chris Wilson cac7c8dc4b sna: Skip wait_for_shadow() when shadow is temporarily disabled
When recursing, we guard against unwanted waits by temporarily disabling
the shadow. For the most part, we actually defer the wait to avoid
recursion, but in a few instances detecting the recursion is hard (e.g.
finishing a vblank and then performing the FakeFront copy). Here, we
just ignore shadow (it should only be a read of valid data) and exit to
avoid the assertion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-25 10:36:38 +01:00
Chris Wilson e827ef7811 sna: Fixup DBG for sprite rename
A few compiled out DBG escaped the sprite rename.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-25 10:35:59 +01:00
Chris Wilson c28e62f94f sna/gen2+: Do not force migration to GPU for very large objects
If the target is larger than the maximum render size, allow us not to
migrate to the GPU if it is entirely damaged on the CPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-21 21:19:46 +01:00
Chris Wilson f1c757e451 sna: Only shutdown unknown secondary planes on CRTC we control
In a ZaphodHead scenario, we do not own all the CRTC and so we should
not be making changes outside of our zone of control. Also, we only want
to disable secondary overlay planes and ignore the secondary cursor
planes which are controlled through the normal modesetting.

As we are now tracking all sprite planes on a CRTC, this leads to much
simpler code.

Reported-by: Egbert Eich <eich@freedesktop.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-21 21:19:06 +01:00
Chris Wilson 7b6e219fe4 sna: Hide compiler warnings for change in uAPI defines
Just a minor, safe, change in the uAPI defines for DRM_CAP_CURSOR_WIDTH
causes the compiler to spit out a warning. (The warning was intentional
to check that when the defines were added to the uAPI they matched. Now
that they are concrete in the uABI, but the defines are subject to the
whims of the author.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-20 12:04:54 +01:00
Chris Wilson ebc5e9c3b2 sna/video: Create one XvAdapter for each sprite plane
The caveat here is that the sprite plane must be available on all CRTCs
so that the availability of the XvAdapter is not dependent upon output
configuration or Window placement.

Based on a patch by Michael Hadley <michaelx.hadley@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-20 11:58:37 +01:00
Chris Wilson 52c9d7ca24 sna/video: Prepare for multiple sprite ports
Allocate an array of XvAdapters, one for each sprite plane on a CRTC.

Based on a patch by Michael Hadley <michaelx.hadley@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-20 11:58:35 +01:00
Chris Wilson 00a3adaf43 sna: Record all sprite planes reported by the kernel
In the following patches, we wish to expose them all to userspace. First
we have to enumerate them, and make sure they all behave as expected.

Based on a patch by Michael Hadley <michaelx.hadley@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-20 11:58:17 +01:00
Chris Wilson b617f80ca5 compat: Another day, another ABI change for OsBlockSGIO
Now OsBlockSGIO/OsReleaseSGIO are back in the headers, but we include
compat-api.h too early so we do not remove them. Instead, move the
avoidance inline.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-06-01 08:00:20 +01:00
Chris Wilson 7337f558d8 sna: Use physical output size from the kernel
We have a conflict between Xorg and the kernel, once again, over the
meaning of the EDID. Since the kernel supplies us with the physical size
of the connector, let's place the burden of trust on the kernel and
ignore the quirky behaviour of Xorg.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=96255
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-31 09:40:18 +01:00
Chris Wilson 000378a801 compat: Add OsBlockSIGIO/OsReleaseSIGIO wrappers
Signal-driven cursor are removed in ABI_VIDEODRV_VERSION 22.0.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-30 16:01:03 +01:00
Chris Wilson 4458f1bf8a sna: Restore TearFree operation after switching everything off
We give up on TearFree if we ever see an error whilst page flipping (in
the hope that we can keep displaying via direct use of the scanout).
With the advent of MST, this can happen simply by the user unplugging a
dock causing connectors to disappear and if we flip before we see the
uevent telling us which outputs are disabled, we get an error.

So, lets try and re-enable TearFree on the next opportunity, when all
the outputs are off and we can rebuild the shadow buffer.

Reported-by: Martin Jørgensen <mkj@gotu.dk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=96180
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-28 19:23:38 +01:00
Chris Wilson 46ffdf295d sna/dri2: Avoid chaining swaps across a mode change
If the pixmap on a drawable changes between swap events, just queue a
normal vblank event rather than chaining up.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22 18:32:54 +01:00
Chris Wilson 2205da0729 sna: Display errno when SETCURSOR fails
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22 18:20:33 +01:00
Chris Wilson 8477615ae1 sna: Allow disconnected outputs to retain state without EDID checks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-22 14:18:20 +01:00
Chris Wilson 25d2c2d049 sna: Confirm the EDID is the same after a hotplug before ignoring
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-18 23:26:50 +01:00
Chris Wilson a508b11bde sna: Don't skip migration-to-GPU for TearFree
In 46caee86db ("sna: Fix reporting of errno after setcrtc failure"),
the intention was to avoid reporting a fail to migrate whilst wedged for
a simple copy from the frontbuffer to TearFree's shadow buffer. However,
by skipping the migration, we never flushed any dirt from the CPU buffer
prior to doing the TearFree flip.

References: https://bugs.freedesktop.org/show_bug.cgi?id=95401#c7
References: https://bugs.freedesktop.org/show_bug.cgi?id=95414#c4
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17 07:55:33 +01:00
Chris Wilson 48569eb18d sna: Track the minimum damage when doing CRTC-local TearFree
We avoid having to redraw the entire CRTC's buffer on every flip as we
know the contents from the previous flip are still available and only
need to invalidate the dirty region.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17 07:45:46 +01:00
Chris Bainbridge ab3ab412a4 sna: Fix increment of modeset serial after applying CRTC
We track how many mode sets have been made in order to detect stale
flips (i.e. a sequence that crosses a mode change). This was broken by
the logic inversion in setcrc in 46caee86db ("sna: Fix reporting of
errno after setcrtc failure")

References: https://bugs.freedesktop.org/show_bug.cgi?id=95401
Signed-off-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-17 07:28:23 +01:00
Chris Wilson 34f63f28c8 sna: Ensure we only cache the local CRTC scanout buffer
Double check that we are not about to cache the common, untransformed,
shadow buffer for the per-CRTC transformed buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-16 10:14:04 +01:00
Chris Wilson 3a7d6afd85 sna: Do not cache the current crtc bo after performing the setcrtc
When doing a SETCRTC as a fallack for a failed pageflip, do not use the
then current CRTC bo as the next bo for pageflipping - as then we will
render into it prior to flipping and so cause tearing.

References: https://bugs.freedesktop.org/show_bug.cgi?id=95401
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-16 10:01:09 +01:00
Chris Wilson f71447998c sna/dri2: Refactor open-coded __kgem_bo_is_busy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-14 16:18:42 +01:00
Chris Wilson 3c95efe5f7 sna/dri2: Force blocking wait if vblank queue fails
Whilst waiting for the previous blit to complete, if we fail to queue
the vblank to wake up on the next frame, block before replying the blit
is complete.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-14 16:18:42 +01:00
Chris Wilson 1486cfdf04 sna/gen6+: Don't force a switch to BLT if the target bo cannot be blitted
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-13 22:53:26 +01:00
Chris Wilson 512284fd47 sna/dri2: Enforce swap-limits on stale buffers
If the client sends an out-of-date swap request, first make sure that we
don't cause an error by chasing a NULL CRTC and secondly force them to
wait for a whole vblank before the next swap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-09 21:11:13 +01:00
Chris Wilson 88733a7874 sna/dri2: Force consideration of the DRI2CopyRegion source as unclean
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07 15:58:43 +01:00
Chris Wilson 08865b0af2 sna: Add a special case for fast DRI2CopyRegion and NoAccel
Enable copying onto a scanout buffer using a WC mmap - so long as it is
X-tiled and no swizzling.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07 15:58:43 +01:00
Chris Wilson b89f203b0d sna: Do not force ping-pong migration for TearFree + NoAccel
If acceleration is disabled, but we are using TearFree, then ideally we
want to flip the shadow buffer onto the scanout. If the shadow buffer is
already on the GPU, e.g. having been swapped in by a compositor, then we
do not want to move it to the CPU domain only to copy it back to a new
buffer and then flipped for a TearFree update.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-07 15:20:32 +01:00
Chris Wilson 47cd7fdd0b test: Exercise XVidMode switching
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-05-04 12:34:37 +01:00
Chris Wilson e4ef6e9e5b sna/dri2: Free the pending back buffer after use
The pending back buffer is only the pending copy, the actual info->back
stores the client's view of the current back buffer which may be more
recent than the pending copy. So store the current back buffer, swap in
the pending to do the normal swap, then free the resultant back (which
may have been exchanged with the front), before restoring the client's
current back buffer.

References: https://bugs.freedesktop.org/show_bug.cgi?id=95200
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-04-30 14:10:57 +01:00