1ae115bc7Smrj /* BEGIN CSTYLED */ 2ae115bc7Smrj 3e92e3a86Szw161486 /* 4ae115bc7Smrj * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 5*0035d21cSmiao chen - Sun Microsystems - Beijing China * Copyright (c) 2009, Intel Corporation. 6ae115bc7Smrj * All Rights Reserved. 7ae115bc7Smrj * 8ae115bc7Smrj * Permission is hereby granted, free of charge, to any person obtaining a 9ae115bc7Smrj * copy of this software and associated documentation files (the 10ae115bc7Smrj * "Software"), to deal in the Software without restriction, including 11ae115bc7Smrj * without limitation the rights to use, copy, modify, merge, publish, 12ae115bc7Smrj * distribute, sub license, and/or sell copies of the Software, and to 13ae115bc7Smrj * permit persons to whom the Software is furnished to do so, subject to 14ae115bc7Smrj * the following conditions: 15ae115bc7Smrj * 16ae115bc7Smrj * The above copyright notice and this permission notice (including the 17ae115bc7Smrj * next paragraph) shall be included in all copies or substantial portions 18ae115bc7Smrj * of the Software. 19ae115bc7Smrj * 20ae115bc7Smrj * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 21ae115bc7Smrj * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22ae115bc7Smrj * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 23ae115bc7Smrj * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 24ae115bc7Smrj * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25ae115bc7Smrj * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26ae115bc7Smrj * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27ae115bc7Smrj * 28e92e3a86Szw161486 */ 29e92e3a86Szw161486 30e92e3a86Szw161486 /* 31d0231070Smiao chen - Sun Microsystems - Beijing China * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 32e92e3a86Szw161486 * Use is subject to license terms. 33e92e3a86Szw161486 */ 34ae115bc7Smrj 35ae115bc7Smrj #ifndef _I915_DRM_H 36ae115bc7Smrj #define _I915_DRM_H 37ae115bc7Smrj 38ae115bc7Smrj /* Please note that modifications to all structs defined here are 39ae115bc7Smrj * subject to backwards-compatibility constraints. 40ae115bc7Smrj */ 41ae115bc7Smrj 42ae115bc7Smrj #include "drm.h" 43ae115bc7Smrj 44ae115bc7Smrj /* Each region is a minimum of 16k, and there are at most 255 of them. 45ae115bc7Smrj */ 46ae115bc7Smrj #define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use 47ae115bc7Smrj * of chars for next/prev indices */ 48ae115bc7Smrj #define I915_LOG_MIN_TEX_REGION_SIZE 14 49ae115bc7Smrj 50ae115bc7Smrj typedef struct _drm_i915_init { 51ae115bc7Smrj enum { 52ae115bc7Smrj I915_INIT_DMA = 0x01, 53ae115bc7Smrj I915_CLEANUP_DMA = 0x02, 54ae115bc7Smrj I915_RESUME_DMA = 0x03 55ae115bc7Smrj } func; 56ae115bc7Smrj unsigned int mmio_offset; 57ae115bc7Smrj int sarea_priv_offset; 58ae115bc7Smrj unsigned int ring_start; 59ae115bc7Smrj unsigned int ring_end; 60ae115bc7Smrj unsigned int ring_size; 61ae115bc7Smrj unsigned int front_offset; 62ae115bc7Smrj unsigned int back_offset; 63ae115bc7Smrj unsigned int depth_offset; 64ae115bc7Smrj unsigned int w; 65ae115bc7Smrj unsigned int h; 66ae115bc7Smrj unsigned int pitch; 67ae115bc7Smrj unsigned int pitch_bits; 68ae115bc7Smrj unsigned int back_pitch; 69ae115bc7Smrj unsigned int depth_pitch; 70ae115bc7Smrj unsigned int cpp; 71ae115bc7Smrj unsigned int chipset; 72ae115bc7Smrj } drm_i915_init_t; 73ae115bc7Smrj 74ae115bc7Smrj typedef struct _drm_i915_sarea { 75ae115bc7Smrj drm_tex_region_t texList[I915_NR_TEX_REGIONS + 1]; 76ae115bc7Smrj int last_upload; /* last time texture was uploaded */ 77ae115bc7Smrj int last_enqueue; /* last time a buffer was enqueued */ 78ae115bc7Smrj int last_dispatch; /* age of the most recently dispatched buffer */ 79ae115bc7Smrj int ctxOwner; /* last context to upload state */ 80ae115bc7Smrj int texAge; 81ae115bc7Smrj int pf_enabled; /* is pageflipping allowed? */ 82ae115bc7Smrj int pf_active; 83ae115bc7Smrj int pf_current_page; /* which buffer is being displayed? */ 84ae115bc7Smrj int perf_boxes; /* performance boxes to be displayed */ 85e92e3a86Szw161486 int width, height; /* screen size in pixels */ 86d0231070Smiao chen - Sun Microsystems - Beijing China int pad0; 87e92e3a86Szw161486 88e92e3a86Szw161486 drm_handle_t front_handle; 89e92e3a86Szw161486 int front_offset; 90e92e3a86Szw161486 int front_size; 91e92e3a86Szw161486 92e92e3a86Szw161486 drm_handle_t back_handle; 93e92e3a86Szw161486 int back_offset; 94e92e3a86Szw161486 int back_size; 95e92e3a86Szw161486 96e92e3a86Szw161486 drm_handle_t depth_handle; 97e92e3a86Szw161486 int depth_offset; 98e92e3a86Szw161486 int depth_size; 99e92e3a86Szw161486 100e92e3a86Szw161486 drm_handle_t tex_handle; 101e92e3a86Szw161486 int tex_offset; 102e92e3a86Szw161486 int tex_size; 103e92e3a86Szw161486 int log_tex_granularity; 104e92e3a86Szw161486 int pitch; 105e92e3a86Szw161486 int rotation; /* 0, 90, 180 or 270 */ 106e92e3a86Szw161486 int rotated_offset; 107e92e3a86Szw161486 int rotated_size; 108e92e3a86Szw161486 int rotated_pitch; 109e92e3a86Szw161486 int virtualX, virtualY; 110e92e3a86Szw161486 111e92e3a86Szw161486 unsigned int front_tiled; 112e92e3a86Szw161486 unsigned int back_tiled; 113e92e3a86Szw161486 unsigned int depth_tiled; 114e92e3a86Szw161486 unsigned int rotated_tiled; 115e92e3a86Szw161486 unsigned int rotated2_tiled; 116e92e3a86Szw161486 117*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeA_x; 118*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeA_y; 119*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeA_w; 120*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeA_h; 121*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeB_x; 122*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeB_y; 123*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeB_w; 124*0035d21cSmiao chen - Sun Microsystems - Beijing China int pipeB_h; 125d0231070Smiao chen - Sun Microsystems - Beijing China 126*0035d21cSmiao chen - Sun Microsystems - Beijing China int pad1; 127d0231070Smiao chen - Sun Microsystems - Beijing China /* Triple buffering */ 128d0231070Smiao chen - Sun Microsystems - Beijing China drm_handle_t third_handle; 129d0231070Smiao chen - Sun Microsystems - Beijing China int third_offset; 130d0231070Smiao chen - Sun Microsystems - Beijing China int third_size; 131d0231070Smiao chen - Sun Microsystems - Beijing China unsigned int third_tiled; 132d0231070Smiao chen - Sun Microsystems - Beijing China 133*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int front_bo_handle; 134*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int back_bo_handle; 135*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int third_bo_handle; 136*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int depth_bo_handle; 137ae115bc7Smrj } drm_i915_sarea_t; 138ae115bc7Smrj 139e92e3a86Szw161486 /* Driver specific fence types and classes. 140e92e3a86Szw161486 */ 141e92e3a86Szw161486 142e92e3a86Szw161486 /* The only fence class we support */ 143e92e3a86Szw161486 #define DRM_I915_FENCE_CLASS_ACCEL 0 144e92e3a86Szw161486 /* Fence type that guarantees read-write flush */ 145e92e3a86Szw161486 #define DRM_I915_FENCE_TYPE_RW 2 146e92e3a86Szw161486 /* MI_FLUSH programmed just before the fence */ 147e92e3a86Szw161486 #define DRM_I915_FENCE_FLAG_FLUSHED 0x01000000 148e92e3a86Szw161486 149ae115bc7Smrj /* Flags for perf_boxes 150ae115bc7Smrj */ 151ae115bc7Smrj #define I915_BOX_RING_EMPTY 0x1 152ae115bc7Smrj #define I915_BOX_FLIP 0x2 153ae115bc7Smrj #define I915_BOX_WAIT 0x4 154ae115bc7Smrj #define I915_BOX_TEXTURE_LOAD 0x8 155ae115bc7Smrj #define I915_BOX_LOST_CONTEXT 0x10 156ae115bc7Smrj 157ae115bc7Smrj /* I915 specific ioctls 158ae115bc7Smrj * The device specific ioctl range is 0x40 to 0x79. 159ae115bc7Smrj */ 160ae115bc7Smrj #define DRM_I915_INIT 0x00 161ae115bc7Smrj #define DRM_I915_FLUSH 0x01 162ae115bc7Smrj #define DRM_I915_FLIP 0x02 163ae115bc7Smrj #define DRM_I915_BATCHBUFFER 0x03 164ae115bc7Smrj #define DRM_I915_IRQ_EMIT 0x04 165ae115bc7Smrj #define DRM_I915_IRQ_WAIT 0x05 166ae115bc7Smrj #define DRM_I915_GETPARAM 0x06 167ae115bc7Smrj #define DRM_I915_SETPARAM 0x07 168ae115bc7Smrj #define DRM_I915_ALLOC 0x08 169ae115bc7Smrj #define DRM_I915_FREE 0x09 170ae115bc7Smrj #define DRM_I915_INIT_HEAP 0x0a 171ae115bc7Smrj #define DRM_I915_CMDBUFFER 0x0b 172e92e3a86Szw161486 #define DRM_I915_DESTROY_HEAP 0x0c 173d0231070Smiao chen - Sun Microsystems - Beijing China #define DRM_I915_SET_VBLANK_PIPE 0x0d 174d0231070Smiao chen - Sun Microsystems - Beijing China #define DRM_I915_GET_VBLANK_PIPE 0x0e 175d0231070Smiao chen - Sun Microsystems - Beijing China #define DRM_I915_VBLANK_SWAP 0x0f 176dc8c6b69Sms148562 #define DRM_I915_HWS_ADDR 0x11 177*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_INIT 0x13 178*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_EXECBUFFER 0x14 179*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_PIN 0x15 180*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_UNPIN 0x16 181*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_BUSY 0x17 182*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_THROTTLE 0x18 183*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_ENTERVT 0x19 184*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_LEAVEVT 0x1a 185*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_CREATE 0x1b 186*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_PREAD 0x1c 187*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_PWRITE 0x1d 188*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_MMAP 0x1e 189*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_SET_DOMAIN 0x1f 190*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_SW_FINISH 0x20 191*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_SET_TILING 0x21 192*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_GET_TILING 0x22 193*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_GET_APERTURE 0x23 194*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_I915_GEM_MMAP_GTT 0x24 195ae115bc7Smrj 196ae115bc7Smrj #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 197ae115bc7Smrj #define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 198ae115bc7Smrj #define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) 199ae115bc7Smrj #define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) 200ae115bc7Smrj #define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) 201ae115bc7Smrj #define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) 202ae115bc7Smrj #define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) 203ae115bc7Smrj #define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) 204ae115bc7Smrj #define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) 205ae115bc7Smrj #define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) 206ae115bc7Smrj #define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) 207ae115bc7Smrj #define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) 208e92e3a86Szw161486 #define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) 209d0231070Smiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 210d0231070Smiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 211d0231070Smiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 212*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 213*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 214*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 215*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 216*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 217*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) 218*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) 219*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) 220*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) 221*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) 222*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 223*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 224*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) 225*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 226*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 227*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 228*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 229*0035d21cSmiao chen - Sun Microsystems - Beijing China #define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 230d0231070Smiao chen - Sun Microsystems - Beijing China 231d0231070Smiao chen - Sun Microsystems - Beijing China /* Asynchronous page flipping: 232d0231070Smiao chen - Sun Microsystems - Beijing China */ 233d0231070Smiao chen - Sun Microsystems - Beijing China typedef struct drm_i915_flip { 234d0231070Smiao chen - Sun Microsystems - Beijing China /* 235d0231070Smiao chen - Sun Microsystems - Beijing China * This is really talking about planes, and we could rename it 236d0231070Smiao chen - Sun Microsystems - Beijing China * except for the fact that some of the duplicated i915_drm.h files 237d0231070Smiao chen - Sun Microsystems - Beijing China * out there check for HAVE_I915_FLIP and so might pick up this 238d0231070Smiao chen - Sun Microsystems - Beijing China * version. 239d0231070Smiao chen - Sun Microsystems - Beijing China */ 240d0231070Smiao chen - Sun Microsystems - Beijing China int pipes; 241d0231070Smiao chen - Sun Microsystems - Beijing China } drm_i915_flip_t; 242ae115bc7Smrj 243ae115bc7Smrj /* Allow drivers to submit batchbuffers directly to hardware, relying 244ae115bc7Smrj * on the security mechanisms provided by hardware. 245ae115bc7Smrj */ 246ae115bc7Smrj typedef struct _drm_i915_batchbuffer { 247ae115bc7Smrj int start; /* agp offset */ 248ae115bc7Smrj int used; /* nr bytes in use */ 249ae115bc7Smrj int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 250ae115bc7Smrj int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 251ae115bc7Smrj int num_cliprects; /* mulitpass with multiple cliprects? */ 252ae115bc7Smrj drm_clip_rect_t __user *cliprects; /* pointer to userspace cliprects */ 253ae115bc7Smrj } drm_i915_batchbuffer_t; 254ae115bc7Smrj 255ae115bc7Smrj typedef struct _drm_i915_batchbuffer32 { 256ae115bc7Smrj int start; /* agp offset */ 257ae115bc7Smrj int used; /* nr bytes in use */ 258ae115bc7Smrj int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 259ae115bc7Smrj int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 260ae115bc7Smrj int num_cliprects; /* mulitpass with multiple cliprects? */ 261ae115bc7Smrj caddr32_t cliprects; /* pointer to userspace cliprects */ 262ae115bc7Smrj } drm_i915_batchbuffer32_t; 263ae115bc7Smrj 264ae115bc7Smrj /* As above, but pass a pointer to userspace buffer which can be 265ae115bc7Smrj * validated by the kernel prior to sending to hardware. 266ae115bc7Smrj */ 267ae115bc7Smrj typedef struct _drm_i915_cmdbuffer { 268ae115bc7Smrj char __user *buf; /* pointer to userspace command buffer */ 269ae115bc7Smrj int sz; /* nr bytes in buf */ 270ae115bc7Smrj int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 271ae115bc7Smrj int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 272ae115bc7Smrj int num_cliprects; /* mulitpass with multiple cliprects? */ 273ae115bc7Smrj drm_clip_rect_t __user *cliprects; /* pointer to userspace cliprects */ 274ae115bc7Smrj } drm_i915_cmdbuffer_t; 275ae115bc7Smrj 276ae115bc7Smrj typedef struct _drm_i915_cmdbuffer32 { 277ae115bc7Smrj caddr32_t buf; /* pointer to userspace command buffer */ 278ae115bc7Smrj int sz; /* nr bytes in buf */ 279ae115bc7Smrj int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 280ae115bc7Smrj int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 281ae115bc7Smrj int num_cliprects; /* mulitpass with multiple cliprects? */ 282ae115bc7Smrj caddr32_t cliprects; /* pointer to userspace cliprects */ 283ae115bc7Smrj } drm_i915_cmdbuffer32_t; 284ae115bc7Smrj 285ae115bc7Smrj /* Userspace can request & wait on irq's: 286ae115bc7Smrj */ 287ae115bc7Smrj typedef struct drm_i915_irq_emit { 288ae115bc7Smrj int __user *irq_seq; 289ae115bc7Smrj } drm_i915_irq_emit_t; 290ae115bc7Smrj 291ae115bc7Smrj typedef struct drm_i915_irq_emit32 { 292ae115bc7Smrj caddr32_t irq_seq; 293ae115bc7Smrj } drm_i915_irq_emit32_t; 294ae115bc7Smrj 295ae115bc7Smrj typedef struct drm_i915_irq_wait { 296ae115bc7Smrj int irq_seq; 297ae115bc7Smrj } drm_i915_irq_wait_t; 298ae115bc7Smrj 299ae115bc7Smrj /* Ioctl to query kernel params: 300ae115bc7Smrj */ 301ae115bc7Smrj #define I915_PARAM_IRQ_ACTIVE 1 302ae115bc7Smrj #define I915_PARAM_ALLOW_BATCHBUFFER 2 303e92e3a86Szw161486 #define I915_PARAM_LAST_DISPATCH 3 304d0231070Smiao chen - Sun Microsystems - Beijing China #define I915_PARAM_CHIPSET_ID 4 305*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_PARAM_HAS_GEM 5 306ae115bc7Smrj 307ae115bc7Smrj typedef struct drm_i915_getparam { 308ae115bc7Smrj int param; 309ae115bc7Smrj int __user *value; 310ae115bc7Smrj } drm_i915_getparam_t; 311ae115bc7Smrj 312ae115bc7Smrj typedef struct drm_i915_getparam32 { 313ae115bc7Smrj int param; 314ae115bc7Smrj caddr32_t value; 315ae115bc7Smrj } drm_i915_getparam32_t; 316ae115bc7Smrj 317ae115bc7Smrj /* Ioctl to set kernel params: 318ae115bc7Smrj */ 319ae115bc7Smrj #define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 320ae115bc7Smrj #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 321ae115bc7Smrj #define I915_SETPARAM_ALLOW_BATCHBUFFER 3 322ae115bc7Smrj 323ae115bc7Smrj typedef struct drm_i915_setparam { 324ae115bc7Smrj int param; 325ae115bc7Smrj int value; 326ae115bc7Smrj } drm_i915_setparam_t; 327ae115bc7Smrj 328ae115bc7Smrj /* A memory manager for regions of shared memory: 329ae115bc7Smrj */ 330ae115bc7Smrj #define I915_MEM_REGION_AGP 1 331ae115bc7Smrj 332ae115bc7Smrj typedef struct drm_i915_mem_alloc { 333ae115bc7Smrj int region; 334ae115bc7Smrj int alignment; 335ae115bc7Smrj int size; 336ae115bc7Smrj int __user *region_offset; /* offset from start of fb or agp */ 337ae115bc7Smrj } drm_i915_mem_alloc_t; 338ae115bc7Smrj 339ae115bc7Smrj typedef struct drm_i915_mem_alloc32 { 340ae115bc7Smrj int region; 341ae115bc7Smrj int alignment; 342ae115bc7Smrj int size; 343ae115bc7Smrj caddr32_t region_offset; /* offset from start of fb or agp */ 344ae115bc7Smrj } drm_i915_mem_alloc32_t; 345ae115bc7Smrj 346ae115bc7Smrj typedef struct drm_i915_mem_free { 347ae115bc7Smrj int region; 348ae115bc7Smrj int region_offset; 349ae115bc7Smrj } drm_i915_mem_free_t; 350ae115bc7Smrj 351ae115bc7Smrj typedef struct drm_i915_mem_init_heap { 352ae115bc7Smrj int region; 353ae115bc7Smrj int size; 354ae115bc7Smrj int start; 355ae115bc7Smrj } drm_i915_mem_init_heap_t; 356ae115bc7Smrj 357e92e3a86Szw161486 /* Allow memory manager to be torn down and re-initialized (eg on 358e92e3a86Szw161486 * rotate): 359e92e3a86Szw161486 */ 360e92e3a86Szw161486 typedef struct drm_i915_mem_destroy_heap { 361e92e3a86Szw161486 int region; 362e92e3a86Szw161486 } drm_i915_mem_destroy_heap_t; 363e92e3a86Szw161486 364e92e3a86Szw161486 /* Allow X server to configure which pipes to monitor for vblank signals 365e92e3a86Szw161486 */ 366e92e3a86Szw161486 #define DRM_I915_VBLANK_PIPE_A 1 367e92e3a86Szw161486 #define DRM_I915_VBLANK_PIPE_B 2 368e92e3a86Szw161486 369e92e3a86Szw161486 typedef struct drm_i915_vblank_pipe { 370e92e3a86Szw161486 int pipe; 371e92e3a86Szw161486 } drm_i915_vblank_pipe_t; 372e92e3a86Szw161486 373e92e3a86Szw161486 /* Schedule buffer swap at given vertical blank: 374e92e3a86Szw161486 */ 375e92e3a86Szw161486 typedef struct drm_i915_vblank_swap { 376e92e3a86Szw161486 drm_drawable_t drawable; 377e92e3a86Szw161486 drm_vblank_seq_type_t seqtype; 378e92e3a86Szw161486 unsigned int sequence; 379e92e3a86Szw161486 } drm_i915_vblank_swap_t; 380e92e3a86Szw161486 381*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_MMIO_READ 0 382*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_MMIO_WRITE 1 383*0035d21cSmiao chen - Sun Microsystems - Beijing China 384*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_MMIO_MAY_READ 0x1 385*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_MMIO_MAY_WRITE 0x2 386*0035d21cSmiao chen - Sun Microsystems - Beijing China 387*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_IA_PRIMATIVES_COUNT 0 388*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_IA_VERTICES_COUNT 1 389*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_VS_INVOCATION_COUNT 2 390*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_GS_PRIMITIVES_COUNT 3 391*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_GS_INVOCATION_COUNT 4 392*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_CL_PRIMITIVES_COUNT 5 393*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_CL_INVOCATION_COUNT 6 394*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_PS_INVOCATION_COUNT 7 395*0035d21cSmiao chen - Sun Microsystems - Beijing China #define MMIO_REGS_PS_DEPTH_COUNT 8 396*0035d21cSmiao chen - Sun Microsystems - Beijing China 397*0035d21cSmiao chen - Sun Microsystems - Beijing China typedef struct drm_i915_mmio_entry { 398*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int flag; 399*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int offset; 400*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int size; 401*0035d21cSmiao chen - Sun Microsystems - Beijing China } drm_i915_mmio_entry_t; 402*0035d21cSmiao chen - Sun Microsystems - Beijing China 403*0035d21cSmiao chen - Sun Microsystems - Beijing China typedef struct drm_i915_mmio { 404*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int read_write:1; 405*0035d21cSmiao chen - Sun Microsystems - Beijing China unsigned int reg:31; 406*0035d21cSmiao chen - Sun Microsystems - Beijing China void __user *data; 407*0035d21cSmiao chen - Sun Microsystems - Beijing China } drm_i915_mmio_t; 408*0035d21cSmiao chen - Sun Microsystems - Beijing China 409dc8c6b69Sms148562 typedef struct drm_i915_hws_addr { 410dc8c6b69Sms148562 uint64_t addr; 411dc8c6b69Sms148562 } drm_i915_hws_addr_t; 412dc8c6b69Sms148562 413dc8c6b69Sms148562 414*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_init { 415*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 416*0035d21cSmiao chen - Sun Microsystems - Beijing China * Beginning offset in the GTT to be managed by the DRM memory 417*0035d21cSmiao chen - Sun Microsystems - Beijing China * manager. 418*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 419*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t gtt_start; 420*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 421*0035d21cSmiao chen - Sun Microsystems - Beijing China * Ending offset in the GTT to be managed by the DRM memory 422*0035d21cSmiao chen - Sun Microsystems - Beijing China * manager. 423*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 424*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t gtt_end; 425*0035d21cSmiao chen - Sun Microsystems - Beijing China 426*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 427*0035d21cSmiao chen - Sun Microsystems - Beijing China 428*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_create { 429*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 430*0035d21cSmiao chen - Sun Microsystems - Beijing China * Requested size for the object. 431*0035d21cSmiao chen - Sun Microsystems - Beijing China * 432*0035d21cSmiao chen - Sun Microsystems - Beijing China * The (page-aligned) allocated size for the object will be returned. 433*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 434*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t size; 435*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 436*0035d21cSmiao chen - Sun Microsystems - Beijing China * Returned handle for the object. 437*0035d21cSmiao chen - Sun Microsystems - Beijing China * 438*0035d21cSmiao chen - Sun Microsystems - Beijing China * Object handles are nonzero. 439*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 440*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 441*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 442*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 443*0035d21cSmiao chen - Sun Microsystems - Beijing China 444*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_pread { 445*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle for the object being read. */ 446*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 447*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 448*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Offset into the object to read from */ 449*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 450*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Length of data to read */ 451*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t size; 452*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 453*0035d21cSmiao chen - Sun Microsystems - Beijing China * Pointer to write the data into. 454*0035d21cSmiao chen - Sun Microsystems - Beijing China * 455*0035d21cSmiao chen - Sun Microsystems - Beijing China * This is a fixed-size type for 32/64 compatibility. 456*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 457*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t data_ptr; 458*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 459*0035d21cSmiao chen - Sun Microsystems - Beijing China 460*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_pwrite { 461*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle for the object being written to. */ 462*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 463*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 464*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Offset into the object to write to */ 465*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 466*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Length of data to write */ 467*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t size; 468*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 469*0035d21cSmiao chen - Sun Microsystems - Beijing China * Pointer to read the data from. 470*0035d21cSmiao chen - Sun Microsystems - Beijing China * 471*0035d21cSmiao chen - Sun Microsystems - Beijing China * This is a fixed-size type for 32/64 compatibility. 472*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 473*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t data_ptr; 474*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 475*0035d21cSmiao chen - Sun Microsystems - Beijing China 476*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_mmap { 477*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle for the object being mapped. */ 478*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 479*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 480*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Offset in the object to map. */ 481*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 482*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 483*0035d21cSmiao chen - Sun Microsystems - Beijing China * Length of data to map. 484*0035d21cSmiao chen - Sun Microsystems - Beijing China * 485*0035d21cSmiao chen - Sun Microsystems - Beijing China * The value will be page-aligned. 486*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 487*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t size; 488*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 489*0035d21cSmiao chen - Sun Microsystems - Beijing China * Returned pointer the data was mapped at. 490*0035d21cSmiao chen - Sun Microsystems - Beijing China * 491*0035d21cSmiao chen - Sun Microsystems - Beijing China * This is a fixed-size type for 32/64 compatibility. 492*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 493*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t addr_ptr; 494*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 495*0035d21cSmiao chen - Sun Microsystems - Beijing China 496*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_mmap_gtt { 497*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle for the object being mapped. */ 498*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 499*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 500*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 501*0035d21cSmiao chen - Sun Microsystems - Beijing China * Fake offset to use for subsequent mmap call 502*0035d21cSmiao chen - Sun Microsystems - Beijing China * 503*0035d21cSmiao chen - Sun Microsystems - Beijing China * This is a fixed-size type for 32/64 compatibility. 504*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 505*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 506*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 507*0035d21cSmiao chen - Sun Microsystems - Beijing China 508*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_set_domain { 509*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle for the object */ 510*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 511*0035d21cSmiao chen - Sun Microsystems - Beijing China 512*0035d21cSmiao chen - Sun Microsystems - Beijing China /** New read domains */ 513*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t read_domains; 514*0035d21cSmiao chen - Sun Microsystems - Beijing China 515*0035d21cSmiao chen - Sun Microsystems - Beijing China /** New write domain */ 516*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t write_domain; 517*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 518*0035d21cSmiao chen - Sun Microsystems - Beijing China 519*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_sw_finish { 520*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle for the object */ 521*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 522*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 523*0035d21cSmiao chen - Sun Microsystems - Beijing China 524*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_relocation_entry { 525*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 526*0035d21cSmiao chen - Sun Microsystems - Beijing China * Handle of the buffer being pointed to by this relocation entry. 527*0035d21cSmiao chen - Sun Microsystems - Beijing China * 528*0035d21cSmiao chen - Sun Microsystems - Beijing China * It's appealing to make this be an index into the mm_validate_entry 529*0035d21cSmiao chen - Sun Microsystems - Beijing China * list to refer to the buffer, but this allows the driver to create 530*0035d21cSmiao chen - Sun Microsystems - Beijing China * a relocation list for state buffers and not re-write it per 531*0035d21cSmiao chen - Sun Microsystems - Beijing China * exec using the buffer. 532*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 533*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t target_handle; 534*0035d21cSmiao chen - Sun Microsystems - Beijing China 535*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 536*0035d21cSmiao chen - Sun Microsystems - Beijing China * Value to be added to the offset of the target buffer to make up 537*0035d21cSmiao chen - Sun Microsystems - Beijing China * the relocation entry. 538*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 539*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t delta; 540*0035d21cSmiao chen - Sun Microsystems - Beijing China 541*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Offset in the buffer the relocation entry will be written into */ 542*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 543*0035d21cSmiao chen - Sun Microsystems - Beijing China 544*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 545*0035d21cSmiao chen - Sun Microsystems - Beijing China * Offset value of the target buffer that the relocation entry was last 546*0035d21cSmiao chen - Sun Microsystems - Beijing China * written as. 547*0035d21cSmiao chen - Sun Microsystems - Beijing China * 548*0035d21cSmiao chen - Sun Microsystems - Beijing China * If the buffer has the same offset as last time, we can skip syncing 549*0035d21cSmiao chen - Sun Microsystems - Beijing China * and writing the relocation. This value is written back out by 550*0035d21cSmiao chen - Sun Microsystems - Beijing China * the execbuffer ioctl when the relocation is written. 551*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 552*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t presumed_offset; 553*0035d21cSmiao chen - Sun Microsystems - Beijing China 554*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 555*0035d21cSmiao chen - Sun Microsystems - Beijing China * Target memory domains read by this operation. 556*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 557*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t read_domains; 558*0035d21cSmiao chen - Sun Microsystems - Beijing China 559*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 560*0035d21cSmiao chen - Sun Microsystems - Beijing China * Target memory domains written by this operation. 561*0035d21cSmiao chen - Sun Microsystems - Beijing China * 562*0035d21cSmiao chen - Sun Microsystems - Beijing China * Note that only one domain may be written by the whole 563*0035d21cSmiao chen - Sun Microsystems - Beijing China * execbuffer operation, so that where there are conflicts, 564*0035d21cSmiao chen - Sun Microsystems - Beijing China * the application will get -EINVAL back. 565*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 566*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t write_domain; 567*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 568*0035d21cSmiao chen - Sun Microsystems - Beijing China 569*0035d21cSmiao chen - Sun Microsystems - Beijing China /** @{ 570*0035d21cSmiao chen - Sun Microsystems - Beijing China * Intel memory domains 571*0035d21cSmiao chen - Sun Microsystems - Beijing China * 572*0035d21cSmiao chen - Sun Microsystems - Beijing China * Most of these just align with the various caches in 573*0035d21cSmiao chen - Sun Microsystems - Beijing China * the system and are used to flush and invalidate as 574*0035d21cSmiao chen - Sun Microsystems - Beijing China * objects end up cached in different domains. 575*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 576*0035d21cSmiao chen - Sun Microsystems - Beijing China /** CPU cache */ 577*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_CPU 0x00000001 578*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Render cache, used by 2D and 3D drawing */ 579*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_RENDER 0x00000002 580*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Sampler cache, used by texture engine */ 581*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_SAMPLER 0x00000004 582*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Command queue, used to load batch buffers */ 583*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_COMMAND 0x00000008 584*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Instruction cache, used by shader programs */ 585*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 586*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Vertex address cache */ 587*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_VERTEX 0x00000020 588*0035d21cSmiao chen - Sun Microsystems - Beijing China /** GTT domain - aperture and scanout */ 589*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_GEM_DOMAIN_GTT 0x00000040 590*0035d21cSmiao chen - Sun Microsystems - Beijing China /** @} */ 591*0035d21cSmiao chen - Sun Microsystems - Beijing China 592*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_exec_object { 593*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 594*0035d21cSmiao chen - Sun Microsystems - Beijing China * User's handle for a buffer to be bound into the GTT for this 595*0035d21cSmiao chen - Sun Microsystems - Beijing China * operation. 596*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 597*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 598*0035d21cSmiao chen - Sun Microsystems - Beijing China 599*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Number of relocations to be performed on this buffer */ 600*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t relocation_count; 601*0035d21cSmiao chen - Sun Microsystems - Beijing China 602*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 603*0035d21cSmiao chen - Sun Microsystems - Beijing China * Pointer to array of struct drm_i915_gem_relocation_entry containing 604*0035d21cSmiao chen - Sun Microsystems - Beijing China * the relocations to be performed in this buffer. 605*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 606*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t relocs_ptr; 607*0035d21cSmiao chen - Sun Microsystems - Beijing China 608*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Required alignment in graphics aperture */ 609*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t alignment; 610*0035d21cSmiao chen - Sun Microsystems - Beijing China 611*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 612*0035d21cSmiao chen - Sun Microsystems - Beijing China * Returned value of the updated offset of the object, for future 613*0035d21cSmiao chen - Sun Microsystems - Beijing China * presumed_offset writes. 614*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 615*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 616*0035d21cSmiao chen - Sun Microsystems - Beijing China 617*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 618*0035d21cSmiao chen - Sun Microsystems - Beijing China 619*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_execbuffer { 620*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 621*0035d21cSmiao chen - Sun Microsystems - Beijing China * List of buffers to be validated with their relocations to be 622*0035d21cSmiao chen - Sun Microsystems - Beijing China * performend on them. 623*0035d21cSmiao chen - Sun Microsystems - Beijing China * 624*0035d21cSmiao chen - Sun Microsystems - Beijing China * This is a pointer to an array of struct drm_i915_gem_validate_entry. 625*0035d21cSmiao chen - Sun Microsystems - Beijing China * 626*0035d21cSmiao chen - Sun Microsystems - Beijing China * These buffers must be listed in an order such that all relocations 627*0035d21cSmiao chen - Sun Microsystems - Beijing China * a buffer is performing refer to buffers that have already appeared 628*0035d21cSmiao chen - Sun Microsystems - Beijing China * in the validate list. 629*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 630*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t buffers_ptr; 631*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t buffer_count; 632*0035d21cSmiao chen - Sun Microsystems - Beijing China 633*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Offset in the batchbuffer to start execution from. */ 634*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t batch_start_offset; 635*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Bytes used in batchbuffer from batch_start_offset */ 636*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t batch_len; 637*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t DR1; 638*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t DR4; 639*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t num_cliprects; 640*0035d21cSmiao chen - Sun Microsystems - Beijing China /** This is a struct drm_clip_rect *cliprects */ 641*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t cliprects_ptr; 642*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 643*0035d21cSmiao chen - Sun Microsystems - Beijing China 644*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_pin { 645*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle of the buffer to be pinned. */ 646*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 647*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 648*0035d21cSmiao chen - Sun Microsystems - Beijing China 649*0035d21cSmiao chen - Sun Microsystems - Beijing China /** alignment required within the aperture */ 650*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t alignment; 651*0035d21cSmiao chen - Sun Microsystems - Beijing China 652*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Returned GTT offset of the buffer. */ 653*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t offset; 654*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 655*0035d21cSmiao chen - Sun Microsystems - Beijing China 656*0035d21cSmiao chen - Sun Microsystems - Beijing China 657*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_unpin { 658*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle of the buffer to be unpinned. */ 659*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 660*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t pad; 661*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 662*0035d21cSmiao chen - Sun Microsystems - Beijing China 663*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_busy { 664*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle of the buffer to check for busy */ 665*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 666*0035d21cSmiao chen - Sun Microsystems - Beijing China 667*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Return busy status (1 if busy, 0 if idle) */ 668*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t busy; 669*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 670*0035d21cSmiao chen - Sun Microsystems - Beijing China 671*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_TILING_NONE 0 672*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_TILING_X 1 673*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_TILING_Y 2 674*0035d21cSmiao chen - Sun Microsystems - Beijing China 675*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_BIT_6_SWIZZLE_NONE 0 676*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_BIT_6_SWIZZLE_9 1 677*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_BIT_6_SWIZZLE_9_10 2 678*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_BIT_6_SWIZZLE_9_11 3 679*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_BIT_6_SWIZZLE_9_10_11 4 680*0035d21cSmiao chen - Sun Microsystems - Beijing China /* Not seen by userland */ 681*0035d21cSmiao chen - Sun Microsystems - Beijing China #define I915_BIT_6_SWIZZLE_UNKNOWN 5 682*0035d21cSmiao chen - Sun Microsystems - Beijing China 683*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_set_tiling { 684*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle of the buffer to have its tiling state updated */ 685*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 686*0035d21cSmiao chen - Sun Microsystems - Beijing China 687*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 688*0035d21cSmiao chen - Sun Microsystems - Beijing China * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 689*0035d21cSmiao chen - Sun Microsystems - Beijing China * I915_TILING_Y). 690*0035d21cSmiao chen - Sun Microsystems - Beijing China * 691*0035d21cSmiao chen - Sun Microsystems - Beijing China * This value is to be set on request, and will be updated by the 692*0035d21cSmiao chen - Sun Microsystems - Beijing China * kernel on successful return with the actual chosen tiling layout. 693*0035d21cSmiao chen - Sun Microsystems - Beijing China * 694*0035d21cSmiao chen - Sun Microsystems - Beijing China * The tiling mode may be demoted to I915_TILING_NONE when the system 695*0035d21cSmiao chen - Sun Microsystems - Beijing China * has bit 6 swizzling that can't be managed correctly by GEM. 696*0035d21cSmiao chen - Sun Microsystems - Beijing China * 697*0035d21cSmiao chen - Sun Microsystems - Beijing China * Buffer contents become undefined when changing tiling_mode. 698*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 699*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t tiling_mode; 700*0035d21cSmiao chen - Sun Microsystems - Beijing China 701*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 702*0035d21cSmiao chen - Sun Microsystems - Beijing China * Stride in bytes for the object when in I915_TILING_X or 703*0035d21cSmiao chen - Sun Microsystems - Beijing China * I915_TILING_Y. 704*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 705*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t stride; 706*0035d21cSmiao chen - Sun Microsystems - Beijing China 707*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 708*0035d21cSmiao chen - Sun Microsystems - Beijing China * Returned address bit 6 swizzling required for CPU access through 709*0035d21cSmiao chen - Sun Microsystems - Beijing China * mmap mapping. 710*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 711*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t swizzle_mode; 712*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 713*0035d21cSmiao chen - Sun Microsystems - Beijing China 714*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_get_tiling { 715*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Handle of the buffer to get tiling state for. */ 716*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t handle; 717*0035d21cSmiao chen - Sun Microsystems - Beijing China 718*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 719*0035d21cSmiao chen - Sun Microsystems - Beijing China * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 720*0035d21cSmiao chen - Sun Microsystems - Beijing China * I915_TILING_Y). 721*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 722*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t tiling_mode; 723*0035d21cSmiao chen - Sun Microsystems - Beijing China 724*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 725*0035d21cSmiao chen - Sun Microsystems - Beijing China * Returned address bit 6 swizzling required for CPU access through 726*0035d21cSmiao chen - Sun Microsystems - Beijing China * mmap mapping. 727*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 728*0035d21cSmiao chen - Sun Microsystems - Beijing China uint32_t swizzle_mode; 729*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 730*0035d21cSmiao chen - Sun Microsystems - Beijing China 731*0035d21cSmiao chen - Sun Microsystems - Beijing China struct drm_i915_gem_get_aperture { 732*0035d21cSmiao chen - Sun Microsystems - Beijing China /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 733*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t aper_size; 734*0035d21cSmiao chen - Sun Microsystems - Beijing China 735*0035d21cSmiao chen - Sun Microsystems - Beijing China /** 736*0035d21cSmiao chen - Sun Microsystems - Beijing China * Available space in the aperture used by i915_gem_execbuffer, in 737*0035d21cSmiao chen - Sun Microsystems - Beijing China * bytes 738*0035d21cSmiao chen - Sun Microsystems - Beijing China */ 739*0035d21cSmiao chen - Sun Microsystems - Beijing China uint64_t aper_available_size; 740*0035d21cSmiao chen - Sun Microsystems - Beijing China }; 741*0035d21cSmiao chen - Sun Microsystems - Beijing China 742ae115bc7Smrj #endif /* _I915_DRM_H */ 743