The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipc: Add a json schema for the IPC description

+102 -1
+2
src/xrt/ipc/proto.json
··· 1 1 { 2 + "$schema": "./proto.schema.json", 3 + 2 4 "instance_get_shm_fd": { 3 5 "out_fds": true 4 6 },
+3 -1
src/xrt/ipc/proto.py
··· 151 151 152 152 def __init__(self, data): 153 153 """Construct a protocol from a dictionary of calls.""" 154 - self.calls = [Call(name, call) for name, call in data.items()] 154 + self.calls = [Call(name, call) for name, call 155 + in data.items() 156 + if not name.startswith("$")] 155 157 156 158 157 159 header = '''// Copyright 2020, Collabora, Ltd.
+97
src/xrt/ipc/proto.schema.json
··· 1 + { 2 + "$schema": "http://json-schema.org/draft-07/schema", 3 + "$id": "http://gitlab.freedesktop.org/monado/monado/src/xrt/ipc/proto.schema.json", 4 + "type": "object", 5 + "title": "Protocol schema", 6 + "description": "The root schema for an entire protocol.", 7 + "definitions": { 8 + "scalar": { 9 + "title": "Known scalar type", 10 + "type": "string", 11 + "enum": [ 12 + "uint32_t", 13 + "int64_t", 14 + "uint64_t" 15 + ] 16 + }, 17 + "aggregate": { 18 + "title": "Struct or union type", 19 + "type": "string", 20 + "pattern": "(struct|union) xrt_[a-z_]+" 21 + }, 22 + "scalar_enum": { 23 + "title": "Custom enum (scalar)", 24 + "type": "string", 25 + "pattern": "enum xrt_[a-z_]+" 26 + }, 27 + "param": { 28 + "type": "object", 29 + "title": "Parameter", 30 + "required": [ 31 + "name", 32 + "type" 33 + ], 34 + "properties": { 35 + "name": { 36 + "title": "Parameter name", 37 + "type": "string" 38 + }, 39 + "type": { 40 + "title": "Parameter type", 41 + "anyOf": [ 42 + { 43 + "$ref": "#/definitions/scalar" 44 + }, 45 + { 46 + "$ref": "#/definitions/aggregate" 47 + }, 48 + { 49 + "$ref": "#/definitions/scalar_enum" 50 + } 51 + ] 52 + } 53 + } 54 + }, 55 + "param_list": { 56 + "title": "Parameter list", 57 + "type": "array", 58 + "additionalItems": { 59 + "$ref": "#/definitions/param" 60 + } 61 + } 62 + }, 63 + "properties": { 64 + "$schema": { 65 + "type": "string" 66 + } 67 + }, 68 + "additionalProperties": { 69 + "$id": "#/call", 70 + "type": "object", 71 + "title": "IPC Call", 72 + "properties": { 73 + "id": { 74 + "type": "string", 75 + "title": "Call ID", 76 + "description": "If left unspecified or empty, the ID will be constructed by prepending IPC_ to the call name in all upper-case." 77 + }, 78 + "out_fds": { 79 + "$id": "#/call/properties/out_fds", 80 + "type": "boolean", 81 + "title": "Call returns fds?", 82 + "default": false, 83 + "examples": [ 84 + true 85 + ] 86 + }, 87 + "in": { 88 + "title": "Input parameters", 89 + "$ref": "#/definitions/param_list" 90 + }, 91 + "out": { 92 + "title": "Output parameters", 93 + "$ref": "#/definitions/param_list" 94 + } 95 + } 96 + } 97 + }