Proposal for RandR version 1.6, Leases and EDID-based output grabs
Daniel Vetter
daniel at ffwll.ch
Sun Apr 2 15:43:02 UTC 2017
On Sat, Apr 01, 2017 at 03:58:58PM -0700, "Keith Packard" wrote:
>
> As a part of the DRM leasing work, we need a way to have the X server
> create a lease and pass it back to an X client. Here's a proposal for
> the RandR specification changes necessary for that. The basic plan is
> pretty simple:
>
> 1. Expose the ability to create a lease for a set of CRTCs and
> OUTPUTs. The X server will have to pick a suitable encoder as that's
> not visible via RandR.
On that, I think we could just unconditionally hand leases all encoders.
Encoders turned out to be a bit an uapi mistake. Neither setcrtc nor
atomic use it, the kernel always selects the right encoder for you. It's
only exposed to give userspace some hints wrt routing (and it's pretty bad
at describing modern restrictions, which often means you get a 1:1
encoder/connector mapping). Unconditionally exposing all encoders for all
lessees would fix all these troubles.
Note that there's also no properties on encoders, those only exist on
crtc, connector and planes.
Kinda more a comment on the kernel side than for xrandr.
-Daniel
> 2. Provide a way to hide some monitors from other clients using EDID
> manufacturer ids and product codes. Outputs with EDID properties
> matching the grab will report 'disconnected' to all clients other
> than the grabbing client. This way, the desktop environment never
> knows that an HMD has been plugged in, so there's no transient
> flicker of desktop being presented to it.
>
> I wanted to make it possible for the X server to set the mode on the
> leased outputs, but I'm not sure how -- I don't want to display the X
> screen on them, and there's no other frame buffer I can name over the
> wire. For now, that means the leasing client will need to set a mode
> itself. If that fails, it can go whack the X configuration over RandR
> and try again, which is all the X server would do anyways.
>
> Comments are welcome; I'll go try to write the code in the next few
> days; it all looks pretty easy at this point.
>
> diff --git a/randrproto.txt b/randrproto.txt
> index 74b7c36..8dded63 100644
> --- a/randrproto.txt
> +++ b/randrproto.txt
> @@ -1,6 +1,6 @@
> The X Resize, Rotate and Reflect Extension
> - Version 1.5.0
> - 2015-03-14
> + Version 1.6.0
> + 2017-04-01
>
> Jim Gettys
> Jim.Gettys at hp.com
> @@ -9,9 +9,7 @@
> Hewlett Packard Company
>
> Keith Packard
> - keith.packard at intel.com
> - Open Source Technology Center
> - Intel Corporation
> + keithp at keithp.com
>
> 1. Introduction
>
> @@ -186,6 +184,24 @@ consider as single viewable areas.
> Xinerama's information now comes from the Monitors instead of directly
> from the CRTCs. The Monitor marked as Primary will be listed first.
>
> +1.6. Introduction to version 1.6 of the extension
> +
> +Version 1.6 adds resource leasing.
> +
> + • A 'Lease' is a collection of crtcs and outputs which are made
> + available to a client for direct access via kernel KMS and DRM
> + APIs. This is done by passing a suitable file descriptor back to
> + the client which has access to those resources. While leased, those
> + resources aren't used by the X server.
> +
> +Version 1.6 adds EDID-based output 'grabbing'.
> +
> + • An 'Output Grab' matches a set of EDID Manufacturer ID and product
> + codes. For outputs with matching EDID values, the connected status
> + of the output is only visible to the grabbing client. Other clients
> + will see the output as disconnected. Attempts to configure the
> + grabbed output by other clients will fail.
> +
> 1.99 Acknowledgments
>
> Our thanks to the contributors to the design found on the xpert mailing
> @@ -273,6 +289,10 @@ Mode
> Provider
> A value for a PROVIDER argument does not name a defined PROVIDER.
>
> +OutputGrab
> + A value for an OUTPUTGRAB argument does not name a defined
> + OUTPUTGRAB
> +
> ❧❧❧❧❧❧❧❧❧❧❧
>
> 5. Protocol Types
> @@ -419,6 +439,23 @@ MONITORINFO { name: ATOM
>
> ❧❧❧❧❧❧❧❧❧❧❧
>
> +5.7. Protocol Types added in version 1.6 of the extension
> +
> +OUTPUTGRAB { XID }
> +
> +EDIDMATCH { id: CARD16
> + code-min: CARD16
> + code-max: CARD16 }
> +
> + These values come from the EDID specification. 'id' is the
> + Manufacturer ID value which is bytes 8 and 9 in the EDID
> + packet, stored in big endian order (MSB first). 'code-min' and
> + 'code-max' define a closed-interval of Manufacturer product
> + codes, which is byte 10 and 11 of the EDID packet, stored in
> + little endian order (LSB first).
> +
> + ❧❧❧❧❧❧❧❧❧❧❧
> +
> 6. Extension Initialization
>
> The name of this extension is "RANDR".
> @@ -1666,6 +1703,67 @@ dynamic changes in the display environment.
> window of the screen.
>
> ❧❧❧❧❧❧❧❧❧❧❧
> +
> +7.6. Extension Requests added in version 1.6 of the extension.
> +
> +┌───
> + RRCreateLease
> + window : WINDOW
> + crtcs: LISTofCRTC
> + outputs: LISTofOUTPUT
> + ▶
> + nfd: CARD8
> + lease: FD
> +└───
> + Errors: Window, Access, Value, CRTC, Output
> +
> + Creates a new Lease for the specified crtcs and outputs from
> + the screen defined by 'window'. Returns a KMS/DRM file
> + descriptor which can control the leased objects directly
> + through the kernel. While leased, all resources will appear to
> + be 'useless' to clients other than the leasing client as
> + follows:
> +
> + • Crtcs are reported as having no 'possible-outputs' and all
> + other values reported as if the crtc were disabled.
> +
> + • Outputs are reported as having no crtcs they can be
> + connected to, no clones they can share a crtc with, will
> + report a connection status of Disconnected, and will show
> + the current crtc as Disabled.
> +
> + The lease remains in effect until the file descriptor is
> + closed, even if the client holding the lease disconnects from
> + the X server.
> +
> + Returns an Access error if any of the named resources are in
> + use or already leased to another client.
> +
> + Returns a Match error if any of the named resources are in use
> + by the X server.
> +
> +┌───
> + RRCreateOutputGrab
> + window : WINDOW
> + outputgrab: OUTPUTGRAB
> + matches: LISTofEDIDMATCH
> +└───
> + Errors: Window, Access, Value, CRTC, Output
> +
> + Creates an Output Grab with the specified ID on the screen
> + associated with 'window'. Any output containing an EDID
> + property matching the grab will appear to be disconnected to
> + all clients other than the grabbing client.
> +
> +┌───
> + RRDestroyOutputGrab
> + outputgrab: OUTPUTGRAB
> +└───
> + Errors: OutputGrab
> +
> + Destroys the named OUTPUTGRAB.
> +
> + ❧❧❧❧❧❧❧❧❧❧❧
> 8. Extension Events
>
> Clients MAY select for ConfigureNotify on the root window to be
>
>
> --
> -keith
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the xorg-devel
mailing list