Commit Graph

95 Commits

Author SHA1 Message Date
Povilas Kanapickas b67e514dbb meson: Fix warnings when reading back and checking feature flags
Meson does not like comparing things of different types which is a
problem when reading back values of feature flags as they may contain
either false (bool) or 1 (string).

Since there is a strong reason why we use false when the feature does
not exist, we work around this issue by always converting the returned
value to int via to_int().

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1190
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-07-05 12:46:14 +00:00
Jan Beich eceafd4a2d meson: switch getpeer* checks to autotools style
Checking for function "getpeereid" : YES
Checking for function "getpeerucred" : NO
[...]
include/meson.build:182:7: ERROR: Argument to "not" is not a boolean.

Fixes: 68c2cfadd6 ("meson: Make sure defines are either set to 1 or not defined")
2021-04-09 16:44:27 +00:00
Jan Beich 9f8421af63 meson: check pthread_setname_np like autotools
FreeBSD < 12.2 and OpenBSD only have pthread_set_name_np.
As libpthread isn't in scope use -Werror to trip the check.

Header <pthread.h> has symbol "PTHREAD_MUTEX_RECURSIVE" : YES
Checking if "pthread_setname_np(tid, name)" compiles: YES

os/inputthread.c:326:5: error: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pthread_setname_np (pthread_self(), "InputThread");
    ^
os/inputthread.c:447:5: error: implicit declaration of function 'pthread_setname_np' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pthread_setname_np (pthread_self(), "MainThread");
    ^

Fixes: c20e7b5e22 ("meson: Automatically detect HAVE_PTHREAD_SETNAME_NP")
2021-04-09 15:43:37 +00:00
Povilas Kanapickas 68c2cfadd6 meson: Make sure defines are either set to 1 or not defined
This will make the behavior of meson consistent with autotools. The
configuration macros are exposed to public headers so any inconsistency
is likely to break code for anyone who's not careful to use #ifdef
instead of #if.

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-04-09 11:18:54 +00:00
Povilas Kanapickas faff5bbdf5 meson: Sync the name of INPUTTHREAD conf macro with autotools build
The rest of dix code uses INPUTTHREAD, so having a different name in
meson configuration was an oversight.

Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/936

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
2021-04-09 11:18:54 +00:00
Povilas Kanapickas 2df55813d0 meson: Drop version subpatch handling 2021-04-08 14:06:02 +00:00
Adam Jackson 5d3679104a meson.build: Keep the protocol version looking like xserver 1.20.x did
This effectively changes the versioning to be as if xserver 21.0 was
xserver 1.21.0. This should keep any client-side version checks that
know about the Xorg 7.0 -> xserver 1.0 epoch from getting confused.
2021-04-08 14:06:02 +00:00
George Matsumura 3e4e70db10 meson: Fix DragonFly BSD identifier in meson build files
This changes the operating system identifier tested against
host_machine.system() in meson build files from "dragonflybsd"
to the officially stable "dragonfly".

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2021-04-08 02:23:21 +00:00
Michel Dänzer 6c51818a0f meson: Make sure XKM_OUTPUT_DIR has a trailing slash
RunXkbComp passes an invalid file path to xkbcomp if there's no
trailing slash.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1146
Suggested-by: Dylan Baker <dylan.c.baker@intel.com>
2021-03-15 16:53:46 +01:00
Jan Beich 376eaadde3 meson: hide C API if Xorg is disabled (like autotools)
When building only Xwayland using Meson some files are always installed.
This causes package conflict if Xwayland is built separately from Xorg.

  include/xorg/compositeext.h
  include/xorg/damage.h
  include/xorg/damagestr.h
  include/xorg/dbestruct.h
  include/xorg/dri3.h
  include/xorg/fb.h
  include/xorg/fboverlay.h
  include/xorg/fbpict.h
  include/xorg/fbrop.h
  include/xorg/geext.h
  include/xorg/geint.h
  include/xorg/glyphstr.h
  include/xorg/mi.h
  include/xorg/micmap.h
  include/xorg/micoord.h
  include/xorg/migc.h
  include/xorg/miline.h
  include/xorg/mioverlay.h
  include/xorg/mipict.h
  include/xorg/mipointer.h
  include/xorg/mipointrst.h
  include/xorg/mistruct.h
  include/xorg/misync.h
  include/xorg/misyncfd.h
  include/xorg/misyncshm.h
  include/xorg/misyncstr.h
  include/xorg/mizerarc.h
  include/xorg/panoramiX.h
  include/xorg/panoramiXsrv.h
  include/xorg/picture.h
  include/xorg/picturestr.h
  include/xorg/present.h
  include/xorg/presentext.h
  include/xorg/randrstr.h
  include/xorg/rrtransform.h
  include/xorg/shadow.h
  include/xorg/shmint.h
  include/xorg/syncsdk.h
  include/xorg/vndserver.h
  include/xorg/wfbrename.h
  include/xorg/xace.h
  include/xorg/xacestr.h
  include/xorg/xorg-server.h
  include/xorg/xvdix.h
  include/xorg/xvmcext.h
  share/aclocal/xorg-server.m4

Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2021-03-11 00:22:36 +00:00
Michel Dänzer add3df2001 Consolidate fourcc.h
Move the copy in hw/xfree86/common to include/, and remove the one in
hw/kdrive/src/.

