Commit Graph

8578 Commits

Author SHA1 Message Date
Chris Wilson 65b680e6cf sna/video: Don't skip setplane if this frame.bo is the same as the last
Always show the image, even if the bo doesn't appear to change as the
client may have put fresh data in the shared buffer and repositioned the
image.

Suggested-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-10 15:42:54 +00:00
Chris Wilson 6d7e13f78b sna/video: Add tiling modifiers for addfb2
In case we do end up with a tiled buffer, create the framebuffer
appropriately.

Suggested-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-10 15:42:54 +00:00
Chris Wilson f3809df493 sna/video: Pass the dst extents to xf86XVClipVideoHelper()
xf86XVClipVideoHelper wants to measure from the origin of the target
extents to the clip in order to determine the right offset into the
source.

Suggested-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-10 15:42:54 +00:00
Chris Wilson 6c8fc44343 sna: Mark up CPU writes for scanout flush
When we flip to a bo, the kernel will flush it from the CPU write domain
and so afterwards we need to do a new set-domain to mark up a subsequent
CPU write (and flush before another flip).

References: https://bugs.freedesktop.org/show_bug.cgi?id=95414
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-05 23:50:10 +00:00
Chris Wilson bf7316a453 sna/dri2: Don't request a signal following a dead flip completion
If we do flip to restore the bo after the current Window is destroyed,
we should not request that we send an event back to the client.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-03 10:39:56 +00:00
Chris Wilson 40e3be3436 sna/dri2: Complete the final flip in a chain after the window is destroyed
When the pending flip is queued, we update all the Windows to use the
next bo as their rendering target. However, that bo is not yet the
scanout until the future flip is performed. If the current fullscreen
Window is destroyed, we still must allow that flip to proceed or else
the old bo is left on the scanout.

And yes, this is indeed a fix to one of the debug patches that intended
to detect the error causing #93844. Irony.

Fixes: 7817949314 ("sna/dri2: Avoiding marking a pending-signal on a dead Drawable")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93844
Reported-by: Diego Viola <diego.viola@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-03 10:25:00 +00:00
Chris Wilson 47da17fe74 sna: Load DRI3 if try to load DRI2 and fail
As a backup in case DRI2 is disabled due to the presence of vgaarb, make
sure we have DRI3 loaded.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-28 08:05:50 +01:00
Chris Wilson 714052fb32 sna: Keep the backlight iface name on the heap
When finding the per-connector backlight interface, we have to take a
copy of the interface name for later use, as in this case it is not
constant.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-24 22:22:44 +01:00
Chris Wilson 325570e731 sna: Check for the per-connector backlight sysfs interface
Modern kernels include a link from the sysfs connector directory to the
backlight interface on that connector. Try to find that link first as
this should allow us to enable backlight interfaces on connectors other
than the presumed solitary panel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-24 15:42:34 +01:00
Chris Wilson 388fd4a654 sna: Check current fb id before flip as well as after
More debug sanity checks that pageflips work.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-23 20:54:03 +01:00
Chris Wilson 90172d81ea sna: Allow Option DPMS to switch on (but not off)
We start off the system with the screens blanked, waiting the first
dixSaveScreen unblank, where we then apply the accumulated modesets.
This means we have to allow that even if Option DPMS off, and so we
restrict the Option to only enable DPMS (then once enabled they will not
turn off).

References: https://bugs.freedesktop.org/show_bug.cgi?id=98375
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-22 21:06:11 +01:00
Chris Wilson b7d6f695dd sna: Disable screen saver if Option "DPMS" is specified
The defacto standard is that the screensaver only blanks the screen but
keeps the outputs alive. We differ by actually disabling the CRTC when
the screen saver kicks in (to save power), however this circumvents
Option "DPMS".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98375
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-21 23:11:42 +01:00
Chris Wilson f18c7620cf sna: Only apply the CRTC fixup when attempting to turn DPMS off
If we were attempting to switch DPMS leave the state as is if the kernel
reports an error.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-21 11:54:05 +01:00
Chris Wilson b9cebe59f9 sna: Ignore the current CRTC mode following a hotplug event
If we detect a change in the output status, ignore the residual mode on
the CRTC. We use this CRTC mode during inheritance to provide
continuity and to make xrandr look neat we ensure that the mode is
included in the output list. However, following a hotplug event the
current mode may now be invalid and needs to be pruned.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-21 11:33:47 +01:00
Chris Wilson 6a2e5bca42 sna: Force a reprobe for the specified hotplug connector
If the kernel can provide us with the exact connector that needs
reprobing following a hotplug event, use it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-21 11:33:47 +01:00
Manasi Navare a43455d4a3 sna: Reprobe if kernel updates the connector mode list
Output_check_status() should return a false if it detects
that the connector mode list has changed so that sna_mode_discover
can reprobe.

