summaryrefslogtreecommitdiff
path: root/hw/xfree86/dri2/dri2.c
diff options
context:
space:
mode:
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>2010-11-01 16:22:00 +0200
committerKeith Packard <keithp@keithp.com>2011-09-21 13:55:45 -0700
commitb435e2aac1b3fbb97d0275de73a1e36d16f170c0 (patch)
treeef52b0d0b31aa795313e6b3631a81623086a5577 /hw/xfree86/dri2/dri2.c
parent86f8da0aa7612558e6563f5de0d9f9793854053f (diff)
DRI2: Expose API to set drawable swap limit.
This allows ddx to set swap_limit if there is more than one back buffer for drawable. Setting swap_limit has to also check if change affects a client that is blocked. This can be used to implement N-buffering in driver with minimal logic in allocation and selecting next back. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Francisco Jerez <currojerez@riseup.net> Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/xfree86/dri2/dri2.c')
-rw-r--r--hw/xfree86/dri2/dri2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 1e6ee16a2..ae685bb0a 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -192,6 +192,29 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
return pPriv;
}
+Bool
+DRI2SwapLimit(DrawablePtr pDraw, int swap_limit)
+{
+ DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
+ if (!pPriv)
+ return FALSE;
+
+ pPriv->swap_limit = swap_limit;
+
+ /* Check throttling */
+ if (pPriv->swapsPending >= pPriv->swap_limit)
+ return TRUE;
+
+ if (pPriv->target_sbc == -1 && !pPriv->blockedOnMsc) {
+ if (pPriv->blockedClient) {
+ AttendClient(pPriv->blockedClient);
+ pPriv->blockedClient = NULL;
+ }
+ }
+
+ return TRUE;
+}
+
typedef struct DRI2DrawableRefRec {
XID id;
XID dri2_id;