Commit Graph

156 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 60a2d2dc37 randr: unexport and document RRModesForScreen()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:36 +02:00
Enrico Weigelt, metux IT consult 6b0f2261e5 randr: unexport and document RROutputIsLeased()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:32 +02:00
Enrico Weigelt, metux IT consult c5f604617c randr: unexport and document RRCrtcIsLeased()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:30 +02:00
Enrico Weigelt, metux IT consult 6b4e452741 randr: unexport and document RRLeaseFree()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:27 +02:00
Enrico Weigelt, metux IT consult d723e78cb8 randr: unexport and document RRLeaseTerminated()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:21 +02:00
Enrico Weigelt, metux IT consult 9dde572f29 randr: unexport and document RRClientKnowsRates()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:18 +02:00
Enrico Weigelt, metux IT consult c9a1dd9281 randr: unexport and document RRHasScanoutPixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:15 +02:00
Enrico Weigelt, metux IT consult 2c71b5f260 randr: unexport and document RRReplaceScanoutPixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:12 +02:00
Enrico Weigelt, metux IT consult eb297d3443 randr: unexport and document RRCrtcDetachScanoutPixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:07 +02:00
Enrico Weigelt, metux IT consult 4b0854252b randr: unexport and document RRCrtcInitErrorValue()
Not supposed to be called by drivers, just internal to the randr extsnsion,
so shouldn't have been exported in the first place.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:28:04 +02:00
Enrico Weigelt, metux IT consult dfa0207c03 randr: unexport and document RRCrtcInit()
Not supposed to be called by any driver, just internal to the extension,
so shouldn't have been exported in the first place.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:59 +02:00
Enrico Weigelt, metux IT consult 03ea1c6ec0 randr: unexport and document RRCrtcDestroy()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:56 +02:00
Enrico Weigelt, metux IT consult f7157f140e randr: unexport and document RRCrtcGetTransform()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:53 +02:00
Enrico Weigelt, metux IT consult a90448d3be randr: unexport and document RRCrtcGetScanoutSize()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:50 +02:00
Enrico Weigelt, metux IT consult 6d3ffc2197 randr: unexport and document RRDeliverCrtcEvent()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:47 +02:00
Enrico Weigelt, metux IT consult ca6b72e362 randr: unexport and document RRCrtcSetTransformSupport()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:44 +02:00
Enrico Weigelt, metux IT consult bf0ed1306e randr: unexport and document RRCrtcExists()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:40 +02:00
Enrico Weigelt, metux IT consult f6002ca703 randr: unexport and document RRVerticalRefresh()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:38 +02:00
Enrico Weigelt, metux IT consult 6fe2807f88 randr: unexport and document RROutputSetNonDesktop()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:35 +02:00
Enrico Weigelt, metux IT consult cb80660ad1 randr: unexport and document RRFirstEnabledCrtc()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:32 +02:00
Enrico Weigelt, metux IT consult cff509582c randr: unexport and document RRInit()
Not called, and should not be called, by drivers, so no need to
keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:28 +02:00
Enrico Weigelt, metux IT consult 4a5fa21098 randr: unexport and document RRResourcesChanged()
Not used by external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:26 +02:00
Enrico Weigelt, metux IT consult 93dfd59d81 randr: unexport and document RRDeliverScreenEvent()
Not used by external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:22 +02:00
Enrico Weigelt, metux IT consult 7c9ad18930 randr: unexport provider related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:17 +02:00
Enrico Weigelt, metux IT consult 5eae9431a9 randr: unexport output related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:14 +02:00
Enrico Weigelt, metux IT consult 32b3218fe6 randr: unexport mode related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:11 +02:00
Enrico Weigelt, metux IT consult 006500cfd6 randr: unexport crtc related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:09 +02:00
Enrico Weigelt, metux IT consult aa981da992 randr: unexport screen related request handlers
Those aren't used by any drivers and never should so, thus no need to
keep them exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:05 +02:00
Enrico Weigelt, metux IT consult 5a17f15f22 randr: make RRCrtcTransformSet() static
Only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:27:02 +02:00
Enrico Weigelt, metux IT consult 2484bcf474 randr: make RRCrtcPendingTransform() static
only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:26:59 +02:00
Enrico Weigelt, metux IT consult 0f43098a9b randr: make RRCrtcGammaGet() static
Only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:26:56 +02:00
Enrico Weigelt, metux IT consult c6aa23769e randr: make RRCrtcChanged() static
Only used locally inside rrcrtc.c, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:26:53 +02:00
Enrico Weigelt, metux IT consult 477b3d2821 randr: drop obsolete RRPostProviderPendingProperties()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:26:08 +02:00
Enrico Weigelt, metux IT consult a7e9bc1803 randr: drop obsolete RRDeleteAllProviderProperties()
Not used by anybody, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:26:05 +02:00
Enrico Weigelt, metux IT consult ad6fb1fbd3 randr: drop obsolete RRProviderLookup()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:26:02 +02:00
Enrico Weigelt, metux IT consult 79d0a49442 randr: drop unused RRPointerMoved()
Not used anywhere, so no need to keep it any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:58 +02:00
Enrico Weigelt, metux IT consult 00435fea20 randr: drop unused dummy RRCrtcGammaNotify()
Not called by anybody and been just a dummy for quite a while,
so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:55 +02:00
Enrico Weigelt, metux IT consult 648b96e5d4 randr: drop obsolete RRGetRotation()
Not used anymore, so no need to keep it around anymore.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:25:52 +02:00
Enrico Weigelt, metux IT consult 10a8031865 render: drop obsolete macros pict_f_transform and pict_f_vector
Over 1.5 decades ago, pixmap handling was moved to using pixman library,
but there's still a bit fallout from that left. Cleaning it up now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1287>
2024-03-03 22:54:16 +00:00
Enrico Weigelt, metux IT consult eda769f34c randr: move private definitons from randrstr.h to randrstr_priv.h
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1291>
2024-02-22 23:47:49 +00:00
Minh Phan 5145742fb6 randr: introduce rrCrtcGetInfo DDX function
This allows rrCrtcGetInfo to override the values in the XRRCrtcGetInfo
reply. One use case is to allow Xwayland to return the current emulated
mode for the specific client instead of the global mode.