Fixes: eb01cc549d (sna: Refresh mode list if the kernel updates)

Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
2016-10-18 09:33:12 +01:00
Chris Wilson eb01cc549d sna: Refresh mode list if the kernel updates
If the kernel changes its list of modes, make sure we update. (This is a
losing battle since X will add whatever modes it finds from the EDID
despite what the kernel is telling it.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-12 17:35:37 +01:00
Chris Wilson 696f58f69f sna: Add an assertion that the flip succeeds
Upon completion of the flip-event, check that the current scanout
matches our expectations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-07 23:34:21 +01:00
Chris Wilson bd33d0a7e9 sna: Force fb release on tiling changes
Since trying to change tiling with an fb attached causes EBUSY, try
without.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-04 12:55:07 +01:00
Chris Wilson d9a32dc657 sna/dri2: Assert signal is unset before setting
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-04 12:55:07 +01:00
Chris Wilson 2579d34713 sna: Handle GetImage planemask inplace
As found by Adam Jackson, we can perform the masking of the planemask on
the user buffer and so avoid hitting the fallback paths, so long as we
have no 24bpp Pixmaps.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-28 18:57:01 +01:00
Chris Wilson f0fbead9f2 sna/present: Prime the msc cache on first query
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-20 08:56:02 +01:00
Chris Wilson b45dbdbd44 sna: Update sanity check for next stage of Xorg ABI
Now X will set the scrn->screen backpointer before Init, update our
assertion to track.

Reported-by: Nick Sarnie <commendsarnex@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97855
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-19 09:34:32 +01:00
Chris Wilson 15c5ff1245 sna: Clear damage tracking when marking as all-clear
In the middle of a composite op, we take the opportunity to note when a
fill clears the entire surface - and mark up the surface as clear. This
includes marking it as all damaged, to the surprise of the upper layer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-08 08:30:02 +01:00
Chris Wilson 5735b3ce3c sna/dri2: Fix busy engine check
We should be using the kernel's exec-id and not our own index.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-07 14:48:12 +01:00
Chris Wilson 205146b0fd sna/gen9: Fix Kabylake typo
Reported-by: Joseph Yasi
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-05 10:05:30 +01:00
Chris Wilson ebc066c1ec sna: Add missing GT info for bxt,kbl
commit c446a7ccc7
Author: Wayne Boyer <wayne.boyer@intel.com>
Date:   Wed Nov 18 10:39:42 2015 -0800

    Add Kabylake PCI IDs

missed adding the GT information, leaving bxt,kbl using only generic
acceleration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-09-02 14:16:01 +01:00
Chris Wilson 74e4c131da sna: Limit the guessed modes by clock rate
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-29 08:25:09 +01:00
Chris Wilson 71d32739db sna/dri3: Flush the DRI3 pixmap bo before reporting the fd to the client
When the client first receives the fd to the pixmap, the presumption is
that it is coherent. (Give or take concurrent rendering to the pixmap
which will be reported in later Damage events.) We queue all damage to
the GPU, but we also need to remember to finally flush the command queue
so that the rendering is ordered implicitly with the client.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-23 09:06:52 +01:00
Chris Wilson 12c14deb40 sna/dri2: Ensure the DRI pixmap is flushed before replying
As we only ensure the flush before damage is sent, we also need to flush
any CPU shadows before the reply to GetBuffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-17 11:46:21 +01:00
Chris Wilson 0bbd55fd1d sna: Add CPU damage to DRI flush
When we damage the CPU shadow of a DRI exported pixmap, we must remember
to add that pixmap of the list to be flushed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-17 09:42:18 +01:00
Chris Wilson c8fc7f5e4b sna/dri2: Force the render to be flushed after DRI2CopyRegion
After doing the copy, we need to be sure that it is submitted to
hardware before the reply is sent to the client.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Fixes: 1f6dfc9df6 ("sna: Only flush GPU bo for a damage event")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-12 17:24:11 +01:00
Chris Wilson 8586813169 sna/dri2: Force the render to be flushed before reporting new buffers
When filling out the set of buffers for the DRI2GetBuffers request,
ensure that any pending rendering to them is flushed to hardware.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-12 17:24:09 +01:00
Chris Wilson c26a148541 sna: Avoid recursing whilst waiting for events within TearFree
Occasionally TearFree likes to flushing pending event to try and avoid a
stall or a reallocation of a buffer. When it does so, we must avoid
processing vblanks as they may cause an update to the frontbuffer
re-entering the TearFree handler. Instead of deferring the obvious
recursions until the next vblank, buffer the events temporarily whilst
we wait inside TearFree.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-11 21:39:36 +01:00
Chris Wilson 52343d7da1 sna: Remove translation from affine HW cursor transformation
When the CRTC is transformed, we also want to apply that transformation
to the cursor image so that we can continue to use the HW cursor (but
have it appear relative to the output and not to the framebuffer).
However, we need to convert the CRTC transformation relative to the
cursor and convert it to a simple rotation/scaling/skew transformation
(we already verify it is an affine) by removing any translation.

Reported-by: Da Fox <da.fox.mail@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97236
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-08 11:31:51 +01:00
Chris Wilson a77397a315 sna/dri2: Flush rendering to a reused front buffer before reporting
When the client calls DRI2GetBuffers it expects the buffer to be
coherent, that is all X rendering to it flushed to hardware for it to be
able to read back.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-08-03 08:07:00 +01:00
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