Mesa (master): nouveau: support NULL-resources

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 29 10:36:19 UTC 2019


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Mar  6 13:28:42 2019 +0100

nouveau: support NULL-resources

It's legal for a buffer-object to have a NULL-resource, but let's just
skip over it, as there's nothing to do.

Signed-off-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Acked-by: Karol Herbst <kherbst at redhat.com>

---

 src/gallium/drivers/nouveau/nv50/nv50_push.c          | 7 +++++--
 src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c | 6 +++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_push.c b/src/gallium/drivers/nouveau/nv50/nv50_push.c
index bec2d42e037..15666d346c1 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_push.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_push.c
@@ -264,10 +264,13 @@ nv50_push_vbo(struct nv50_context *nv50, const struct pipe_draw_info *info)
       const struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i];
       const uint8_t *data;
 
-      if (unlikely(!vb->is_user_buffer))
+      if (unlikely(!vb->is_user_buffer)) {
+         if (!vb->buffer.resource)
+            continue;
+
          data = nouveau_resource_map_offset(&nv50->base,
             nv04_resource(vb->buffer.resource), vb->buffer_offset, NOUVEAU_BO_RD);
-      else
+      } else
          data = vb->buffer.user;
 
       if (apply_bias && likely(!(nv50->vertex->instance_bufs & (1 << i))))
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
index 4333fb26d23..64903fc5cf0 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo_translate.c
@@ -71,9 +71,13 @@ nvc0_vertex_configure_translate(struct nvc0_context *nvc0, int32_t index_bias)
 
       if (likely(vb->is_user_buffer))
          map = (const uint8_t *)vb->buffer.user;
-      else
+      else {
+         if (!vb->buffer.resource)
+            continue;
+
          map = nouveau_resource_map_offset(&nvc0->base,
             nv04_resource(vb->buffer.resource), vb->buffer_offset, NOUVEAU_BO_RD);
+      }
 
       if (index_bias && !unlikely(nvc0->vertex->instance_bufs & (1 << i)))
          map += (intptr_t)index_bias * vb->stride;




More information about the mesa-commit mailing list