From 42f0aae874da440a041ee09b20c93f0d8e836b37 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 30 Aug 2019 17:37:22 -0700 Subject: [PATCH] panfrost: Fix misc. issues flagged by cppcheck Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso --- src/gallium/drivers/panfrost/pan_allocate.c | 2 +- src/gallium/drivers/panfrost/pan_context.c | 13 ++++++------- src/gallium/drivers/panfrost/pan_resource.c | 2 -- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c index 78318ee1784..57af5adede5 100644 --- a/src/gallium/drivers/panfrost/pan_allocate.c +++ b/src/gallium/drivers/panfrost/pan_allocate.c @@ -159,7 +159,7 @@ panfrost_upload(struct panfrost_memory *mem, const void *data, size_t sz) /* Bounds check */ if ((mem->stack_bottom + aligned_sz) >= mem->bo->size) { - printf("Out of memory, tried to upload %zd but only %zd available\n", + printf("Out of memory, tried to upload %zu but only %zu available\n", sz, mem->bo->size - mem->stack_bottom); assert(0); } diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 94ee9b5bdb2..2db360b0d49 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -946,7 +946,6 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) COPY(varying_count); COPY(texture_count); COPY(sampler_count); - COPY(sampler_count); COPY(midgard1.uniform_count); COPY(midgard1.uniform_buffer_count); COPY(midgard1.work_count); @@ -1163,10 +1162,10 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) /* The rest are honest-to-goodness UBOs */ for (unsigned ubo = 1; ubo < ubo_count; ++ubo) { - size_t sz = buf->cb[ubo].buffer_size; + size_t usz = buf->cb[ubo].buffer_size; bool enabled = buf->enabled_mask & (1 << ubo); - bool empty = sz == 0; + bool empty = usz == 0; if (!enabled || empty) { /* Stub out disabled UBOs to catch accesses */ @@ -1179,7 +1178,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) mali_ptr gpu = panfrost_map_constant_buffer_gpu(ctx, buf, ubo); unsigned bytes_per_field = 16; - unsigned aligned = ALIGN_POT(sz, bytes_per_field); + unsigned aligned = ALIGN_POT(usz, bytes_per_field); unsigned fields = aligned / bytes_per_field; ubos[ubo].size = MALI_POSITIVE(fields); @@ -1566,7 +1565,7 @@ panfrost_statistics_record( uint32_t prims = u_prims_for_vertices(info->mode, info->count); ctx->prims_generated += prims; - if (ctx->streamout.num_targets <= 0) + if (!ctx->streamout.num_targets) return; ctx->tf_prims_generated += prims; @@ -2616,7 +2615,7 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q) break; default: - fprintf(stderr, "Skipping query %d\n", query->type); + fprintf(stderr, "Skipping query %u\n", query->type); break; } @@ -2681,7 +2680,7 @@ panfrost_get_query_result(struct pipe_context *pipe, break; default: - DBG("Skipped query get %d\n", query->type); + DBG("Skipped query get %u\n", query->type); break; } diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 57df61cb71c..6b72f2a5559 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -908,9 +908,7 @@ void panfrost_resource_context_init(struct pipe_context *pctx) { pctx->transfer_map = u_transfer_helper_transfer_map; - pctx->transfer_flush_region = u_transfer_helper_transfer_flush_region; pctx->transfer_unmap = u_transfer_helper_transfer_unmap; - pctx->buffer_subdata = u_default_buffer_subdata; pctx->create_surface = panfrost_create_surface; pctx->surface_destroy = panfrost_surface_destroy; pctx->resource_copy_region = util_resource_copy_region; -- 2.30.2