Mesa (master): i965: Remove unnecessary malloc/ free in VS binding table setup.

Eric Anholt anholt at kemper.freedesktop.org
Mon Jan 25 22:59:05 PST 2010


Module: Mesa
Branch: master
Commit: 5e1851b144a97bd577409dd5c6f3f6f45b4ff56f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e1851b144a97bd577409dd5c6f3f6f45b4ff56f

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Jan 19 15:26:56 2010 -0800

i965: Remove unnecessary malloc/free in VS binding table setup.

---

 src/mesa/drivers/dri/i965/brw_vs_surface_state.c |    4 +---
 src/mesa/drivers/dri/intel/intel_batchbuffer.c   |    3 ++-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index ca93ca7..ead623f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -155,7 +155,7 @@ brw_vs_get_binding_table(struct brw_context *brw)
 
    if (bind_bo == NULL) {
       GLuint data_size = BRW_VS_MAX_SURF * sizeof(GLuint);
-      uint32_t *data = malloc(data_size);
+      uint32_t data[BRW_VS_MAX_SURF];
       int i;
 
       for (i = 0; i < BRW_VS_MAX_SURF; i++)
@@ -180,8 +180,6 @@ brw_vs_get_binding_table(struct brw_context *brw)
 				    I915_GEM_DOMAIN_INSTRUCTION, 0);
 	 }
       }
-
-      free(data);
    }
 
    return bind_bo;
diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
index 3a4b21a..f18fb91 100644
--- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c
@@ -167,7 +167,8 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
    struct intel_context *intel = batch->intel;
    GLuint used = batch->ptr - batch->map;
 
-   if (intel->first_post_swapbuffers_batch == NULL) {
+   if (!intel->using_dri2_swapbuffers &&
+       intel->first_post_swapbuffers_batch == NULL) {
       intel->first_post_swapbuffers_batch = intel->batch->buf;
       drm_intel_bo_reference(intel->first_post_swapbuffers_batch);
    }



More information about the mesa-commit mailing list