1 // Copyright (C) 2020 The Android Open Source Project 2 // Copyright (C) 2020 Google Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 #pragma once 16 17 #ifndef HOST_BUILD 18 #include "drm.h" 19 #endif 20 21 #define DRM_VIRTGPU_RESOURCE_CREATE_BLOB 0x0a 22 23 #define VIRTGPU_PARAM_RESOURCE_BLOB 3 /* DRM_VIRTGPU_RESOURCE_CREATE_BLOB */ 24 #define VIRTGPU_PARAM_HOST_VISIBLE 4 25 26 struct drm_virtgpu_resource_create_blob { 27 #define VIRTGPU_BLOB_MEM_GUEST 0x0001 28 #define VIRTGPU_BLOB_MEM_HOST 0x0002 29 #define VIRTGPU_BLOB_MEM_HOST_GUEST 0x0003 30 31 #define VIRTGPU_BLOB_FLAG_MAPPABLE 0x0001 32 #define VIRTGPU_BLOB_FLAG_SHAREABLE 0x0002 33 #define VIRTGPU_BLOB_FLAG_CROSS_DEVICE 0x0004 34 /* zero is invalid blob_mem */ 35 uint32_t blob_mem; 36 uint32_t blob_flags; 37 uint32_t bo_handle; 38 uint32_t res_handle; 39 uint64_t size; 40 41 /* 42 * for 3D contexts with VIRTGPU_BLOB_MEM_HOSTGUEST and 43 * VIRTGPU_BLOB_MEM_HOST otherwise, must be zero. 44 */ 45 uint32_t pad; 46 uint32_t cmd_size; 47 uint64_t cmd; 48 uint64_t blob_id; 49 }; 50 51 52 #define DRM_IOCTL_VIRTGPU_RESOURCE_CREATE_BLOB \ 53 DRM_IOWR(DRM_COMMAND_BASE + DRM_VIRTGPU_RESOURCE_CREATE_BLOB, \ 54 struct drm_virtgpu_resource_create_blob) 55