panfrost: Fix vertex buffer corruption
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 27 Mar 2019 02:22:33 +0000 (02:22 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 31 Mar 2019 02:36:37 +0000 (02:36 +0000)
Fixes crash in dEQP-GLES2.functional.buffer.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/pan_context.c

index c513791615eadf4a266859674d8d94fff3764654..8fed5270f5030763b6d2baad64c770ec773f0c6e 100644 (file)
@@ -773,12 +773,14 @@ panfrost_emit_vertex_data(struct panfrost_context *ctx)
                  * rsrc->gpu. However, attribute buffers must be 64 aligned. If
                  * it is not, for now we have to duplicate the buffer. */
 
-                mali_ptr effective_address = (rsrc->bo->gpu + buf->buffer_offset);
+                mali_ptr effective_address = rsrc ? (rsrc->bo->gpu + buf->buffer_offset) : 0;
 
-                if (effective_address & 0x3F) {
-                        attrs[i].elements = panfrost_upload_transient(ctx, rsrc->bo->cpu + buf->buffer_offset, attrs[i].size) | 1;
+                if (effective_address) {
+                        attrs[i].elements = panfrost_upload_transient(ctx, rsrc->bo->cpu + buf->buffer_offset, attrs[i].size) | MALI_ATTR_LINEAR;
+                } else if (effective_address) {
+                        attrs[i].elements = effective_address | MALI_ATTR_LINEAR;
                 } else {
-                        attrs[i].elements = effective_address | 1;
+                        /* Leave unset? */
                 }
         }