summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-11-26 11:55:47 +0000
committerKeith Whitwell <[email protected]>2009-11-26 11:55:47 +0000
commit7b0e4adaf21d4c788657eff41cb51d5c89647309 (patch)
treecbdb55e113654e1485c63c7748c55c6dd758adea /src/gallium/state_trackers
parent8544c309d0a296449d11cf2cf52ca306662dc41d (diff)
st/xorg: render throttling in block handler
Similar to the classic swapbuffer throttling in GL drivers, put an upper bound on the number of outstanding chunks of rendering the state tracker can generate -- where calling the block handler denotes a chunk. Currently that number is set at around 4 "chunks", but could be tweaked up or down. If a better measure for the amount of outstanding rendering is found, that would be fine too. As it stands, this improves interactivity by preventing the X server from queueing up arbitary amounts of rendering.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c20
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c5
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h4
3 files changed, 22 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index c74fb280729..4c66354ad45 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -450,8 +450,24 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
pScreen->BlockHandler = drv_block_handler;
- if (ms->ctx)
- ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
+ if (ms->ctx) {
+ int j;
+
+ ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, &ms->fence[XORG_NR_FENCES-1]);
+
+ if (ms->fence[0])
+ ms->ctx->screen->fence_finish(ms->ctx->screen, ms->fence[0], 0);
+
+ /* The amount of rendering generated by a block handler can be
+ * quite small. Let us get a fair way ahead of hardware before
+ * throttling.
+ */
+ for (j = 0; j < XORG_NR_FENCES; j++)
+ ms->screen->fence_reference(ms->screen,
+ &ms->fence[j],
+ ms->fence[j+1]);
+ }
+
#ifdef DRM_MODE_FEATURE_DIRTYFB
{
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 16ac5d204d9..d9698e32e1f 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -13,11 +13,6 @@
#include <math.h>
-enum AxisOrientation {
- Y0_BOTTOM,
- Y0_TOP
-};
-
#define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y)))
#define floatIsZero(x) (floatsEqual((x) + 1, 1))
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 31e11b48093..c6c7b2fe158 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -63,6 +63,8 @@ typedef struct
ScrnInfoPtr pScrn_2;
} EntRec, *EntPtr;
+#define XORG_NR_FENCES 3
+
typedef struct _modesettingRec
{
/* drm */
@@ -86,6 +88,8 @@ typedef struct _modesettingRec
unsigned int SaveGeneration;
void (*blockHandler)(int, pointer, pointer, pointer);
+ struct pipe_fence_handle *fence[XORG_NR_FENCES];
+
CreateScreenResourcesProcPtr createScreenResources;
/* for frontbuffer backing store */