summaryrefslogtreecommitdiff
path: root/hw/xfree86/dri2/dri2.c
diff options
context:
space:
mode:
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>2010-11-01 16:21:59 +0200
committerKeith Packard <keithp@keithp.com>2011-09-21 13:54:55 -0700
commit86f8da0aa7612558e6563f5de0d9f9793854053f (patch)
tree3fbc7055b839c6a02b517444451127f813584b88 /hw/xfree86/dri2/dri2.c
parent2f47433fef2cf63063e069ead9003891d135e87f (diff)
DRI2: Add ReuseBufferNotify hook
ReuseBufferNotify hook is called whenever old buffer is reused in DRI2 code. Driver can use this hook to rewrite the buffer name if hardware requires shared buffers. Shared buffer might be some hardware limited resources like framebuffer that is preallocated in boot. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw/xfree86/dri2/dri2.c')
-rw-r--r--hw/xfree86/dri2/dri2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index af3bcaefe..1e6ee16a2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -102,6 +102,7 @@ typedef struct _DRI2Screen {
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
DRI2AuthMagicProcPtr AuthMagic;
+ DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
HandleExposuresProcPtr HandleExposures;
@@ -352,6 +353,10 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
} else {
*buffer = pPriv->buffers[old_buf];
+
+ if (ds->ReuseBufferNotify)
+ (*ds->ReuseBufferNotify)(pDraw, *buffer);
+
pPriv->buffers[old_buf] = NULL;
return FALSE;
}
@@ -1128,6 +1133,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->AuthMagic = info->AuthMagic;
}
+ if (info->version >= 6)
+ ds->ReuseBufferNotify = info->ReuseBufferNotify;
+
/*
* if the driver doesn't provide an AuthMagic function or the info struct
* version is too low, it relies on the old method (using libdrm) or fail