Commit Graph

9152 Commits

Author SHA1 Message Date
Chris Wilson df72bc5761 sna: Avoid truncating the cursor when scaling up
The affine_blt walks the destination image sampling from the source, so
we need to walk all the output pixels and not the source size.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09 15:40:58 +01:00
Chris Wilson 5793183c82 sna: Compute rotation cursor transformation
A confusion over the use of marking when we need to compute a
transformed cursor image using pixman version when we need to compute
transformed cursor coordinates meant that we failed to compute the
required transformation after simply rotating the monitor.

Should fix the regression from
commit bbbcc4101c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Sep 18 12:17:07 2015 +0100

    sna: Apply cursor hotspot transformation

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
References: https://bugs.archlinux.org/task/46606
2015-10-09 15:20:40 +01:00
Robert Ancell 4e668dd19c uxa: Add missing const to string to stop compiler warning 2015-10-02 10:43:10 +01:00
Chris Wilson 096ddef22d sna: Indicate when we expect to call RRGetInfo during discovery
Continuing the udevless saga where we query for topology changes on
calls to RRGetInfo() and so where we cannot call RRGetInfo() ourselves
on discovering the changes (to facilitate hotplug). The next step is
explicitly prevent the recursive call.

References: https://bugs.freedesktop.org/show_bug.cgi?id=91929#c10
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-01 09:47:59 +01:00
Olivier Fourdan 0d3e1d3b2e man: Fix discrepancy in man page for ZaphodHeads
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92179
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-29 12:57:00 +01:00
Chris Wilson 679ee12079 sna: Prevent infinite recursion on udevless RRGetInfo()
As summarised by Mark Kettenis:

    Unfortunately commit 2c08d72393 that
    was made to resolve this bug introduced infinite recursion if
    polling udev for events fails (which is always the case on systems
    without udev).  The scenario is as follows:

    1. The server calls RRGetInfo().
    2. RRGetInfo() calls sna_randr_getinfo()
    3. sna_randr_getinfo() calls sna_uevent_poll(), which returns false
    4. sna_randr_getinfo() calls sna_mode_discover()
    5. sna_mode_discover() calls RRGetInfo()

    and we jump straight back to step 2, until we run out of stack
    space and crash

Reported-by: Mark Kettenis <kettenis@openbsd.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91929#c8
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-28 11:10:12 +01:00
Chris Wilson f0fd4d500d sna: Explicitly retire any buffers underneath the static_request
If we are forced to use the static_request (reserved for allocation
failure), we dispatch the execbuffer synchronously and expect no buffers
to be present afterwards. Rather than just assert that this is so, we
should clean up the buffer list!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-23 10:52:42 +01:00
Chris Wilson 31d42ed563 sna: Check for udev events before reading
When performing RRGetInfo() we drain any pending uevents before checking
the CRTC/connector statuses. However, some versions of libudev do a
blocking read and so when we call RRGetInfo() from a Timer callback
(outside of the usual sigtimer interrupts) that blocking read lasts
indefinitely.

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-22 10:23:24 +01:00
Chris Wilson 7be6263b82 sna: Check alternate userptr mmappings
For a read-only mmaping, we may be able to use a read-write (as we know
we don't write) if the memory permits us. We can check this by forcing
the get-user-pages via set-domain(GTT).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-18 20:26:41 +01:00
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