From 5314afa27aa8d9260ed0b0a42a6d6050313953da Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 3 Jul 2013 14:28:29 -0700 Subject: [PATCH] i965: Move intel_context's framerate throttling fields to brw_context. Signed-off-by: Kenneth Graunke Acked-by: Chris Forbes Acked-by: Paul Berry Acked-by: Anuj Phogat --- src/mesa/drivers/dri/i965/brw_context.h | 5 +++++ src/mesa/drivers/dri/i965/intel_batchbuffer.c | 6 +++--- src/mesa/drivers/dri/i965/intel_context.c | 17 ++++++++--------- src/mesa/drivers/dri/i965/intel_context.h | 2 -- src/mesa/drivers/dri/i965/intel_screen.c | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 6ca4b2eb314..f278c5302ba 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -833,6 +833,11 @@ struct brw_context */ bool is_front_buffer_reading; + /** Framerate throttling: @{ */ + drm_intel_bo *first_post_swapbuffers_batch; + bool need_throttle; + /** @} */ + GLuint stats_wm; /** diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 8f032183cf4..0905237aa89 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -241,9 +241,9 @@ _intel_batchbuffer_flush(struct brw_context *brw, if (brw->batch.used == 0) return 0; - if (intel->first_post_swapbuffers_batch == NULL) { - intel->first_post_swapbuffers_batch = brw->batch.bo; - drm_intel_bo_reference(intel->first_post_swapbuffers_batch); + if (brw->first_post_swapbuffers_batch == NULL) { + brw->first_post_swapbuffers_batch = brw->batch.bo; + drm_intel_bo_reference(brw->first_post_swapbuffers_batch); } if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c index 53ae742dfa7..3ef6d2cf85c 100644 --- a/src/mesa/drivers/dri/i965/intel_context.c +++ b/src/mesa/drivers/dri/i965/intel_context.c @@ -283,12 +283,12 @@ 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 (intel->need_throttle && intel->first_post_swapbuffers_batch) { + if (brw->need_throttle && brw->first_post_swapbuffers_batch) { if (!brw->disable_throttling) - drm_intel_bo_wait_rendering(intel->first_post_swapbuffers_batch); - drm_intel_bo_unreference(intel->first_post_swapbuffers_batch); - intel->first_post_swapbuffers_batch = NULL; - intel->need_throttle = false; + 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; } } @@ -350,12 +350,11 @@ static void intel_glFlush(struct gl_context *ctx) { struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = intel_context(ctx); intel_flush(ctx); intel_flush_front(ctx); if (brw->is_front_buffer_rendering) - intel->need_throttle = true; + brw->need_throttle = true; } void @@ -635,8 +634,8 @@ intelDestroyContext(__DRIcontext * driContextPriv) intel_batchbuffer_free(brw); - drm_intel_bo_unreference(intel->first_post_swapbuffers_batch); - intel->first_post_swapbuffers_batch = NULL; + drm_intel_bo_unreference(brw->first_post_swapbuffers_batch); + brw->first_post_swapbuffers_batch = NULL; driDestroyOptionCache(&brw->optionCache); diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h index ae5ae5f8a75..f95b1db2597 100644 --- a/src/mesa/drivers/dri/i965/intel_context.h +++ b/src/mesa/drivers/dri/i965/intel_context.h @@ -129,8 +129,6 @@ struct intel_context bool has_llc; bool has_swizzling; - drm_intel_bo *first_post_swapbuffers_batch; - bool need_throttle; bool no_batch_wrap; /** diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 41090e8bc59..a9a5c121b5b 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -162,7 +162,7 @@ intelDRI2Flush(__DRIdrawable *drawable) return; intel_resolve_for_dri2_flush(brw, drawable); - intel->need_throttle = true; + brw->need_throttle = true; if (brw->batch.used) intel_batchbuffer_flush(brw); -- 2.30.2