1 // Copyright 2022 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef VIRTGPU_GFXSTREAM_PROTOCOL_H 16 #define VIRTGPU_GFXSTREAM_PROTOCOL_H 17 18 #include <stdint.h> 19 20 // Address Space Graphics contexts 21 #define GFXSTREAM_CONTEXT_CREATE 0x1001 22 #define GFXSTREAM_CONTEXT_PING 0x1002 23 #define GFXSTREAM_CONTEXT_PING_WITH_RESPONSE 0x1003 24 25 // Native Sync FD 26 #define GFXSTREAM_CREATE_EXPORT_SYNC 0x9000 27 #define GFXSTREAM_CREATE_IMPORT_SYNC 0x9001 28 29 // Vulkan Sync 30 #define GFXSTREAM_CREATE_EXPORT_SYNC_VK 0xa000 31 #define GFXSTREAM_CREATE_IMPORT_SYNC_VK 0xa001 32 #define GFXSTREAM_CREATE_QSRI_EXPORT_VK 0xa002 33 34 // A placeholder command to ensure virtio-gpu completes 35 #define GFXSTREAM_PLACEHOLDER_COMMAND_VK 0xf002 36 37 struct gfxstreamHeader { 38 uint32_t opCode; 39 }; 40 41 struct gfxstreamContextCreate { 42 struct gfxstreamHeader hdr; 43 uint32_t resourceId; 44 }; 45 46 struct gfxstreamContextPing { 47 struct gfxstreamHeader hdr; 48 uint32_t resourceId; 49 }; 50 51 struct gfxstreamCreateExportSync { 52 struct gfxstreamHeader hdr; 53 uint32_t syncHandleLo; 54 uint32_t syncHandleHi; 55 }; 56 57 struct gfxstreamCreateExportSyncVK { 58 struct gfxstreamHeader hdr; 59 uint32_t deviceHandleLo; 60 uint32_t deviceHandleHi; 61 uint32_t fenceHandleLo; 62 uint32_t fenceHandleHi; 63 }; 64 65 struct gfxstreamCreateQSRIExportVK { 66 struct gfxstreamHeader hdr; 67 uint32_t imageHandleLo; 68 uint32_t imageHandleHi; 69 }; 70 71 struct gfxstreamPlaceholderCommandVk { 72 struct gfxstreamHeader hdr; 73 uint32_t pad; 74 uint32_t padding; 75 }; 76 77 struct gfxstreamCapset { 78 uint32_t protocolVersion; 79 80 // ASG Ring Parameters 81 uint32_t ringSize; 82 uint32_t bufferSize; 83 84 uint32_t colorBufferMemoryIndex; 85 uint32_t padding[16]; 86 uint32_t deferredMapping; 87 }; 88 89 #endif 90