Commit c824104c authored by Patrick Lerda's avatar Patrick Lerda
Browse files

panfrost: Fix unwanted valgrind message related to restart_index

As a reminder primitive_restart should always be checked before any access to restart_index.

It seems that restart_index is only initialized when primitive_restart is set to a non-zero
value. This patch is equivalent to the previous code but written in a way that the compiler
will test primitive_restart first before trying to read restart_index.

With commit ad864a7c

:
Conditional jump or move depends on uninitialised value(s)
   at 0xD33F1EC: panfrost_is_implicit_prim_restart (pan_cmdstream.c:2907)
   by 0xD33F1EC: panfrost_emit_primitive (pan_cmdstream.c:3073)
   by 0xD33F1EC: panfrost_draw_emit_tiler (pan_cmdstream.c:3440)
   by 0xD33F1EC: panfrost_direct_draw (pan_cmdstream.c:3595)
   by 0xD340467: panfrost_draw_vbo (pan_cmdstream.c:3889)
   by 0xD219119: u_vbuf_draw_vbo (u_vbuf.c:1498)
   by 0xD1C81F9: cso_multi_draw (cso_context.c:1644)
   by 0xCFBA19B: _mesa_draw_arrays.part.11 (draw.c:1324)
   by 0xCFBADA1: _mesa_draw_arrays (draw.c:1295)
   by 0xCFBADA1: _mesa_DrawArrays (draw.c:1533)
   by 0xD32EB: gl_vao_draw_data (in /usr/local/bin/mpv)
 Uninitialised value was created by a stack allocation
   at 0xCFBA14E: _mesa_draw_arrays.part.11 (draw.c:1289)

With mesa-22.1.0-rc4:
Conditional jump or move depends on uninitialised value(s)
   at 0xD36369C: panfrost_is_implicit_prim_restart (pan_cmdstream.c:2895)
   by 0xD36369C: panfrost_draw_emit_tiler (pan_cmdstream.c:3023)
   by 0xD36369C: panfrost_direct_draw (pan_cmdstream.c:3215)
   by 0xD3649BF: panfrost_draw_vbo (pan_cmdstream.c:3494)
   by 0xD23DE7D: u_vbuf_draw_vbo (u_vbuf.c:1498)
   by 0xD1ECBD1: cso_multi_draw (cso_context.c:1644)
   by 0xCFD60FF: _mesa_draw_arrays.part.11 (draw.c:1324)
   by 0xCFD6D11: _mesa_draw_arrays (draw.c:1295)
   by 0xCFD6D11: _mesa_DrawArrays (draw.c:1533)
   by 0xD32EB: gl_vao_draw_data (in /usr/local/bin/mpv)
 Uninitialised value was created by a stack allocation
   at 0xCFD60B2: _mesa_draw_arrays.part.11 (draw.c:1289)
Signed-off-by: default avatarPatrick Lerda <patrick9876@free.fr>
Reviewed-by: Alyssa Rosenzweig alyssa@collabora.com
Part-of: <!16389>
parent 7339ad2e
Pipeline #581387 waiting for manual action with stages
......@@ -2902,9 +2902,10 @@ panfrost_emit_primitive_size(struct panfrost_context *ctx,
static bool
panfrost_is_implicit_prim_restart(const struct pipe_draw_info *info)
{
unsigned implicit_index = BITFIELD_MASK(info->index_size * 8);
bool implicit = info->restart_index == implicit_index;
return info->primitive_restart && implicit;
/* As a reminder primitive_restart should always be checked before any
access to restart_index. */
return info->primitive_restart &&
info->restart_index == (unsigned)BITFIELD_MASK(info->index_size * 8);
}
/* On Bifrost and older, the Renderer State Descriptor aggregates many pieces of
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment