nouveau_drm.h revision 3f012e29
122944501Smrg/* 222944501Smrg * Copyright 2005 Stephane Marchesin. 322944501Smrg * All Rights Reserved. 422944501Smrg * 522944501Smrg * Permission is hereby granted, free of charge, to any person obtaining a 622944501Smrg * copy of this software and associated documentation files (the "Software"), 722944501Smrg * to deal in the Software without restriction, including without limitation 822944501Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 922944501Smrg * and/or sell copies of the Software, and to permit persons to whom the 1022944501Smrg * Software is furnished to do so, subject to the following conditions: 1122944501Smrg * 1222944501Smrg * The above copyright notice and this permission notice (including the next 1322944501Smrg * paragraph) shall be included in all copies or substantial portions of the 1422944501Smrg * Software. 1522944501Smrg * 1622944501Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1722944501Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1822944501Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1922944501Smrg * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 2022944501Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 2122944501Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2222944501Smrg * OTHER DEALINGS IN THE SOFTWARE. 2322944501Smrg */ 2422944501Smrg 2522944501Smrg#ifndef __NOUVEAU_DRM_H__ 2622944501Smrg#define __NOUVEAU_DRM_H__ 2722944501Smrg 2822944501Smrg#define NOUVEAU_DRM_HEADER_PATCHLEVEL 16 2922944501Smrg 3022944501Smrgstruct drm_nouveau_channel_alloc { 3122944501Smrg uint32_t fb_ctxdma_handle; 3222944501Smrg uint32_t tt_ctxdma_handle; 3322944501Smrg 3422944501Smrg int channel; 3522944501Smrg uint32_t pushbuf_domains; 3622944501Smrg 3722944501Smrg /* Notifier memory */ 3822944501Smrg uint32_t notifier_handle; 3922944501Smrg 4022944501Smrg /* DRM-enforced subchannel assignments */ 4122944501Smrg struct { 4222944501Smrg uint32_t handle; 4322944501Smrg uint32_t grclass; 4422944501Smrg } subchan[8]; 4522944501Smrg uint32_t nr_subchan; 4622944501Smrg}; 4722944501Smrg 4822944501Smrgstruct drm_nouveau_channel_free { 4922944501Smrg int channel; 5022944501Smrg}; 5122944501Smrg 5222944501Smrgstruct drm_nouveau_grobj_alloc { 5322944501Smrg int channel; 5422944501Smrg uint32_t handle; 5522944501Smrg int class; 5622944501Smrg}; 5722944501Smrg 5822944501Smrgstruct drm_nouveau_notifierobj_alloc { 5922944501Smrg uint32_t channel; 6022944501Smrg uint32_t handle; 6122944501Smrg uint32_t size; 6222944501Smrg uint32_t offset; 6322944501Smrg}; 6422944501Smrg 6522944501Smrgstruct drm_nouveau_gpuobj_free { 6622944501Smrg int channel; 6722944501Smrg uint32_t handle; 6822944501Smrg}; 6922944501Smrg 7022944501Smrg/* FIXME : maybe unify {GET,SET}PARAMs */ 7122944501Smrg#define NOUVEAU_GETPARAM_PCI_VENDOR 3 7222944501Smrg#define NOUVEAU_GETPARAM_PCI_DEVICE 4 7322944501Smrg#define NOUVEAU_GETPARAM_BUS_TYPE 5 7422944501Smrg#define NOUVEAU_GETPARAM_FB_PHYSICAL 6 7522944501Smrg#define NOUVEAU_GETPARAM_AGP_PHYSICAL 7 7622944501Smrg#define NOUVEAU_GETPARAM_FB_SIZE 8 7722944501Smrg#define NOUVEAU_GETPARAM_AGP_SIZE 9 7822944501Smrg#define NOUVEAU_GETPARAM_PCI_PHYSICAL 10 7922944501Smrg#define NOUVEAU_GETPARAM_CHIPSET_ID 11 8022944501Smrg#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12 8122944501Smrg#define NOUVEAU_GETPARAM_GRAPH_UNITS 13 82d049871aSmrg#define NOUVEAU_GETPARAM_PTIMER_TIME 14 8369dda199Smrg#define NOUVEAU_GETPARAM_HAS_BO_USAGE 15 8469dda199Smrg#define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16 8522944501Smrgstruct drm_nouveau_getparam { 8622944501Smrg uint64_t param; 8722944501Smrg uint64_t value; 8822944501Smrg}; 8922944501Smrg 9022944501Smrgstruct drm_nouveau_setparam { 9122944501Smrg uint64_t param; 9222944501Smrg uint64_t value; 9322944501Smrg}; 9422944501Smrg 9522944501Smrg#define NOUVEAU_GEM_DOMAIN_CPU (1 << 0) 9622944501Smrg#define NOUVEAU_GEM_DOMAIN_VRAM (1 << 1) 9722944501Smrg#define NOUVEAU_GEM_DOMAIN_GART (1 << 2) 9822944501Smrg#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) 99e6188e58Smrg#define NOUVEAU_GEM_DOMAIN_COHERENT (1 << 4) 10022944501Smrg 10169dda199Smrg#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 10269dda199Smrg#define NOUVEAU_GEM_TILE_16BPP 0x00000001 10369dda199Smrg#define NOUVEAU_GEM_TILE_32BPP 0x00000002 10469dda199Smrg#define NOUVEAU_GEM_TILE_ZETA 0x00000004 10569dda199Smrg#define NOUVEAU_GEM_TILE_NONCONTIG 0x00000008 10669dda199Smrg 10722944501Smrgstruct drm_nouveau_gem_info { 10822944501Smrg uint32_t handle; 10922944501Smrg uint32_t domain; 11022944501Smrg uint64_t size; 11122944501Smrg uint64_t offset; 11222944501Smrg uint64_t map_handle; 11322944501Smrg uint32_t tile_mode; 11422944501Smrg uint32_t tile_flags; 11522944501Smrg}; 11622944501Smrg 11722944501Smrgstruct drm_nouveau_gem_new { 11822944501Smrg struct drm_nouveau_gem_info info; 11922944501Smrg uint32_t channel_hint; 12022944501Smrg uint32_t align; 12122944501Smrg}; 12222944501Smrg 12322944501Smrg#define NOUVEAU_GEM_MAX_BUFFERS 1024 12422944501Smrgstruct drm_nouveau_gem_pushbuf_bo_presumed { 12522944501Smrg uint32_t valid; 12622944501Smrg uint32_t domain; 12722944501Smrg uint64_t offset; 12822944501Smrg}; 12922944501Smrg 13022944501Smrgstruct drm_nouveau_gem_pushbuf_bo { 13122944501Smrg uint64_t user_priv; 13222944501Smrg uint32_t handle; 13322944501Smrg uint32_t read_domains; 13422944501Smrg uint32_t write_domains; 13522944501Smrg uint32_t valid_domains; 13622944501Smrg struct drm_nouveau_gem_pushbuf_bo_presumed presumed; 13722944501Smrg}; 13822944501Smrg 13922944501Smrg#define NOUVEAU_GEM_RELOC_LOW (1 << 0) 14022944501Smrg#define NOUVEAU_GEM_RELOC_HIGH (1 << 1) 14122944501Smrg#define NOUVEAU_GEM_RELOC_OR (1 << 2) 14222944501Smrg#define NOUVEAU_GEM_MAX_RELOCS 1024 14322944501Smrgstruct drm_nouveau_gem_pushbuf_reloc { 14422944501Smrg uint32_t reloc_bo_index; 14522944501Smrg uint32_t reloc_bo_offset; 14622944501Smrg uint32_t bo_index; 14722944501Smrg uint32_t flags; 14822944501Smrg uint32_t data; 14922944501Smrg uint32_t vor; 15022944501Smrg uint32_t tor; 15122944501Smrg}; 15222944501Smrg 15322944501Smrg#define NOUVEAU_GEM_MAX_PUSH 512 15422944501Smrgstruct drm_nouveau_gem_pushbuf_push { 15522944501Smrg uint32_t bo_index; 15622944501Smrg uint32_t pad; 15722944501Smrg uint64_t offset; 15822944501Smrg uint64_t length; 15922944501Smrg}; 16022944501Smrg 16122944501Smrgstruct drm_nouveau_gem_pushbuf { 16222944501Smrg uint32_t channel; 16322944501Smrg uint32_t nr_buffers; 16422944501Smrg uint64_t buffers; 16522944501Smrg uint32_t nr_relocs; 16622944501Smrg uint32_t nr_push; 16722944501Smrg uint64_t relocs; 16822944501Smrg uint64_t push; 16922944501Smrg uint32_t suffix0; 17022944501Smrg uint32_t suffix1; 17122944501Smrg uint64_t vram_available; 17222944501Smrg uint64_t gart_available; 17322944501Smrg}; 17422944501Smrg 17522944501Smrg#define NOUVEAU_GEM_CPU_PREP_NOWAIT 0x00000001 17622944501Smrg#define NOUVEAU_GEM_CPU_PREP_NOBLOCK 0x00000002 17722944501Smrg#define NOUVEAU_GEM_CPU_PREP_WRITE 0x00000004 17822944501Smrgstruct drm_nouveau_gem_cpu_prep { 17922944501Smrg uint32_t handle; 18022944501Smrg uint32_t flags; 18122944501Smrg}; 18222944501Smrg 18322944501Smrgstruct drm_nouveau_gem_cpu_fini { 18422944501Smrg uint32_t handle; 18522944501Smrg}; 18622944501Smrg 18722944501Smrgenum nouveau_bus_type { 18822944501Smrg NV_AGP = 0, 18922944501Smrg NV_PCI = 1, 19022944501Smrg NV_PCIE = 2, 19122944501Smrg}; 19222944501Smrg 19322944501Smrgstruct drm_nouveau_sarea { 19422944501Smrg}; 19522944501Smrg 19622944501Smrg#define DRM_NOUVEAU_GETPARAM 0x00 19722944501Smrg#define DRM_NOUVEAU_SETPARAM 0x01 19822944501Smrg#define DRM_NOUVEAU_CHANNEL_ALLOC 0x02 19922944501Smrg#define DRM_NOUVEAU_CHANNEL_FREE 0x03 20022944501Smrg#define DRM_NOUVEAU_GROBJ_ALLOC 0x04 20122944501Smrg#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC 0x05 20222944501Smrg#define DRM_NOUVEAU_GPUOBJ_FREE 0x06 2033f012e29Smrg#define DRM_NOUVEAU_NVIF 0x07 20422944501Smrg#define DRM_NOUVEAU_GEM_NEW 0x40 20522944501Smrg#define DRM_NOUVEAU_GEM_PUSHBUF 0x41 20622944501Smrg#define DRM_NOUVEAU_GEM_CPU_PREP 0x42 20722944501Smrg#define DRM_NOUVEAU_GEM_CPU_FINI 0x43 20822944501Smrg#define DRM_NOUVEAU_GEM_INFO 0x44 20922944501Smrg 21022944501Smrg#endif /* __NOUVEAU_DRM_H__ */ 211