Skip to content

Commit

Permalink
Expose 2 symbols from android_main
Browse files Browse the repository at this point in the history
MainGetCurrentBlockIndex and MainGetLoadingTrimmedState whould de
discoveralbe through dlopen + dlsym from the android replay native .so:

- MainGetCurrentBlockIndex():
Returns the current block index as calculated from the file processor

- MainGetLoadingTrimmedState():
Returns wheter file processor is between a FrameStateBegin/FrameStateEnd
markers pair
  • Loading branch information
panos-lunarg committed Sep 13, 2024
1 parent 544fb67 commit b623781
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
5 changes: 4 additions & 1 deletion framework/decode/file_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const uint32_t kFirstFrame = 0;
FileProcessor::FileProcessor() :
file_header_{}, file_descriptor_(nullptr), current_frame_number_(kFirstFrame), bytes_read_(0),
error_state_(kErrorInvalidFileDescriptor), annotation_handler_(nullptr), compressor_(nullptr), block_index_(0),
api_call_index_(0), block_limit_(0), capture_uses_frame_markers_(false), first_frame_(kFirstFrame + 1)
api_call_index_(0), block_limit_(0), capture_uses_frame_markers_(false), first_frame_(kFirstFrame + 1),
loading_trimmed_capture_state_(false)
{}

FileProcessor::FileProcessor(uint64_t block_limit) : FileProcessor()
Expand Down Expand Up @@ -1926,11 +1927,13 @@ bool FileProcessor::ProcessStateMarker(const format::BlockHeader& block_header,
if (marker_type == format::kBeginMarker)
{
GFXRECON_LOG_INFO("Loading state for captured frame %" PRId64, frame_number);
loading_trimmed_capture_state_ = true;
}
else if (marker_type == format::kEndMarker)
{
GFXRECON_LOG_INFO("Finished loading state for captured frame %" PRId64, frame_number);
first_frame_ = frame_number;
loading_trimmed_capture_state_ = false;
}

for (auto decoder : decoders_)
Expand Down
5 changes: 5 additions & 0 deletions framework/decode/file_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class FileProcessor

uint32_t GetCurrentFrameNumber() const { return current_frame_number_; }

uint64_t GetCurrentBlockIndex() const { return block_index_; }

bool GetLoadingTrimmedState() const { return loading_trimmed_capture_state_; }

uint64_t GetNumBytesRead() const { return bytes_read_; }

Error GetErrorState() const { return error_state_; }
Expand Down Expand Up @@ -184,6 +188,7 @@ class FileProcessor
bool enable_print_block_info_{ false };
int64_t block_index_from_{ 0 };
int64_t block_index_to_{ 0 };
bool loading_trimmed_capture_state_;
};

GFXRECON_END_NAMESPACE(decode)
Expand Down
22 changes: 18 additions & 4 deletions tools/replay/android_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ void ProcessAppCmd(struct android_app* app, int32_t cmd);
int32_t ProcessInputEvent(struct android_app* app, AInputEvent* event);
void DestroyActivity(struct android_app* app);

static std::unique_ptr<gfxrecon::decode::FileProcessor> file_processor;

extern "C"
{
uint64_t MainGetCurrentBlockIndex()
{
return file_processor->GetCurrentBlockIndex();
}

bool MainGetLoadingTrimmedState()
{
return file_processor->GetLoadingTrimmedState();
}
}

void android_main(struct android_app* app)
{
gfxrecon::util::Log::Init();
Expand Down Expand Up @@ -102,10 +117,9 @@ void android_main(struct android_app* app)

try
{
std::unique_ptr<gfxrecon::decode::FileProcessor> file_processor =
arg_parser.IsOptionSet(kPreloadMeasurementRangeOption)
? std::make_unique<gfxrecon::decode::PreloadFileProcessor>()
: std::make_unique<gfxrecon::decode::FileProcessor>();
file_processor = arg_parser.IsOptionSet(kPreloadMeasurementRangeOption)
? std::make_unique<gfxrecon::decode::PreloadFileProcessor>()
: std::make_unique<gfxrecon::decode::FileProcessor>();

if (!file_processor->Initialize(filename))
{
Expand Down

0 comments on commit b623781

Please sign in to comment.