nouveau: intrusive drm interface changes
[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 #define NOUVEAU_DRM_HEADER_PATCHLEVEL 4
29
30 typedef struct drm_nouveau_fifo_alloc {
31         int          channel;
32         uint32_t     put_base;
33         /* FIFO control regs */
34         drm_handle_t ctrl;
35         int          ctrl_size;
36         /* DMA command buffer */
37         drm_handle_t cmdbuf;
38         int          cmdbuf_size;
39 }
40 drm_nouveau_fifo_alloc_t;
41
42 typedef struct drm_nouveau_object_init {
43         uint32_t handle;
44         int      class;
45 }
46 drm_nouveau_object_init_t;
47
48 #define NOUVEAU_MEM_ACCESS_RO   1
49 #define NOUVEAU_MEM_ACCESS_WO   2
50 #define NOUVEAU_MEM_ACCESS_RW   3
51 typedef struct drm_nouveau_dma_object_init {
52         uint32_t handle;
53         int      class;
54         int      access;
55         int      target;
56         uint32_t offset;
57         int      size;
58 }
59 drm_nouveau_dma_object_init_t;
60
61 #define NOUVEAU_MEM_FB                  0x00000001
62 #define NOUVEAU_MEM_AGP                 0x00000002
63 #define NOUVEAU_MEM_FB_ACCEPTABLE       0x00000004
64 #define NOUVEAU_MEM_AGP_ACCEPTABLE      0x00000008
65 #define NOUVEAU_MEM_PINNED              0x00000010
66 #define NOUVEAU_MEM_USER_BACKED         0x00000020
67 #define NOUVEAU_MEM_MAPPED              0x00000040
68 #define NOUVEAU_MEM_INSTANCE            0x00000080 /* internal */
69
70 typedef struct drm_nouveau_mem_alloc {
71         int flags;
72         int alignment;
73         uint64_t size;  // in bytes
74         uint64_t region_offset;
75 }
76 drm_nouveau_mem_alloc_t;
77
78 typedef struct drm_nouveau_mem_free {
79         uint64_t region_offset;
80         int flags;
81 }
82 drm_nouveau_mem_free_t;
83
84 /* FIXME : maybe unify {GET,SET}PARAMs */
85 #define NOUVEAU_GETPARAM_PCI_VENDOR      3
86 #define NOUVEAU_GETPARAM_PCI_DEVICE      4
87 #define NOUVEAU_GETPARAM_BUS_TYPE        5
88 #define NOUVEAU_GETPARAM_FB_PHYSICAL     6
89 #define NOUVEAU_GETPARAM_AGP_PHYSICAL    7
90 #define NOUVEAU_GETPARAM_FB_SIZE         8
91 #define NOUVEAU_GETPARAM_AGP_SIZE        9
92 typedef struct drm_nouveau_getparam {
93         uint64_t param;
94         uint64_t value;
95 }
96 drm_nouveau_getparam_t;
97
98 #define NOUVEAU_SETPARAM_CMDBUF_LOCATION 1
99 #define NOUVEAU_SETPARAM_CMDBUF_SIZE     2
100 typedef struct drm_nouveau_setparam {
101         uint64_t param;
102         uint64_t value;
103 }
104 drm_nouveau_setparam_t;
105
106 enum nouveau_card_type {
107         NV_UNKNOWN =0,
108         NV_01      =1,
109         NV_03      =3,
110         NV_04      =4,
111         NV_05      =5,
112         NV_10      =10,
113         NV_11      =10,
114         NV_15      =10,
115         NV_17      =10,
116         NV_20      =20,
117         NV_25      =20,
118         NV_30      =30,
119         NV_34      =30,
120         NV_40      =40,
121         NV_44      =44,
122         NV_50      =50,
123         NV_LAST    =0xffff,
124 };
125
126 enum nouveau_bus_type {
127         NV_AGP     =0,
128         NV_PCI     =1,
129         NV_PCIE    =2,
130 };
131
132 #define NOUVEAU_MAX_SAREA_CLIPRECTS 16
133
134 typedef struct drm_nouveau_sarea {
135         /* the cliprects */
136         drm_clip_rect_t boxes[NOUVEAU_MAX_SAREA_CLIPRECTS];
137         unsigned int nbox;
138 }
139 drm_nouveau_sarea_t;
140
141 #define DRM_NOUVEAU_FIFO_ALLOC      0x00
142 #define DRM_NOUVEAU_OBJECT_INIT     0x01
143 #define DRM_NOUVEAU_DMA_OBJECT_INIT 0x02 // We don't want this eventually..
144 #define DRM_NOUVEAU_MEM_ALLOC       0x03
145 #define DRM_NOUVEAU_MEM_FREE        0x04
146 #define DRM_NOUVEAU_GETPARAM        0x05
147 #define DRM_NOUVEAU_SETPARAM        0x06
148
149 #endif /* __NOUVEAU_DRM_H__ */
150