Now About Social Code
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-07-28 20:45:52 +0100
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-07-28 20:45:52 +0100
commitc0cb2a22e7237c02df614f1994bd6acebfd23125 (patch)
tree84b57ca191907e87f5db92cb2995cdd42bc35097
parentbadb33ac17ff418730eaa8e316450178c998fc80 (diff)
wrap: Improve some data gathering
-rw-r--r--src/pprint.c7
-rw-r--r--src/wrap.c31
2 files changed, 31 insertions, 7 deletions
diff --git a/src/pprint.c b/src/pprint.c
index 2424735..17c3ece 100644
--- a/src/pprint.c
+++ b/src/pprint.c
@@ -399,3 +399,10 @@ static void pprint_drmVersion(FILE *fp, drmVersion *drm) {
(int)drm->date_len, drm->date,
(int)drm->desc_len, drm->desc);
}
+
+static void pprint_SGXMKIF_COMMAND(FILE *fp, SGXMKIF_COMMAND *in) {
+ fprintf(fp, "{\n.ui32ServiceAddress = 0x%x,\n.ui32CacheControl = 0x%x,\n.ui32Data = {0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x}\n}\n",
+ in->ui32ServiceAddress, in->ui32CacheControl,
+ in->ui32Data[0], in->ui32Data[1], in->ui32Data[2], in->ui32Data[3],
+ in->ui32Data[4], in->ui32Data[5]);
+}
diff --git a/src/wrap.c b/src/wrap.c
index 7b0263c..0423c34 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -5,7 +5,6 @@
#include <stdbool.h>
#include <assert.h>
#include <unistd.h>
-//#include <fcntl.h>
#include <dlfcn.h>
#include <sys/stat.h>
@@ -613,17 +612,24 @@ static void pvrsrv_ioctl_post(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package, int
case _IOC_NR(PVRSRV_BRIDGE_SGX_REGISTER_HW_RENDER_CONTEXT):
/* TODO figure out if we can find cmd submits from this */
{
+ PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_RENDER_CONTEXT *in = bridge_package->pvParamIn;
PVRSRV_BRIDGE_OUT_SGX_REGISTER_HW_RENDER_CONTEXT *data = bridge_package->pvParamOut;
printf("HW Render Context handle %p\n", data->hHWRenderContext);
printf("HW Render Context %p\n", data);
+ printf("HW Render Context size 0x%x\n", in->ui32HWRenderContextSize);
+ printf("HW Render Context addr 0x%x\n", data->sHWRenderContextDevVAddr.uiAddr);
break;
}
case _IOC_NR(PVRSRV_BRIDGE_ALLOC_DEVICEMEM):
{
+ PVRSRV_BRIDGE_IN_ALLOCDEVICEMEM *in = bridge_package->pvParamIn;
PVRSRV_BRIDGE_OUT_ALLOCDEVICEMEM *mem_data = bridge_package->pvParamOut;
PVRSRV_CLIENT_MEM_INFO *mem = &mem_data->sClientMemInfo;
track_buffer(mem, MEM_TYPE_NORMAL);
printf("Alloc %p\n", mem->hKernelMemInfo);
+
+ if (!(in->ui32Attribs & PVRSRV_MEM_NO_SYNCOBJ))
+ printf("Allocating sync as well\n");
}
break;
case _IOC_NR(PVRSRV_BRIDGE_MHANDLE_TO_MMAP_DATA):
@@ -650,6 +656,14 @@ static void pvrsrv_ioctl_post(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package, int
printf("Mapping %p %p\n", in->hKernelMemInfo, in->hDstDevMemHeap);
}
break;
+ case _IOC_NR(PVRSRV_BRIDGE_MAP_DMABUF):
+ {
+ PVRSRV_BRIDGE_IN_MAP_DMABUF *in = bridge_package->pvParamIn;
+ PVRSRV_BRIDGE_OUT_MAP_DMABUF *out = bridge_package->pvParamOut;
+ track_buffer(&out->sClientMemInfo, MEM_TYPE_MAP);
+ printf("Map dev mem %p\n", out->sClientMemInfo.hKernelMemInfo);
+ printf("Mapping %d %p\n", in->i32DmaBufFD, in->hDevMemHeap);
+ }
case _IOC_NR(PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT):
{
PVRSRV_BRIDGE_OUT_CREATE_DEVMEMCONTEXT *out = bridge_package->pvParamOut;
@@ -707,7 +721,7 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) {
printf("Created buffer to offset\n");
}
#endif
-#if 1
+#if 0
/* Before buffer is allocated, allocate an identical buffer so addresses will be offset */
create_buffer(fd, bridge_package, mem_data->hDevCookie, (uintptr_t)mem_data->hDevMemHeap,
mem_data->uSize, mem_data->ui32Attribs, mem_data->uAlignment);
@@ -715,9 +729,9 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) {
#endif
#if 0
- if (current_alloc == 74) {
+ if (current_alloc == 5) {
printf("Dupped this buffer!\n");
- create_buffer(fd, bridge_package, mem_data->hDevCookie, mem_data->hDevMemHeap,
+ create_buffer(fd, bridge_package, mem_data->hDevCookie, (uintptr_t)mem_data->hDevMemHeap,
mem_data->uSize, mem_data->ui32Attribs, mem_data->uAlignment);
}
#endif
@@ -731,10 +745,10 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) {
{
PVRSRV_BRIDGE_IN_SGX_REGISTER_HW_RENDER_CONTEXT *data = bridge_package->pvParamIn;
printf("HW Render Context %p\n", data);
-#if 0
+#if 1
for (IMG_UINT32 i = 0; i < data->ui32HWRenderContextSize; i += sizeof(IMG_UINT32)) {
- IMG_UINT32 *t = (IMG_UINT32*)&data->pHWRenderContextCpuVAddr[i];
- printf("\tvalue is 0x%x\n", *t);
+ IMG_UINT32 *t = (IMG_UINT32*)(data->pHWRenderContextCpuVAddr+i);
+ printf("\t0x%x\n", *t);
}
#endif
break;
@@ -777,6 +791,8 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) {
dump_tracked_buffers();
patch_buffers();
+ PPRINT(stdout, &ccb->sCCBKick.sCommand, SGXMKIF_COMMAND);
+
printf("CCB offset 0x%x\n", ccb->sCCBKick.ui32CCBOffset);
printf("Cookie %p\n", ccb->hDevCookie);
printf("Dev Mem Context %p\n", ccb->sCCBKick.hDevMemContext);
@@ -923,6 +939,7 @@ static bool pvrsrv_ioctl(int fd, PVRSRV_BRIDGE_PACKAGE *bridge_package) {
PPRINT(stdout, bridge_package->pvParamIn, PVRSRV_BRIDGE_IN_GETCLIENTINFO);
//fwrite(bridge_package->pvParamIn, 1, sizeof(PVRSRV_BRIDGE_IN_GETCLIENTINFO), log_file);
break;
+ case _IOC_NR(PVRSRV_BRIDGE_MAP_DMABUF):
case _IOC_NR(PVRSRV_BRIDGE_GET_MISC_INFO):
case _IOC_NR(PVRSRV_BRIDGE_EVENT_OBJECT_OPEN):
case _IOC_NR(PVRSRV_BRIDGE_GET_DEVMEM_HEAPINFO):