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

Author: Kenneth Graunke <kenn...@whitecape.org>
Date:   Thu Dec 11 01:40:28 2014 -0800

i965/query: Add query->bo == NULL early return in CheckQuery hook.

If query->bo == NULL, this is a redundant CheckQuery call, and we
should simply return.  We didn't do anything anyway - we skipped the
batch flushing block, and although we called get_results(), it has an
early return and does nothing.  Why bother?

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Reviewed-by: Ben Widawsky <b...@bwidawsk.net>
Reviewed-by: Ian Romanick <ian.d.roman...@intel.com>

---

 src/mesa/drivers/dri/i965/gen6_queryobj.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c 
b/src/mesa/drivers/dri/i965/gen6_queryobj.c
index 3013513..537c1d9 100644
--- a/src/mesa/drivers/dri/i965/gen6_queryobj.c
+++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c
@@ -320,6 +320,12 @@ static void gen6_check_query(struct gl_context *ctx, 
struct gl_query_object *q)
    struct brw_context *brw = brw_context(ctx);
    struct brw_query_object *query = (struct brw_query_object *)q;
 
+   /* If query->bo is NULL, we've already gathered the results - this is a
+    * redundant CheckQuery call.  Ignore it.
+    */
+   if (query->bo == NULL)
+      return;
+
    /* From the GL_ARB_occlusion_query spec:
     *
     *     "Instead of allowing for an infinite loop, performing a
@@ -327,10 +333,10 @@ static void gen6_check_query(struct gl_context *ctx, 
struct gl_query_object *q)
     *      not ready yet on the first time it is queried.  This ensures that
     *      the async query will return true in finite time.
     */
-   if (query->bo && drm_intel_bo_references(brw->batch.bo, query->bo))
+   if (drm_intel_bo_references(brw->batch.bo, query->bo))
       intel_batchbuffer_flush(brw);
 
-   if (query->bo == NULL || !drm_intel_bo_busy(query->bo)) {
+   if (!drm_intel_bo_busy(query->bo)) {
       gen6_queryobj_get_results(ctx, query);
    }
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to