Signed-off-by: Minh Phan <phanquangminh217@gmail.com>
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2023-01-03 23:27:29 +07:00
Xaver Hugl 7759743c63 randr: add new interface to allow delaying lease responses
Add a new interface to _rrScrPriv to make it possible for the server to
delay answering a lease request, at the cost of blocking the client. This
is needed for implementing drm-lease-v1, as the Wayland protocol has no
defined time table for responding to lease requests.

Signed-off-by: Xaver Hugl <xaver.hugl@gmail.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
2021-12-07 10:02:29 +00:00
Łukasz Spintzyk d6c02ffd9c present: fallback get_crtc to return crtc belonging to screen with present extension
Since crtc can belong to secondary output that may not have present
extension enabled we should fallback to first enabled crtc or fake crtc.

Fix for issue xorg/xserver#1195
2021-07-20 08:10:46 +02:00
Łukasz Spintzyk d2dce22b67 present: fix msc offset calculation in screen mode
Instead of getting the current msc value from the window crtc,
which not exist take the last saved msc value saved in
the window_priv struct

Signed-off-by: Łukasz Spintzyk <lukasz.spintzyk@synaptics.com>
2021-04-16 10:53:43 +00:00
Dave Airlie ea47af87f6 xserver/output: rename some badly named variables/APIs.
This is an API and ABI break

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-10 06:17:44 +10:00
Dave Airlie 078277e4d9 xf86: autobind GPUs to the screen
This is a modified version of a patch we've been carry-ing in Fedora and
RHEL for years now. This patch automatically adds secondary GPUs to the
master as output sink / offload source making e.g. the use of
slave-outputs just work, with requiring the user to manually run
"xrandr --setprovideroutputsource" before he can hookup an external
monitor to his hybrid graphics laptop.

There is one problem with this patch, which is why it was not upstreamed
before. What to do when a secondary GPU gets detected really is a policy
decission (e.g. one may want to autobind PCI GPUs but not USB ones) and
as such should be under control of the Desktop Environment.

Unconditionally adding autobinding support to the xserver will result
in races between the DE dealing with the hotplug of a secondary GPU
and the server itself dealing with it.

However we've waited for years for any Desktop Environments to actually
start doing some sort of autoconfiguration of secondary GPUs and there
is still not a single DE dealing with this, so I believe that it is
time to upstream this now.

To avoid potential future problems if any DEs get support for doing
secondary GPU configuration themselves, the new autobind functionality
is made optional. Since no DEs currently support doing this themselves it
is enabled by default. When DEs grow support for doing this themselves
they can disable the servers autobinding through the servers cmdline or a
xorg.conf snippet.

Signed-off-by: Dave Airlie <airlied@gmail.com>
[hdegoede@redhat.com: Make configurable, fix with nvidia, submit upstream]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
---
Changes in v2:
-Make the default enabled instead of installing a xorg.conf
 snippet which enables it unconditionally

Changes in v3:
-Handle GPUScreen autoconfig in randr/rrprovider.c, looking at
 rrScrPriv->provider, rather then in hw/xfree86/modes/xf86Crtc.c
 looking at xf86CrtcConfig->provider. This fixes the autoconfig not
 working with the nvidia binary driver
2019-08-07 12:26:59 +02:00
Keith Packard 1ef7aed3e2 During reset/shutdown, clean up leases in DIX instead of each driver
Instead of having every video driver loop over any pending leases to
free them during CloseScreen, do this up in the DIX layer by
terminating leases when a leased CRTC or Output is destroyed and
(just to make sure), also terminating leases in RRCloseScreen. The
latter should "never" get invoked as any lease should be associated
with a resource which was destroyed.

This is required as by the time the driver's CloseScreen function is
invoked, we've already freed all of the DIX randr structures and no
longer have any way to reference the leases

Signed-off-by: Keith Packard <keithp@keithp.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=106960
Cc: Thomas Hellstrom <thellstrom@vmware.com>
2018-08-02 10:15:26 -04: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
Keith Packard 3957360505 randr: Support "non-desktop" property
Tracks changes to the non-desktop property so that when non-zero,
outputs will always appear to be disconnected.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@nwnk.net>
2018-02-27 12:34:26 -05:00
Keith Packard 29f79bedf2 randr: Declare incoming property values const
RRChangeOutputProperty and RRConfigureOutputProperty should not modify
their parameters, and callers may want to pass pointers to fixed data,
so declare the value pointers as const in both cases.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2018-01-22 17:22:21 -05:00