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
|
||||
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 *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 = (const uint8_t *)body + header->size;
|
||||
if(next > last)
|
||||
break;
|
||||
const uint8_t *body = (const uint8_t *)data;
|
||||
const uint8_t *next = body + size;
|
||||
|
||||
switch(cmd_id) {
|
||||
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)
|
||||
_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) {
|
||||
_debug_printf("\tSVGA_CMD_FENCE\n");
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
void
|
||||
svga_dump_command(uint32_t cmd_id, const void *data, uint32_t size);
|
||||
|
||||
void
|
||||
svga_dump_commands(const void *commands, uint32_t size);
|
||||
|
||||
|
|
|
@ -208,25 +208,11 @@ cmds = [
|
|||
def dump_cmds():
|
||||
print r'''
|
||||
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 *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 = (const uint8_t *)body + header->size;
|
||||
if(next > last)
|
||||
break;
|
||||
const uint8_t *body = (const uint8_t *)data;
|
||||
const uint8_t *next = body + size;
|
||||
'''
|
||||
|
||||
print ' switch(cmd_id) {'
|
||||
indexes = 'ijklmn'
|
||||
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 ' }'
|
||||
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 ' }'
|
||||
print ' break;'
|
||||
|
@ -259,7 +247,6 @@ svga_dump_commands(const void *commands, uint32_t size)
|
|||
print ' _debug_printf("\\t0x%08x\\n", cmd_id);'
|
||||
print ' break;'
|
||||
print ' }'
|
||||
|
||||
print r'''
|
||||
while(body + sizeof(uint32_t) <= next) {
|
||||
_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)
|
||||
_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) {
|
||||
_debug_printf("\tSVGA_CMD_FENCE\n");
|
||||
|
|
Loading…
Reference in New Issue