tools/null_state_gen: fix various compiler warnings

Add the debug and warning flags to cflags and fix the resulting issues.

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2015-08-26 12:05:13 +01:00
parent 4ee6709e3b
commit b9d27f03c7
9 changed files with 51 additions and 23 deletions

View File

@ -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 \

View File

@ -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);
}

View File

@ -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);

View File

@ -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)

View File

@ -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__ */

View File

@ -24,7 +24,7 @@
* Mika Kuoppala <mika.kuoppala@intel.com>
*/
#include "intel_batchbuffer.h"
#include "intel_renderstate.h"
#include <lib/gen6_render.h>
#include <lib/intel_reg.h>
#include <string.h>

View File

@ -24,7 +24,7 @@
* Mika Kuoppala <mika.kuoppala@intel.com>
*/
#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);

View File

@ -24,6 +24,7 @@
* Mika Kuoppala <mika.kuoppala@intel.com>
*/
#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));

View File

@ -25,7 +25,7 @@
* Mika Kuoppala <mika.kuoppala@intel.com>
*/
#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;
}