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