Commit Graph

161 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
Ville Syrjälä 781fd07e55 meson: Add meson build system
Allow building the driver with meson. Could probably use
plenty of cleanups, but at least it gives me a working driver.
And I think I managed to make it build everything that
autotools builds.

Quite a few compiler warnings were suppressed as well. Might
want to look at those at some point.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-02-06 13:12:33 +00:00
Mike Gilbert 93942b7de8 tools/backlight_helper: #include "config.h"
The file uses defines from config.h but never actually includes it.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2017-02-10 21:52:47 +00: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 094924f7f8 tools/cursor: Print an ASCII representation as well
Show the ASCII outline of the cursor as well as the image stored in the
PNG.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-25 20:59:48 +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 7301516b63 tools/cursor: Error on malloc failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-21 14:09:01 +01: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 54770d46f1 tools/dri3info: Include compilation instructions for standalone building
Let the read know how to compile dri3info without having to compile the
whole of xf86-video-intel

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-21 10:16:27 +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 61d2baa430 configure: Make tools/PROGRAMS agnostic to tools presence
In order to make tools indivdiually selectable for compiling, we don't
want to override earlier tools - so use '+=' rather than a plain '='
when adding each tool to the set of PROGRAMS.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-01 15:55:11 +01:00
Chris Wilson 2f047c6278 tools/dri3info: Query refresh rate on Primary monitor
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-04-01 12:55:44 +01:00
Chris Wilson aa40f99014 Use AC_HEADER_MAJOR to find how to include major()
We need to include <sys/mkdev.h> on Solaris.

Reported-by: Richard Palo <richard@netbsd.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89763
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-25 14:14:30 +00:00
Chris Wilson 8e8eac5097 tools/cursor: Inlcude stdlib for malloc declaration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-06 09:11:11 +00:00
Chris Wilson 8d76f90e2c tools: Add simple tool to retrieve the current cursor from X
Slightly more funky would be to poke around in the CRTC, but that should
require master. As it stands this should help verify that what X is
supplying to the driver matches user expectations

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-04 11:20:50 +00: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 88db217705 tools/dri3info: Match fd against render nodes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 12:20:47 +00:00
Chris Wilson 27ededdfc7 tools/dri3info: Query the kernel driver name
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10 12:10:56 +00:00
Chris Wilson 928ff25430 tools: Add rudimentary dri3info
A simple tool just to check if the target Xserver offers dri3.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-09 17:09:55 +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 3140d72826 backlight: Prevent dereference of potential NULL argv
Adam Sampson spotted that

"It's possible (but not very sensible) to exec a program with an empty
argument list, so argv[0] is not necessarily a valid pointer. For
example:

$ cat exec0.c

int main(int argc, char *argv[]) {
    char *empty[1] = { NULL };
    execvp(argv[1], empty);
    perror("execvp");
    return 1;
}
$ ./exec0 /usr/libexec/xf86-video-intel-backlight-helper
Usage: (null) <iface>
"

He sensibly suggested that we hardcode the program name to avoid the
NULL dereference. Being the paranoid type, we should also be careful not
to write to any file descriptors outside of our control (i.e. stderr),
so disable the messages unless we are debugging.

Reported-by: Adam Sampson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-17 16:14:16 +01:00
Matthieu Herrb 8fa22964f6 backlight: Fix security issues in handling of the interface path name.
- don't allow '/' in the interface name to avoid escaping the /sys
  hierarchy
- check snprintf() return value for overflow.

Problems reported by  Adam Sampson. Thanks.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-04 20:33:29 +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 85bb55e4a6 intel: Fix weblinks (again)
Julien pointed out that I fail at checking links.

Reported-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-25 11:45:55 +01:00
Chris Wilson ff31d49bfa intel: Fix weblinks
Matti reported a few outdated links to intellinuxgraphics.org, now
superseded by 01.org.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-25 11:34:48 +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 0625185f47 intel-virtual-output: Make it possible to disable building via configure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-14 17:29:21 +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