Commit Graph

28 Commits

Author SHA1 Message Date
Olivier Fourdan e167299f60 xfixes: Add ClientDisconnectMode
With Wayland compositors now being able to start Xwayland on demand, the
next logical step is to be able to stop Xwayland when there is no more
need for it.

The Xserver itself is capable of terminating itself once all X11 clients
are gone, yet in a typical full session, there are a number of X11
clients running continuously (e.g. the Xsettings daemon, IBus, etc.).

Those always-running clients will prevent the Xserver from terminating,
because the actual number of X11 clients will never drop to 0. Worse,
the X11 window manager of a Wayland compositor also counts as an X11
client, hence also preventing Xwayland from stopping.

Some compositors such as mutter use the XRes extension to query the X11
clients connected, match their PID with the actual executable name and
compare those with a list of executables that can be ignored when
deciding to kill the Xserver.

But that's not just clumsy, it is also racy, because a new X11 client
might initiate a connection the X11 server right when the compositor is
about to kill it.

To solve this issue directly at the Xserver level, this add new entries
to the XFixes extension to let the X11 clients themselves specify the
disconnect mode they expect.

Typically, those X11 daemon clients would specify the disconnect mode
XFixesClientDisconnectFlagTerminate to let the Xserver know that they
should not be accounted for when checking the remaining clients prior
to terminate.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-06-07 17:28:05 +02:00
Povilas Kanapickas dccc0275f4 Bump XI protocol version to 2.4 2021-05-30 13:26:44 +03:00
Thierry Reding abb9b58d1a present: Advertise protocol version 1.2
Everything is implemented to support protocol version 1.2. Make it
official.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-19 15:44:46 -04:00
Louis-Francis Ratté-Boulianne ce8da93646 dri3: Enable DRI3 version 1.2
Enable DRI3 v1.2 now that all functions have been implemented and
that there is at least one backend implementing the driver hooks
(modesetting/glamor).

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:28:01 -05:00
Louis-Francis Ratté-Boulianne e2ef3b44fa present: Send PresentCompleteModeSuboptimalCopy appropriately
Add 'check_flip2' hook for driver to let know the core
about why flipping is not possible ('reason').
If it is because of unsupported buffer format/modifier,
a PresentCompleteNotify event is sent to the client with
the PresentCompleteModeSuboptimalCopy mode.

v2: Check for PresentOptionSuboptimal and check driver version
    before using 'check_flip2'.

v3: Only require one of 'check_flip' or 'check_flip2' to be
    implemented by the driver.
    Refactor reasons list to enum

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:32 -05:00
Keith Packard e4e3447603 Add RandR leases with modesetting driver support [v6]
This adds support for RandR CRTC/Output leases through the modesetting
driver, creating a lease using new kernel infrastructure and returning
that to a client through an fd which will have access to only those
resources.

v2:	Restore CRTC mode when leases terminate

	When a lease terminates for a crtc we have saved data for, go
	ahead and restore the saved mode.

v3:	Report RR_Rotate_0 rotations for leased crtcs.

	Ignore leased CRTCs when selecting screen size.

	Stop leasing encoders, the kernel doesn't do that anymore.

	Turn off crtc->enabled while leased so that modesetting
	ignores them.

	Check lease status before calling any driver mode functions

	When starting a lease, mark leased CRTCs as disabled and hide
	their cursors. Also, check to see if there are other
	non-leased CRTCs which are driving leased Outputs and mark
	them as disabled as well. Sometimes an application will lease
	an idle crtc instead of the one already associated with the
	leased output.

	When terminating a lease, reset any CRTCs which are driving
	outputs that are no longer leased so that they start working
	again.

	This required splitting the DIX level lease termination code
	into two pieces, one to remove the lease from the system
	(RRLeaseTerminated) and a new function that frees the lease
	data structure (RRLeaseFree).

v4:	Report RR_Rotate_0 rotation for leased crtcs.

