Context switching work.
[platform/upstream/libdrm.git] / shared-core / nouveau_drm.h
1 /*
2  * Copyright 2005 Stephane Marchesin.
3  * All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  */
24
25 #ifndef __NOUVEAU_DRM_H__
26 #define __NOUVEAU_DRM_H__
27
28 typedef struct drm_nouveau_fifo_alloc {
29         int          channel;
30         uint32_t     put_base;
31         /* FIFO control regs */
32         drm_handle_t ctrl;
33         int          ctrl_size;
34         /* DMA command buffer */
35         drm_handle_t cmdbuf;
36         int          cmdbuf_size;
37 }
38 drm_nouveau_fifo_alloc_t;
39
40 typedef struct drm_nouveau_object_init {
41         uint32_t handle;
42         int class;
43         uint32_t flags0, flags1, flags2;
44         /* these are object handles */
45         uint32_t dma0;
46         uint32_t dma1;
47         uint32_t dma_notifier;
48 }
49 drm_nouveau_object_init_t;
50
51 typedef struct drm_nouveau_dma_object_init {
52         uint32_t handle;
53         int      access;
54         int      target;
55         uint32_t offset;
56         int      size;
57 }
58 drm_nouveau_dma_object_init_t;
59
60 #define NOUVEAU_MEM_FB                  0x00000001
61 #define NOUVEAU_MEM_AGP                 0x00000002
62 #define NOUVEAU_MEM_FB_ACCEPTABLE       0x00000004
63 #define NOUVEAU_MEM_AGP_ACCEPTABLE      0x00000008
64 #define NOUVEAU_MEM_PINNED              0x00000010
65 #define NOUVEAU_MEM_USER_BACKED         0x00000020
66 #define NOUVEAU_MEM_MAPPED              0x00000040
67
68 typedef struct drm_nouveau_mem_alloc {
69         int flags;
70         int alignment;
71         uint64_t size;  // in bytes
72         uint64_t __user *region_offset;
73 }
74 drm_nouveau_mem_alloc_t;
75
76 typedef struct drm_nouveau_mem_free {
77         int flags;
78         uint64_t region_offset;
79 }
80 drm_nouveau_mem_free_t;
81
82 typedef struct drm_nouveau_getparam {
83         unsigned int param;
84         unsigned int value;
85 }
86 drm_nouveau_getparam_t;
87
88 #define NOUVEAU_SETPARAM_CMDBUF_LOCATION 1
89 #define NOUVEAU_SETPARAM_CMDBUF_SIZE     2
90 typedef struct drm_nouveau_setparam {
91         unsigned int param;
92         unsigned int value;
93 }
94 drm_nouveau_setparam_t;
95
96 enum nouveau_card_type {
97         NV_UNKNOWN =0,
98         NV_01      =1,
99         NV_03      =3,
100         NV_04      =4,
101         NV_05      =5,
102         NV_10      =10,
103         NV_20      =20,
104         NV_30      =30,
105         NV_40      =40,
106         G_70       =50,
107         NV_LAST    =0xffff,
108 };
109
110 enum nouveau_bus_type {
111         NV_AGP     =0,
112         NV_PCI     =1,
113         NV_PCIE    =2,
114 };
115
116 #define NOUVEAU_MAX_SAREA_CLIPRECTS 16
117
118 typedef struct drm_nouveau_sarea {
119         /* the cliprects */
120         drm_clip_rect_t boxes[NOUVEAU_MAX_SAREA_CLIPRECTS];
121         unsigned int nbox;
122 }
123 drm_nouveau_sarea_t;
124
125 #define DRM_NOUVEAU_FIFO_ALLOC      0x00
126 #define DRM_NOUVEAU_OBJECT_INIT     0x01
127 #define DRM_NOUVEAU_DMA_OBJECT_INIT 0x02 // We don't want this eventually..
128 #define DRM_NOUVEAU_MEM_ALLOC       0x03
129 #define DRM_NOUVEAU_MEM_FREE        0x04
130 #define DRM_NOUVEAU_GETPARAM        0x05
131 #define DRM_NOUVEAU_SETPARAM        0x06
132
133 #endif /* __NOUVEAU_DRM_H__ */
134