i965: Move intel_context's framerate throttling fields to brw_context. 02/7402/1
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 3 Jul 2013 21:28:29 +0000 (14:28 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 9 Jul 2013 21:09:12 +0000 (14:09 -0700)
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/intel_batchbuffer.c
src/mesa/drivers/dri/i965/intel_context.c
src/mesa/drivers/dri/i965/intel_context.h
src/mesa/drivers/dri/i965/intel_screen.c

index 6ca4b2e..f278c53 100644 (file)
@@ -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;
 
    /**
index 8f03218..0905237 100644 (file)
@@ -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))
index 53ae742..3ef6d2c 100644 (file)
@@ -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);
 
index ae5ae5f..f95b1db 100644 (file)
@@ -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;
 
    /**
index 41090e8..a9a5c12 100644 (file)
@@ -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);