DRI2: Allow DDX to validate swap_limit changes
DDX can now implement validation for swap_limit changes to prevent configurations that are not support in driver. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> CC: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
parent
b435e2aac1
commit
871d65790e
|
@ -103,6 +103,7 @@ typedef struct _DRI2Screen {
|
|||
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
|
||||
DRI2AuthMagicProcPtr AuthMagic;
|
||||
DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
|
||||
DRI2SwapLimitValidateProcPtr SwapLimitValidate;
|
||||
|
||||
HandleExposuresProcPtr HandleExposures;
|
||||
|
||||
|
@ -196,9 +197,16 @@ Bool
|
|||
DRI2SwapLimit(DrawablePtr pDraw, int swap_limit)
|
||||
{
|
||||
DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
|
||||
DRI2ScreenPtr ds;
|
||||
if (!pPriv)
|
||||
return FALSE;
|
||||
|
||||
ds = pPriv->dri2_screen;
|
||||
|
||||
if (!ds->SwapLimitValidate
|
||||
|| !ds->SwapLimitValidate(pDraw, swap_limit))
|
||||
return FALSE;
|
||||
|
||||
pPriv->swap_limit = swap_limit;
|
||||
|
||||
/* Check throttling */
|
||||
|
@ -1156,8 +1164,10 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
|
|||
ds->AuthMagic = info->AuthMagic;
|
||||
}
|
||||
|
||||
if (info->version >= 6)
|
||||
if (info->version >= 6) {
|
||||
ds->ReuseBufferNotify = info->ReuseBufferNotify;
|
||||
ds->SwapLimitValidate = info->SwapLimitValidate;
|
||||
}
|
||||
|
||||
/*
|
||||
* if the driver doesn't provide an AuthMagic function or the info struct
|
||||
|
|
|
@ -168,6 +168,19 @@ typedef int (*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client,
|
|||
typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
|
||||
void *data);
|
||||
|
||||
/**
|
||||
* DRI2 calls this hook when ever swap_limit is going to be changed. Default
|
||||
* implementation for the hook only accepts one as swap_limit. If driver can
|
||||
* support other swap_limits it has to implement supported limits with this
|
||||
* callback.
|
||||
*
|
||||
* \param pDraw drawable whos swap_limit is going to be changed
|
||||
* \param swap_limit new swap_limit that going to be set
|
||||
* \return TRUE if limit is support, FALSE if not.
|
||||
*/
|
||||
typedef Bool (*DRI2SwapLimitValidateProcPtr)(DrawablePtr pDraw,
|
||||
int swap_limit);
|
||||
|
||||
/**
|
||||
* Version of the DRI2InfoRec structure defined in this header
|
||||
*/
|
||||
|
@ -203,6 +216,7 @@ typedef struct {
|
|||
/* added in version 6 */
|
||||
|
||||
DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
|
||||
DRI2SwapLimitValidateProcPtr SwapLimitValidate;
|
||||
} DRI2InfoRec, *DRI2InfoPtr;
|
||||
|
||||
extern _X_EXPORT int DRI2EventBase;
|
||||
|
|
Loading…
Reference in New Issue