Commit Graph

138 Commits

Author SHA1 Message Date
Ville Syrjälä bfeeae4de9 tools: Get rid of -Wno-sign-compare
Fix the sign comparison warnings by changing some types, and
using a few casts.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-09-19 19:24:38 +03:00
Chris Wilson cdd0671764 tools/intel-virtual-output: Check for pending events before blocking
If the xlib/xcb library has pulled events from the fd, then a poll on
that fd will block until new events arrive. If none do, we fail to
process the currently waiting events in a timely fashion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-11-30 23:54:05 +00:00
Chris Wilson 371219c34a intel-virtual-output: Virtual heads are numbered from index 1
When checking for VIRTUAL support on the xserver, it helps to check for
the right name.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-08 09:17:19 +00:00
Chris Wilson 9083d2ed58 intel-virtual-output: Print more helpful error when run on the wrong server
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-06 14:18:08 +00:00
Chris Wilson 8e987511f0 tools/intel-virtual-output: Propagate screen blanking
When attaching to a target display, disable the builtin screen blanking
(equivalent to xset -d :8 s off, or setting
	Option          "BlankTime"     "0"
	Option          "StandbyTime"   "0"
	Option          "SuspendTime"   "0"
	Option          "OffTime"       "0"
in the target xorg.conf). Then listen to the ScreenSaver notify events
on the host and forward the activations/resets to the targets. This
should then keep all the screen blanking in sync.

Reported-by: Raffael Herzog <herzog@raffael.ch>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93562
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-04 18:15:25 +00:00
Chris Wilson 082a57e6eb tools/intel-virtual-output: Respond to expose events on target displays
If the destination screen is exposed (for example screensavers), we need
to redraw. So enable the ExposeEvent on the target and synthesize
damage to any clones on that display in order to trigger a redraw.

