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>
This commit is contained in:
parent
f34ffdd9a9
commit
7759743c63
|
@ -74,7 +74,7 @@
|
|||
* mask is 0xFFFF0000.
|
||||
*/
|
||||
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
|
||||
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(25, 2)
|
||||
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(25, 3)
|
||||
#define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 4)
|
||||
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(10, 0)
|
||||
|
||||
|
|
|
@ -280,6 +280,15 @@ typedef int (*RRCreateLeaseProcPtr)(ScreenPtr screen,
|
|||
typedef void (*RRTerminateLeaseProcPtr)(ScreenPtr screen,
|
||||
RRLeasePtr lease);
|
||||
|
||||
typedef int (*RRRequestLeaseProcPtr)(ClientPtr client,
|
||||
ScreenPtr screen,
|
||||
RRLeasePtr lease);
|
||||
|
||||
typedef void (*RRGetLeaseProcPtr)(ClientPtr client,
|
||||
ScreenPtr screen,
|
||||
RRLeasePtr *lease,
|
||||
int *fd);
|
||||
|
||||
/* These are for 1.0 compatibility */
|
||||
|
||||
typedef struct _rrRefresh {
|
||||
|
@ -408,6 +417,9 @@ typedef struct _rrScrPriv {
|
|||
RRMonitorPtr *monitors;
|
||||
|
||||
struct xorg_list leases;
|
||||
|
||||
RRRequestLeaseProcPtr rrRequestLease;
|
||||
RRGetLeaseProcPtr rrGetLease;
|
||||
} rrScrPrivRec, *rrScrPrivPtr;
|
||||
|
||||
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
|
||||
|
|
|
@ -239,9 +239,19 @@ ProcRRCreateLease(ClientPtr client)
|
|||
if (!scr_priv)
|
||||
return BadMatch;
|
||||
|
||||
if (!scr_priv->rrCreateLease)
|
||||
if (!scr_priv->rrCreateLease && !scr_priv->rrRequestLease)
|
||||
return BadMatch;
|
||||
|
||||
if (scr_priv->rrGetLease) {
|
||||
scr_priv->rrGetLease(client, screen, &lease, &fd);
|
||||
if (lease) {
|
||||
if (fd >= 0)
|
||||
goto leaseReturned;
|
||||
else
|
||||
goto bail_lease;
|
||||
}
|
||||
}
|
||||
|
||||
/* Allocate a structure to hold all of the lease information */
|
||||
|
||||
lease = RRLeaseAlloc(screen, stuff->lid, stuff->nCrtcs, stuff->nOutputs);
|
||||
|
@ -291,10 +301,19 @@ ProcRRCreateLease(ClientPtr client)
|
|||
lease->outputs[o] = output;
|
||||
}
|
||||
|
||||
rc = scr_priv->rrCreateLease(screen, lease, &fd);
|
||||
if (rc != Success)
|
||||
goto bail_lease;
|
||||
if (scr_priv->rrRequestLease) {
|
||||
rc = scr_priv->rrRequestLease(client, screen, lease);
|
||||
if (rc == Success)
|
||||
return Success;
|
||||
else
|
||||
goto bail_lease;
|
||||
} else {
|
||||
rc = scr_priv->rrCreateLease(screen, lease, &fd);
|
||||
if (rc != Success)
|
||||
goto bail_lease;
|
||||
}
|
||||
|
||||
leaseReturned:
|
||||
xorg_list_add(&lease->list, &scr_priv->leases);
|
||||
|
||||
if (!AddResource(stuff->lid, RRLeaseType, lease)) {
|
||||
|
|
Loading…
Reference in New Issue