1 1.1 riastrad /* $NetBSD: vgem_drv.h,v 1.3 2021/12/18 23:45:44 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright 2012 Intel Corporation 5 1.1 riastrad * Copyright 2014 The Chromium OS Authors 6 1.1 riastrad * 7 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 8 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 9 1.1 riastrad * to deal in the Software without restriction, including without limitation 10 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 12 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 13 1.1 riastrad * 14 1.1 riastrad * The above copyright notice and this permission notice (including the next 15 1.1 riastrad * paragraph) shall be included in all copies or substantial portions of the 16 1.1 riastrad * Software. 17 1.1 riastrad * 18 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 1.1 riastrad * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 1.1 riastrad * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 1.1 riastrad * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 24 1.1 riastrad * IN THE SOFTWARE. 25 1.1 riastrad * 26 1.1 riastrad * Authors: 27 1.1 riastrad * Ben Widawsky <ben (at) bwidawsk.net> 28 1.1 riastrad * 29 1.1 riastrad */ 30 1.1 riastrad 31 1.1 riastrad #ifndef _VGEM_DRV_H_ 32 1.1 riastrad #define _VGEM_DRV_H_ 33 1.1 riastrad 34 1.1 riastrad #include <drm/drm_gem.h> 35 1.3 riastrad #include <drm/drm_cache.h> 36 1.3 riastrad 37 1.3 riastrad #include <uapi/drm/vgem_drm.h> 38 1.3 riastrad 39 1.3 riastrad struct vgem_file { 40 1.3 riastrad struct idr fence_idr; 41 1.3 riastrad struct mutex fence_mutex; 42 1.3 riastrad }; 43 1.1 riastrad 44 1.1 riastrad #define to_vgem_bo(x) container_of(x, struct drm_vgem_gem_object, base) 45 1.1 riastrad struct drm_vgem_gem_object { 46 1.1 riastrad struct drm_gem_object base; 47 1.3 riastrad 48 1.1 riastrad struct page **pages; 49 1.3 riastrad unsigned int pages_pin_count; 50 1.3 riastrad struct mutex pages_lock; 51 1.3 riastrad 52 1.3 riastrad struct sg_table *table; 53 1.1 riastrad }; 54 1.1 riastrad 55 1.3 riastrad int vgem_fence_open(struct vgem_file *file); 56 1.3 riastrad int vgem_fence_attach_ioctl(struct drm_device *dev, 57 1.3 riastrad void *data, 58 1.3 riastrad struct drm_file *file); 59 1.3 riastrad int vgem_fence_signal_ioctl(struct drm_device *dev, 60 1.3 riastrad void *data, 61 1.3 riastrad struct drm_file *file); 62 1.3 riastrad void vgem_fence_close(struct vgem_file *file); 63 1.1 riastrad 64 1.1 riastrad #endif 65