Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:50

0001 /*
0002  * Copyright 2005 Stephane Marchesin.
0003  * All Rights Reserved.
0004  *
0005  * Permission is hereby granted, free of charge, to any person obtaining a
0006  * copy of this software and associated documentation files (the "Software"),
0007  * to deal in the Software without restriction, including without limitation
0008  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0009  * and/or sell copies of the Software, and to permit persons to whom the
0010  * Software is furnished to do so, subject to the following conditions:
0011  *
0012  * The above copyright notice and this permission notice (including the next
0013  * paragraph) shall be included in all copies or substantial portions of the
0014  * Software.
0015  *
0016  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0017  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0018  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0019  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0020  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0021  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0022  * OTHER DEALINGS IN THE SOFTWARE.
0023  */
0024 
0025 #ifndef __NOUVEAU_DRM_H__
0026 #define __NOUVEAU_DRM_H__
0027 
0028 #define NOUVEAU_DRM_HEADER_PATCHLEVEL 16
0029 
0030 #include "drm.h"
0031 
0032 #if defined(__cplusplus)
0033 extern "C" {
0034 #endif
0035 
0036 struct drm_nouveau_channel_alloc {
0037     uint32_t     fb_ctxdma_handle;
0038     uint32_t     tt_ctxdma_handle;
0039 
0040     int          channel;
0041     uint32_t     pushbuf_domains;
0042 
0043     /* Notifier memory */
0044     uint32_t     notifier_handle;
0045 
0046     /* DRM-enforced subchannel assignments */
0047     struct {
0048         uint32_t handle;
0049         uint32_t grclass;
0050     } subchan[8];
0051     uint32_t nr_subchan;
0052 };
0053 
0054 struct drm_nouveau_channel_free {
0055     int channel;
0056 };
0057 
0058 struct drm_nouveau_grobj_alloc {
0059     int      channel;
0060     uint32_t handle;
0061     int      class;
0062 };
0063 
0064 struct drm_nouveau_notifierobj_alloc {
0065     uint32_t channel;
0066     uint32_t handle;
0067     uint32_t size;
0068     uint32_t offset;
0069 };
0070 
0071 struct drm_nouveau_gpuobj_free {
0072     int      channel;
0073     uint32_t handle;
0074 };
0075 
0076 #define NOUVEAU_GETPARAM_PCI_VENDOR      3
0077 #define NOUVEAU_GETPARAM_PCI_DEVICE      4
0078 #define NOUVEAU_GETPARAM_BUS_TYPE        5
0079 #define NOUVEAU_GETPARAM_FB_SIZE         8
0080 #define NOUVEAU_GETPARAM_AGP_SIZE        9
0081 #define NOUVEAU_GETPARAM_CHIPSET_ID      11
0082 #define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
0083 #define NOUVEAU_GETPARAM_GRAPH_UNITS     13
0084 #define NOUVEAU_GETPARAM_PTIMER_TIME     14
0085 #define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
0086 #define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
0087 struct drm_nouveau_getparam {
0088     uint64_t param;
0089     uint64_t value;
0090 };
0091 
0092 struct drm_nouveau_setparam {
0093     uint64_t param;
0094     uint64_t value;
0095 };
0096 
0097 #define NOUVEAU_GEM_DOMAIN_CPU       (1 << 0)
0098 #define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
0099 #define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
0100 #define NOUVEAU_GEM_DOMAIN_MAPPABLE  (1 << 3)
0101 #define NOUVEAU_GEM_DOMAIN_COHERENT  (1 << 4)
0102 
0103 #define NOUVEAU_GEM_TILE_COMP        0x00030000 /* nv50-only */
0104 #define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
0105 #define NOUVEAU_GEM_TILE_16BPP       0x00000001
0106 #define NOUVEAU_GEM_TILE_32BPP       0x00000002
0107 #define NOUVEAU_GEM_TILE_ZETA        0x00000004
0108 #define NOUVEAU_GEM_TILE_NONCONTIG   0x00000008
0109 
0110 struct drm_nouveau_gem_info {
0111     __u32 handle;
0112     __u32 domain;
0113     __u64 size;
0114     __u64 offset;
0115     __u64 map_handle;
0116     __u32 tile_mode;
0117     __u32 tile_flags;
0118 };
0119 
0120 struct drm_nouveau_gem_new {
0121     struct drm_nouveau_gem_info info;
0122     __u32 channel_hint;
0123     __u32 align;
0124 };
0125 
0126 #define NOUVEAU_GEM_MAX_BUFFERS 1024
0127 struct drm_nouveau_gem_pushbuf_bo_presumed {
0128     __u32 valid;
0129     __u32 domain;
0130     __u64 offset;
0131 };
0132 
0133 struct drm_nouveau_gem_pushbuf_bo {
0134     __u64 user_priv;
0135     __u32 handle;
0136     __u32 read_domains;
0137     __u32 write_domains;
0138     __u32 valid_domains;
0139     struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
0140 };
0141 
0142 #define NOUVEAU_GEM_RELOC_LOW  (1 << 0)
0143 #define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
0144 #define NOUVEAU_GEM_RELOC_OR   (1 << 2)
0145 #define NOUVEAU_GEM_MAX_RELOCS 1024
0146 struct drm_nouveau_gem_pushbuf_reloc {
0147     __u32 reloc_bo_index;
0148     __u32 reloc_bo_offset;
0149     __u32 bo_index;
0150     __u32 flags;
0151     __u32 data;
0152     __u32 vor;
0153     __u32 tor;
0154 };
0155 
0156 #define NOUVEAU_GEM_MAX_PUSH 512
0157 struct drm_nouveau_gem_pushbuf_push {
0158     __u32 bo_index;
0159     __u32 pad;
0160     __u64 offset;
0161     __u64 length;
0162 };
0163 
0164 struct drm_nouveau_gem_pushbuf {
0165     __u32 channel;
0166     __u32 nr_buffers;
0167     __u64 buffers;
0168     __u32 nr_relocs;
0169     __u32 nr_push;
0170     __u64 relocs;
0171     __u64 push;
0172     __u32 suffix0;
0173     __u32 suffix1;
0174 #define NOUVEAU_GEM_PUSHBUF_SYNC                                    (1ULL << 0)
0175     __u64 vram_available;
0176     __u64 gart_available;
0177 };
0178 
0179 #define NOUVEAU_GEM_CPU_PREP_NOWAIT                                  0x00000001
0180 #define NOUVEAU_GEM_CPU_PREP_WRITE                                   0x00000004
0181 struct drm_nouveau_gem_cpu_prep {
0182     __u32 handle;
0183     __u32 flags;
0184 };
0185 
0186 struct drm_nouveau_gem_cpu_fini {
0187     __u32 handle;
0188 };
0189 
0190 #define DRM_NOUVEAU_GETPARAM           0x00 /* deprecated */
0191 #define DRM_NOUVEAU_SETPARAM           0x01 /* deprecated */
0192 #define DRM_NOUVEAU_CHANNEL_ALLOC      0x02 /* deprecated */
0193 #define DRM_NOUVEAU_CHANNEL_FREE       0x03 /* deprecated */
0194 #define DRM_NOUVEAU_GROBJ_ALLOC        0x04 /* deprecated */
0195 #define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05 /* deprecated */
0196 #define DRM_NOUVEAU_GPUOBJ_FREE        0x06 /* deprecated */
0197 #define DRM_NOUVEAU_NVIF               0x07
0198 #define DRM_NOUVEAU_SVM_INIT           0x08
0199 #define DRM_NOUVEAU_SVM_BIND           0x09
0200 #define DRM_NOUVEAU_GEM_NEW            0x40
0201 #define DRM_NOUVEAU_GEM_PUSHBUF        0x41
0202 #define DRM_NOUVEAU_GEM_CPU_PREP       0x42
0203 #define DRM_NOUVEAU_GEM_CPU_FINI       0x43
0204 #define DRM_NOUVEAU_GEM_INFO           0x44
0205 
0206 struct drm_nouveau_svm_init {
0207     __u64 unmanaged_addr;
0208     __u64 unmanaged_size;
0209 };
0210 
0211 struct drm_nouveau_svm_bind {
0212     __u64 header;
0213     __u64 va_start;
0214     __u64 va_end;
0215     __u64 npages;
0216     __u64 stride;
0217     __u64 result;
0218     __u64 reserved0;
0219     __u64 reserved1;
0220 };
0221 
0222 #define NOUVEAU_SVM_BIND_COMMAND_SHIFT          0
0223 #define NOUVEAU_SVM_BIND_COMMAND_BITS           8
0224 #define NOUVEAU_SVM_BIND_COMMAND_MASK           ((1 << 8) - 1)
0225 #define NOUVEAU_SVM_BIND_PRIORITY_SHIFT         8
0226 #define NOUVEAU_SVM_BIND_PRIORITY_BITS          8
0227 #define NOUVEAU_SVM_BIND_PRIORITY_MASK          ((1 << 8) - 1)
0228 #define NOUVEAU_SVM_BIND_TARGET_SHIFT           16
0229 #define NOUVEAU_SVM_BIND_TARGET_BITS            32
0230 #define NOUVEAU_SVM_BIND_TARGET_MASK            0xffffffff
0231 
0232 /*
0233  * Below is use to validate ioctl argument, userspace can also use it to make
0234  * sure that no bit are set beyond known fields for a given kernel version.
0235  */
0236 #define NOUVEAU_SVM_BIND_VALID_BITS     48
0237 #define NOUVEAU_SVM_BIND_VALID_MASK     ((1ULL << NOUVEAU_SVM_BIND_VALID_BITS) - 1)
0238 
0239 
0240 /*
0241  * NOUVEAU_BIND_COMMAND__MIGRATE: synchronous migrate to target memory.
0242  * result: number of page successfuly migrate to the target memory.
0243  */
0244 #define NOUVEAU_SVM_BIND_COMMAND__MIGRATE               0
0245 
0246 /*
0247  * NOUVEAU_SVM_BIND_HEADER_TARGET__GPU_VRAM: target the GPU VRAM memory.
0248  */
0249 #define NOUVEAU_SVM_BIND_TARGET__GPU_VRAM               (1UL << 31)
0250 
0251 
0252 #if defined(__cplusplus)
0253 }
0254 #endif
0255 
0256 #endif /* __NOUVEAU_DRM_H__ */