Fixes DIX glamor code including an xfree86 DDX header.
2020-09-15 11:43:16 +02:00
Jan Beich b5b529799a meson: split udev from udev_kms which requires systemd
DragonFly and FreeBSD can use xf86-input-libinput with config/udev.

ld: error: undefined symbol: xf86PlatformDeviceProbe
>>> referenced by xf86platformBus.c
>>>               xf86platformBus.c.o:(xf86platformProbe) in archive hw/xfree86/common/libxorg_common.a

ld: error: undefined symbol: xf86PlatformDeviceCheckBusID
>>> referenced by xf86platformBus.c
>>>               xf86platformBus.c.o:(xf86platformProbeDev) in archive hw/xfree86/common/libxorg_common.a

ld: error: undefined symbol: xf86PlatformReprobeDevice
>>> referenced by xf86platformBus.c
>>>               xf86platformBus.c.o:(xf86platformVTProbe) in archive hw/xfree86/common/libxorg_common.a

ld: error: undefined symbol: NewGPUDeviceRequest
>>> referenced by udev.c
>>>               udev.c.o:(device_added) in archive config/liblibxserver_config.a

ld: error: undefined symbol: DeleteGPUDeviceRequest
>>> referenced by udev.c
>>>               udev.c.o:(device_removed) in archive config/liblibxserver_config.a
2020-05-27 07:16:02 +00:00
Adam Jackson ee9f6e20de meson: Add support for libunwind 2020-02-12 16:56:13 -05:00
Kenneth Graunke 195c2ef8f9 glamor: Add a function to get the driver name via EGL_MESA_query_driver
This maps to eglGetDisplayDriverName if EGL_MESA_query_render is
supported, otherwise it returns NULL.
2019-11-26 01:13:45 -08:00
Matt Turner e6ab7f9f34 xfree86: Test presence of isastream()
isastream() was never more than a stub in glibc, and was removed in
glibc-2.30 by commit a0a0dc83173c ("Remove obsolete, never-implemented
XSI STREAMS declarations").

Bug: https://bugs.gentoo.org/700838
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2019-11-22 15:22:43 -05:00
Jon Turney 622eea366a meson: Add sha1 library options
v2: Set the define for xha1.c programatically, rather than using loads
of conditionals.
2019-10-30 16:58:39 +00:00
Adam Jackson 89a9927b1e include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
Alan Coopersmith 6036e84527 meson: fix builds on Solaris 11.4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2019-09-23 16:28:42 -07:00
Adam Jackson 7d0e660e0e meson: Add dtrace support 2019-08-27 17:38:59 -04:00
Olivier Fourdan aed62f8fbe meson/xwayland: No libdrm nor epoxy without glamor
When building Xwayland with neither DRI nor GLamor support enabled with
the Meson build system, the resulting binary would still link against
libdrm and epoxy even though those are not used/needed.

Make sure we require and link against libdrm and epoxy only if needed.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2019-08-15 17:08:04 +00:00
Jon Turney 7b4b030df8 configure: Check for sigprocmask
MinGW defines SIG_BLOCK, but doesn't have signal masks, so rather than
checking for SIG_BLOCK, add a configure check for sigprocmask.

v2:
Also add check to meson.build
2019-05-18 14:59:38 +00:00
Jon Turney 246b729df8 configure: Force --disable-input-thread for MinGW
I don't think an input thread can ever be useful on Windows.

There is a pthread emulation, so having the thread itself isn't much of
a problem.

However, there is no device to wait on for Windows events, and even if
we were to replace select() with WFMO, Windows wants to send events for
a window to the thread which created that window.

So, disable input thread by default for MinGW

v2:
Also add similar to meson.build
2019-05-18 14:59:38 +00:00
Jon Turney 655b1eb32e meson: Convert xquartz from autotools
Differences from autotools:

* Autotools defined NO_ALLOCA for OSX builds.  I don't think we need
this anymore as Xalloc.h is no longer used anywhere in the xserver.

* X11.bin is linked with -u,miDCInitialize, and then libserver_mi
provided to satisfy (just) that.  It's been that way since the commit
which added it.  We can't write the equivalent in meson due to linker
argument ordering issues, but do we really need to?

* An explicit -Dsecure-rpc=false is required for OSX, since in meson we
don't do the checks that XTRANS_SECURE_RPC_FLAGS did for the existence
of the specific RPC functions required.
2019-05-02 15:42:58 +00:00
Jon Turney ecf62b7ba6 meson: Build rootless extension 2019-05-02 15:42:58 +00:00
Jon Turney 504468d2cf meson: Don't use strndup() unless it's prototyped
A workaround for https://github.com/mesonbuild/meson/issues/3672

MinGW-w64 gcc has a built-in strndup, but it's not in the C library and
MinGW-w64 headers don't prototype it.

Don't try to use it, as that will cause an undefined reference if gcc
decides that an out-of-line call is appropriate.
2019-04-30 20:07:51 +00:00
Jon Turney 50b8670fdf meson: Require clock_gettime() as well for MONOTONIC_CLOCK
As configure.ac, require that clock_gettime() exists as well to use
MONOTONIC_CLOCK (MinGW provides the define, but not the function)
2019-04-30 20:07:51 +00:00
Jon Turney d21224cd15 meson: Don't set UNIXCONN on Windows
As XTRANS_CONNECTION_FLAGS did, don't try to build unix socket support
on Windows.
2019-04-30 20:07:51 +00:00
Jon Turney c2feeca1b0 meson: Absence of dri.pc is an error if building with GLX
Currently, this can error if dri.pc isn't found, as we can't then get
the value of pkgconfig variable from it:

include/meson.build:199:10: ERROR:  'dri' is not a pkgconfig dependency

I think we need DRI_DRIVER_PATH (only) when building GLX, even if dri2/3
isn't enabled, so we know where to load swrast_dri.so from.

(For autotools, configure.ac directly calls `pkg-config
--variable=dridriverdir dri`, the backticks swallowing any error,
causing the value of this define to be empty if dri.pc isn't present)
2019-04-30 20:07:51 +00:00
Alexander Volkov f6753c117e shm: Use memfd_create when possible
It doesn't require shared memory dir and thus allows
to avoid cases when this dir is detected incorrectly,
as in https://bugreports.qt.io/browse/QTBUG-71440

Signed-off-by: Alexander Volkov <a.volkov@rusbitech.ru>
2019-02-14 12:53:06 +03:00
Eric Anholt 19f6cb570b shm: Pick the shm dir at run time, not build time.
Prodding the builder's filesystem for tmp dirs doesn't necessarily
tell you anything about what the actual host's filesystem is going to
look like, so we should just try the dirs at runtime.

Signed-off-by: Eric Anholt <eric@anholt.net>
2018-09-19 21:36:16 +00:00
Eric Anholt b8b64cd627 xorg: Don't log "Build Operating System: Linux 4.9.0-5-amd64 x86_64 Debian"
I don't think this is useful information to have in the log, and it's
a bunch of autotools and meson logic to produce it.

Signed-off-by: Eric Anholt <eric@anholt.net>
2018-09-19 13:15:04 -07:00
Eric Anholt bfa6e84641 meson: Add configure option and autodetection of HAVE_INPUTTHREAD.
Signed-off-by: Eric Anholt <eric@anholt.net>
2018-09-19 13:10:29 -07:00
Eric Anholt 1fc20b985c meson: Add detection of libsystemd-daemon.
This enables Xtrans's systemd socket activation.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:42:54 -04:00
Eric Anholt 4ba7866770 meson: Get close to parity with autotools for CLIENTIDS tracking.
The client ID is only needed for XRes, and autotools build ignores the
--clientids= arg if xres is disabled.  We haven't made a meson option
for disabling tracking client ids (is it actually worth a build
option?), so just make this depend on xres.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:42:54 -04:00
Eric Anholt e047da37be meson: Add missing setup of the NO_LOCAL_CLIENT_CRED define.
Ported from autotools.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:42:54 -04:00
Eric Anholt 049d2346ab meson: Make FALLBACK_INPUT_DRIVER configurable in meson.
This makes us match the featureset of autotools, and also fixes the
non-Linux default value to match.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:42:54 -04:00
Eric Anholt 97bd8bc9cb meson: Make xf86vidmodeproto mandatory.
This is silly to have optional based on detection of the protocol
headers, particularly now that we have a single protocol header repo
to install.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
2018-08-09 13:28:23 -04:00
Eric Anholt db53c439ba meson: Add linking to x86 iopl libs on BSDs.
Ported from automake.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:28:21 -04:00
Eric Anholt 9869512cbf meson: Add HAVE_LIBDISPATCH define to xquartz build.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:28:19 -04:00
Eric Anholt 843e44adf1 meson: Add PIO access support for FreeBSD and NetBSD on Alpha.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 13:28:17 -04:00
Eric Anholt c20e7b5e22 meson: Automatically detect HAVE_PTHREAD_SETNAME_NP
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-02 10:27:40 -04:00
Eric Anholt accd32a466 xorg: Remove the XF86PM define.
We already have pm_noop.c being built most of the time for the
no-OS-PM case, so just switch to always using it.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-02 10:27:37 -04:00
Eric Anholt 708ddfbda1 automake,meson: Remove HAVE_LIBUDEV define.
CONFIG_UDEV and CONFIG_UDEV_KMS are the actual defines that are used
in the C code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-02 10:27:36 -04:00
Eric Anholt 7deaf99007 meson: Automatically detect support for XTRANS_SEND_FDs.
The SCM_RIGHTS flag seems to be the thing that xtrans depends on, and
meson makes the check easy without needing a build option.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-02 10:27:33 -04:00
Laurent Carlier 2f39b2a078 meson: Add configuration of listening on tcp, unix and local
bugzilla: https://bugs.kde.org/show_bug.cgi?id=395419
bugzilla: https://bugs.archlinux.org/task/59025

Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-28 15:15:49 +10:00
Aaron Plattner f5ded22e14 meson: Set XCONFIGFILE to 'xorg.conf' instead of '/etc/xorg.conf'
The autoconf build hard-codes XCONFIGFILE to just 'xorg.conf':

 XF86CONFIGFILE="xorg.conf"
 AC_DEFINE_DIR(XCONFIGFILE, XF86CONFIGFILE, [Name of configuration file])

Later, the X server passes that into DoSubstitution() which expands the path:

 DoSubstitution(template="/etc/X11/%X", ..., XConfigFile="xorg.conf")

This returns "/etc/X11/xorg.conf".

The Meson build, on the other hand, sets XCONFIGFILE to
join_paths(get_option('sysconfdir'), 'xorg.conf'). If sysconfdir is /etc, this
results in '/etc/xorg.conf', resulting in DoSubstitution returning
'/etc/X11/etc/xorg.conf'.

Fix this by just hard-coding XCONFIGFILE to 'xorg.conf'.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2018-05-07 12:25:00 -04:00
Aaron Plattner 1a3e4a2f67 meson: Define DEFAULT_LIBRARY_PATH as join_paths(get_option('prefix'), get_option('libdir'))
'libdir' defaults to 'lib', so running X -showDefaultLibPath just prints 'lib'
instead of '/usr/lib' or '/usr/local/lib'. Use joint_paths() to get the correct
full path.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2018-05-07 12:23:34 -04:00
Adam Jackson 4191b59bd5 meson: Fix build with three-component version numbers
Otherwise:

include/meson.build:5:0: ERROR: Index 3 out of bounds of array of size 3.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-05-02 15:10:20 -04:00
Lyude Paul 54ac09717c xwayland: Add glamor egl_backend for EGLStreams
This adds initial support for displaying Xwayland applications through
the use of EGLStreams and nvidia's custom wayland protocol by adding
another egl_backend driver. This also adds some additional egl_backend
hooks that are required to make things work properly.

EGLStreams work a lot differently then the traditional way of handling
buffers with wayland. Unfortunately, there are also a LOT of various
pitfalls baked into it's design that need to be explained.

This has a very large and unfortunate implication: direct rendering is,
for the time being at least, impossible to do through EGLStreams. The
main reason being that the EGLStream spec mandates that we lose the
entire color buffer contents with each eglSwapBuffers(), which goes
against X's requirement of not losing data with pixmaps.  no way to use
an allocated EGLSurface as the storage for glamor rendering like we do
with GBM, we have to rely on blitting each pixmap to it's respective
EGLSurface producer each frame. In order to pull this off, we add two
different additional egl_backend hooks that GBM opts out of
implementing:

- egl_backend.allow_commits for holding off displaying any EGLStream
  backed pixmaps until the point where it's stream is completely
  initialized and ready for use
- egl_backend.post_damage for blitting the content of the EGLStream
  surface producer before Xwayland actually damages and commits the
  wl_surface to the screen.

The other big pitfall here is that using nvidia's wayland-eglstreams
helper library is also not possible for the most part. All of it's API
for creating and destroying streams rely on being able to perform a
roundtrip in order to bring each stream to completion since the wayland
compositor must perform it's job of connecting a consumer to each
EGLstream. Because Xwayland has to potentially handle both responding to
the wayland compositor and it's own X clients, the situation of the
wayland compositor being one of our X clients must be considered. If we
perform a roundtrip with the Wayland compositor, it's possible that the
wayland compositor might currently be connected to us as an X client and
thus hang while both Xwayland and the wayland compositor await responses
from eachother. To avoid this, we work directly with the wayland
protocol and use wl_display_sync() events along with release() events to
set up and destroy EGLStreams asynchronously alongside handling X
clients.

Additionally, since setting up EGLStreams is not an atomic operation we
have to take into consideration the fact that an EGLStream can
potentially be created in response to a window resize, then immediately
deleted due to another pending window resize in the same X client's
pending reqests before Xwayland hits the part of it's event loop where
we read from the wayland compositor. To make this even more painful, we
also have to take into consideration that since EGLStreams are not
atomic that it's possible we could delete wayland resources for an
EGLStream before the compositor even finishes using them and thus run
into errors. So, we use quite a bit of tracking logic to keep EGLStream
objects alive until we know the compositor isn't using them (even if
this means the stream outlives the pixmap it backed).

While the default backend for glamor remains GBM, this patch exists for
users who have had to deal with the reprecussion of their GPU
manufacturers ignoring the advice of upstream and the standardization of
GBM across most major GPU manufacturers. It is not intended to be a
final solution to the GBM debate, but merely a baindaid so our users
don't have to suffer from the consequences of companies avoiding working
upstream. New drivers are strongly encouraged not to use this as a
backend, and use GBM like everyone else. We even spit this out as an
error from Xwayland when using the eglstream backend.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-24 16:51:18 -04:00
Lyude Paul 994f781007 xwayland: Add xwayland-config.h
Just a small autogenerated header that will soon contain more then just
one macro.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-24 14:58:19 -04:00