Commit Graph

16558 Commits

Author SHA1 Message Date
Adam Jackson
6f0903ddc9 dix: Hush an almost certainly bogus warning
../dix/getevents.c: In function ‘transformAbsolute’:
../dix/getevents.c:1195:28: warning: ‘oy’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     struct pixman_f_vector p = {.v = {*x, *y, 1} };
                            ^
../dix/getevents.c🔢22: note: ‘oy’ was declared here
     double x, y, ox, oy;
                      ^~

This one is truly special. Even though both ox and oy are set and read
along the same paths, only oy is marked for this warning! Initializing
just oy = 0.0 fixes it entirely, but let's not make a weird thing
weirder.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:52 -04:00
Adam Jackson
57e872301f mi: Hush an almost certainly bogus warning
In file included from ../mi/miexpose.c:83:
../mi/miexpose.c: In function ‘miHandleExposures’:
../include/regionstr.h:174:22: warning: ‘expBox.y2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     (_pReg)->extents = *(_pBox);
     ~~~~~~~~~~~~~~~~~^~~~~~~~~~
../mi/miexpose.c:139:12: note: ‘expBox.y2’ was declared here
     BoxRec expBox;
            ^~~~~~

etc. It's initialized if (extents), and then only read if (extents),
but gcc doesn't seem to figure that out. Whatever, bzero it to be
explicit.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:49 -04:00
Adam Jackson
83913de25d xkb: Silence some compiler warnings
Of the form:

../xkb/XKBGAlloc.c: In function ‘SrvXkbAddGeomKeyAlias’:
../xkb/XKBGAlloc.c:591:13: warning: ‘strncpy’ specified bound 4 equals destination size [-Wstringop-truncation]
             strncpy(alias->real, realStr, XkbKeyNameLength);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is intentional; the code that reads from these fields never reads
more than 4 bytes anyway. Rephrase things in terms of memcpy so that's
clear. Obviously this is awful but in XKB awful is par.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:47 -04:00
Adam Jackson
d13cd3862e dmx: Silence a string truncation warning.
../hw/dmx/config/dmxparse.c: In function ‘dmxConfigCreateOption’:
../hw/dmx/config/dmxparse.c:385:13: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
             strncpy(option->string + offset, p->string, len);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/config/dmxparse.c:383:23: note: length computed here
             int len = strlen(p->string);
                       ^~~~~~~~~~~~~~~~~

The thing it's warning about is intentional, the surrounding code does
its own nul-termination. Make that obvious by using memcpy instead.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:44 -04:00
Adam Jackson
176f26e96a dmx: Clean up some argument parsing code
This threw:

../hw/dmx/input/dmxarg.c: In function ‘dmxArgParse’:
../hw/dmx/input/dmxarg.c:128:5: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
     strncpy(tmp, string, len);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/input/dmxarg.c:126:11: note: length computed here
     len = strlen(string) + 2;
           ^~~~~~~~~~~~~~

This code predates xstrtokenize, but that's no excuse.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:41 -04:00
Adam Jackson
be99072a1a dmx: Fix a read-from-uninitialized warning
../hw/dmx/dmxpixmap.c: In function ‘dmxBitmapToRegion’:
../include/regionstr.h:174:22: warning: ‘Box.x1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     (_pReg)->extents = *(_pBox);
     ~~~~~~~~~~~~~~~~~^~~~~~~~~~
../hw/dmx/dmxpixmap.c:208:12: note: ‘Box.x1’ was declared here
     BoxRec Box;
            ^~~

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:36 -04:00
Adam Jackson
c3b190f9da dmx: Fix some snprintf warnings.
snprintf doesn't terminate the string if it truncates, so things like
this are lurking crashers:

../hw/dmx/dmxprop.c: In function ‘dmxPropertyIdentifier.part.0’:
../hw/dmx/dmxprop.c:94:36: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 123 [-Wformat-truncation=]
     snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
                                    ^~                 ~~~~~~~~
../hw/dmx/dmxprop.c:94:5: note: ‘snprintf’ output 7 or more bytes (assuming 262) into a destination of size 128
     snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/dmxprop.c: In function ‘dmxPropertyWindow’:
../hw/dmx/dmxprop.c:372:36: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
     snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
                                    ^~
../hw/dmx/dmxprop.c:372:5: note: ‘snprintf’ output between 3 and 140 bytes into a destination of size 128
     snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We could be more precise about termination, but meh.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:31 -04:00
