i965: Move intel_context's framerate throttling fields to brw_context.
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 6ca4b2eb3141a34f568732a44562d24435d955c7..f278c5302ba12a236abd418f8db476ca594ccf19 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 8f032183cf4e9306348d982a4f9f6355765fb90c..0905237aa895d99d25458e1fec537cfe3adb1d0f 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 53ae742dfa7fb7c2cfd926e83b931fefd5a06a7d..3ef6d2cf85cc01513eae869356a9e990df908617 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 ae5ae5f8a75d678d5accf9478ed814bbe95953e5..f95b1db259759084c8ffb9ded83030a989ddee7a 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 41090e8bc59dcb2aec30550f414ae766d7be6f93..a9a5c121b5b21100e9fa57d2e9a673d469f32a72 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);