Skip to content

Commit

Permalink
Log and ignore COND_INDIRECT_BUFFER_PFE packets
Browse files Browse the repository at this point in the history
Not used by Turnip, and the parameters are garbage (or we just
don't know the format) when used by the production driver
  • Loading branch information
shanminchao committed Oct 30, 2023
1 parent 9bf1add commit e70e5d5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion dive_core/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <cstdio>
#include <cstring>

void DIVE_LOG(const char *file, int line, const char *format, ...)
void DIVE_LOG_INTERNAL(const char *file, int line, const char *format, ...)
{
va_list args;
char str[8 * 1024];
Expand Down
29 changes: 11 additions & 18 deletions dive_core/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,22 @@
limitations under the License.
*/

// Warning: This is a common file that is shared with the Dive GUI tool!

#pragma once

// The common folder is used by both the GUI tool and the PAL capture code
// A macro is defined for the GUI tool
#ifndef DIVE_GUI_TOOL
# define DIVE_PAL_CAPTURE
#endif
void DIVE_LOG_INTERNAL(const char* file, int line, const char* format, ...);

#ifdef DIVE_PAL_CAPTURE
# include "palAssert.h"
# define DIVE_ASSERT PAL_ASSERT
# define DIVE_ERROR_MSG(_pReasonFmt, ...) PAL_ALERT_ALWAYS_MSG(_pReasonFmt, ##__VA_ARGS__)
#else
#include <assert.h>
#include <stdio.h>

void DIVE_LOG(const char* file, int line, const char* format, ...);
#define DIVE_ERROR_MSG(...) DIVE_LOG_INTERNAL(__FILE__, __LINE__, __VA_ARGS__)
#define DIVE_LOG(...) DIVE_LOG_INTERNAL(__FILE__, __LINE__, __VA_ARGS__)

# include <assert.h>
# include <stdio.h>
# define DIVE_ASSERT assert
# define DIVE_ERROR_MSG(...) DIVE_LOG(__FILE__, __LINE__, __VA_ARGS__)
# define DIVE_TRACE(...) DIVE_LOG(__FILE__, __LINE__, __VA_ARGS__)
#ifndef NDEBUG // DEBUG
# define DIVE_ASSERT(p) assert(p)
# define DIVE_DEBUG_LOG(...) DIVE_LOG_INTERNAL(__FILE__, __LINE__, __VA_ARGS__)
#else
# define DIVE_ASSERT(...)
# define DIVE_DEBUG_LOG(...)
#endif

// This does not get compiled out, so safe to call it in RELEASE
Expand Down
10 changes: 8 additions & 2 deletions dive_core/common/emulate_pm4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,12 +716,18 @@ bool EmulatePM4::AdvanceCb(const IMemoryManager &mem_manager,
Pm4Type7Header type7_header;
type7_header.u32All = header;

// Note: CP_COND_INDIRECT_BUFFER_PFE is not parsed here because it isn't used by Turnip.
// When it shows up in production driver captures, the IB addr and size values are all
// garbage. Not sure what it's used for at this point.
if (type7_header.opcode == CP_COND_INDIRECT_BUFFER_PFE)
DIVE_LOG("Packet ignored: CP_COND_INDIRECT_BUFFER_PFE\n");

// Deal with calls and chains
if (type == Pm4Type::kType7 && (type7_header.opcode == CP_INDIRECT_BUFFER_PFE ||
type7_header.opcode == CP_INDIRECT_BUFFER_PFD ||
type7_header.opcode == CP_INDIRECT_BUFFER_CHAIN ||
type7_header.opcode == CP_COND_INDIRECT_BUFFER_PFE))
type7_header.opcode == CP_INDIRECT_BUFFER_CHAIN))
{

PM4_CP_INDIRECT_BUFFER ib_packet;
if (!mem_manager.CopyMemory(&ib_packet,
emu_state_ptr->m_submit_index,
Expand Down
5 changes: 2 additions & 3 deletions ui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,8 @@ bool MainWindow::LoadFile(const char *file_name, bool is_temp_file)
time_used_to_load_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now() - begin)
.count();
#ifndef NDEBUG
DIVE_TRACE("Time used to load the capture is %f seconds.", (time_used_to_load_ms / 1000.0));
#endif

DIVE_DEBUG_LOG("Time used to load the capture is %f seconds.", (time_used_to_load_ms / 1000.0));

FileLoaded();

Expand Down

0 comments on commit e70e5d5

Please sign in to comment.