intel-gpu-tools: Fixes-compiler-warnings-about-wrong-function-type
PATCH 1/1 intel-gpu-tools: Fixes-compiler-warnings-about-wrong-function-type
Hi
Find a simple buildfix against current intel-gpu-tools git sources attached.
Thanks,
Stefan
Public Key available
------------------------------------------------------
Stefan Dirsch (Res. & Dev.) SUSE LINUX GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany
---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------
Quoted 1 line
From
89822e4caba0868b397afb141a9f561a254fe92cMon Sep 17 00:00:00 2001
From: Stefan Dirsch <[email protected]>
Date: Fri, 21 Aug 2015 12:40:23 +0200
Subject: [PATCH] Fixes compiler warnings about wrong function type.
Makes definition of function types for gen8_setup_null_render_state and gen9_setup_null_render_state consistent with the ones from functions for earlier GPU families like gen6_setup_null_render_state, gen7_setup_null_render_state, ...
--- tools/null_state_gen/intel_renderstate_gen8.c | 5 +---- tools/null_state_gen/intel_renderstate_gen9.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-)
tools/null_state_gen/intel_renderstate_gen8.c +1 -4
@@ -322,11 +322,8 @@ static void gen8_emit_primitive(struct intel_batchbuffer *batch)OUT_BATCH (0 );/* index buffer offset, ignored */ } -int gen8_setup_null_render_state (struct intel_batchbuffer *batch) +void gen8_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret; -int i; -#define GEN8_PIPE_CONTROL_GLOBAL_GTT (1 << 24)OUT_BATCH (GEN6_PIPE_CONTROL | (6 -2 ));
tools/null_state_gen/intel_renderstate_gen9.c +1 -4
@@ -342,9 +342,8 @@ static void gen9_emit_state_base_address(struct intel_batchbuffer *batch) {* Generate the batch buffer commands needed to initialize the 3D engine * to its "golden state". */ -int gen9_setup_null_render_state (struct intel_batchbuffer *batch) +void gen9_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret;int i;#define GEN8_PIPE_CONTROL_GLOBAL_GTT (1 << 24)
@@ -477,6 +476,4 @@ int gen9_setup_null_render_state(struct intel_batchbuffer *batch)gen8_emit_primitive (batch);OUT_BATCH (MI_BATCH_BUFFER_END ); - -return ret; }
Signature · 1 line
1.8.4.5
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Stefan Dirsch
Hi
Find a simple buildfix against current intel-gpu-tools git sources attached.
I assume the compiler warning is about uninitialised values and unused variables? It looks like the Makefile is not using the debug cflags so these warning do not appear by default.
intel_null_state_gen.c appears to assume the gen*_setup_null_render_state functions have return values in the extern declarations, so this could do with fixing too.
Quoted 15 lines
Thanks,
StefanPublic Key available
------------------------------------------------------Stefan Dirsch (Res. & Dev.) SUSE LINUX GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------
Quoted 5 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 tools/null_state_gen: fix various compiler warnings
Add the debug and warning flags to cflags and fix the resulting issues.
--- tools/null_state_gen/Makefile.am | 2 ++ tools/null_state_gen/intel_batchbuffer.c | 7 +++--- tools/null_state_gen/intel_batchbuffer.h | 4 +++- tools/null_state_gen/intel_null_state_gen.c | 8 ++----- tools/null_state_gen/intel_renderstate.h | 34 +++++++++++++++++++++++++++ tools/null_state_gen/intel_renderstate_gen6.c | 2 +- tools/null_state_gen/intel_renderstate_gen7.c | 4 +--- tools/null_state_gen/intel_renderstate_gen8.c | 6 ++--- tools/null_state_gen/intel_renderstate_gen9.c | 7 ++---- 9 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 tools/null_state_gen/intel_renderstate.h
tools/null_state_gen/Makefile.am +2 -0
@@ -1,11 +1,13 @@ GPU_TOOLS_PATH := $(top_srcdir) AM_CPPFLAGS = -I$(top_srcdir) +AM_CFLAGS = $(DEBUG_CFLAGS) $(CWARNFLAGS) noinst_PROGRAMS = intel_null_state_gen intel_null_state_gen_SOURCES = \ intel_batchbuffer.c \ intel_batchbuffer.h \ + intel_renderstate.h \ intel_renderstate_gen6.c \ intel_renderstate_gen7.c \ intel_renderstate_gen8.c \
tools/null_state_gen/intel_batchbuffer.c +4 -3
@@ -3,7 +3,7 @@* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * -* Copyright 2014 Intel Corporation +* Copyright 2014, 2015 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a
@@ -164,7 +164,7 @@ unsigned intel_batch_num_cmds(struct intel_batchbuffer *batch)return bb_area_items (batch->cmds); } -static unsigned intel_batch_num_state (struct intel_batchbuffer *batch) +unsigned intel_batch_num_state (struct intel_batchbuffer *batch) {return bb_area_items (batch->state); }
@@ -217,9 +217,10 @@ uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch,for (i =0 ; i < dwords; i++) {char offsetinside[80 ]; +uint32_t *s;sprintf (offsetinside,"%s: 0x%x" , str, i *4 ); -uint32_t *s = (uint32_t *)(uint8_t *)d + i; + s = (uint32_t *)(uint8_t *)d + i;bb_area_emit (batch->state, *s,STATE , offsetinside); }
tools/null_state_gen/intel_batchbuffer.h +3 -1
@@ -3,7 +3,7 @@* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * -* Copyright 2014 Intel Corporation +* Copyright 2014, 2015 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a
@@ -86,6 +86,8 @@ uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes const char *name);uint32_t intel_batch_state_offset (struct intel_batchbuffer *batch,unsigned align);unsigned intel_batch_num_cmds (struct intel_batchbuffer *batch); +struct bb_item *intel_batch_state_get (struct intel_batchbuffer *batch,unsigned i); +unsigned intel_batch_num_state (struct intel_batchbuffer *batch);struct bb_item *intel_batch_cmd_get (struct intel_batchbuffer *batch,unsigned i);int intel_batch_is_reloc (struct intel_batchbuffer *batch,unsigned i);
tools/null_state_gen/intel_null_state_gen.c +2 -6
@@ -30,13 +30,9 @@#include <errno.h> #include <assert.h> +#include "intel_renderstate.h" #include "intel_batchbuffer.h" -extern int gen6_setup_null_render_state (struct intel_batchbuffer *batch); -extern int gen7_setup_null_render_state (struct intel_batchbuffer *batch); -extern int gen8_setup_null_render_state (struct intel_batchbuffer *batch); -extern int gen9_setup_null_render_state (struct intel_batchbuffer *batch); -static int debug =0 ;static void print_usage (char *s)
@@ -115,7 +111,7 @@ static int do_generate(int gen) {struct intel_batchbuffer *batch;int ret = -EINVAL ; -int (*null_state_gen)(struct intel_batchbuffer *batch) =NULL ; +void (*null_state_gen)(struct intel_batchbuffer *batch) =NULL ; batch =intel_batchbuffer_create ();if (batch ==NULL )
tools/null_state_gen/intel_renderstate.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright © 2015 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __INTEL_RENDERSTATE_H__ +#define __INTEL_RENDERSTATE_H__ + +#include "intel_batchbuffer.h" + +void gen6_setup_null_render_state (struct intel_batchbuffer *batch); +void gen7_setup_null_render_state (struct intel_batchbuffer *batch); +void gen8_setup_null_render_state (struct intel_batchbuffer *batch); +void gen9_setup_null_render_state (struct intel_batchbuffer *batch); + +#endif /* __INTEL_RENDERSTATE_H__ */
tools/null_state_gen/intel_renderstate_gen6.c +1 -1
@@ -24,7 +24,7 @@* Mika Kuoppala <[email protected]> */ -#include "intel_batchbuffer.h" +#include "intel_renderstate.h" #include <lib/gen6_render.h> #include <lib/intel_reg.h> #include <string.h>
tools/null_state_gen/intel_renderstate_gen7.c +1 -3
@@ -24,7 +24,7 @@* Mika Kuoppala <[email protected]> */ -#include "intel_batchbuffer.h" +#include "intel_renderstate.h" #include <lib/gen7_render.h> #include <lib/intel_reg.h> #include <string.h>
@@ -417,8 +417,6 @@ gen7_emit_null_depth_buffer(struct intel_batchbuffer *batch)void gen7_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret; -OUT_BATCH (GEN7_PIPELINE_SELECT |PIPELINE_SELECT_3D );gen7_emit_state_base_address (batch);
tools/null_state_gen/intel_renderstate_gen8.c +2 -4
@@ -24,6 +24,7 @@* Mika Kuoppala <[email protected]> */ +#include "intel_renderstate.h" #include "intel_batchbuffer.h" #include <lib/gen8_render.h> #include <lib/intel_reg.h>
@@ -322,11 +323,8 @@ static void gen8_emit_primitive(struct intel_batchbuffer *batch)OUT_BATCH (0 );/* index buffer offset, ignored */ } -int gen8_setup_null_render_state (struct intel_batchbuffer *batch) +void gen8_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret; -int i; -#define GEN8_PIPE_CONTROL_GLOBAL_GTT (1 << 24)OUT_BATCH (GEN6_PIPE_CONTROL | (6 -2 ));
tools/null_state_gen/intel_renderstate_gen9.c +2 -5
@@ -25,7 +25,7 @@* Mika Kuoppala <[email protected]> */ -#include "intel_batchbuffer.h" +#include "intel_renderstate.h" #include <lib/gen9_render.h> #include <lib/intel_reg.h>
@@ -342,9 +342,8 @@ static void gen9_emit_state_base_address(struct intel_batchbuffer *batch) {* Generate the batch buffer commands needed to initialize the 3D engine * to its "golden state". */ -int gen9_setup_null_render_state (struct intel_batchbuffer *batch) +void gen9_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret;int i;#define GEN8_PIPE_CONTROL_GLOBAL_GTT (1 << 24)
@@ -477,6 +476,4 @@ int gen9_setup_null_render_state(struct intel_batchbuffer *batch)gen8_emit_primitive (batch);OUT_BATCH (MI_BATCH_BUFFER_END ); - -return ret; }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t] tools/null_state_gen: fix various compiler warnings
Quoted 3 lines · Thomas Wood
Add the debug and warning flags to cflags and fix the resulting issues.
Signed-off-by Thomas Wood <[email protected]>
Much better now,
Quoted 248 lines
--- tools/null_state_gen/Makefile.am | 2 ++ tools/null_state_gen/intel_batchbuffer.c | 7 +++--- tools/null_state_gen/intel_batchbuffer.h | 4 +++- tools/null_state_gen/intel_null_state_gen.c | 8 ++----- tools/null_state_gen/intel_renderstate.h | 34 +++++++++++++++++++++++++++ tools/null_state_gen/intel_renderstate_gen6.c | 2 +- tools/null_state_gen/intel_renderstate_gen7.c | 4 +--- tools/null_state_gen/intel_renderstate_gen8.c | 6 ++--- tools/null_state_gen/intel_renderstate_gen9.c | 7 ++---- 9 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 tools/null_state_gen/intel_renderstate.htools/null_state_gen/Makefile.am +2
-0@@ -1,11 +1,13 @@ GPU_TOOLS_PATH := $(top_srcdir) AM_CPPFLAGS = -I$(top_srcdir) +AM_CFLAGS = $(DEBUG_CFLAGS) $(CWARNFLAGS) noinst_PROGRAMS = intel_null_state_gen intel_null_state_gen_SOURCES = \ intel_batchbuffer.c \ intel_batchbuffer.h \ + intel_renderstate.h \ intel_renderstate_gen6.c \ intel_renderstate_gen7.c \ intel_renderstate_gen8.c \tools/null_state_gen/intel_batchbuffer.c +4
-3@@ -3,7 +3,7 @@* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * -* Copyright 2014 Intel Corporation +* Copyright 2014, 2015 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -164,7 +164,7 @@ unsigned intel_batch_num_cmds(struct intel_batchbuffer *batch)return bb_area_items (batch->cmds); } -static unsigned intel_batch_num_state (struct intel_batchbuffer *batch) +unsigned intel_batch_num_state (struct intel_batchbuffer *batch) {return bb_area_items (batch->state); }@@ -217,9 +217,10 @@ uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch,for (i =0 ; i < dwords; i++) {char offsetinside[80 ]; +uint32_t *s;sprintf (offsetinside,"%s: 0x%x" , str, i *4 ); -uint32_t *s = (uint32_t *)(uint8_t *)d + i; + s = (uint32_t *)(uint8_t *)d + i;bb_area_emit (batch->state, *s,STATE , offsetinside); }tools/null_state_gen/intel_batchbuffer.h +3
-1@@ -3,7 +3,7 @@* Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. * All Rights Reserved. * -* Copyright 2014 Intel Corporation +* Copyright 2014, 2015 Intel Corporation * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -86,6 +86,8 @@ uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes const char *name);uint32_t intel_batch_state_offset (struct intel_batchbuffer *batch,unsigned align);unsigned intel_batch_num_cmds (struct intel_batchbuffer *batch); +struct bb_item *intel_batch_state_get (struct intel_batchbuffer *batch,unsigned i); +unsigned intel_batch_num_state (struct intel_batchbuffer *batch);struct bb_item *intel_batch_cmd_get (struct intel_batchbuffer *batch,unsigned i);int intel_batch_is_reloc (struct intel_batchbuffer *batch,unsigned i);tools/null_state_gen/intel_null_state_gen.c +2
-6@@ -30,13 +30,9 @@#include <errno.h> #include <assert.h> +#include "intel_renderstate.h" #include "intel_batchbuffer.h" -extern int gen6_setup_null_render_state (struct intel_batchbuffer *batch); -extern int gen7_setup_null_render_state (struct intel_batchbuffer *batch); -extern int gen8_setup_null_render_state (struct intel_batchbuffer *batch); -extern int gen9_setup_null_render_state (struct intel_batchbuffer *batch); -static int debug =0 ;static void print_usage (char *s)@@ -115,7 +111,7 @@ static int do_generate(int gen) {struct intel_batchbuffer *batch;int ret = -EINVAL ; -int (*null_state_gen)(struct intel_batchbuffer *batch) =NULL ; +void (*null_state_gen)(struct intel_batchbuffer *batch) =NULL ; batch =intel_batchbuffer_create ();if (batch ==NULL )tools/null_state_gen/intel_renderstate.h new file +34
-0@@ -0,0 +1,34 @@ +/* +* Copyright © 2015 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __INTEL_RENDERSTATE_H__ +#define __INTEL_RENDERSTATE_H__ + +#include "intel_batchbuffer.h" + +void gen6_setup_null_render_state (struct intel_batchbuffer *batch); +void gen7_setup_null_render_state (struct intel_batchbuffer *batch); +void gen8_setup_null_render_state (struct intel_batchbuffer *batch); +void gen9_setup_null_render_state (struct intel_batchbuffer *batch); + +#endif /* __INTEL_RENDERSTATE_H__ */ tools/null_state_gen/intel_renderstate_gen6.c +1
-1@@ -24,7 +24,7 @@* Mika Kuoppala <[email protected]> */ -#include "intel_batchbuffer.h" +#include "intel_renderstate.h" #include <lib/gen6_render.h> #include <lib/intel_reg.h> #include <string.h> tools/null_state_gen/intel_renderstate_gen7.c +1
-3@@ -24,7 +24,7 @@* Mika Kuoppala <[email protected]> */ -#include "intel_batchbuffer.h" +#include "intel_renderstate.h" #include <lib/gen7_render.h> #include <lib/intel_reg.h> #include <string.h> @@ -417,8 +417,6 @@ gen7_emit_null_depth_buffer(struct intel_batchbuffer *batch)void gen7_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret; -OUT_BATCH (GEN7_PIPELINE_SELECT |PIPELINE_SELECT_3D );gen7_emit_state_base_address (batch);tools/null_state_gen/intel_renderstate_gen8.c +2
-4@@ -24,6 +24,7 @@* Mika Kuoppala <[email protected]> */ +#include "intel_renderstate.h" #include "intel_batchbuffer.h" #include <lib/gen8_render.h> #include <lib/intel_reg.h> @@ -322,11 +323,8 @@ static void gen8_emit_primitive(struct intel_batchbuffer *batch)OUT_BATCH (0 );/* index buffer offset, ignored */ } -int gen8_setup_null_render_state (struct intel_batchbuffer *batch) +void gen8_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret; -int i; -#define GEN8_PIPE_CONTROL_GLOBAL_GTT (1 << 24)OUT_BATCH (GEN6_PIPE_CONTROL | (6 -2 ));tools/null_state_gen/intel_renderstate_gen9.c +2
-5@@ -25,7 +25,7 @@* Mika Kuoppala <[email protected]> */ -#include "intel_batchbuffer.h" +#include "intel_renderstate.h" #include <lib/gen9_render.h> #include <lib/intel_reg.h> @@ -342,9 +342,8 @@ static void gen9_emit_state_base_address(struct intel_batchbuffer *batch) {* Generate the batch buffer commands needed to initialize the 3D engine * to its "golden state". */ -int gen9_setup_null_render_state (struct intel_batchbuffer *batch) +void gen9_setup_null_render_state (struct intel_batchbuffer *batch) { -int ret;int i;#define GEN8_PIPE_CONTROL_GLOBAL_GTT (1 << 24)@@ -477,6 +476,4 @@ int gen9_setup_null_render_state(struct intel_batchbuffer *batch)gen8_emit_primitive (batch);OUT_BATCH (MI_BATCH_BUFFER_END ); - -return ret; }Signature · 1 line
1.9.1
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Thomas Wood
Quoted 3 lines · Stefan Dirsch
Hi
Find a simple buildfix against current intel-gpu-tools git sources attached.
I assume the compiler warning is about uninitialised values and unused variables? It looks like the
Makefileis not using the debug cflags so these warning do not appear by default.
Warnings/error were:
W: intel-gpu-tools uninitialized-variable intel_renderstate_gen9.c:476
E: intel-gpu-tools no-return-in-nonvoid-function intel_renderstate_gen8.c:441
Quoted 3 lines
intel_null_state_gen.cappears to assume the gen*_setup_null_render_state functions have return values in the extern declarations, so this could do with fixing too.
Indeed your patches fixes these warnings/errors. So no need any longer to include/review my patch as long as your patch gets integrated. ;-)
Thanks,
Stefan
Public Key available
------------------------------------------------------
Stefan Dirsch (Res. & Dev.) SUSE LINUX GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany
---------------------------------------------------------------
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
---------------------------------------------------------------
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx