Commit Graph

9143 Commits

Author SHA1 Message Date
Chris Wilson bbbcc4101c sna: Apply cursor hotspot transformation
After applying scaling to the cursor image, it was being positioned on
the display incorrectly due to the hotspot transformation remaining
unscaled and so offseting the cursor slightly.

References: https://bugs.archlinux.org/task/45572
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-18 12:20:21 +01:00
Chris Wilson 15215651a9 sna: Refresh last detection timestamp on hotplug notifies
If the status hasn't changed, mark the connector as recently probed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-16 13:03:20 +01:00
Chris Wilson 23986f0a31 sna: Update the last known status timestamp on modeset
If the modeset is successful we know the connector is still alive, so
update its timestamp.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-13 20:07:35 +01:00
Chris Wilson 717b6208d0 sna: Only update the CRTC mode serial number on success
If the kernel doesn't accept the update, then the CRTC remains in its
previous mode i.e. we should not also touch the modesetting serial
stamp.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-13 20:06:21 +01:00
Chris Wilson 650da13c72 sna: Coldplug unknown connections as well
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-11 09:02:06 +01:00
Chris Wilson 2c08d72393 sna: Use RRGetInfo() for setting hotplug/coldplug information
Force the full reprobe, resetting all the output properties on all
outputs if we detect a status change on hotplug. Rather than simply
translate the kernel mode lists ourselves, use the common functions in
case more settings change.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91929
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-10 10:23:45 +01:00
Chris Wilson d50d336605 sna: Coldplug all outputs on startup
Since we only update the mode list when the user queries xrandr or upon
a hotplug event, queue a deferred probe for 2s after X starts in order
to fill in the unknown modes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-09 20:47:51 +01:00
Chris Wilson f384af433c sna: Hook up kernel modes on hotplug notification
Some display managers, for example mutter, only use
XRRScreenResourcesCurrent() which means they only query the existing
modes on an output. We need to therefore update the list of available
modes after a hotplug event.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-09 20:28:19 +01:00
Chris Wilson f5aabb7bdd sna: On hotplug events, update the output->status
During the hotplug event, we query the current connector status and use
that to trigger an output changed event to the clients. However, since
we know the new status, we can set that on the RROutput immediately.
Note the modelist is left unchanged, and will only be queried when the
user requests it (though we may want to provide that in the hotplug
notify as well).

References: https://bugs.freedesktop.org/show_bug.cgi?id=91929#c2
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-09 11:27:40 +01:00
Chris Wilson e179e7d3a4 sna/dri2: Update the swap_limit on each ScheduleSwap
In order to catch transitions between SwapInterval 0 and 1 in the middle
of a flip sequence, we need to reset our swap_limit every time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-08 13:02:48 +01:00
Chris Wilson 300319e204 intel: Add an Option for disabling native rotation
Just in case we want to debug the native vs software paths and allow
switching without recompiling.  For the unfortunate

Section "Device"
	Identifier "igfx"
	Driver "intel"
	Option "HWRotation" "off"
EndSection

default is for us to use HW rotation where available (for speed, reduced
resource usage and reduce power usage).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-25 13:50:13 +01:00
Chris Wilson 3e07681c19 sna/dri2: Stop trying to attach vblank events to pixmaps
Once again I tried to add an event to a pixmap, but only Windows carry
the CRTC tracking information. Stop it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22 19:10:47 +01:00
Chris Wilson a6317fc329 sna: Fix build on squeeze
Not all build enviroments have a definition for the wait ioctl, so
provide one.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22 12:23:30 +01:00
Chris Wilson f3e14ec8de list: Consolidate the two list_for_each_from_safe()
We can use the same macro on top of the xorg list.h interloper as well
as the private version, so do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22 12:16:06 +01:00
Chris Wilson 5daec5173e sna/dri2: Do not attempt to queue an off-screen vblank if the primary is off
Even though the kernel reports and error and we skip the queuing, we
have information to avoid the roundtrip through the kernel.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22 11:45:18 +01:00
Chris Wilson 275d8b039a sna/dri2: Report an error if WaitMSC/GetMSC are called without any CRTCs
On a headless or hosted system, we do not have any CRTC on which to
report or queue the vblank. Reporting a BadDrawable is evil (as clients
never expect the error) but is better than crashing the Xserver.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22 11:43:11 +01:00
Chris Wilson c26cfbcc0c sna/dri2: Fix back buffer reuse for simple blits
Along the blit swap path, we expect the buffer to not be scanout
compatible and not have the same pitch as the front buffer. The reuse
logic failed to take this into account!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-22 10:28:32 +01:00
Chris Wilson 78f7451886 sna: Check for system memory contents when looking for empty sources
Fixes a regression from
commit 3f128867d9
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Aug 7 15:19:17 2015 +0100

    sna: Skip a no-op copy

