From: Pauli Nieminen <ext-pauli.niemi...@nokia.com> 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.niemi...@nokia.com> CC: Mario Kleiner <mario.klei...@tuebingen.mpg.de> Reviewed-by: Mario Kleiner <mario.klei...@tuebingen.mpg.de> Reviewed-by: Jesse Barnes <jbar...@virtuousgeek.org> --- hw/xfree86/dri2/dri2.c | 12 +++++++++++- hw/xfree86/dri2/dri2.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 1 deletions(-) diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 255fed0..263ae4f 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -102,6 +102,7 @@ typedef struct _DRI2Screen { DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; DRI2AuthMagicProcPtr AuthMagic; DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; + DRI2SwapLimitValidateProcPtr SwapLimitValidate; HandleExposuresProcPtr HandleExposures; @@ -195,9 +196,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 */ @@ -1134,8 +1142,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 diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index 3d01c55..a4bba02 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -169,6 +169,19 @@ 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 */ #define DRI2INFOREC_VERSION 6 @@ -203,6 +216,7 @@ typedef struct { /* added in version 6 */ DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; + DRI2SwapLimitValidateProcPtr SwapLimitValidate; } DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT int DRI2EventBase; -- 1.7.0.4 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel