From d449627829e1a4a3250a1a723af2f4e3cd5fd194 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 17 Feb 2010 21:17:55 -0500 Subject: intel: Implement the DRI2 invalidate function properly This uses a stamp mechanisms to mark the DRI drawable as invalid. Instead of immediately updating the buffers we just bump the drawable stamp and call out to DRI2GetBuffers "later". "Later" used to be at LOCK_HARDWARE time, and this patch brings back callouts at the points where we used to call LOCK_HARDWARE. A new function, intel_prepare_render(), is called where we used to call LOCK_HARDWARE, and if the buffers are invalid, we call out to DRI2GetBuffers there. This lets us invalidate buffers only when notified instead of on every glViewport() call. If the loader calls the DRI invalidate entrypoint, we disable viewport triggered buffer invalidation. Additionally, we can clean up the old viewport mechanism a bit, since we can just invalidate the buffers and not worry about reentrancy and whatnot. --- src/mesa/drivers/dri/common/dri_util.c | 2 ++ src/mesa/drivers/dri/common/dri_util.h | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'src/mesa/drivers/dri/common') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index b891fca2b1..58a94b5868 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -585,6 +585,8 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, pcp->driDrawablePriv = NULL; pcp->loaderPrivate = data; + pcp->dri2.draw_stamp = 0; + pcp->dri2.read_stamp = 0; /* When the first context is created for a screen, initialize a "dummy" * context. */ diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h index 8f0cd4cf9d..2eadb9ac8c 100644 --- a/src/mesa/drivers/dri/common/dri_util.h +++ b/src/mesa/drivers/dri/common/dri_util.h @@ -422,6 +422,11 @@ struct __DRIcontextRec { * The loaders's private context data. This structure is opaque. */ void *loaderPrivate; + + struct { + int draw_stamp; + int read_stamp; + } dri2; }; /** -- cgit v1.2.3