Re: [Mesa-dev] [PATCH 01/10] panfrost: Fix vertex buffer corruption

2019-03-29 Thread Tomeu Vizoso
On Fri, 29 Mar 2019 at 02:48, Alyssa Rosenzweig  wrote:
>
> Fixes crash in dEQP-GLES2.functional.buffer.*
>
> Signed-off-by: Alyssa Rosenzweig 
> ---
>  src/gallium/drivers/panfrost/pan_context.c | 10 ++
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/panfrost/pan_context.c 
> b/src/gallium/drivers/panfrost/pan_context.c
> index d242c3f90ce..5139a33d0fc 100644
> --- a/src/gallium/drivers/panfrost/pan_context.c
> +++ b/src/gallium/drivers/panfrost/pan_context.c
> @@ -772,12 +772,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) {

Guess the two conditions above weren't supposed to be the same?

Regards,

Tomeu

> +attrs[i].elements = effective_address | 
> MALI_ATTR_LINEAR;
>  } else {
> -attrs[i].elements = effective_address | 1;
> +/* Leave unset? */
>  }
>  }
>
> --
> 2.20.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 01/10] panfrost: Fix vertex buffer corruption

2019-03-28 Thread Alyssa Rosenzweig
Fixes crash in dEQP-GLES2.functional.buffer.*

Signed-off-by: Alyssa Rosenzweig 
---
 src/gallium/drivers/panfrost/pan_context.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index d242c3f90ce..5139a33d0fc 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -772,12 +772,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? */
 }
 }
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev