Mesa (master): mesa: Add usage history bitfield to buffer objects

Chris Forbes chrisf at kemper.freedesktop.org
Thu Oct 16 09:33:50 UTC 2014


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

Author: Chris Forbes <chrisf at ijw.co.nz>
Date:   Wed Oct  1 19:19:47 2014 +1300

mesa: Add usage history bitfield to buffer objects

In the drivers, we occasionally want to reallocate the backing
store for a buffer object; often to avoid waiting for the GPU
to be finished with the previous contents.

At the point that happens, we don't have a good way of determining
where else the buffer object may be bound, and so no good way of
determining which dirty flags need to be raised -- it's fairly
expensive to go looking at all the possible binding points.

Until now, we've considered any BO to be possibly bound as a UBO or
TexBO, and flagged all that state to be reemitted.

Instead, remember what kinds of binding point this buffer has ever
been used with, so that the drivers can flag only what they need.
I don't expect these bits to ever be reset, but that doesn't matter
for reasonable apps.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>

---

 src/mesa/main/mtypes.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 5e9453b..881c26c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1465,6 +1465,14 @@ struct gl_buffer_mapping {
 
 
 /**
+ * Usages we've seen for a buffer object.
+ */
+typedef enum {
+   USAGE_UNIFORM_BUFFER = 0x1,
+} gl_buffer_usage;
+
+
+/**
  * GL_ARB_vertex/pixel_buffer_object buffer object
  */
 struct gl_buffer_object
@@ -1481,6 +1489,7 @@ struct gl_buffer_object
    GLboolean Written;   /**< Ever written to? (for debugging) */
    GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
    GLboolean Immutable; /**< GL_ARB_buffer_storage */
+   gl_buffer_usage UsageHistory; /**< How has this buffer been used so far? */
 
    struct gl_buffer_mapping Mappings[MAP_COUNT];
 };




More information about the mesa-commit mailing list