1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright(c) 2017 Intel Corporation. All rights reserved. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 5*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 6*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 7*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 9*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * The above copyright notice and this permission notice (including the next 12*4882a593Smuzhiyun * paragraph) shall be included in all copies or substantial portions of the 13*4882a593Smuzhiyun * Software. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*4882a593Smuzhiyun * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19*4882a593Smuzhiyun * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20*4882a593Smuzhiyun * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21*4882a593Smuzhiyun * SOFTWARE. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * Authors: 24*4882a593Smuzhiyun * Zhiyuan Lv <zhiyuan.lv@intel.com> 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * Contributors: 27*4882a593Smuzhiyun * Xiaoguang Chen 28*4882a593Smuzhiyun * Tina Zhang <tina.zhang@intel.com> 29*4882a593Smuzhiyun */ 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #ifndef _GVT_DMABUF_H_ 32*4882a593Smuzhiyun #define _GVT_DMABUF_H_ 33*4882a593Smuzhiyun #include <linux/vfio.h> 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun struct intel_vgpu_fb_info { 36*4882a593Smuzhiyun __u64 start; 37*4882a593Smuzhiyun __u64 start_gpa; 38*4882a593Smuzhiyun __u64 drm_format_mod; 39*4882a593Smuzhiyun __u32 drm_format; /* drm format of plane */ 40*4882a593Smuzhiyun __u32 width; /* width of plane */ 41*4882a593Smuzhiyun __u32 height; /* height of plane */ 42*4882a593Smuzhiyun __u32 stride; /* stride of plane */ 43*4882a593Smuzhiyun __u32 size; /* size of plane in bytes, align on page */ 44*4882a593Smuzhiyun __u32 x_pos; /* horizontal position of cursor plane */ 45*4882a593Smuzhiyun __u32 y_pos; /* vertical position of cursor plane */ 46*4882a593Smuzhiyun __u32 x_hot; /* horizontal position of cursor hotspot */ 47*4882a593Smuzhiyun __u32 y_hot; /* vertical position of cursor hotspot */ 48*4882a593Smuzhiyun struct intel_vgpu_dmabuf_obj *obj; 49*4882a593Smuzhiyun }; 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun /** 52*4882a593Smuzhiyun * struct intel_vgpu_dmabuf_obj- Intel vGPU device buffer object 53*4882a593Smuzhiyun */ 54*4882a593Smuzhiyun struct intel_vgpu_dmabuf_obj { 55*4882a593Smuzhiyun struct intel_vgpu *vgpu; 56*4882a593Smuzhiyun struct intel_vgpu_fb_info *info; 57*4882a593Smuzhiyun __u32 dmabuf_id; 58*4882a593Smuzhiyun struct kref kref; 59*4882a593Smuzhiyun bool initref; 60*4882a593Smuzhiyun struct list_head list; 61*4882a593Smuzhiyun }; 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args); 64*4882a593Smuzhiyun int intel_vgpu_get_dmabuf(struct intel_vgpu *vgpu, unsigned int dmabuf_id); 65*4882a593Smuzhiyun void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu); 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun #endif 68