blob: c6f422e879dd6986f372bb2dfb6a5c764fcc045d [file] [log] [blame]
David Herrmanne7b960702014-07-24 12:10:04 +02001#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 Herrmann9fc5cde2014-08-29 12:12:28 +020026/*
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 Herrmanncc5ea592014-08-29 12:12:32 +020031#include <linux/list.h>
Daniel Vetter4f03b1f2014-09-10 12:43:49 +020032#include <drm/drm_legacy.h>
David Herrmanncc5ea592014-08-29 12:12:32 +020033
34struct agp_memory;
David Herrmanne7b960702014-07-24 12:10:04 +020035struct drm_device;
36struct drm_file;
37
38/*
39 * Generic DRM Contexts
40 */
41
42#define DRM_KERNEL_CONTEXT 0
43#define DRM_RESERVED_CONTEXTS 1
44
Daniel Vetterba6976c2015-06-23 11:22:36 +020045void drm_legacy_ctxbitmap_init(struct drm_device *dev);
David Herrmanne7b960702014-07-24 12:10:04 +020046void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
47void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
48void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
49
50int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f);
51int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f);
52int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f);
53int drm_legacy_switchctx(struct drm_device *d, void *v, struct drm_file *f);
54int drm_legacy_newctx(struct drm_device *d, void *v, struct drm_file *f);
55int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);
56
57int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
58int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
59
David Herrmann9fc5cde2014-08-29 12:12:28 +020060/*
61 * Generic Buffer Management
62 */
63
64#define DRM_MAP_HASH_OFFSET 0x10000000
65
Daniel Vetterec1f52e2016-04-26 19:29:36 +020066int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
67 struct drm_file *file_priv);
David Herrmann9fc5cde2014-08-29 12:12:28 +020068int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
69int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
70int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
71int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f);
72int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f);
73int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f);
74int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f);
75int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f);
76
Daniel Vettera677f4c2014-09-10 12:43:48 +020077void drm_legacy_vma_flush(struct drm_device *d);
78
David Herrmanncc5ea592014-08-29 12:12:32 +020079/*
80 * AGP Support
81 */
82
83struct drm_agp_mem {
84 unsigned long handle;
85 struct agp_memory *memory;
86 unsigned long bound;
87 int pages;
88 struct list_head head;
89};
90
Daniel Vetter1a75a222016-06-14 20:50:57 +020091/* drm_lock.c */
David Herrmannbb6d8222014-08-29 12:12:46 +020092int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f);
93int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f);
Daniel Vetter1a75a222016-06-14 20:50:57 +020094void drm_legacy_lock_release(struct drm_device *dev, struct file *filp);
David Herrmannbb6d8222014-08-29 12:12:46 +020095
Daniel Vettera2661622014-09-11 07:41:51 +020096/* DMA support */
97int drm_legacy_dma_setup(struct drm_device *dev);
98void drm_legacy_dma_takedown(struct drm_device *dev);
99void drm_legacy_free_buffer(struct drm_device *dev,
100 struct drm_buf * buf);
101void drm_legacy_reclaim_buffers(struct drm_device *dev,
102 struct drm_file *filp);
103
Daniel Vetter9ec4e2f2014-09-11 07:42:43 +0200104/* Scatter Gather Support */
105void drm_legacy_sg_cleanup(struct drm_device *dev);
106int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
107 struct drm_file *file_priv);
108int drm_legacy_sg_free(struct drm_device *dev, void *data,
109 struct drm_file *file_priv);
110
David Herrmanne7b960702014-07-24 12:10:04 +0200111#endif /* __DRM_LEGACY_H__ */