aboutsummaryrefslogtreecommitdiff
path: root/loader/loader.c
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2014-10-24 15:48:55 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2014-10-29 18:02:04 -0600
commitbacb19c0ec0a77b6a89ff1dd224653354194332a (patch)
tree268441107f2c86fab02a0a1eb696afdddc5b37bb /loader/loader.c
parent0034d47ca313b6ec01954b1e64d18ea7437a2600 (diff)
downloadusermoji-bacb19c0ec0a77b6a89ff1dd224653354194332a.tar.xz
Loader: GPA fixes and also properly insert wrapped gpu objs into chain
Loader wasn't properly inserting the wrapped gpu objects for activated layers into the chain of objects. This was a problem for any calls that used the wrapped gpu object chain after activation of layers.
Diffstat (limited to 'loader/loader.c')
-rw-r--r--loader/loader.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/loader/loader.c b/loader/loader.c
index 8b0cd671..6bfba284 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -752,12 +752,12 @@ static void loader_deactivate_layer()
}
}
-extern XGL_UINT ActivateLayers(XGL_PHYSICAL_GPU *gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo)
+extern XGL_UINT ActivateLayers(XGL_PHYSICAL_GPU gpu, const XGL_DEVICE_CREATE_INFO* pCreateInfo)
{
XGL_UINT gpu_index;
XGL_UINT count;
XGL_CHAR ** ppLayerNames;
- struct loader_icd *icd = loader_get_icd((const XGL_BASE_LAYER_OBJECT *) *gpu, &gpu_index);
+ struct loader_icd *icd = loader_get_icd((const XGL_BASE_LAYER_OBJECT *) gpu, &gpu_index);
if (!icd)
return 0;
@@ -765,8 +765,8 @@ extern XGL_UINT ActivateLayers(XGL_PHYSICAL_GPU *gpu, const XGL_DEVICE_CREATE_IN
/* activate any layer libraries */
if (!loader_layers_activated(icd, gpu_index)) {
- XGL_BASE_LAYER_OBJECT *gpuObj = (XGL_BASE_LAYER_OBJECT *) *gpu;
- XGL_BASE_LAYER_OBJECT *nextGpuObj;
+ XGL_BASE_LAYER_OBJECT *gpuObj = (XGL_BASE_LAYER_OBJECT *) gpu;
+ XGL_BASE_LAYER_OBJECT *nextGpuObj, *baseObj = gpuObj->baseObject;
GetProcAddrType nextGPA = xglGetProcAddr;
count = loader_get_layer_libs(pCreateInfo, &ppLayerNames);
@@ -780,7 +780,7 @@ extern XGL_UINT ActivateLayers(XGL_PHYSICAL_GPU *gpu, const XGL_DEVICE_CREATE_IN
for (XGL_INT i = icd->layer_count[gpu_index] - 1; i >= 0; i--) {
nextGpuObj = (icd->wrappedGpus[gpu_index] + i);
nextGpuObj->pGPA = nextGPA;
- nextGpuObj->baseObject = gpuObj->baseObject;
+ nextGpuObj->baseObject = baseObj;
nextGpuObj->nextObject = gpuObj;
gpuObj = nextGpuObj;
@@ -790,11 +790,17 @@ extern XGL_UINT ActivateLayers(XGL_PHYSICAL_GPU *gpu, const XGL_DEVICE_CREATE_IN
continue;
}
- if (i == 0)
+ if (i == 0) {
loader_init_dispatch_table(icd->loader_dispatch + gpu_index, nextGPA, gpuObj);
+ //Insert the new wrapped objects into the list with loader object at head
+ ((XGL_BASE_LAYER_OBJECT *) gpu)->nextObject = gpuObj;
+ ((XGL_BASE_LAYER_OBJECT *) gpu)->pGPA = nextGPA;
+ gpuObj = icd->wrappedGpus[gpu_index] + icd->layer_count[gpu_index] - 1;
+ gpuObj->nextObject = baseObj;
+ gpuObj->pGPA = icd->GetProcAddr;
+ }
}
- *gpu = ((XGL_PHYSICAL_GPU *) gpuObj);
}
else {
//make sure requested Layers matches currently activated Layers
@@ -817,13 +823,13 @@ LOADER_EXPORT XGL_VOID * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_C
if (gpu == NULL)
return NULL;
XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
- XGL_LAYER_DISPATCH_TABLE * disp_table = * (XGL_LAYER_DISPATCH_TABLE **) gpuw->nextObject;
+ XGL_LAYER_DISPATCH_TABLE * disp_table = * (XGL_LAYER_DISPATCH_TABLE **) gpuw->baseObject;
if (disp_table == NULL)
return NULL;
if (!strncmp("xglGetProcAddr", (const char *) pName, sizeof("xglGetProcAddr")))
- return xglGetProcAddr;
+ return disp_table->GetProcAddr;
else if (!strncmp("xglInitAndEnumerateGpus", (const char *) pName, sizeof("xglInitAndEnumerateGpus")))
return disp_table->InitAndEnumerateGpus;
else if (!strncmp("xglGetGpuInfo", (const char *) pName, sizeof ("xglGetGpuInfo")))
@@ -1063,10 +1069,9 @@ LOADER_EXPORT XGL_VOID * XGLAPI xglGetProcAddr(XGL_PHYSICAL_GPU gpu, const XGL_C
else if (!strncmp("xglWsiX11QueuePresent", (const char *) pName, sizeof("xglWsiX11QueuePresent")))
return disp_table->WsiX11QueuePresent;
else {
- XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu;
- if (gpuw->pGPA == NULL)
+ if (disp_table->GetProcAddr == NULL)
return NULL;
- return gpuw->pGPA(gpuw->nextObject, pName);
+ return disp_table->GetProcAddr(gpuw->nextObject, pName);
}
}