that forgot that we can flush damage but still have valid contents to
copy from.

Reported-by: Timo Aaltonen <tjaalton@ubuntu.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-20 10:43:05 +01:00
Chris Wilson 8485441947 sna/dri2: Don't queue a vblank delay for a pixmap swap
Otherwise we raise assertions about trying to attach events to an
illegal Window.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 23:24:17 +01:00
Chris Wilson 74c1e45ed5 sna/dri2: Look for potential flip targets when recreating backbuffers
As the window may be reparented during its swap lifetime, we may be able
to recreate the backbuffer ready for flipping next swap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 21:46:43 +01:00
Chris Wilson 3d0cd2dfca sna/dri2: Extend the active buffer tracking to TearFree
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 20:27:29 +01:00
Chris Wilson 819971e7a6 sna/dri2: Remove stale active buffer assert
Since the DRI2BufferPtr destruction may be delayed, by the time we do
free it, the state may no longer be accurate. (At this level at least,
there is a later assertion to the same regard just as we think we are
releasing the buffer.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 20:24:37 +01:00
Chris Wilson 6f3e81d430 sna/dri2: Consolidate vblank queueing into a couple of helpers
With the rigamorale of assertions, using the vblank is no longer
trivial.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 20:06:15 +01:00
Chris Wilson e29dc33e35 sna: Release the mode before releasing the accel backend on LeaveVT
When we release the accel backend, we mark the interface as wedged.
However, when we release the modesetting backend we flush the vblank
queue which may want to do rendering. So if we do that first then
disable the accel backend, things we go much smoother.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658#c20
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 18:28:51 +01:00
Chris Wilson 6027bfc461 sna/dri2: Also track the front bo as an active buffer
This so that we permanently exclude the active front buffer from the set
of triple buffer replacements.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 17:03:02 +01:00
Chris Wilson 8a59e85801 sna/dri2: Initialise scratch.pScreen for copying
Down one particular patch (overlapping render copies) the
scratch.pScreen is dereferenced (to create a temporary Pixmap). Ensure
that we populate it before hand.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 16:48:58 +01:00
Chris Wilson 8c59c5ba4e sna/dri2: Remove unused local variable in normal builds
The local was only used in debug builds, so remove it to squash the
compiler warning.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 15:21:09 +01:00
Chris Wilson dab1c0f159 sna/dri2: Move the pending swap from the buffer to the event
To ease tracking of the next swap, stash it on the event (which is then
reused) rather than the back buffer (which changes frequently).

In addition, add debug flags and assertions to track event stages (such
as making sure we do not decouple/free an event that we have sent a
signal back to the client).

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-19 15:18:24 +01:00
Chris Wilson 18e4845027 sna/dri2: Transfer the pending back to the new back following the xchg
Third time lucky at getting the pending copy swap with the real back
correct?

References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18 13:37:09 +01:00
Chris Wilson b86974ffd4 sna/dri2: Do full exchanges of back/pending around deferred swaps
References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
References: https://bugs.freedesktop.org/show_bug.cgi?id=70461
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18 11:58:21 +01:00
Chris Wilson 79fc9a923c sna/dri2: Immediately complete a stale swap if any are queued
If we don't control the vblank for the window, we cannot use the vblank
signal as it ends up being queued as well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91658
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-18 09:21:20 +01:00
Chris Wilson 07eee812b2 sna/dri2: Avoid pushing the triple buffer into the cache list twice
A side effect of commit 4cea803798
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Aug 8 22:10:20 2015 +0100

    sna/dri2: Restore caching of fullscreen triple buffers

was that we discovered that we had been inserting the buffer into the
cache list multiple times.

Reported-by: Dan Doel <dan.doel@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=91658#c5
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-17 20:57:54 +01:00
Chris Wilson 1b3cf1efe3 sna/dri2: Check that the copy succeeds before associating the request
If the DRI2 copy ends up on the CPU, then we will not have a GPU
request for the operation.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-17 12:45:24 +01:00
Chris Wilson 9b0ed16385 sna/dri2: Flush the pending flip when a client disappears
If a client dies with a pending flip, we have to complete it so that the
scanout matches the frontbuffer again. This requires one last flip
following the client disapparance.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-16 13:31:16 +01:00
Chris Wilson 521b2c5a3b sna/dri2: Use the primary CRTC for swap completion for offscreen Windows
Letting GL clients run amok when offscreen (or when hidden) has
unexpected UX behaviour. Instead we can elect to throttle them to the
nearest CRTC and keep the desktop running smoothly.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 19:39:22 +01:00
Chris Wilson 2c03599166 sna: Fixup conversion of rotation into reflection
Similarly to the fix for reflection into rotation, make sure we only set
one Rotation bit afterwards.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 10:47:30 +01:00
Chris Wilson eea91b8e23 sna: Only handle a rotation natively if all bits are supported
Since we can combine Reflections and Rotations, we have to check all
bits.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 10:31:33 +01:00
Bob Paauwe f75a5689c3 sna: Fix the reduction of xy reflection onto rotations.
When reducing a xy reflection to a 180 degree rotation, make sure
only one rotation bit is set.  Also by rotating the bit left, we
can support cases where xy reflection happens with 90/270 degree
rotation.

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
[ickle: Interleave comments]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-14 09:15:57 +01:00
Chris Wilson 656c0a6946 list: Add missing ';' for the compatiblity macro for intermediate xorg
Reported-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-12 12:31:27 +01:00
Chris Wilson 5a9a3e73a9 sna/dri2: Keep the most-recent back buffer cache when reaping on idle
When the client misses a swap, we consider it idle and unlikely to swap
again for a while. We try to take advantage of that and remove the old
back buffers. But it is likely to swap again and so having some of that
cache around would be advantageous.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-11 10:48:48 +01:00
Chris Wilson 4cea803798 sna/dri2: Restore caching of fullscreen triple buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08 22:10:58 +01:00
Chris Wilson fd5f44f4d2 sna: A couple more asserts for valid flip data and handling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08 22:10:57 +01:00
Chris Wilson cadea260de sna/dri2: Add the old buffer from a chain swap to the swap cache
Rather than just discarding the old buffer, we want to add it to the swap
cache and so hand it back to the client in the near future.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-08 15:39:05 +01:00
Chris Wilson 611ec7d7d4 sna: Remove incorrect assertion
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 17:19:25 +01:00
Chris Wilson f324506f7d sna: Prefer direct writes if the target is LLC
If we can use WB CPU writes into the target, prefer to do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 16:45:38 +01:00
Chris Wilson 095528e6c3 sna: Tweak the semantics for small uploads into Damage tracked pixmaps
Based on further study of behaviour under a compositing manager, always
prefer to upload directly into the flushed bo, with a couple of
exceptions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 16:38:32 +01:00
Chris Wilson 07bcd3f0c7 sna: Use direct uploads into a Damage tracked for v.small operations
If the batch is being frequently flushed due to Damage+Composite
tracking, we cannot amalgamate the small copies into the destination and
so end up sending thousands and thousands of tiny batches with tiny
render copies hogging the GPU.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 15:26:30 +01:00
Chris Wilson 3f128867d9 sna: Skip a no-op copy
If the source has no contents, the destination is equally undefined.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 15:21:33 +01:00
Chris Wilson a3ac461a30 sna: Add a handle=%d to a DBG for consistency
Helps with grepping if the DBG are consistent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 15:18:49 +01:00
Chris Wilson 5ef9d68043 sna: More simple DBG tracing around cleanup/retire handling
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-08-07 14:04:31 +01:00