svga: Allow to dump an individual command.
This commit is contained in:
parent
5676082d28
commit
8353c87cce
|
@ -1444,23 +1444,10 @@ dump_SVGA3dCmdBlitSurfaceToScreen(const SVGA3dCmdBlitSurfaceToScreen *cmd)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
svga_dump_commands(const void *commands, uint32_t size)
|
svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size)
|
||||||
{
|
{
|
||||||
const uint8_t *next = commands;
|
const uint8_t *body = (const uint8_t *)data;
|
||||||
const uint8_t *last = next + size;
|
const uint8_t *next = body + size;
|
||||||
|
|
||||||
assert(size % sizeof(uint32_t) == 0);
|
|
||||||
|
|
||||||
while(next < last) {
|
|
||||||
const uint32_t cmd_id = *(const uint32_t *)next;
|
|
||||||
|
|
||||||
if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
|
|
||||||
const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
|
|
||||||
const uint8_t *body = (const uint8_t *)&header[1];
|
|
||||||
|
|
||||||
next = (const uint8_t *)body + header->size;
|
|
||||||
if(next > last)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch(cmd_id) {
|
switch(cmd_id) {
|
||||||
case SVGA_3D_CMD_SURFACE_DEFINE:
|
case SVGA_3D_CMD_SURFACE_DEFINE:
|
||||||
|
@ -1759,6 +1746,29 @@ svga_dump_commands(const void *commands, uint32_t size)
|
||||||
}
|
}
|
||||||
while(body + sizeof(uint32_t) <= next)
|
while(body + sizeof(uint32_t) <= next)
|
||||||
_debug_printf("\t\t0x%02x\n", *body++);
|
_debug_printf("\t\t0x%02x\n", *body++);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
svga_dump_commands(const void *commands, uint32_t size)
|
||||||
|
{
|
||||||
|
const uint8_t *next = commands;
|
||||||
|
const uint8_t *last = next + size;
|
||||||
|
|
||||||
|
assert(size % sizeof(uint32_t) == 0);
|
||||||
|
|
||||||
|
while(next < last) {
|
||||||
|
const uint32_t cmd_id = *(const uint32_t *)next;
|
||||||
|
|
||||||
|
if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
|
||||||
|
const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
|
||||||
|
const uint8_t *body = (const uint8_t *)&header[1];
|
||||||
|
|
||||||
|
next = body + header->size;
|
||||||
|
if(next > last)
|
||||||
|
break;
|
||||||
|
|
||||||
|
svga_dump_command(cmd_id, body, header->size);
|
||||||
}
|
}
|
||||||
else if(cmd_id == SVGA_CMD_FENCE) {
|
else if(cmd_id == SVGA_CMD_FENCE) {
|
||||||
_debug_printf("\tSVGA_CMD_FENCE\n");
|
_debug_printf("\tSVGA_CMD_FENCE\n");
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
|
|
||||||
#include "pipe/p_compiler.h"
|
#include "pipe/p_compiler.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size);
|
||||||
|
|
||||||
void
|
void
|
||||||
svga_dump_commands(const void *commands, uint32_t size);
|
svga_dump_commands(const void *commands, uint32_t size);
|
||||||
|
|
||||||
|
|
|
@ -208,25 +208,11 @@ cmds = [
|
||||||
def dump_cmds():
|
def dump_cmds():
|
||||||
print r'''
|
print r'''
|
||||||
void
|
void
|
||||||
svga_dump_commands(const void *commands, uint32_t size)
|
svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size)
|
||||||
{
|
{
|
||||||
const uint8_t *next = commands;
|
const uint8_t *body = (const uint8_t *)data;
|
||||||
const uint8_t *last = next + size;
|
const uint8_t *next = body + size;
|
||||||
|
|
||||||
assert(size % sizeof(uint32_t) == 0);
|
|
||||||
|
|
||||||
while(next < last) {
|
|
||||||
const uint32_t cmd_id = *(const uint32_t *)next;
|
|
||||||
|
|
||||||
if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
|
|
||||||
const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
|
|
||||||
const uint8_t *body = (const uint8_t *)&header[1];
|
|
||||||
|
|
||||||
next = (const uint8_t *)body + header->size;
|
|
||||||
if(next > last)
|
|
||||||
break;
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
print ' switch(cmd_id) {'
|
print ' switch(cmd_id) {'
|
||||||
indexes = 'ijklmn'
|
indexes = 'ijklmn'
|
||||||
for id, header, body, footer in cmds:
|
for id, header, body, footer in cmds:
|
||||||
|
@ -251,7 +237,9 @@ svga_dump_commands(const void *commands, uint32_t size)
|
||||||
print ' body += sizeof(%s);' % footer
|
print ' body += sizeof(%s);' % footer
|
||||||
print ' }'
|
print ' }'
|
||||||
if id == 'SVGA_3D_CMD_SHADER_DEFINE':
|
if id == 'SVGA_3D_CMD_SHADER_DEFINE':
|
||||||
print ' sh_svga_dump((const uint32_t *)body, (unsigned)(next - body)/sizeof(uint32_t));'
|
print ' svga_shader_dump((const uint32_t *)body,'
|
||||||
|
print ' (unsigned)(next - body)/sizeof(uint32_t),'
|
||||||
|
print ' FALSE);'
|
||||||
print ' body = next;'
|
print ' body = next;'
|
||||||
print ' }'
|
print ' }'
|
||||||
print ' break;'
|
print ' break;'
|
||||||
|
@ -259,7 +247,6 @@ svga_dump_commands(const void *commands, uint32_t size)
|
||||||
print ' _debug_printf("\\t0x%08x\\n", cmd_id);'
|
print ' _debug_printf("\\t0x%08x\\n", cmd_id);'
|
||||||
print ' break;'
|
print ' break;'
|
||||||
print ' }'
|
print ' }'
|
||||||
|
|
||||||
print r'''
|
print r'''
|
||||||
while(body + sizeof(uint32_t) <= next) {
|
while(body + sizeof(uint32_t) <= next) {
|
||||||
_debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
|
_debug_printf("\t\t0x%08x\n", *(const uint32_t *)body);
|
||||||
|
@ -267,6 +254,29 @@ svga_dump_commands(const void *commands, uint32_t size)
|
||||||
}
|
}
|
||||||
while(body + sizeof(uint32_t) <= next)
|
while(body + sizeof(uint32_t) <= next)
|
||||||
_debug_printf("\t\t0x%02x\n", *body++);
|
_debug_printf("\t\t0x%02x\n", *body++);
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
print r'''
|
||||||
|
void
|
||||||
|
svga_dump_commands(const void *commands, uint32_t size)
|
||||||
|
{
|
||||||
|
const uint8_t *next = commands;
|
||||||
|
const uint8_t *last = next + size;
|
||||||
|
|
||||||
|
assert(size % sizeof(uint32_t) == 0);
|
||||||
|
|
||||||
|
while(next < last) {
|
||||||
|
const uint32_t cmd_id = *(const uint32_t *)next;
|
||||||
|
|
||||||
|
if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) {
|
||||||
|
const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next;
|
||||||
|
const uint8_t *body = (const uint8_t *)&header[1];
|
||||||
|
|
||||||
|
next = body + header->size;
|
||||||
|
if(next > last)
|
||||||
|
break;
|
||||||
|
|
||||||
|
svga_dump_command(cmd_id, body, header->size);
|
||||||
}
|
}
|
||||||
else if(cmd_id == SVGA_CMD_FENCE) {
|
else if(cmd_id == SVGA_CMD_FENCE) {
|
||||||
_debug_printf("\tSVGA_CMD_FENCE\n");
|
_debug_printf("\tSVGA_CMD_FENCE\n");
|
||||||
|
|
Loading…
Reference in New Issue