Mesa (master): st/mesa: always allocate pack/unpack buffers as staging

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 15 18:26:40 UTC 2019


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Aug 27 16:38:05 2019 -0400

st/mesa: always allocate pack/unpack buffers as staging

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>

---

 src/mesa/state_tracker/st_cb_bufferobjects.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 6b54aa67583..6c20a57ef76 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -245,6 +245,11 @@ buffer_usage(GLenum target, GLboolean immutable,
       }
    }
    else {
+      /* These are often read by the CPU, so enable CPU caches. */
+      if (target == GL_PIXEL_PACK_BUFFER ||
+          target == GL_PIXEL_UNPACK_BUFFER)
+         return PIPE_USAGE_STAGING;
+
       /* BufferData */
       switch (usage) {
       case GL_DYNAMIC_DRAW:
@@ -252,14 +257,7 @@ buffer_usage(GLenum target, GLboolean immutable,
          return PIPE_USAGE_DYNAMIC;
       case GL_STREAM_DRAW:
       case GL_STREAM_COPY:
-         /* XXX: Remove this test and fall-through when we have PBO unpacking
-          * acceleration. Right now, PBO unpacking is done by the CPU, so we
-          * have to make sure CPU reads are fast.
-          */
-         if (target != GL_PIXEL_UNPACK_BUFFER_ARB) {
-            return PIPE_USAGE_STREAM;
-         }
-         /* fall through */
+         return PIPE_USAGE_STREAM;
       case GL_STATIC_READ:
       case GL_DYNAMIC_READ:
       case GL_STREAM_READ:




More information about the mesa-commit mailing list