v5: Terminate all leases on server reset.

	Leases hang around after the associated client exits so that
	the client doesn't need to occupy an X server client slot and
	consume a file descriptor once it has gotten the output
	resources necessary.

	Any leases still hanging around when the X server resets or
	shuts down need to be cleaned up by calling the kernel to
	terminate the lease and freeing any DIX structures.

	Note that we cannot simply use the existing
	drmmode_terminate_lease function on each lease as that wants
	to also reset the video mode, and during server shut down that

   modesetting: Validate leases on VT enter

	The kernel doesn't allow any master ioctls to run when another
	VT is active, including simple things like listing the active
	leases. To deal with that, we check the list of leases
	whenever the X server VT is activated.

   xfree86: hide disabled cursors when resetting after lease termination

	The lessee may well have played with cursors and left one
	active on our screen. Just tell the kernel to turn it off.

v6:	Add meson build infrastructure

[Also bumped libdrm requirement - ajax]

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-27 12:39:50 -05:00
Jon Turney f5f4d32ac7 Add Windows-DRI extension
If windowsdriproto headers are available, build a Windows-DRI extension,
which supports requests to enable local clients to directly render GL to a
Windows drawable:

- a query to check if WGL is being used on a screen
- a query to map a fbconfigID to a native pixelformatindex
- a query to map a drawable to a native handle

Windows-DRI can only be useful if we are using WGL, so make an note if WGL
is active on a screen.

Make validGlxDrawable() public

Adjust glxWinSetPixelFormat() so it doesn't require a context, just a
screen and config.

That enables factoring out the deferred drawable creation code as
glxWinDeferredCreateDrawable()

Enhance glxWinDeferredCreateDrawable(), so that pixmaps are placed into a
file mapping, so they exist in memory which can be shared with the direct
rendering process.

Currently, this file mapping is accessed by a name generated from the XID.
This will not be unique across multiple server instances. It would perhaps
be better, although more complicated, to use an anonymous file mapping, and
then duplicate the handle for the direct rendering process.

Use glxWinDeferredCreateDrawable() to ensure the native handle exists for
the Windows-DRI query to map a drawable to native handle.

v2:
Various printf format warning fixes

v3:
Fix format warnings on x86
Move some uninteresting windows-dri output to debug log level

v4:
check for windowsdriproto when  --enable-windowsdri
use windowsdriproto_CFLAGS

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2016-09-15 20:10:29 +01:00
Keith Packard 7e1f86d42b randr: Add Monitor support (v1.1)
Store the user-defined monitors in the RandR screen private.

Generate a list of monitors from both the user-defined ones and from
any outputs not mentioned in one of the user-defined monitors. This list
covers both the outputs in the main screen as well as any slaves.

v1.1: airlied: fix up primary skipping bug,
fix wrong height initialiser
add get_active flag from updated protocol.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-03-31 12:32:04 +10:00
Adam Jackson 128449dd64 present: Don't use the major/minor version from the protocol headers
We want to advertise the version we implement, not the version the
protocol headers happen to describe.

Reviewed-by: Jasper St. Pierre <<jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-13 14:59:04 -05:00
Adam Jackson ec6087bf07 dri3: Don't use the major/minor version from the protocol headers
We want to advertise the version we implement, not the version the
protocol headers happen to describe.

