[igt-dev] [PATCH i-g-t v31 06/32] lib/intel_batchbuffer: dump bb to base64

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 26 15:55:41 UTC 2020


Quoting Zbigniew Kempczyński (2020-08-20 07:30:04)
> +#define LINELEN 76
> +static void intel_bb_dump_base64(struct intel_bb *ibb)
> +{
> +       int outsize;
> +       gchar *str, *pos;
> +
> +       igt_info("--- bb ---\n");
> +       pos = str = g_base64_encode((const guchar *) ibb->batch, ibb->size);
> +       outsize = strlen(str);
> +
> +       while (pos) {
> +               char line[LINELEN + 1];
> +               int to_copy = min(LINELEN, outsize);
> +
> +               memcpy(line, pos, to_copy);
> +               line[to_copy] = 0;
> +               igt_info("%s\n", line);

while (outsize > 0) {
	igt_info("%.*s\n", LINELEN, pos);
	pos += LINELEN;
	outsize -= LINELEN;
}

?

for bonus points, pass the line limit in as a parameter.
-Chris


More information about the igt-dev mailing list