David Herrmann | e7b96070 | 2014-07-24 12:10:04 +0200 | [diff] [blame] | 1 | #ifndef __DRM_LEGACY_H__ |
| 2 | #define __DRM_LEGACY_H__ |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 2014 David Herrmann <dh.herrmann@gmail.com> |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the "Software"), |
| 9 | * to deal in the Software without restriction, including without limitation |
| 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | * and/or sell copies of the Software, and to permit persons to whom the |
| 12 | * Software is furnished to do so, subject to the following conditions: |
| 13 | * |
| 14 | * The above copyright notice and this permission notice shall be included in |
| 15 | * all copies or substantial portions of the Software. |
| 16 | * |
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 23 | * OTHER DEALINGS IN THE SOFTWARE. |
| 24 | */ |
| 25 | |
David Herrmann | 9fc5cde | 2014-08-29 12:12:28 +0200 | [diff] [blame] | 26 | /* |
| 27 | * This file contains legacy interfaces that modern drm drivers |
| 28 | * should no longer be using. They cannot be removed as legacy |
| 29 | * drivers use them, and removing them are API breaks. |
| 30 | */ |
David Herrmann | cc5ea59 | 2014-08-29 12:12:32 +0200 | [diff] [blame] | 31 | #include <linux/list.h> |
Daniel Vetter | 4f03b1f | 2014-09-10 12:43:49 +0200 | [diff] [blame] | 32 | #include <drm/drm_legacy.h> |
David Herrmann | cc5ea59 | 2014-08-29 12:12:32 +0200 | [diff] [blame] | 33 | |
| 34 | struct agp_memory; |
David Herrmann | e7b96070 | 2014-07-24 12:10:04 +0200 | [diff] [blame] | 35 | struct drm_device; |
| 36 | struct drm_file; |
| 37 | |
| 38 | /* |
| 39 | * Generic DRM Contexts |
| 40 | */ |
| 41 | |
| 42 | #define DRM_KERNEL_CONTEXT 0 |
| 43 | #define DRM_RESERVED_CONTEXTS 1 |
| 44 | |
Daniel Vetter | ba6976c | 2015-06-23 11:22:36 +0200 | [diff] [blame] | 45 | void drm_legacy_ctxbitmap_init(struct drm_device *dev); |
David Herrmann | e7b96070 | 2014-07-24 12:10:04 +0200 | [diff] [blame] | 46 | void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev); |
| 47 | void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle); |
| 48 | void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file); |
| 49 | |
| 50 | int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f); |
| 51 | int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f); |
| 52 | int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f); |
| 53 | int drm_legacy_switchctx(struct drm_device *d, void *v, struct drm_file *f); |
| 54 | int drm_legacy_newctx(struct drm_device *d, void *v, struct drm_file *f); |
| 55 | int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f); |
| 56 | |
| 57 | int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f); |
| 58 | int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f); |
| 59 | |
David Herrmann | 9fc5cde | 2014-08-29 12:12:28 +0200 | [diff] [blame] | 60 | /* |
| 61 | * Generic Buffer Management |
| 62 | */ |
| 63 | |
| 64 | #define DRM_MAP_HASH_OFFSET 0x10000000 |
| 65 | |
Daniel Vetter | ec1f52e | 2016-04-26 19:29:36 +0200 | [diff] [blame] | 66 | int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data, |
| 67 | struct drm_file *file_priv); |
David Herrmann | 9fc5cde | 2014-08-29 12:12:28 +0200 | [diff] [blame] | 68 | int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f); |
| 69 | int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f); |
| 70 | int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f); |
| 71 | int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f); |
| 72 | int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f); |
| 73 | int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f); |
| 74 | int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f); |
| 75 | int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f); |
| 76 | |
Al Viro | 5c7640a | 2017-05-24 17:54:09 -0400 | [diff] [blame^] | 77 | int __drm_legacy_infobufs(struct drm_device *, void *, int *, |
| 78 | int (*)(void *, int, struct drm_buf_entry *)); |
| 79 | |
Benjamin Gaignard | 99c48e1 | 2017-01-04 10:12:56 +0100 | [diff] [blame] | 80 | #ifdef CONFIG_DRM_VM |
Daniel Vetter | a677f4c | 2014-09-10 12:43:48 +0200 | [diff] [blame] | 81 | void drm_legacy_vma_flush(struct drm_device *d); |
Benjamin Gaignard | 99c48e1 | 2017-01-04 10:12:56 +0100 | [diff] [blame] | 82 | #else |
| 83 | static inline void drm_legacy_vma_flush(struct drm_device *d) |
| 84 | { |
| 85 | /* do nothing */ |
| 86 | } |
| 87 | #endif |
Daniel Vetter | a677f4c | 2014-09-10 12:43:48 +0200 | [diff] [blame] | 88 | |
David Herrmann | cc5ea59 | 2014-08-29 12:12:32 +0200 | [diff] [blame] | 89 | /* |
| 90 | * AGP Support |
| 91 | */ |
| 92 | |
| 93 | struct drm_agp_mem { |
| 94 | unsigned long handle; |
| 95 | struct agp_memory *memory; |
| 96 | unsigned long bound; |
| 97 | int pages; |
| 98 | struct list_head head; |
| 99 | }; |
| 100 | |
Daniel Vetter | 1a75a22 | 2016-06-14 20:50:57 +0200 | [diff] [blame] | 101 | /* drm_lock.c */ |
David Herrmann | bb6d822 | 2014-08-29 12:12:46 +0200 | [diff] [blame] | 102 | int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f); |
| 103 | int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f); |
Daniel Vetter | 1a75a22 | 2016-06-14 20:50:57 +0200 | [diff] [blame] | 104 | void drm_legacy_lock_release(struct drm_device *dev, struct file *filp); |
David Herrmann | bb6d822 | 2014-08-29 12:12:46 +0200 | [diff] [blame] | 105 | |
Daniel Vetter | a266162 | 2014-09-11 07:41:51 +0200 | [diff] [blame] | 106 | /* DMA support */ |
| 107 | int drm_legacy_dma_setup(struct drm_device *dev); |
| 108 | void drm_legacy_dma_takedown(struct drm_device *dev); |
| 109 | void drm_legacy_free_buffer(struct drm_device *dev, |
| 110 | struct drm_buf * buf); |
| 111 | void drm_legacy_reclaim_buffers(struct drm_device *dev, |
| 112 | struct drm_file *filp); |
| 113 | |
Daniel Vetter | 9ec4e2f | 2014-09-11 07:42:43 +0200 | [diff] [blame] | 114 | /* Scatter Gather Support */ |
| 115 | void drm_legacy_sg_cleanup(struct drm_device *dev); |
| 116 | int drm_legacy_sg_alloc(struct drm_device *dev, void *data, |
| 117 | struct drm_file *file_priv); |
| 118 | int drm_legacy_sg_free(struct drm_device *dev, void *data, |
| 119 | struct drm_file *file_priv); |
| 120 | |
David Herrmann | e7b96070 | 2014-07-24 12:10:04 +0200 | [diff] [blame] | 121 | #endif /* __DRM_LEGACY_H__ */ |