Reviewed-by: Jasper St. Pierre <<jstpierre@mecheye.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-12-13 14:59:03 -05:00
Keith Packard bee2ec5404 Xext: Enable MIT-SHM FD-passing request definitions only when possible
Check to see if xtrans FD passing is available and use that to
advertise the appropriate version of the SHM extension

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-11-11 15:12:50 -08:00
Dave Airlie c1602d1c17 randr: bump advertised RandR version to 1.4
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-02-08 09:09:54 -08:00
Jasper St. Pierre 7fe5e6dfa5 protocol-versions: Bump minor version of XI
This was accidentally excluded when we added barriers.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-01-23 19:05:31 -08:00
Erkki Seppälä 96864bfa95 Implemented first part of XResource extension v1.2: X_XResQueryClientIds
This patch implements a part of the XResource extension v1.2 (as specified in
http://patchwork.freedesktop.org/patch/2720/ ). The request implemented is
X_XResQueryClientIds.

This patch depends on the feature introduced by
1e933665be "dix: Add facilities for
client ID tracking." .

This latest version also adds Doxygen-formatted comments and takes a better
notice of coding conventions (as in http://www.x.org/wiki/CodingStyle ).

Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
2012-04-18 10:21:49 +03:00
Peter Hutterer b274c472a5 Support XI 2.2 officially
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21 12:38:35 +10:00
Peter Hutterer 16244fba00 Support (and require) XI 2.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29 14:09:41 +10:00
Adam Jackson d45f5b2493 fixes: Add support for pointer barriers
Implements pointer barriers as specified by version 5 of the XFIXES
protocol. Barriers are axis-aligned, zero-width lines that block pointer
movement for relative input devices. Barriers may block motion in either
the positive or negative direction, or both.

v3:
- Fix off-by-one in version_requests array
- Port to non-glib test harness
- Fix review notes from Søren Sandmann Pedersen, add tests to match

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-05-31 15:10:51 -04:00
Keith Packard 6c90e839d9 Merge remote branch 'whot/for-keith' 2011-03-03 14:41:44 -08:00
Adam Jackson edcceedbd3 xext: Remove XCALIBRATE extension
Nobody can have been using this, it's never called from extension init.
XI2 device properties should now be a functional replacement.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-03-01 10:56:17 +10:00
Keith Packard 9f47780ecd Revert "randr: Hook up the new RandR 1.4 functionality"
This reverts commit afb6ebf1d5.
2011-02-23 11:17:36 -08:00
Keith Packard afb6ebf1d5 randr: Hook up the new RandR 1.4 functionality
This bumps the supported RandR protocol version and adds the dispatch
hooks needed to call the new functions

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
2010-12-06 20:08:52 -08:00
James Jones 8127c83c81 Expose Sync Fence Object protocol
Add the new protocol handlers for XSync 3.1 to the
dispatch tables and report support for Sync protocol
version 3.1.

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-12-06 19:15:38 -08:00
James Jones 27593eea7e Add and use SERVER_SYNC_*_VERSION
Most extensions have a version defined
in the protocol headers, and also in the
server's protocol-versions.h.  The latter
defines which version the server advertises
support for.  Sync wasn't included in
protocol-versions.h, and was advertising
support for whatever was in the protocol
headers the server was built against.

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-12-06 19:07:00 -08:00
Robert Hooker c65280ce8d Increase advertised RENDER protocol minor version to 11
Support for the blend mode operators was added in
0ce42adbf4
and the requirement was bumped but when things were split off into
include/protocol-versions.h it defined it to 10. render uses
the lower of the client and server advertised versions so it's not
using the new blend mode operators.

Signed-off-by: Robert Hooker <sarvatt@ubuntu.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2010-07-06 10:14:00 -04:00
Jesse Barnes db1c7cb604 DRI2: advertise lowest supported DRI2 protocol version
Update our supported DRI2 protocol version as each driver does
DRI2ScreenInit, since depending on available kernel features, each DDX
may support different callbacks and therefore protocol.

Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-03-29 10:02:37 -07:00
Jesse Barnes 04a54f69a8 DRI2: add support for new DRI2 protocol requests
Support the new DRI2 2.2 protocol requests: DRI2SwapBuffers, DRI2GetMSC,
DRI2WaitMSC, DRI2WaitSBC and DRI2SwapInterval.

These requests allow the server to support the SGI_video_sync,
SGI_swap_interval, and OML_sync_control GLX extensions if DDX support is
present.  The new DDX APIs are documented in dri2.h.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Adam Jackson <ajax@nwnk.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2010-01-11 16:16:35 -05:00
Ian Romanick 4c6bfa2c09 GLX: More clearly document the GLX protocol version handling
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-10-01 23:13:40 -07:00
Peter Hutterer 55747d256d input: define server-supported protocol versions in one single file.
include/protocol-versions.h specifies each extension version as supported by
the server and sent back on the wire to the client.

This fixes up several issues with the server potentially reporting a higher
version of the protocol if recompiled against a newer version of the
protocol.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Rémi Cardona <remi@gentoo.org>
Acked-by: Julien Cristau <jcristau@debian.org>
2009-09-21 21:47:35 +10:00