iris: avoid crashing on unbound constant resources
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 20 Jun 2018 06:37:10 +0000 (23:37 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:07 +0000 (10:26 -0800)
instead, read from the workaround BO

src/gallium/drivers/iris/iris_state.c

index baa27e7cd49b6795b662f6ded1f294443265ea23..1dc761caff6fdd315082da90c4a950097113939b 100644 (file)
@@ -2290,7 +2290,10 @@ iris_restore_context_saved_bos(struct iris_context *ice,
          struct iris_const_buffer *cbuf = &shs->constbuf[range->block];
          struct iris_resource *res = (void *) cbuf->resource;
 
-         iris_use_pinned_bo(batch, res->bo, false);
+         if (res)
+            iris_use_pinned_bo(batch, res->bo, false);
+         else
+            iris_use_pinned_bo(batch, batch->screen->workaround_bo, false);
       }
    }
 
@@ -2467,7 +2470,8 @@ iris_upload_render_state(struct iris_context *ice,
 
                pkt.ConstantBody.ReadLength[n] = range->length;
                pkt.ConstantBody.Buffer[n] =
-                  ro_bo(res->bo, range->start * 32 + cbuf->offset);
+                  res ? ro_bo(res->bo, range->start * 32 + cbuf->offset)
+                      : ro_bo(batch->screen->workaround_bo, 0);
                n--;
             }
          }