Reported-by: Raffael Herzog <herzog@raffael.ch>
References: https://bugs.freedesktop.org/show_bug.cgi?id=93562
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-01-03 09:55:29 +00:00
Chris Wilson 1525b01778 intel-virtual-output: Fix cloning fixed mode outputs
When using a fixed mode, e.g. a Display without RandR support like
Xnest, we have to remember to hook up the connection during
recofiguration of VIRTUAL outputs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-06-03 13:14:01 +01:00
Chris Wilson f696867c89 intel-virtual-output: Record the cursor shape in the DBG log
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-16 22:15:31 +01:00
Chris Wilson 63c43dfa63 intel-virtual-output: Only store cursor image on reference display
We only need a single copy of the cursor image, from which we can create
all the cloned cursors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-05-16 22:15:31 +01:00
Chris Wilson 15354751b7 tools/intel-virtual-output: Update DBG comment to include DRI3 transport
The Pixmap may either be being used for DRI3 or SHM transport.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-09 10:40:59 +01:00
Chris Wilson 2b978c71e4 tools/intel-virtual-output: Use xcb_dri3_id
xcb exports the extension structs for querying whether they exist and
sharing the results.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-25 14:29:03 +00:00
Chris Wilson 127aae5a72 tools/intel-virtual-output: Check for DRI3 more carefully
Using xcb, we cannot simply call xcb_dri3_query_version() without it
terminating the connection if DRI3 is not enabled on the target display.
Oops.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89172
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-16 21:48:41 +00:00
Chris Wilson 82e4802670 intel-virtual-output: Do not attempt to tidy up the local display if it fails
Just fix the segfault dereferencing the primary display if we bail
during its setup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-17 08:01:30 +00:00
Chris Wilson c211b3bc61 intel-virtual-output: Add version number to verbose output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-17 08:00:00 +00:00
Chris Wilson 7548f77fff intel-virtual-output: Initialise width/height for a disabled output
virtual.c:1081:6: warning: variable 'width' is used uninitialized
whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (clone->dst.mode.id == 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~
virtual.c:1092:6: note: uninitialized use occurs here
        if (width == clone->width && height == clone->height)
            ^~~~~
virtual.c:1081:2: note: remove the 'if' if its condition is always false
        if (clone->dst.mode.id == 0) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual.c:1079:11: note: initialize the variable 'width' to silence this warning
        int width, height;

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 21:15:18 +01:00
Chris Wilson f95d04b75b intel-virtual-output: Use snprintf() for simplicity
Third one-line patch to fix copying from the tainted user argument into
the socket's path buffer. This time, give in and just use snprintf() as
it guarrantees that it will not write more than 'n' characters and that
the last is a NUL byte.

Suggested-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-27 10:24:35 +01:00
Chris Wilson 011f04ff8e intel-virtual-output: Fix invocation of strncpy()
Somebody (me) confused it with snprintf() and put the string length in
the wrong location. Also note that strncpy() does not NUL terminate long
strings.

Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-26 18:31:05 +01:00
Chris Wilson e827f80e5c intel-virtual-output: Sanity check length on user supplied socket path
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Suggested-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-26 12:46:41 +01:00
Chris Wilson 4ae346e764 configure: Double check xinerama's headers
Having the pkgconfig present doesn't always necessarily imply the
headers are installed correctly - just fail over gracefully for xinerama
and intel-virtual-output

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-18 07:38:59 +01:00
Chris Wilson 901d889dd7 intel-virtual-output: Remove one redundant cleanup on error
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-30 07:44:25 +01:00
Chris Wilson a8b0ba0ed5 intel-virtual-output: Cleanup singleton on failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-29 15:30:03 +01:00
Chris Wilson 8188966485 intel-virtual-output: Convert debugging messages to verbosity
Original patch by main.haarp:
"A verbose switch is quite useful for debugging, it shouldn't require
editing and recompilation to gain more useful output. I added it."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80664
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-29 15:29:46 +01:00
Chris Wilson 05fdfe3b28 intel-virtual-output: Compile fixes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13 21:43:59 +01:00
Chris Wilson 8a92261b22 intel-virtual-output: Disable outputs on remote displays upon shutdown
References: https://bugs.freedesktop.org/show_bug.cgi?id=79994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13 20:00:05 +01:00
Chris Wilson 0c6fa0cdf0 intel-virtual-output: Initialise image after clone
As the image inherits its width/height from the clone, we need to set
those first on the clone.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13 19:30:54 +01:00
Chris Wilson 79b4e45ebe intel-virtual-output: Only call XShmDetach on a valid SHM segment
Saves a couple of extraneous XErrors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13 19:30:54 +01:00
Chris Wilson c8074b6bcf intel-virtual-output: Check for an error creating the DRI3 fd
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79994
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13 18:37:47 +01:00
Chris Wilson 67b37332bd intel-virtual-output: Add DRI3 xfer path
Just as proof-of-principle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 8d1e9afb60 intel-virtual-output: Probe after claiming virtual output
Rerun a detection cycle after claiming the virtual output so that it is
hidden again.

References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-22 20:55:55 +01:00
Chris Wilson 10c18b1a46 intel-virtual-output: Mark the source SHMPixmap as writeable
This is fortunately a no-op, as it gets initialized to zero already
(that is the pixmap is writeable). However, we may as well do the right
thing...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-16 10:02:16 +01:00
Chris Wilson c5bad6daaa intel-virtual-output: Disable remote CRTC using the remote Display!
Reported-by: Kirill Müller <mail@kirill-mueller.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78293
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-07 07:56:14 +01:00
Chris Wilson 77507909a1 intel-virtual-output: Grab the server whilst cleanging up the local output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-06 06:59:20 +01:00
Chris Wilson 464ef44ab1 intel-virtual-output: Copy existing CRTC information
If we fail to disable the remote output during initialisation, copy the
current configuration in order to try and keep the bookkeeping in order.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 14:50:44 +01:00
Chris Wilson 194f9332d3 intel-virtual-output: Try disabling Panning after disabling CRTC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 14:34:12 +01:00
Chris Wilson 5279ebf564 intel-virtual-output: Mark ShmPixmap destinations as writeable
In order to prevent a subsequent BadAccess when we try to use it as a
ShmPixmap, we need to mark the segment as writeable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
2014-05-05 13:07:31 +01:00
Chris Wilson a93d2d4f91 intel-virtual-output: Check for errors whilst creating ShmPixmaps
Creating a ShmPixmap may cause an asynchronous BadAccess error, so wrap
the construction with XSync and check for an error before proceeding.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
References: https://bugs.freedesktop.org/show_bug.cgi?id=78293
2014-05-05 13:07:31 +01:00
Chris Wilson 45892b3a63 intel-virtual-output: Record shm/randr/xinerama queries in DBG log
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 12:42:56 +01:00
Chris Wilson 6c9f216d7c intel-virtual-output: Check error state when disabling CRTC
Only mark an output as disabled if we do successfully disable it. This
will require a little more work to make sure that such errors are
cleanly propagated back to the host...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-05 12:42:56 +01:00
Chris Wilson f9a279b2dc intel-virtual-output: Fix damage bounds
Sigh. A serious mixup of integer promotion rules and wraparound caused
the damage computation for small regions to be completely bogus.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-09 22:15:19 +01:00
Chris Wilson bf18751398 intel-virtual-output: Fixup DBG messages
Use the right variables and it may even compile.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-07 08:28:55 +01:00
Chris Wilson 771b86e2a8 intel-virtual-output: Add DBG option to force 16 bit transfers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 14:26:54 +00:00
Chris Wilson a273b207b9 intel-virtual-output: Fix damage iteration over active list
When iterating over the active list to mark the current damage, we need
to chase the ->active pointer rather than ->next or else we walk the
wrong list from the wrong starting point.

Reported-by: Kirill Müller <mail@kirill-mueller.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76271
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-25 09:40:40 +00:00
Chris Wilson bfd51e2056 intel-virtual-output: Add a little more DBG around damaging clones
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-25 08:59:58 +00:00
Chris Wilson 278ef8f7bc intel-virtual-output: Do not detach with DBG enabled
Since DBG is sent to stdout, we only see it if we do not daemonize
(which closes stdout).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-25 08:33:46 +00:00
Chris Wilson 57e63221ec intel-virtual-output: Minor DBG fixes
Improve the summary after failing to detect MIT-SHM, and fix a DBG

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 19:49:59 +00:00
Chris Wilson 8cc1f005c6 intel-virtual-output: Iterate over remote outputs in the same order as listed
If we walk the output lists in the same order as they are listed by
RandR, we are more likely to hit favourable priority sorting. E.g. the
user is likely to setup the outputs in the same order as listed, meaning
fewer CRTC transitions etc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 15:55:41 +00:00
Chris Wilson a55bbe3b59 intel-virtual-output: Disable panning before setting mode on CRTC
For whatever reason, presumably to do with the switch between CRTCs, we
need to disable the panning before setting the mode in order for our
desired CRTC position to take effect.

Reported-by: Jeff Katz <bugzilla@kraln.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76146
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 15:47:20 +00:00
Chris Wilson 5079830bd5 intel-virtual-output: Mode names are freed with ScreenResources
So we have to be careful not to continue to reference the strings after
they may be freed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 14:35:29 +00:00
Chris Wilson f47f192f22 intel-virtual-output: Include extra debug information for modesets
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 11:38:19 +00:00
Chris Wilson 0ad54325e9 intel-virtual-output: Disable remote CRTCs at startup
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 08:15:24 +00:00