Skip to content

Commit

Permalink
Fix an error that GPU ID is not dumped.
Browse files Browse the repository at this point in the history
  • Loading branch information
RenfengLiu committed Oct 13, 2023
1 parent 087cb91 commit dfa9f50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 4 additions & 1 deletion third_party/freedreno/wrap/dive-load-log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ limitations under the License.

#include "dive-wrap.h"

#include <unistd.h>
#include <pthread.h>


#if defined(__ANDROID__)
struct DiveWrapLoadLog
{
DiveWrapLoadLog() { LOGI("Libwrap loaded ..."); }
DiveWrapLoadLog() { LOGI("Libwrap loaded in pid %d, thread id %ld...", getpid(),pthread_self()); }
} load_log;
#endif
13 changes: 8 additions & 5 deletions third_party/freedreno/wrap/wrap-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ void rd_start(const char *name, const char *fmt, ...)
int n = cnt++;
const char *testnum;
va_list args;

testnum = getenv("TESTNUM");
if (testnum) {
n = strtol(testnum, NULL, 0);
Expand All @@ -89,7 +88,11 @@ void rd_start(const char *name, const char *fmt, ...)
}

fd = open(buf, O_WRONLY| O_TRUNC | O_CREAT, 0644);

// GOOGLE: check the return value of the open function call.
if(fd == -1) {
LOGI("failed to open file: %s, error: %s", buf, strerror(errno));
return;
}
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
Expand Down Expand Up @@ -137,6 +140,9 @@ void rd_write_section(enum rd_sect_type type, const void *buf, int sz)
uint32_t val = ~0;

// GOOGLE: Write out rd file only when capturing flag is enabled.
if (type == RD_GPU_ID) {
gpu_id = *(unsigned int *)buf;
}
if(!IsCapturing()) {
return;
}
Expand All @@ -149,9 +155,6 @@ void rd_write_section(enum rd_sect_type type, const void *buf, int sz)
printf("opened rd, %d\n", fd);
}

if (type == RD_GPU_ID) {
gpu_id = *(unsigned int *)buf;
}

rd_write(&val, 4);
rd_write(&val, 4);
Expand Down

0 comments on commit dfa9f50

Please sign in to comment.