From 3a597c0efaceb6b6d6aa60d35497200f2ee94ef6 Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Thu, 23 Oct 2014 10:59:23 -0600 Subject: [PATCH] layers: update documentation --- layers/README.md | 26 ++++++++++++++++---------- layers/basic_plugin.c | 4 ++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/layers/README.md b/layers/README.md index 039fe0e1..ec5882c8 100644 --- a/layers/README.md +++ b/layers/README.md @@ -12,19 +12,25 @@ activated at xglCreateDevice time. xglCreateDevice createInfo struct is extended a list of layers to be activated. Layer libraries can alternatively be LD_PRELOADed. Layer library example code: -layer/basic_plugin.c - simple example -/layer/generic_layer.c - auto generated example wrapping all XGL entrypoints +include/xglLayer.h - header file for layer code +layer/basic_plugin.c - simple example wrapping three entrypoints. Single global dispatch + table for either single gpu/device or multi-gpu with same activated + layers for each device. Can be LD_PRELOADed individually. +/layer/generic_layer.c - auto generated example wrapping all XGL entrypoints. + Single global dispatch table. Can be LD_PRELOADed. /layer/api_dump.c - print out API calls along with parameter values /layer/object_track.c - Print object CREATE/USE/DESTROY stats -Using Layers:: -Build XGL loader and i965 icd driver using normal steps (cmake and make) -Place libXGLLayer.so in the same directory as your XGL test or app: +Using Layers: +1) Build XGL loader and i965 icd driver using normal steps (cmake and make) + +2) Place libXGLLayer.so in the same directory as your XGL test or app: cp build/layer/libXGLLayerBasic.so build/layer/libXGLLayerGeneric.so build/tests +This is required for the Icd loader to be able to scan and enumerate your library. -Specify which Layers to activate by using xglCreateDevice XGL_LAYER_CREATE_INFO struct or -environment variable LIBXGL_LAYERS_LIB - export LIBXGL_LAYERS_LIB=libXGLLayerBasic.so:LibXGLLayerGeneric.so +3) Specify which Layers to activate by using xglCreateDevice XGL_LAYER_CREATE_INFO struct or +environment variable LIBXGL_LAYER_LIBS + export LIBXGL_LAYER_LIBS=libXGLLayerBasic.so:LibXGLLayerGeneric.so cd build/tests; ./xglinfo @@ -33,8 +39,8 @@ Current Features: -scanning of available Layers during xglInitAndEnumerateGpus -xglEnumerateLayers and xglGetProcAddr supported APIs in xgl.h, ICD loader and i965 driver -multiple layers in a hierarchy supported --layer enumeration works --layers activated per gpu and per icd driver: separate dispatch table and layer library +-layer enumeration supported +-layers activated per gpu and per icd driver: separate dispatch table and layer library list in loader for each gpu or icd driver -activation via xglCreateDevice extension struct in CreateInfo or via env var (LIBXGL_LAYER_LIBS) diff --git a/layers/basic_plugin.c b/layers/basic_plugin.c index 3807d493..1674107d 100644 --- a/layers/basic_plugin.c +++ b/layers/basic_plugin.c @@ -144,7 +144,7 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglGetGpuInfo(XGL_PHYSICAL_GPU gpu, XGL_PHYSI XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; printf("At start of wrapped xglGetGpuInfo() call w/ gpu: %p\n", (void*)gpu); pCurObj = gpuw; - pthread_once(&tabOnce, initLayerTable); + pthread_once(&tabOnce, initLayerTable); //Required for LD_PRELOAD case XGL_RESULT result = myTable.GetGpuInfo((XGL_PHYSICAL_GPU)gpuw->nextObject, infoType, pDataSize, pData); printf("Completed wrapped xglGetGpuInfo() call w/ gpu: %p\n", (void*)gpu); return result; @@ -155,7 +155,7 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDevice(XGL_PHYSICAL_GPU gpu, const X XGL_BASE_LAYER_OBJECT* gpuw = (XGL_BASE_LAYER_OBJECT *) gpu; printf("At start of wrapped xglCreateDevice() call w/ gpu: %p\n", (void*)gpu); pCurObj = gpuw; - pthread_once(&tabOnce, initLayerTable); + pthread_once(&tabOnce, initLayerTable); //Required for LD_PRELOAD case XGL_RESULT result = myTable.CreateDevice((XGL_PHYSICAL_GPU)gpuw->nextObject, pCreateInfo, pDevice); printf("Completed wrapped xglCreateDevice() call w/ pDevice: %p\n", (void*)pDevice); return result; -- 2.34.1