summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_context.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-02-26 11:25:18 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2015-03-18 09:33:33 +0000
commit8b9bd19021c0efef33d66ae24f8871b826d66e8a (patch)
tree083c874b30a10d14c4ebfea0d82cc5d7ccf273ed /src/mesa/drivers/dri/i965/brw_context.c
parent27bf37ba05b69ebf6f373d1637a26b4839265921 (diff)
downloadexternal_mesa3d-8b9bd19021c0efef33d66ae24f8871b826d66e8a.zip
external_mesa3d-8b9bd19021c0efef33d66ae24f8871b826d66e8a.tar.gz
external_mesa3d-8b9bd19021c0efef33d66ae24f8871b826d66e8a.tar.bz2
i965: Throttle rendering to an fbo
When rendering to an fbo, even though it may be acting as a winsys frontbuffer or just generally, we never throttle. However, when rendering to an fbo, there is no natural frame boundary. Conventionally we use SwapBuffers and glFinish, but potential callers avoid often glFinish for being too heavy handed (waiting on all outstanding rendering to complete). The kernel provides a soft-throttling option for this case that waits for rendering older than 20ms to be complete (that's a little too lax to be used for swapbuffers, but is here a useful safety net). The remaining choice is then either never to throttle, throttle after every draw call, or at after intermediate user defined point such as glFlush and thus all the implied flushes. This patch opts for the latter as that is the current method used for flushing to front buffers. v2: Defer the throttling from inside the flush to the next intel_prepare_render() and switch non-fbo frontbuffer throttling over to use the same lax method. The issuing being that glFlush()/intel_prepare_read() is just as likely to be called inside a tight loop and not at "frame" boundaries. v3: Rename from need_front_throttle to need_flush_throttle to avoid any ambiguity between front buffer rendering and fbo rendering. (Chad) v4: Whitespace Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Kenneth Graunke <kenneth@whitecape.org> Cc: Ben Widawsky <ben@bwidawsk.net> Cc: Kristian Høgsberg <krh@bitplanet.net> Cc: Chad Versace <chad.versace@linux.intel.com> Cc: Ian Romanick <idr@freedesktop.org> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_context.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 0881e48..5120372 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -234,8 +234,8 @@ intel_glFlush(struct gl_context *ctx)
intel_batchbuffer_flush(brw);
intel_flush_front(ctx);
- if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
- brw->need_throttle = true;
+
+ brw->need_flush_throttle = true;
}
static void
@@ -1245,12 +1245,20 @@ intel_prepare_render(struct brw_context *brw)
* the swap, and getting our hands on that doesn't seem worth it,
* so we just us the first batch we emitted after the last swap.
*/
- if (brw->need_throttle && brw->first_post_swapbuffers_batch) {
+ if (brw->need_swap_throttle && brw->first_post_swapbuffers_batch) {
if (!brw->disable_throttling)
drm_intel_bo_wait_rendering(brw->first_post_swapbuffers_batch);
drm_intel_bo_unreference(brw->first_post_swapbuffers_batch);
brw->first_post_swapbuffers_batch = NULL;
- brw->need_throttle = false;
+ brw->need_swap_throttle = false;
+ /* Throttling here is more precise than the throttle ioctl, so skip it */
+ brw->need_flush_throttle = false;
+ }
+
+ if (brw->need_flush_throttle) {
+ __DRIscreen *psp = brw->intelScreen->driScrnPriv;
+ drmCommandNone(psp->fd, DRM_I915_GEM_THROTTLE);
+ brw->need_flush_throttle = false;
}
}