i965/drm: Inline brw_bo_references.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 12 Apr 2017 05:55:02 +0000 (22:55 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 1 Aug 2017 06:19:34 +0000 (23:19 -0700)
It's a single atomic add, so it makes sense to inline it.

Improves performance in Piglit's drawoverhead microbenchmark's
"DrawArrays ( 1 VBO, 0 UBO,  0    ) w/ no state change" subtest by
0.400922% +/- 0.310389% (n=350) on my i7-7700HQ.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_bufmgr.c
src/mesa/drivers/dri/i965/brw_bufmgr.h

index 020d648..f70365e 100644 (file)
@@ -196,12 +196,6 @@ bucket_for_size(struct brw_bufmgr *bufmgr, uint64_t size)
    return NULL;
 }
 
-inline void
-brw_bo_reference(struct brw_bo *bo)
-{
-   p_atomic_inc(&bo->refcount);
-}
-
 int
 brw_bo_busy(struct brw_bo *bo)
 {
index 6a6051b..15d37c0 100644 (file)
@@ -37,6 +37,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
+#include "util/u_atomic.h"
 #include "util/list.h"
 
 #if defined(__cplusplus)
@@ -188,7 +189,11 @@ struct brw_bo *brw_bo_alloc_tiled_2d(struct brw_bufmgr *bufmgr,
                                      unsigned flags);
 
 /** Takes a reference on a buffer object */
-void brw_bo_reference(struct brw_bo *bo);
+static inline void
+brw_bo_reference(struct brw_bo *bo)
+{
+   p_atomic_inc(&bo->refcount);
+}
 
 /**
  * Releases a reference on a buffer object, freeing the data if