#include <stdio.h>
#include <stdarg.h>
+#include <stdint.h>
#include <string.h>
-#include <inttypes.h>
+#include "util/u_string.h"
#include "intel_decode.h"
/*#include "intel_chipset.h"*/
}
static void
-instr_out(uint32_t *data, uint32_t hw_offset, unsigned int index,
+instr_out(const uint32_t *data, uint32_t hw_offset, unsigned int index,
char *fmt, ...)
{
va_list va;
static int
-decode_mi(uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_mi(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
unsigned int opcode;
}
static int
-decode_2d(uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_2d(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
unsigned int opcode, len;
char *format = NULL;
}
static int
-decode_3d_1c(uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d_1c(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
switch ((data[0] & 0x00f80000) >> 19) {
case 0x11:
/** Sets the string dstname to describe the destination of the PS instruction */
static void
-i915_get_instruction_dst(uint32_t *data, int i, char *dstname, int do_mask)
+i915_get_instruction_dst(const uint32_t *data, int i, char *dstname, int do_mask)
{
uint32_t a0 = data[i];
int dst_nr = (a0 >> 14) & 0xf;
}
static void
-i915_get_instruction_src0(uint32_t *data, int i, char *srcname)
+i915_get_instruction_src0(const uint32_t *data, int i, char *srcname)
{
uint32_t a0 = data[i];
uint32_t a1 = data[i + 1];
char swizzle[100];
i915_get_instruction_src_name((a0 >> 7) & 0x7, src_nr, srcname);
- sprintf(swizzle, ".%s%s%s%s", swizzle_x, swizzle_y, swizzle_z, swizzle_w);
+ util_snprintf(swizzle, sizeof(swizzle), ".%s%s%s%s", swizzle_x, swizzle_y, swizzle_z, swizzle_w);
if (strcmp(swizzle, ".xyzw") != 0)
strcat(srcname, swizzle);
}
static void
-i915_get_instruction_src1(uint32_t *data, int i, char *srcname)
+i915_get_instruction_src1(const uint32_t *data, int i, char *srcname)
{
uint32_t a1 = data[i + 1];
uint32_t a2 = data[i + 2];
char swizzle[100];
i915_get_instruction_src_name((a1 >> 13) & 0x7, src_nr, srcname);
- sprintf(swizzle, ".%s%s%s%s", swizzle_x, swizzle_y, swizzle_z, swizzle_w);
+ util_snprintf(swizzle, sizeof(swizzle), ".%s%s%s%s", swizzle_x, swizzle_y, swizzle_z, swizzle_w);
if (strcmp(swizzle, ".xyzw") != 0)
strcat(srcname, swizzle);
}
static void
-i915_get_instruction_src2(uint32_t *data, int i, char *srcname)
+i915_get_instruction_src2(const uint32_t *data, int i, char *srcname)
{
uint32_t a2 = data[i + 2];
int src_nr = (a2 >> 16) & 0x1f;
char swizzle[100];
i915_get_instruction_src_name((a2 >> 21) & 0x7, src_nr, srcname);
- sprintf(swizzle, ".%s%s%s%s", swizzle_x, swizzle_y, swizzle_z, swizzle_w);
+ util_snprintf(swizzle, sizeof(swizzle), ".%s%s%s%s", swizzle_x, swizzle_y, swizzle_z, swizzle_w);
if (strcmp(swizzle, ".xyzw") != 0)
strcat(srcname, swizzle);
}
}
static void
-i915_decode_alu1(uint32_t *data, uint32_t hw_offset,
+i915_decode_alu1(const uint32_t *data, uint32_t hw_offset,
int i, char *instr_prefix, char *op_name)
{
char dst[100], src0[100];
}
static void
-i915_decode_alu2(uint32_t *data, uint32_t hw_offset,
+i915_decode_alu2(const uint32_t *data, uint32_t hw_offset,
int i, char *instr_prefix, char *op_name)
{
char dst[100], src0[100], src1[100];
}
static void
-i915_decode_alu3(uint32_t *data, uint32_t hw_offset,
+i915_decode_alu3(const uint32_t *data, uint32_t hw_offset,
int i, char *instr_prefix, char *op_name)
{
char dst[100], src0[100], src1[100], src2[100];
}
static void
-i915_decode_tex(uint32_t *data, uint32_t hw_offset, int i, char *instr_prefix,
+i915_decode_tex(const uint32_t *data, uint32_t hw_offset, int i, char *instr_prefix,
char *tex_name)
{
uint32_t t0 = data[i];
}
static void
-i915_decode_dcl(uint32_t *data, uint32_t hw_offset, int i, char *instr_prefix)
+i915_decode_dcl(const uint32_t *data, uint32_t hw_offset, int i, char *instr_prefix)
{
uint32_t d0 = data[i];
char *sampletype;
switch ((d0 >> 19) & 0x3) {
case 1:
- sprintf(dcl_mask, ".%s%s%s%s", dcl_x, dcl_y, dcl_z, dcl_w);
+ util_snprintf(dcl_mask, sizeof(dcl_mask), ".%s%s%s%s", dcl_x, dcl_y, dcl_z, dcl_w);
if (strcmp(dcl_mask, ".") == 0)
fprintf(out, "bad (empty) dcl mask\n");
}
static void
-i915_decode_instruction(uint32_t *data, uint32_t hw_offset,
+i915_decode_instruction(const uint32_t *data, uint32_t hw_offset,
int i, char *instr_prefix)
{
switch ((data[i] >> 24) & 0x1f) {
}
static int
-decode_3d_1d(uint32_t *data, int count, uint32_t hw_offset, int *failures, int i830)
+decode_3d_1d(const uint32_t *data, int count, uint32_t hw_offset, int *failures, int i830)
{
unsigned int len, i, c, opcode, word, map, sampler, instr;
char *format;
if (i + 3 >= count)
BUFFER_FAIL(count, len, "3DSTATE_PIXEL_SHADER_PROGRAM");
- sprintf(instr_prefix, "PS%03d", instr);
+ util_snprintf(instr_prefix, sizeof(instr_prefix), "PS%03d", instr);
i915_decode_instruction(data, hw_offset, i, instr_prefix);
i += 3;
}
}
static int
-decode_3d_primitive(uint32_t *data, int count, uint32_t hw_offset,
+decode_3d_primitive(const uint32_t *data, int count, uint32_t hw_offset,
int *failures)
{
char immediate = (data[0] & (1 << 23)) == 0;
}
static int
-decode_3d(uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
unsigned int opcode;
}
static int
-decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d_965(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
unsigned int opcode, len;
int i;
}
static int
-decode_3d_i830(uint32_t *data, int count, uint32_t hw_offset, int *failures)
+decode_3d_i830(const uint32_t *data, int count, uint32_t hw_offset, int *failures)
{
unsigned int opcode;
* \param hw_offset hardware address for the buffer
*/
int
-intel_decode(uint32_t *data, int count, uint32_t hw_offset, uint32_t devid)
+intel_decode(const uint32_t *data, int count, uint32_t hw_offset, uint32_t devid)
{
int index = 0;
int failures = 0;