From: Jon Ashburn Date: Wed, 15 Oct 2014 18:08:33 +0000 (-0600) Subject: Fixes to Basic and Generic layers to work singly with LD_PRELOAD X-Git-Tag: upstream/1.1.92~6505 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3660c7480587f4eb9df22b5741d71433c74c8534;p=platform%2Fupstream%2FVulkan-Tools.git Fixes to Basic and Generic layers to work singly with LD_PRELOAD --- diff --git a/layers/basic_plugin.c b/layers/basic_plugin.c index 32ada03..c13aace 100644 --- a/layers/basic_plugin.c +++ b/layers/basic_plugin.c @@ -14,12 +14,8 @@ static void initLayerTable() { GetProcAddrType fpGPA; - //memset(&myTable, 0 , sizeof(myTable)); - - //todo init the entire table to next entrypoint fpGPA = pCurObj->pGPA; assert(fpGPA); - // Layer myTable.GetProcAddr = fpGPA; myTable.InitAndEnumerateGpus = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglInitAndEnumerateGpus"); myTable.GetGpuInfo = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglGetGpuInfo"); @@ -139,25 +135,17 @@ static void initLayerTable() myTable.WsiX11GetMSC = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglWsiX11GetMSC"); myTable.WsiX11CreatePresentableImage = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglWsiX11CreatePresentableImage"); myTable.WsiX11QueuePresent = fpGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (const XGL_CHAR *) "xglWsiX11QueuePresent"); -#if 0 - fpNextCD = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglCreateDevice"); - myTable.CreateDevice = fpNextCD; - fpNextGGI = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetGpuInfo"); - myTable.GetGpuInfo = fpNextGGI; - fpNextGFI = fpNextGPA((XGL_PHYSICAL_GPU) pCurObj->nextObject, (XGL_CHAR *) "xglGetFormatInfo"); - myTable.GetFormatInfo = fpNextGFI; -#endif return; } XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSICAL_GPU_INFO_TYPE infoType, XGL_SIZE* pDataSize, XGL_VOID* pData) { XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; - printf("At start of wrapped xglCreateDevice() call w/ gpu: %p\n", (void*)gpu); + printf("At start of wrapped xglGetGpuInfo() call w/ gpu: %p\n", (void*)gpu); pCurObj = gpuw; pthread_once(&tabOnce, initLayerTable); XGL_RESULT result = myTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); - printf("Completed wrapped xglCreateDevice() call w/ gpu: %p\n", (void*)gpu); + printf("Completed wrapped xglGetGpuInfo() call w/ gpu: %p\n", (void*)gpu); return result; } diff --git a/xgl-generate.py b/xgl-generate.py index 6e790d8..552c84d 100755 --- a/xgl-generate.py +++ b/xgl-generate.py @@ -151,7 +151,7 @@ class Subcommand(object): " %s = wrapped_obj->nextObject;\n" " %s;\n" "}" % (qual, decl, proto.params[0].name, proto.params[0].name, stmt)) - elif proto.name != "GetProcAddr": + elif proto.name != "GetProcAddr" and proto.name != "InitAndEnumerateGpus": decl = proto.c_func(prefix="xgl", attr="XGLAPI") param0_name = proto.params[0].name ret_val = '' @@ -194,8 +194,13 @@ class Subcommand(object): for name in xgl.icd_dispatch_table: if name == "GetProcAddr": continue - func_body.append(' else if (!strncmp("%s%s", (const char *) funcName, sizeof("%s%s")))\n' + if name == "InitAndEnumerateGpus": + func_body.append(' else if (!strncmp("%s%s", (const char *) funcName, sizeof("%s%s")))\n' + ' return nextTable.%s;' % (prefix, name, prefix, name, name)) + else: + func_body.append(' else if (!strncmp("%s%s", (const char *) funcName, sizeof("%s%s")))\n' ' return %s%s;' % (prefix, name, prefix, name, prefix, name)) + func_body.append(" else {\n" " XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;\n" " if (gpuw->pGPA == NULL)\n"