panfrost: Fix misc. issues flagged by cppcheck
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Sat, 31 Aug 2019 00:37:22 +0000 (17:37 -0700)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 3 Sep 2019 11:55:29 +0000 (13:55 +0200)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
src/gallium/drivers/panfrost/pan_allocate.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_resource.c

index 78318ee1784f5d40d6b381503cc3fbb19c80970b..57af5adede5664d32bf4559da04d6b733661c0a1 100644 (file)
@@ -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);
         }
index 94ee9b5bdb2945eefe46d809c3c07e62dcf5811b..2db360b0d490eaf6daf8f760668356e4f6f5ef37 100644 (file)
@@ -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;
         }
 
index 57df61cb71cc19e248d10f74b4130e0575c58ea1..6b72f2a5559b90aa7b0034980dd42c61935337b0 100644 (file)
@@ -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;