Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 1 | Layer Description and Status |
| 2 | 10/22/2014 |
| 3 | |
| 4 | Overview: |
| 5 | Layer libraries can be written to intercept or hook XGL entrypoints for various |
| 6 | debug and validation purpose. One or more XGL entrypoints can be defined in your Layer |
| 7 | library. Undefined entrypoints in the Layer library will be passed to the next Layer which |
| 8 | may be the driver. Multiple layer libraries can be chained (actually a hierarchy) together. |
Tobin Ehlis | 475bebe | 2014-10-23 08:44:44 -0600 | [diff] [blame] | 9 | xglEnumerateLayer can be called to list the available layer libraries. xglGetProcAddr is |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 10 | used internally by the Layers and ICD Loader to initialize dispatch tables. Layers are |
| 11 | activated at xglCreateDevice time. xglCreateDevice createInfo struct is extended to allow |
| 12 | a list of layers to be activated. Layer libraries can alternatively be LD_PRELOADed. |
| 13 | |
| 14 | Layer library example code: |
Jon Ashburn | a0b85eb | 2014-10-23 10:59:23 -0600 | [diff] [blame^] | 15 | include/xglLayer.h - header file for layer code |
| 16 | layer/basic_plugin.c - simple example wrapping three entrypoints. Single global dispatch |
| 17 | table for either single gpu/device or multi-gpu with same activated |
| 18 | layers for each device. Can be LD_PRELOADed individually. |
| 19 | <build dir>/layer/generic_layer.c - auto generated example wrapping all XGL entrypoints. |
| 20 | Single global dispatch table. Can be LD_PRELOADed. |
Tobin Ehlis | 475bebe | 2014-10-23 08:44:44 -0600 | [diff] [blame] | 21 | <build dir>/layer/api_dump.c - print out API calls along with parameter values |
| 22 | <build dir>/layer/object_track.c - Print object CREATE/USE/DESTROY stats |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 23 | |
Jon Ashburn | a0b85eb | 2014-10-23 10:59:23 -0600 | [diff] [blame^] | 24 | Using Layers: |
| 25 | 1) Build XGL loader and i965 icd driver using normal steps (cmake and make) |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 26 | |
Jon Ashburn | a0b85eb | 2014-10-23 10:59:23 -0600 | [diff] [blame^] | 27 | 2) Place libXGLLayer<name>.so in the same directory as your XGL test or app: |
| 28 | cp build/layer/libXGLLayerBasic.so build/layer/libXGLLayerGeneric.so build/tests |
| 29 | This is required for the Icd loader to be able to scan and enumerate your library. |
| 30 | |
| 31 | 3) Specify which Layers to activate by using xglCreateDevice XGL_LAYER_CREATE_INFO struct or |
| 32 | environment variable LIBXGL_LAYER_LIBS |
| 33 | export LIBXGL_LAYER_LIBS=libXGLLayerBasic.so:LibXGLLayerGeneric.so |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 34 | cd build/tests; ./xglinfo |
| 35 | |
| 36 | |
| 37 | Status: |
| 38 | Current Features: |
| 39 | -scanning of available Layers during xglInitAndEnumerateGpus |
| 40 | -xglEnumerateLayers and xglGetProcAddr supported APIs in xgl.h, ICD loader and i965 driver |
| 41 | -multiple layers in a hierarchy supported |
Jon Ashburn | a0b85eb | 2014-10-23 10:59:23 -0600 | [diff] [blame^] | 42 | -layer enumeration supported |
| 43 | -layers activated per gpu and per icd driver: separate dispatch table and layer library |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 44 | list in loader for each gpu or icd driver |
| 45 | -activation via xglCreateDevice extension struct in CreateInfo or via env var |
| 46 | (LIBXGL_LAYER_LIBS) |
| 47 | -layer libraries can be LD_PRELOADed |
| 48 | |
| 49 | Current known issues: |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 50 | -layer libraries don't support multiple dispatch tables for multi-gpus |
Tobin Ehlis | 475bebe | 2014-10-23 08:44:44 -0600 | [diff] [blame] | 51 | -layers with extension APIs not yet tested or supported |
| 52 | -layer libraries not yet include loader init functionality for full LD_PRELOAD of |
Jon Ashburn | 183dfd0 | 2014-10-22 18:13:16 -0600 | [diff] [blame] | 53 | entire API including xglInitAndEnumerate |
| 54 | -no support for apps registering layers, must be discovered via initial scan |
| 55 | -no support for Loader discovering from layer and driver which layers support which |
| 56 | gpus/drivers: any layer can be use any gpu right now |
| 57 | -xglEnumerateLayers doesn't qualify Layers based on gpu, but enumerates all that were scanned |
| 58 | |