* [PATCH i-g-t 1/2] tools/aubdump: remove void pointer arithmetic
@ 2015-09-08 17:13 Thomas Wood
2015-09-08 17:13 ` [PATCH i-g-t 2/2] null_state_gen: add const to intel_batch_state_copy data Thomas Wood
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Wood @ 2015-09-08 17:13 UTC (permalink / raw
To: intel-gfx
A gcc extension allows void pointer arithmetic by treating the size of
void as 1, but this generates a warning when -Wpointer-arith is used.
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
tools/aubdump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/aubdump.c b/tools/aubdump.c
index d52515b..a17dc10 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -191,7 +191,7 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_
dword_out((gtt_offset + offset) >> 32);
if (virtual)
- data_out(GET_PTR(virtual) + offset, block_size);
+ data_out(((char *) GET_PTR(virtual)) + offset, block_size);
else
data_out(null_block, block_size);
@@ -261,7 +261,7 @@ relocate_bo(struct bo *bo, const struct drm_i915_gem_execbuffer2 *execbuffer2,
else
handle = relocs[i].target_handle;
- dw = relocated + relocs[i].offset;
+ dw = (uint32_t*)(((char *) relocated) + relocs[i].offset);
*dw = bos[handle].offset + relocs[i].delta;
}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH i-g-t 2/2] null_state_gen: add const to intel_batch_state_copy data
2015-09-08 17:13 [PATCH i-g-t 1/2] tools/aubdump: remove void pointer arithmetic Thomas Wood
@ 2015-09-08 17:13 ` Thomas Wood
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Wood @ 2015-09-08 17:13 UTC (permalink / raw
To: intel-gfx
The data is not modified by the function and is often declared const.
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
tools/null_state_gen/intel_batchbuffer.c | 6 +++---
tools/null_state_gen/intel_batchbuffer.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/null_state_gen/intel_batchbuffer.c b/tools/null_state_gen/intel_batchbuffer.c
index 5aa980e..2ead22e 100644
--- a/tools/null_state_gen/intel_batchbuffer.c
+++ b/tools/null_state_gen/intel_batchbuffer.c
@@ -202,7 +202,7 @@ uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes
}
uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch,
- void *d, unsigned bytes,
+ const void *d, unsigned bytes,
unsigned align,
const char *str)
{
@@ -217,10 +217,10 @@ uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch,
for (i = 0; i < dwords; i++) {
char offsetinside[80];
- uint32_t *s;
+ const uint32_t *s;
sprintf(offsetinside, "%s: 0x%x", str, i * 4);
- s = (uint32_t *)(uint8_t *)d + i;
+ s = (const uint32_t *)(const uint8_t *)d + i;
bb_area_emit(batch->state, *s, STATE, offsetinside);
}
diff --git a/tools/null_state_gen/intel_batchbuffer.h b/tools/null_state_gen/intel_batchbuffer.h
index 2919e87..771d1c8 100644
--- a/tools/null_state_gen/intel_batchbuffer.h
+++ b/tools/null_state_gen/intel_batchbuffer.h
@@ -80,7 +80,7 @@ struct intel_batchbuffer *intel_batchbuffer_create(void);
#define OUT_STATE_OFFSET(offset) bb_area_emit(batch->state, offset, STATE_OFFSET, #offset)
#define OUT_STATE_STRUCT(name, align) intel_batch_state_copy(batch, &name, sizeof(name), align, #name " " #align)
-uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, void *d, unsigned bytes, unsigned align,
+uint32_t intel_batch_state_copy(struct intel_batchbuffer *batch, const void *d, unsigned bytes, unsigned align,
const char *name);
uint32_t intel_batch_state_alloc(struct intel_batchbuffer *batch, unsigned bytes, unsigned align,
const char *name);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-08 17:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-08 17:13 [PATCH i-g-t 1/2] tools/aubdump: remove void pointer arithmetic Thomas Wood
2015-09-08 17:13 ` [PATCH i-g-t 2/2] null_state_gen: add const to intel_batch_state_copy data Thomas Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).