Adam Jackson
4c1453393f gtf: Warning fix
../hw/xfree86/utils/gtf/gtf.c: In function ‘print_fb_mode’:
../hw/xfree86/utils/gtf/gtf.c:241:50: warning: cast from function call of type ‘double’ to non-matching type ‘int’ [-Wbad-function-cast]
     printf("    timings %d %d %d %d %d %d %d\n", (int) rint(1000000.0 / m->pclk),       /* pixclock in picoseconds */

That's pretty nitpicky of you, gcc, but at least it's easy to fix.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
2018-04-05 14:18:16 -04:00
Daniel Stone
99f9b077c6 modesetting: Actually get framebuffer ID
We would fail to get the FB ID if it wasn't already imported, since we
were checking to see if the pointer was NULL (it never was) rather than
if the content of the pointer was 0.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Olivier Fourdan <ofourdan@redhat.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
2018-04-05 12:03:57 -04:00
Daniel Stone
8ff1cdb2bf dri3: Set stride and size for old clients
For old clients using the fd_from_pixmap entrypoint, make sure we set
stride and size correctly.

Noticed by inspection.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-04-05 10:51:38 -04:00
Daniel Stone
78574a66b5 modesetting: Don't reuse iterator in nested loop
drmmode_crtc_set_mode has a loop nested inside another loop, where both
of them were using 'i' as the loop iterator. Rename it to avoid an
infinite loop.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-05 10:48:10 -04:00
Mario Kleiner
ce2a4313dd modesetting: Fix page flipping harder under DRI 3.2.
Non-atomic kms drivers like radeon-kms (or nouveau-kms with
default setting of "atomic ioctl disabled") don't export
any formats, so num_formats == 0.

Some atomic drivers (nouveau-kms with boot param nouveau.atomic=1,
or intel-kms on, e.g., Linux 4.13) expose num_formats == 0, or
don't expose any modifiers, so num_modifiers == 0.

Let the drmmode_is_format_supported() check pass in these cases
to allow page flipping, as it works just fine.

Tested on NV-96 for nouveau, HD-5770 for radeon, Intel Ivybridge
with Linux 4.13 and drm-next to fix page flipping.

Fixes: 9d147305b4 ("modesetting: Check if buffer format is supported when flipping")
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-04-04 14:10:23 -04:00
Louis-Francis Ratté-Boulianne
44e7098367 modesetting: Have consistent state when using atomic modesetting
We need to make sure that the atomic commit are consistent
or else the kernel will reject it. For example, when moving
a CRTC from one output to another one, the first output CRTC_ID
property needs to be reset. Also if the second output was using
another CRTC beforehands, it needs to be disabled to avoid an
inconsistent state.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Tested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 14:01:51 -04:00
Louis-Francis Ratté-Boulianne
bc4d278132 modesetting: Use atomic modesetting to set DPMS mode
CRTCs and outputs needs to be enabled/disabled when the current
DPMS mode is changed. We also try to do it in an atomic commit
when possible.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Tested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 14:01:48 -04:00
Daniel Stone
23c67987a3 glamor: Add fd_from_pixmap hook
Add a fd_from_pixmap (singular) hook to go with fds_from_pixmap, which
will ensure that the pixmap is allocated without modifiers and is thus
exportable to non-modifier-aware clients.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Daniel Stone
9c407f0a1b glamor: Fall back to non-modifier allocations
If we try to allocate with particular modifiers but it fails, try to
fall back to non-modifier allocations.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Daniel Stone
86b2d8740a glamor: Reallocate pixmap storage without modifiers if necessary
If we need a pixmap's storage to be exported to a context in which we
aren't aware of modifiers, reallocate the buffer again without
modifiers.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Daniel Stone
aab5c46ccb glamor: Push make_exportable into callers
Rather than calling make_exportable from the get_bo entrypoint, make
sure that someone has already explicitly requested the pixmap be
exportable.

This is technically an ABI break in that it changes observable
behaviour, but no driver other than modesetting has ever used get_bo.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Daniel Stone
1b9fa3b64c glamor: Track if BO allocation used modifiers
Keep track of whether or not we fed modifiers into GBM when we allocated
a BO. We'll use this later inside Glamor, to reallocate buffer storage
if we allocate buffer storage using modifiers, and a non-modifier-aware
client requests an export of that pixmap.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Daniel Stone
0e9504e10c drmmode: Track if BO allocation used modifiers
Keep track of whether or not we fed modifiers into GBM when we allocated
a BO. We'll use this later inside Glamor, to reallocate buffer storage
if we allocate buffer storage using modifiers, and a non-modifier-aware
client requests an export of that pixmap.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Daniel Stone
75bba3aedc dri3: Use single-FD screen call for single-FD request
When importing client buffers into Pixmaps, we can use the fds_to_pixmap
hook for both single-FD and multi-FD client requests without any harm.

For the other direction of exporting Pixmap buffers to client FDs,
create a new helper which calls the old pixmap_to_fd hook if available.
This allows the implementation to ensure that the Pixmap storage is
accessible to clients not aware of multiple planes or modifiers, e.g. by
reallocating and copying.

This makes it possible to run a compositing manager on an old GLX/EGL
stack on top of an X server which allocates internal buffer storage
using exotic modifiers from modifier-aware GBM/EGL/KMS.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04 13:46:57 -04:00
Aaron Plattner
574069c291 xfree86: Restore newline before "X Protocol Version" string
The newline before the protocl version got lost in commit
6cbefc3e0a. Prior to that commit, the
release date printed a newline at the end:

 X.Org X Server 1.19.6
 Release Date: 2017-12-20
 X Protocol Version 11, Revision 0
 Build Operating System: Linux 4.14.12-1-ARCH x86_64

Now, that string gets run together with the version:

 X.Org X Server 1.19.99.903 (1.20.0 RC 3)X Protocol Version 11, Revision 0
 Build Operating System: Linux

Since the version string printing has a variety of #ifdefs in it, just
add the newline to the begining of the protocol version string.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-03 14:59:25 +10:00
Adam Jackson
df6cbf7a2b xserver 1.20 RC3
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-04-02 15:44:50 -04:00
Louis-Francis Ratté-Boulianne
f580116f3c modesetting: Fix reported size when using atomic modesetting
The framebuffer can include multiple CRTCs in multi-monitors
setup. So we shouldn't use the buffer size but the CRTC size
instead. Rotated displays are shadowed, so we don't need to
worry about it there.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-04-02 14:58:57 -04:00
Louis-Francis Ratté-Boulianne
ce7d5087cf modesetting: Ignore alpha channel when importing BOs for modesetting
Fixes a regression caused by modifiers support. For some hw to
continue working even if not supporting ARGB8888 and ARGB2101010
formats, we assume that all imported BOs are opaque.

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Tested-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-04-02 14:58:52 -04:00
Olivier Fourdan
85b3fc1860 modesetting: Use actual crtc position for pageflip
Otherwise the same content is shown on all outputs.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.comM>
2018-04-02 14:57:23 -04:00
Emil Velikov
a10f1c9e08 docs: remove resource management references
The code referenced was removed back in 2009.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-02 14:10:58 -04:00
Emil Velikov
32c07e6b83 docs: purge some ISA references
The respective ISA functions were dropped back in 2008

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-02 14:10:51 -04:00
Thierry Reding
80d4098411 meson: Add pixman-1 to required modules in xorg-server.pc
pixman headers will be included for builds of external modules against
the xorg-server SDK. Make sure pixman is listed as a required module so
that the correct CFLAGS will be added.

Note that the xorg-server.pc generated by the autotools-based build has
many more modules listed, but this seems to be enough to build at least
some of the external drivers against an X server built with Meson (I've
tested with xf86-input-libinput, xf86-video-nouveau and xf86-video-ati).

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-04-02 13:42:11 -04:00
Thierry Reding
88c7b8bf4b meson: Distribute more SDK headers
Install missing headers to the SDK directory to allow external modules
to properly build against the SDK. After this commit, the list of files
installed in the SDK include directory is the same as the list of files
installed by the autotools-based build.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-04-02 13:42:08 -04:00
Thierry Reding
f3b0a2aee2 meson: Remove usage of pkg-config --variable=includedir
Querying a pkg-config variable using the --variable option produces the
value of the given variable as stored in the pkg-config file and should
not be used to add directories to the include search path.

The reason for this is that it breaks cross-compilation, because header
files are installed relative to the host sysroot. pkg-config supports a
PKG_CONFIG_SYSROOT_DIR environment variable that points to this sysroot
and will prepend that to the path of directories in -I or -L options in
pkg-config's Cflags, Libs or Libs.private keywords. However, because no
context can be inferred from variable names, as opposed to the keywords
with fixed meaning, the sysroot path will not be prepended to them. The
build system is responsible for doing so if necessary since it is aware
of the context in which the variable is used.

Adding the include directory returned by pkg-config to the include path
leaks build system information into the cross-build and break with very
confusing errors such as this:

	In file included from include/misc.h:82:0,
			 from dix/atom.c:55:
	/usr/include/pthread.h:682:6: warning: '__regparm__' attribute directive ignored [-Wattributes]
	      __cleanup_fct_attribute;
	      ^~~~~~~~~~~~~~~~~~~~~~~

or this:

	In file included from include/misc.h:139:0,
			 from dix/atom.c:55:
	/usr/include/stdlib.h:133:8: error: '_Float128' is not supported on this target
	 extern _Float128 strtof128 (const char *__restrict __nptr,
		^~~~~~~~~

Fix this by replacing the include directory with the appropriate xproto
dependency required to add the correct include directory to the compile
command for subdirectories that are missing the dependency. As detailed
above, this gives pkg-config the opportunity to prepend the sysroot for
all paths in -I compiler options.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-04-02 13:42:02 -04:00
Tobias Klausmann
1c002bc434 modesetting/drmmode: add NULL pointer check in drmmode_output_dpms
drmmode_output_dpms is called especially with !output->crtc found in
xf86DisableUnusedFunctions so we have to guard for it, else the server
segfaults:

0  0x00007fdc1706054b in drmmode_output_dpms (output=0x55e15243c210, mode=3) at
drmmode_display.c:2243
1  0x000055e1500b6873 in xf86DisableUnusedFunctions (pScrn=0x55e152133f00) at
xf86Crtc.c:3021
2  0x000055e1500be940 in xf86RandR12CrtcSet (pScreen=<optimized out>,
randr_crtc=0x55e1524b2b90, randr_mode=0x0, x=0, y=0, rotation=<optimized out>,
num_randr_outputs=0, randr_outputs=0x0) at xf86RandR12.c:1244
3  0x000055e1500fa1c2 in RRCrtcSet (crtc=<optimized out>, mode=0x0, x=0, y=0,
rotation=rotation@entry=1, numOutputs=numOutputs@entry=0, outputs=0x0) at
rrcrtc.c:763
4  0x000055e1500fba9e in ProcRRSetCrtcConfig (client=0x55e152bfae50) at
rrcrtc.c:1390
5  0x000055e150044008 in Dispatch () at dispatch.c:478
6  0x000055e150047ff8 in dix_main (argc=13, argv=0x7ffc68561038,
envp=<optimized out>) at main.c:276
7  0x00007fdc1a0c6a87 in __libc_start_main () at /lib64/libc.so.6
8  0x000055e150031d0a in _start () at ../sysdeps/x86_64/start.S:120

Fixes: ba0c75177 ("modesetting: Fix up some XXX from removing GLAMOR_HAS_DRM_*")
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-02 13:34:47 -04:00
Tobias Klausmann
258081759f glamor: sanitze handling of "Debug" Option for "dmabuf_capable"
With the appearance of the this new Option the X Server would crash if the
option is not set.

Default dmabuf_capable to off/FALSE for now - a user without knowledge about
this option does not want to enable it until its save.

Fixes: d11d5bb80 ("glamor: Hide new DRI behind Option "Debug" "dmabuf_capable")
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-02 12:27:35 -04:00
Adam Jackson
debf75bd0b xserver 1.20 RC2
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-03-28 16:34:36 -04:00
Adam Jackson
726839459c autotools: Derive xkb configuration from xkbcomp.pc
... if available, falling back to the current heuristics otherwise. This
_finally_ gets me to being able to run util/modular/release.sh without
overriding $prefix.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-03-28 16:34:36 -04:00
Adam Jackson
d11d5bb80d glamor: Hide new DRI behind Option "Debug" "dmabuf_capable"
... for xfree86, at least for now. Things appear to work for Xwayland
but not yet for modesetting. Hopefully we can fix that before 1.20 but
in the meantime this makes testing both paths easier than a rebuild.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-03-28 16:34:28 -04:00
Adam Jackson
df13ea7da9 xfree86: Add Option "Debug" to ServerFlags
This provides a generic way to control obscure runtime behavior knobs
without making interface promises.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-03-28 16:33:52 -04:00
Antoine Martin
c95361465e os: Fix -logfile when used with -displayfd
Trivial way to reproduce the bug:

$ Xorg -logfile /tmp/mylog -config /etc/xpra/xorg.conf -displayfd 2

The server then moans:

Failed to rename log file "/tmp/mylog" to "/tmp/mylog": No such file or directory

And the log file is created but immediately renamed to "/tmp/mylog.old".
This is caused by the changes to the log file handling introduced by
this commit:

https://cgit.freedesktop.org/xorg/xserver/commit/?id=edcb6426f20c3be5dd5f50b76a686754aef2f64e

To fix this, only rename the logfile if the log filename contains the
magic substitution string "%s".

Signed-off-by: Antoine Martin <antoine@nagafix.co.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-03-28 15:16:02 -04:00
Olivier Fourdan
b355e55f50 automake: Fix 'make dist'
Automake would skip a few meson files that would prevent to build with
meson a dist file previously generated by automake.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2018-03-28 15:11:16 -04:00
Kyle Brenneman
16639ab77d Don't delete GLX's extensionInitCallback list during a reset.
When a callback list is initialized using CreateCallbackList via AddCallback,
the list gets added to the listsToCleanup array, and as a result the list gets
deleted at the end of the server generation.

But, vendor libraries add themselves to that callback list only once, not once
per generation, so if you delete the list, then no vendor will register itself
on the next generation, and GLX breaks.

Instead, use a static CallbackListRec for the extensionInitCallback list. That
way, it doesn't get added to listsToCleanup, and doesn't get deleted during a
reset.

Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 15:04:39 -04:00
Daniel Stone
7004a7c3c9 modesetting/drmmode: Remove unused flink call
We don't use flink in the GetFB import path anymore, as we do an
FD-based import instead.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-28 14:53:23 -04:00
Roman Gilg
be087778a0 xwayland: Activate Present flips in rootless mode with Glamor
Link the newly introduced support for Present flips. For now flips can only
be used in rootless mode together with Glamor.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:37:01 -04:00
Roman Gilg
07750ff3c0 xwayland: Implement queuing present vblanks
Queue present events to msc values. Fake msc events with a refresh rate of
about 60fps when flips are not possible. When flips are executed rely on
frame callbacks with a slow updating timer as fallback.

This is important for applications, that want to limit their framerate.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:59 -04:00
Roman Gilg
86df366973 xwayland: Add fallback timer for msc counting
When the compositor is not sending frame callbacks while we still wait
on buffer release events fake a continuous msc counter with a timer.

Having this timer is a prerequisite for queuing events.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:55 -04:00
Roman Gilg
0fb2cca193 xwayland: Preliminary support for Present's new window flip mode
Introduce support for Present's window flip mode. The support is not yet
complete, but works reasonable well for the most important use case, that
is fullscreen applications.

We take a Present flip and if the xwl_window->window has the same dimensions
as the presenting window, the flip is represented by a wl_buffer and attached
to the main wl_surface of the xwl_window.

After commit we are listening for the sync callback in order to tell Present,
that the pixmap flip is not longer pending, for the frame callback in order
to update the msc counter and for the buffer release callback in order to tell
Present that the pixmap is idle again.

The following functionality is missing from this patch:
* (slowed down) flips in case the compositor is not sending frame callbacks,
* queuing events to MSC times,
* per window flips for child windows with smaller size than the xwl_window.

To make use of this functionality Xwayland must run rootless and with
Glamor/GBM.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:51 -04:00
Roman Gilg
8fba2a03f1 xwayland: Add arguments to glamor_pixmap_get_wl_buffer
Add arguments to give the caller more information and control
over the creation of a wl_buffer with GBM, in particular let
the caller determine the size of the buffer.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:45 -04:00
Roman Gilg
902429f077 present: Add exported init function of window flip mode
Allow drivers now to initialize window flip mode.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:44 -04:00
Roman Gilg
a337949f99 present: Add cleanups for window flip mode
Make sure that vblanks and windows get cleaned up correctly
in window flip mode.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:42 -04:00
Roman Gilg
66a5c0bccb present: In window flip mode report damage on flip to driver
Calculate damage before trying to flip and report it to the driver.
This allows drivers to optimize their rendering.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:39 -04:00
Roman Gilg
029608dd80 present: Add window flip mode
In contrast to screen flip mode this mode:
* supports flips per windows (these windows currently need to have the same
  size as their parent windows with the same pixmap),
* sends pixmap idle signals to the client only after the driver has given
  an additional event notify.

This patch only introduces the new mode as a stub. It additionally needs a
driver hook, such that it can get initialized and appropriate cleanup
functions.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28 14:36:36 -04:00