mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-25 00:36:16 +00:00
tools/intel_dump_decode: use libdrm decoder
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
24a33db7f0
commit
2ca6c6b4fd
@ -35,10 +35,12 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "intel_decode.h"
|
#include <intel_bufmgr.h>
|
||||||
|
|
||||||
|
struct drm_intel_decode *ctx;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_bin_file(uint32_t devid, const char * filename)
|
read_bin_file(const char * filename)
|
||||||
{
|
{
|
||||||
uint32_t buf[16384];
|
uint32_t buf[16384];
|
||||||
int fd, offset, ret;
|
int fd, offset, ret;
|
||||||
@ -53,16 +55,19 @@ read_bin_file(uint32_t devid, const char * filename)
|
|||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drm_intel_decode_set_dump_past_end(ctx, 1);
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
while ((ret = read (fd, buf, sizeof(buf))) > 0) {
|
while ((ret = read (fd, buf, sizeof(buf))) > 0) {
|
||||||
intel_decode (buf, ret/4, offset, devid, 1);
|
drm_intel_decode_set_batch_pointer(ctx, buf, offset, ret/4);
|
||||||
|
drm_intel_decode(ctx);
|
||||||
offset += ret;
|
offset += ret;
|
||||||
}
|
}
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_data_file(uint32_t devid, const char * filename)
|
read_data_file(const char * filename)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
uint32_t *data = NULL;
|
uint32_t *data = NULL;
|
||||||
@ -108,7 +113,8 @@ read_data_file(uint32_t devid, const char * filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (count) {
|
if (count) {
|
||||||
intel_decode (data, count, gtt_offset, devid, 0);
|
drm_intel_decode_set_batch_pointer(ctx, data, gtt_offset, count);
|
||||||
|
drm_intel_decode(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
free (data);
|
free (data);
|
||||||
@ -118,7 +124,7 @@ read_data_file(uint32_t devid, const char * filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_autodetect_file(uint32_t devid, const char * filename)
|
read_autodetect_file(const char * filename)
|
||||||
{
|
{
|
||||||
int binary = 0, c;
|
int binary = 0, c;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
@ -141,9 +147,9 @@ read_autodetect_file(uint32_t devid, const char * filename)
|
|||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
if (binary == 1)
|
if (binary == 1)
|
||||||
read_bin_file(devid, filename);
|
read_bin_file(filename);
|
||||||
else
|
else
|
||||||
read_data_file(devid, filename);
|
read_data_file(filename);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +186,8 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx = drm_intel_decode_context_alloc(devid);
|
||||||
|
|
||||||
if (optind == argc) {
|
if (optind == argc) {
|
||||||
fprintf(stderr, "no input file given\n");
|
fprintf(stderr, "no input file given\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@ -188,15 +196,15 @@ main (int argc, char *argv[])
|
|||||||
for (i = optind; i < argc; i++) {
|
for (i = optind; i < argc; i++) {
|
||||||
/* For stdin input, let's read as data file */
|
/* For stdin input, let's read as data file */
|
||||||
if (!strcmp(argv[i], "-")) {
|
if (!strcmp(argv[i], "-")) {
|
||||||
read_data_file(devid, argv[i]);
|
read_data_file(argv[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (binary == 1)
|
if (binary == 1)
|
||||||
read_bin_file(devid, argv[i]);
|
read_bin_file(argv[i]);
|
||||||
else if (binary == 0)
|
else if (binary == 0)
|
||||||
read_data_file(devid, argv[i]);
|
read_data_file(argv[i]);
|
||||||
else
|
else
|
||||||
read_autodetect_file(devid, argv[i]);
|
read_autodetect_file(argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user