i915_drm.h revision 424e9256
122944501Smrg/* 222944501Smrg * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 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 722944501Smrg * "Software"), to deal in the Software without restriction, including 822944501Smrg * without limitation the rights to use, copy, modify, merge, publish, 922944501Smrg * distribute, sub license, and/or sell copies of the Software, and to 1022944501Smrg * permit persons to whom the Software is furnished to do so, subject to 1122944501Smrg * the following conditions: 1222944501Smrg * 1322944501Smrg * The above copyright notice and this permission notice (including the 1422944501Smrg * next paragraph) shall be included in all copies or substantial portions 1522944501Smrg * of the Software. 1622944501Smrg * 1722944501Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1822944501Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1922944501Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 2022944501Smrg * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 2122944501Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 2222944501Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 2322944501Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2422944501Smrg * 2522944501Smrg */ 2622944501Smrg 2722944501Smrg#ifndef _I915_DRM_H_ 2822944501Smrg#define _I915_DRM_H_ 2922944501Smrg 30e88f27b3Smrg#include <drm.h> 3122944501Smrg 3222944501Smrg/* Please note that modifications to all structs defined here are 3322944501Smrg * subject to backwards-compatibility constraints. 3422944501Smrg */ 3522944501Smrg 36e88f27b3Smrg/** 37e88f27b3Smrg * DOC: uevents generated by i915 on it's device node 38e88f27b3Smrg * 39e88f27b3Smrg * I915_L3_PARITY_UEVENT - Generated when the driver receives a parity mismatch 40e88f27b3Smrg * event from the gpu l3 cache. Additional information supplied is ROW, 41e88f27b3Smrg * BANK, SUBBANK, SLICE of the affected cacheline. Userspace should keep 42e88f27b3Smrg * track of these events and if a specific cache-line seems to have a 43e88f27b3Smrg * persistent error remap it with the l3 remapping tool supplied in 44e88f27b3Smrg * intel-gpu-tools. The value supplied with the event is always 1. 45e88f27b3Smrg * 46e88f27b3Smrg * I915_ERROR_UEVENT - Generated upon error detection, currently only via 47e88f27b3Smrg * hangcheck. The error detection event is a good indicator of when things 48e88f27b3Smrg * began to go badly. The value supplied with the event is a 1 upon error 49e88f27b3Smrg * detection, and a 0 upon reset completion, signifying no more error 50e88f27b3Smrg * exists. NOTE: Disabling hangcheck or reset via module parameter will 51e88f27b3Smrg * cause the related events to not be seen. 52e88f27b3Smrg * 53e88f27b3Smrg * I915_RESET_UEVENT - Event is generated just before an attempt to reset the 54e88f27b3Smrg * the GPU. The value supplied with the event is always 1. NOTE: Disable 55e88f27b3Smrg * reset via module parameter will cause this event to not be seen. 56e88f27b3Smrg */ 57e88f27b3Smrg#define I915_L3_PARITY_UEVENT "L3_PARITY_ERROR" 58e88f27b3Smrg#define I915_ERROR_UEVENT "ERROR" 59e88f27b3Smrg#define I915_RESET_UEVENT "RESET" 60e88f27b3Smrg 6122944501Smrg/* Each region is a minimum of 16k, and there are at most 255 of them. 6222944501Smrg */ 6322944501Smrg#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use 6422944501Smrg * of chars for next/prev indices */ 6522944501Smrg#define I915_LOG_MIN_TEX_REGION_SIZE 14 6622944501Smrg 6722944501Smrgtypedef struct _drm_i915_init { 6822944501Smrg enum { 6922944501Smrg I915_INIT_DMA = 0x01, 7022944501Smrg I915_CLEANUP_DMA = 0x02, 7122944501Smrg I915_RESUME_DMA = 0x03 7222944501Smrg } func; 7322944501Smrg unsigned int mmio_offset; 7422944501Smrg int sarea_priv_offset; 7522944501Smrg unsigned int ring_start; 7622944501Smrg unsigned int ring_end; 7722944501Smrg unsigned int ring_size; 7822944501Smrg unsigned int front_offset; 7922944501Smrg unsigned int back_offset; 8022944501Smrg unsigned int depth_offset; 8122944501Smrg unsigned int w; 8222944501Smrg unsigned int h; 8322944501Smrg unsigned int pitch; 8422944501Smrg unsigned int pitch_bits; 8522944501Smrg unsigned int back_pitch; 8622944501Smrg unsigned int depth_pitch; 8722944501Smrg unsigned int cpp; 8822944501Smrg unsigned int chipset; 8922944501Smrg} drm_i915_init_t; 9022944501Smrg 9122944501Smrgtypedef struct _drm_i915_sarea { 9222944501Smrg struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1]; 9322944501Smrg int last_upload; /* last time texture was uploaded */ 9422944501Smrg int last_enqueue; /* last time a buffer was enqueued */ 9522944501Smrg int last_dispatch; /* age of the most recently dispatched buffer */ 9622944501Smrg int ctxOwner; /* last context to upload state */ 9722944501Smrg int texAge; 9822944501Smrg int pf_enabled; /* is pageflipping allowed? */ 9922944501Smrg int pf_active; 10022944501Smrg int pf_current_page; /* which buffer is being displayed? */ 10122944501Smrg int perf_boxes; /* performance boxes to be displayed */ 10222944501Smrg int width, height; /* screen size in pixels */ 10322944501Smrg 10422944501Smrg drm_handle_t front_handle; 10522944501Smrg int front_offset; 10622944501Smrg int front_size; 10722944501Smrg 10822944501Smrg drm_handle_t back_handle; 10922944501Smrg int back_offset; 11022944501Smrg int back_size; 11122944501Smrg 11222944501Smrg drm_handle_t depth_handle; 11322944501Smrg int depth_offset; 11422944501Smrg int depth_size; 11522944501Smrg 11622944501Smrg drm_handle_t tex_handle; 11722944501Smrg int tex_offset; 11822944501Smrg int tex_size; 11922944501Smrg int log_tex_granularity; 12022944501Smrg int pitch; 12122944501Smrg int rotation; /* 0, 90, 180 or 270 */ 12222944501Smrg int rotated_offset; 12322944501Smrg int rotated_size; 12422944501Smrg int rotated_pitch; 12522944501Smrg int virtualX, virtualY; 12622944501Smrg 12722944501Smrg unsigned int front_tiled; 12822944501Smrg unsigned int back_tiled; 12922944501Smrg unsigned int depth_tiled; 13022944501Smrg unsigned int rotated_tiled; 13122944501Smrg unsigned int rotated2_tiled; 13222944501Smrg 13322944501Smrg int pipeA_x; 13422944501Smrg int pipeA_y; 13522944501Smrg int pipeA_w; 13622944501Smrg int pipeA_h; 13722944501Smrg int pipeB_x; 13822944501Smrg int pipeB_y; 13922944501Smrg int pipeB_w; 14022944501Smrg int pipeB_h; 14122944501Smrg 14222944501Smrg /* fill out some space for old userspace triple buffer */ 14322944501Smrg drm_handle_t unused_handle; 14422944501Smrg __u32 unused1, unused2, unused3; 14522944501Smrg 14622944501Smrg /* buffer object handles for static buffers. May change 14722944501Smrg * over the lifetime of the client. 14822944501Smrg */ 14922944501Smrg __u32 front_bo_handle; 15022944501Smrg __u32 back_bo_handle; 15122944501Smrg __u32 unused_bo_handle; 15222944501Smrg __u32 depth_bo_handle; 15322944501Smrg 15422944501Smrg} drm_i915_sarea_t; 15522944501Smrg 15622944501Smrg/* due to userspace building against these headers we need some compat here */ 15722944501Smrg#define planeA_x pipeA_x 15822944501Smrg#define planeA_y pipeA_y 15922944501Smrg#define planeA_w pipeA_w 16022944501Smrg#define planeA_h pipeA_h 16122944501Smrg#define planeB_x pipeB_x 16222944501Smrg#define planeB_y pipeB_y 16322944501Smrg#define planeB_w pipeB_w 16422944501Smrg#define planeB_h pipeB_h 16522944501Smrg 16622944501Smrg/* Flags for perf_boxes 16722944501Smrg */ 16822944501Smrg#define I915_BOX_RING_EMPTY 0x1 16922944501Smrg#define I915_BOX_FLIP 0x2 17022944501Smrg#define I915_BOX_WAIT 0x4 17122944501Smrg#define I915_BOX_TEXTURE_LOAD 0x8 17222944501Smrg#define I915_BOX_LOST_CONTEXT 0x10 17322944501Smrg 17422944501Smrg/* I915 specific ioctls 17522944501Smrg * The device specific ioctl range is 0x40 to 0x79. 17622944501Smrg */ 17722944501Smrg#define DRM_I915_INIT 0x00 17822944501Smrg#define DRM_I915_FLUSH 0x01 17922944501Smrg#define DRM_I915_FLIP 0x02 18022944501Smrg#define DRM_I915_BATCHBUFFER 0x03 18122944501Smrg#define DRM_I915_IRQ_EMIT 0x04 18222944501Smrg#define DRM_I915_IRQ_WAIT 0x05 18322944501Smrg#define DRM_I915_GETPARAM 0x06 18422944501Smrg#define DRM_I915_SETPARAM 0x07 18522944501Smrg#define DRM_I915_ALLOC 0x08 18622944501Smrg#define DRM_I915_FREE 0x09 18722944501Smrg#define DRM_I915_INIT_HEAP 0x0a 18822944501Smrg#define DRM_I915_CMDBUFFER 0x0b 18922944501Smrg#define DRM_I915_DESTROY_HEAP 0x0c 19022944501Smrg#define DRM_I915_SET_VBLANK_PIPE 0x0d 19122944501Smrg#define DRM_I915_GET_VBLANK_PIPE 0x0e 19222944501Smrg#define DRM_I915_VBLANK_SWAP 0x0f 19322944501Smrg#define DRM_I915_HWS_ADDR 0x11 19422944501Smrg#define DRM_I915_GEM_INIT 0x13 19522944501Smrg#define DRM_I915_GEM_EXECBUFFER 0x14 19622944501Smrg#define DRM_I915_GEM_PIN 0x15 19722944501Smrg#define DRM_I915_GEM_UNPIN 0x16 19822944501Smrg#define DRM_I915_GEM_BUSY 0x17 19922944501Smrg#define DRM_I915_GEM_THROTTLE 0x18 20022944501Smrg#define DRM_I915_GEM_ENTERVT 0x19 20122944501Smrg#define DRM_I915_GEM_LEAVEVT 0x1a 20222944501Smrg#define DRM_I915_GEM_CREATE 0x1b 20322944501Smrg#define DRM_I915_GEM_PREAD 0x1c 20422944501Smrg#define DRM_I915_GEM_PWRITE 0x1d 20522944501Smrg#define DRM_I915_GEM_MMAP 0x1e 20622944501Smrg#define DRM_I915_GEM_SET_DOMAIN 0x1f 20722944501Smrg#define DRM_I915_GEM_SW_FINISH 0x20 20822944501Smrg#define DRM_I915_GEM_SET_TILING 0x21 20922944501Smrg#define DRM_I915_GEM_GET_TILING 0x22 21022944501Smrg#define DRM_I915_GEM_GET_APERTURE 0x23 21122944501Smrg#define DRM_I915_GEM_MMAP_GTT 0x24 21222944501Smrg#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25 21322944501Smrg#define DRM_I915_GEM_MADVISE 0x26 21422944501Smrg#define DRM_I915_OVERLAY_PUT_IMAGE 0x27 21522944501Smrg#define DRM_I915_OVERLAY_ATTRS 0x28 21622944501Smrg#define DRM_I915_GEM_EXECBUFFER2 0x29 217e88f27b3Smrg#define DRM_I915_GET_SPRITE_COLORKEY 0x2a 218e88f27b3Smrg#define DRM_I915_SET_SPRITE_COLORKEY 0x2b 219e88f27b3Smrg#define DRM_I915_GEM_WAIT 0x2c 220e88f27b3Smrg#define DRM_I915_GEM_CONTEXT_CREATE 0x2d 221e88f27b3Smrg#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e 222e88f27b3Smrg#define DRM_I915_GEM_SET_CACHING 0x2f 223e88f27b3Smrg#define DRM_I915_GEM_GET_CACHING 0x30 224e88f27b3Smrg#define DRM_I915_REG_READ 0x31 225e88f27b3Smrg#define DRM_I915_GET_RESET_STATS 0x32 226baaff307Smrg#define DRM_I915_GEM_USERPTR 0x33 227424e9256Smrg#define DRM_I915_GEM_CONTEXT_GETPARAM 0x34 228424e9256Smrg#define DRM_I915_GEM_CONTEXT_SETPARAM 0x35 22922944501Smrg 23022944501Smrg#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 23122944501Smrg#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 23222944501Smrg#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) 23322944501Smrg#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) 23422944501Smrg#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) 23522944501Smrg#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) 23622944501Smrg#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) 23722944501Smrg#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) 23822944501Smrg#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) 23922944501Smrg#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) 24022944501Smrg#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) 24122944501Smrg#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) 24222944501Smrg#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) 24322944501Smrg#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 24422944501Smrg#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 24522944501Smrg#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 24669dda199Smrg#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init) 24722944501Smrg#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 24822944501Smrg#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 24922944501Smrg#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) 25022944501Smrg#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 25122944501Smrg#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 25222944501Smrg#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 253e88f27b3Smrg#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching) 254e88f27b3Smrg#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching) 25522944501Smrg#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) 25622944501Smrg#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) 25722944501Smrg#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) 25822944501Smrg#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) 25922944501Smrg#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) 26022944501Smrg#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 26122944501Smrg#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 26222944501Smrg#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) 26322944501Smrg#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 26422944501Smrg#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 26522944501Smrg#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 26622944501Smrg#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 26722944501Smrg#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 26822944501Smrg#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id) 26922944501Smrg#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 270e88f27b3Smrg#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 27122944501Smrg#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 272e88f27b3Smrg#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 273b7926a35Schristos#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 274e88f27b3Smrg#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) 275e88f27b3Smrg#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) 276e88f27b3Smrg#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 277e88f27b3Smrg#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 278e88f27b3Smrg#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) 279424e9256Smrg#define DRM_IOCTL_I915_GEM_USERPTR DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_USERPTR, struct drm_i915_gem_userptr) 280424e9256Smrg#define DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_GETPARAM, struct drm_i915_gem_context_param) 281424e9256Smrg#define DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_SETPARAM, struct drm_i915_gem_context_param) 28222944501Smrg 28322944501Smrg/* Allow drivers to submit batchbuffers directly to hardware, relying 28422944501Smrg * on the security mechanisms provided by hardware. 28522944501Smrg */ 28622944501Smrgtypedef struct drm_i915_batchbuffer { 28722944501Smrg int start; /* agp offset */ 28822944501Smrg int used; /* nr bytes in use */ 28922944501Smrg int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 29022944501Smrg int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 29122944501Smrg int num_cliprects; /* mulitpass with multiple cliprects? */ 29222944501Smrg struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ 29322944501Smrg} drm_i915_batchbuffer_t; 29422944501Smrg 29522944501Smrg/* As above, but pass a pointer to userspace buffer which can be 29622944501Smrg * validated by the kernel prior to sending to hardware. 29722944501Smrg */ 29822944501Smrgtypedef struct _drm_i915_cmdbuffer { 29922944501Smrg char *buf; /* pointer to userspace command buffer */ 30022944501Smrg int sz; /* nr bytes in buf */ 30122944501Smrg int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 30222944501Smrg int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 30322944501Smrg int num_cliprects; /* mulitpass with multiple cliprects? */ 30422944501Smrg struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ 30522944501Smrg} drm_i915_cmdbuffer_t; 30622944501Smrg 30722944501Smrg/* Userspace can request & wait on irq's: 30822944501Smrg */ 30922944501Smrgtypedef struct drm_i915_irq_emit { 31022944501Smrg int *irq_seq; 31122944501Smrg} drm_i915_irq_emit_t; 31222944501Smrg 31322944501Smrgtypedef struct drm_i915_irq_wait { 31422944501Smrg int irq_seq; 31522944501Smrg} drm_i915_irq_wait_t; 31622944501Smrg 31722944501Smrg/* Ioctl to query kernel params: 31822944501Smrg */ 31922944501Smrg#define I915_PARAM_IRQ_ACTIVE 1 32022944501Smrg#define I915_PARAM_ALLOW_BATCHBUFFER 2 32122944501Smrg#define I915_PARAM_LAST_DISPATCH 3 32222944501Smrg#define I915_PARAM_CHIPSET_ID 4 32322944501Smrg#define I915_PARAM_HAS_GEM 5 32422944501Smrg#define I915_PARAM_NUM_FENCES_AVAIL 6 32522944501Smrg#define I915_PARAM_HAS_OVERLAY 7 32622944501Smrg#define I915_PARAM_HAS_PAGEFLIPPING 8 32722944501Smrg#define I915_PARAM_HAS_EXECBUF2 9 32813d1d17dSmrg#define I915_PARAM_HAS_BSD 10 32969dda199Smrg#define I915_PARAM_HAS_BLT 11 33069dda199Smrg#define I915_PARAM_HAS_RELAXED_FENCING 12 331e88f27b3Smrg#define I915_PARAM_HAS_COHERENT_RINGS 13 332e88f27b3Smrg#define I915_PARAM_HAS_EXEC_CONSTANTS 14 333e88f27b3Smrg#define I915_PARAM_HAS_RELAXED_DELTA 15 334e88f27b3Smrg#define I915_PARAM_HAS_GEN7_SOL_RESET 16 335e88f27b3Smrg#define I915_PARAM_HAS_LLC 17 336e88f27b3Smrg#define I915_PARAM_HAS_ALIASING_PPGTT 18 337e88f27b3Smrg#define I915_PARAM_HAS_WAIT_TIMEOUT 19 338e88f27b3Smrg#define I915_PARAM_HAS_SEMAPHORES 20 339e88f27b3Smrg#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 340e88f27b3Smrg#define I915_PARAM_HAS_VEBOX 22 341e88f27b3Smrg#define I915_PARAM_HAS_SECURE_BATCHES 23 342e88f27b3Smrg#define I915_PARAM_HAS_PINNED_BATCHES 24 343e88f27b3Smrg#define I915_PARAM_HAS_EXEC_NO_RELOC 25 344e88f27b3Smrg#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 345e88f27b3Smrg#define I915_PARAM_HAS_WT 27 346baaff307Smrg#define I915_PARAM_CMD_PARSER_VERSION 28 347424e9256Smrg#define I915_PARAM_HAS_COHERENT_PHYS_GTT 29 348424e9256Smrg#define I915_PARAM_MMAP_VERSION 30 349424e9256Smrg#define I915_PARAM_HAS_BSD2 31 350424e9256Smrg#define I915_PARAM_REVISION 32 351424e9256Smrg#define I915_PARAM_SUBSLICE_TOTAL 33 352424e9256Smrg#define I915_PARAM_EU_TOTAL 34 35322944501Smrg 35422944501Smrgtypedef struct drm_i915_getparam { 35522944501Smrg int param; 35622944501Smrg int *value; 35722944501Smrg} drm_i915_getparam_t; 35822944501Smrg 35922944501Smrg/* Ioctl to set kernel params: 36022944501Smrg */ 36122944501Smrg#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 36222944501Smrg#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 36322944501Smrg#define I915_SETPARAM_ALLOW_BATCHBUFFER 3 36422944501Smrg#define I915_SETPARAM_NUM_USED_FENCES 4 36522944501Smrg 36622944501Smrgtypedef struct drm_i915_setparam { 36722944501Smrg int param; 36822944501Smrg int value; 36922944501Smrg} drm_i915_setparam_t; 37022944501Smrg 37122944501Smrg/* A memory manager for regions of shared memory: 37222944501Smrg */ 37322944501Smrg#define I915_MEM_REGION_AGP 1 37422944501Smrg 37522944501Smrgtypedef struct drm_i915_mem_alloc { 37622944501Smrg int region; 37722944501Smrg int alignment; 37822944501Smrg int size; 37922944501Smrg int *region_offset; /* offset from start of fb or agp */ 38022944501Smrg} drm_i915_mem_alloc_t; 38122944501Smrg 38222944501Smrgtypedef struct drm_i915_mem_free { 38322944501Smrg int region; 38422944501Smrg int region_offset; 38522944501Smrg} drm_i915_mem_free_t; 38622944501Smrg 38722944501Smrgtypedef struct drm_i915_mem_init_heap { 38822944501Smrg int region; 38922944501Smrg int size; 39022944501Smrg int start; 39122944501Smrg} drm_i915_mem_init_heap_t; 39222944501Smrg 39322944501Smrg/* Allow memory manager to be torn down and re-initialized (eg on 39422944501Smrg * rotate): 39522944501Smrg */ 39622944501Smrgtypedef struct drm_i915_mem_destroy_heap { 39722944501Smrg int region; 39822944501Smrg} drm_i915_mem_destroy_heap_t; 39922944501Smrg 40022944501Smrg/* Allow X server to configure which pipes to monitor for vblank signals 40122944501Smrg */ 40222944501Smrg#define DRM_I915_VBLANK_PIPE_A 1 40322944501Smrg#define DRM_I915_VBLANK_PIPE_B 2 40422944501Smrg 40522944501Smrgtypedef struct drm_i915_vblank_pipe { 40622944501Smrg int pipe; 40722944501Smrg} drm_i915_vblank_pipe_t; 40822944501Smrg 40922944501Smrg/* Schedule buffer swap at given vertical blank: 41022944501Smrg */ 41122944501Smrgtypedef struct drm_i915_vblank_swap { 41222944501Smrg drm_drawable_t drawable; 41322944501Smrg enum drm_vblank_seq_type seqtype; 41422944501Smrg unsigned int sequence; 41522944501Smrg} drm_i915_vblank_swap_t; 41622944501Smrg 41722944501Smrgtypedef struct drm_i915_hws_addr { 41822944501Smrg __u64 addr; 41922944501Smrg} drm_i915_hws_addr_t; 42022944501Smrg 42122944501Smrgstruct drm_i915_gem_init { 42222944501Smrg /** 42322944501Smrg * Beginning offset in the GTT to be managed by the DRM memory 42422944501Smrg * manager. 42522944501Smrg */ 42622944501Smrg __u64 gtt_start; 42722944501Smrg /** 42822944501Smrg * Ending offset in the GTT to be managed by the DRM memory 42922944501Smrg * manager. 43022944501Smrg */ 43122944501Smrg __u64 gtt_end; 43222944501Smrg}; 43322944501Smrg 43422944501Smrgstruct drm_i915_gem_create { 43522944501Smrg /** 43622944501Smrg * Requested size for the object. 43722944501Smrg * 43822944501Smrg * The (page-aligned) allocated size for the object will be returned. 43922944501Smrg */ 44022944501Smrg __u64 size; 44122944501Smrg /** 44222944501Smrg * Returned handle for the object. 44322944501Smrg * 44422944501Smrg * Object handles are nonzero. 44522944501Smrg */ 44622944501Smrg __u32 handle; 44722944501Smrg __u32 pad; 44822944501Smrg}; 44922944501Smrg 45022944501Smrgstruct drm_i915_gem_pread { 45122944501Smrg /** Handle for the object being read. */ 45222944501Smrg __u32 handle; 45322944501Smrg __u32 pad; 45422944501Smrg /** Offset into the object to read from */ 45522944501Smrg __u64 offset; 45622944501Smrg /** Length of data to read */ 45722944501Smrg __u64 size; 45822944501Smrg /** 45922944501Smrg * Pointer to write the data into. 46022944501Smrg * 46122944501Smrg * This is a fixed-size type for 32/64 compatibility. 46222944501Smrg */ 46322944501Smrg __u64 data_ptr; 46422944501Smrg}; 46522944501Smrg 46622944501Smrgstruct drm_i915_gem_pwrite { 46722944501Smrg /** Handle for the object being written to. */ 46822944501Smrg __u32 handle; 46922944501Smrg __u32 pad; 47022944501Smrg /** Offset into the object to write to */ 47122944501Smrg __u64 offset; 47222944501Smrg /** Length of data to write */ 47322944501Smrg __u64 size; 47422944501Smrg /** 47522944501Smrg * Pointer to read the data from. 47622944501Smrg * 47722944501Smrg * This is a fixed-size type for 32/64 compatibility. 47822944501Smrg */ 47922944501Smrg __u64 data_ptr; 48022944501Smrg}; 48122944501Smrg 48222944501Smrgstruct drm_i915_gem_mmap { 48322944501Smrg /** Handle for the object being mapped. */ 48422944501Smrg __u32 handle; 48522944501Smrg __u32 pad; 48622944501Smrg /** Offset in the object to map. */ 48722944501Smrg __u64 offset; 48822944501Smrg /** 48922944501Smrg * Length of data to map. 49022944501Smrg * 49122944501Smrg * The value will be page-aligned. 49222944501Smrg */ 49322944501Smrg __u64 size; 49422944501Smrg /** 49522944501Smrg * Returned pointer the data was mapped at. 49622944501Smrg * 49722944501Smrg * This is a fixed-size type for 32/64 compatibility. 49822944501Smrg */ 49922944501Smrg __u64 addr_ptr; 500424e9256Smrg 501424e9256Smrg /** 502424e9256Smrg * Flags for extended behaviour. 503424e9256Smrg * 504424e9256Smrg * Added in version 2. 505424e9256Smrg */ 506424e9256Smrg __u64 flags; 507424e9256Smrg#define I915_MMAP_WC 0x1 50822944501Smrg}; 50922944501Smrg 51022944501Smrgstruct drm_i915_gem_mmap_gtt { 51122944501Smrg /** Handle for the object being mapped. */ 51222944501Smrg __u32 handle; 51322944501Smrg __u32 pad; 51422944501Smrg /** 51522944501Smrg * Fake offset to use for subsequent mmap call 51622944501Smrg * 51722944501Smrg * This is a fixed-size type for 32/64 compatibility. 51822944501Smrg */ 51922944501Smrg __u64 offset; 52022944501Smrg}; 52122944501Smrg 52222944501Smrgstruct drm_i915_gem_set_domain { 52322944501Smrg /** Handle for the object */ 52422944501Smrg __u32 handle; 52522944501Smrg 52622944501Smrg /** New read domains */ 52722944501Smrg __u32 read_domains; 52822944501Smrg 52922944501Smrg /** New write domain */ 53022944501Smrg __u32 write_domain; 53122944501Smrg}; 53222944501Smrg 53322944501Smrgstruct drm_i915_gem_sw_finish { 53422944501Smrg /** Handle for the object */ 53522944501Smrg __u32 handle; 53622944501Smrg}; 53722944501Smrg 53822944501Smrgstruct drm_i915_gem_relocation_entry { 53922944501Smrg /** 54022944501Smrg * Handle of the buffer being pointed to by this relocation entry. 54122944501Smrg * 54222944501Smrg * It's appealing to make this be an index into the mm_validate_entry 54322944501Smrg * list to refer to the buffer, but this allows the driver to create 54422944501Smrg * a relocation list for state buffers and not re-write it per 54522944501Smrg * exec using the buffer. 54622944501Smrg */ 54722944501Smrg __u32 target_handle; 54822944501Smrg 54922944501Smrg /** 55022944501Smrg * Value to be added to the offset of the target buffer to make up 55122944501Smrg * the relocation entry. 55222944501Smrg */ 55322944501Smrg __u32 delta; 55422944501Smrg 55522944501Smrg /** Offset in the buffer the relocation entry will be written into */ 55622944501Smrg __u64 offset; 55722944501Smrg 55822944501Smrg /** 55922944501Smrg * Offset value of the target buffer that the relocation entry was last 56022944501Smrg * written as. 56122944501Smrg * 56222944501Smrg * If the buffer has the same offset as last time, we can skip syncing 56322944501Smrg * and writing the relocation. This value is written back out by 56422944501Smrg * the execbuffer ioctl when the relocation is written. 56522944501Smrg */ 56622944501Smrg __u64 presumed_offset; 56722944501Smrg 56822944501Smrg /** 56922944501Smrg * Target memory domains read by this operation. 57022944501Smrg */ 57122944501Smrg __u32 read_domains; 57222944501Smrg 57322944501Smrg /** 57422944501Smrg * Target memory domains written by this operation. 57522944501Smrg * 57622944501Smrg * Note that only one domain may be written by the whole 57722944501Smrg * execbuffer operation, so that where there are conflicts, 57822944501Smrg * the application will get -EINVAL back. 57922944501Smrg */ 58022944501Smrg __u32 write_domain; 58122944501Smrg}; 58222944501Smrg 58322944501Smrg/** @{ 58422944501Smrg * Intel memory domains 58522944501Smrg * 58622944501Smrg * Most of these just align with the various caches in 58722944501Smrg * the system and are used to flush and invalidate as 58822944501Smrg * objects end up cached in different domains. 58922944501Smrg */ 59022944501Smrg/** CPU cache */ 59122944501Smrg#define I915_GEM_DOMAIN_CPU 0x00000001 59222944501Smrg/** Render cache, used by 2D and 3D drawing */ 59322944501Smrg#define I915_GEM_DOMAIN_RENDER 0x00000002 59422944501Smrg/** Sampler cache, used by texture engine */ 59522944501Smrg#define I915_GEM_DOMAIN_SAMPLER 0x00000004 59622944501Smrg/** Command queue, used to load batch buffers */ 59722944501Smrg#define I915_GEM_DOMAIN_COMMAND 0x00000008 59822944501Smrg/** Instruction cache, used by shader programs */ 59922944501Smrg#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 60022944501Smrg/** Vertex address cache */ 60122944501Smrg#define I915_GEM_DOMAIN_VERTEX 0x00000020 60222944501Smrg/** GTT domain - aperture and scanout */ 60322944501Smrg#define I915_GEM_DOMAIN_GTT 0x00000040 60422944501Smrg/** @} */ 60522944501Smrg 60622944501Smrgstruct drm_i915_gem_exec_object { 60722944501Smrg /** 60822944501Smrg * User's handle for a buffer to be bound into the GTT for this 60922944501Smrg * operation. 61022944501Smrg */ 61122944501Smrg __u32 handle; 61222944501Smrg 61322944501Smrg /** Number of relocations to be performed on this buffer */ 61422944501Smrg __u32 relocation_count; 61522944501Smrg /** 61622944501Smrg * Pointer to array of struct drm_i915_gem_relocation_entry containing 61722944501Smrg * the relocations to be performed in this buffer. 61822944501Smrg */ 61922944501Smrg __u64 relocs_ptr; 62022944501Smrg 62122944501Smrg /** Required alignment in graphics aperture */ 62222944501Smrg __u64 alignment; 62322944501Smrg 62422944501Smrg /** 62522944501Smrg * Returned value of the updated offset of the object, for future 62622944501Smrg * presumed_offset writes. 62722944501Smrg */ 62822944501Smrg __u64 offset; 62922944501Smrg}; 63022944501Smrg 63122944501Smrgstruct drm_i915_gem_execbuffer { 63222944501Smrg /** 63322944501Smrg * List of buffers to be validated with their relocations to be 63422944501Smrg * performend on them. 63522944501Smrg * 63622944501Smrg * This is a pointer to an array of struct drm_i915_gem_validate_entry. 63722944501Smrg * 63822944501Smrg * These buffers must be listed in an order such that all relocations 63922944501Smrg * a buffer is performing refer to buffers that have already appeared 64022944501Smrg * in the validate list. 64122944501Smrg */ 64222944501Smrg __u64 buffers_ptr; 64322944501Smrg __u32 buffer_count; 64422944501Smrg 64522944501Smrg /** Offset in the batchbuffer to start execution from. */ 64622944501Smrg __u32 batch_start_offset; 64722944501Smrg /** Bytes used in batchbuffer from batch_start_offset */ 64822944501Smrg __u32 batch_len; 64922944501Smrg __u32 DR1; 65022944501Smrg __u32 DR4; 65122944501Smrg __u32 num_cliprects; 65222944501Smrg /** This is a struct drm_clip_rect *cliprects */ 65322944501Smrg __u64 cliprects_ptr; 65422944501Smrg}; 65522944501Smrg 65622944501Smrgstruct drm_i915_gem_exec_object2 { 65722944501Smrg /** 65822944501Smrg * User's handle for a buffer to be bound into the GTT for this 65922944501Smrg * operation. 66022944501Smrg */ 66122944501Smrg __u32 handle; 66222944501Smrg 66322944501Smrg /** Number of relocations to be performed on this buffer */ 66422944501Smrg __u32 relocation_count; 66522944501Smrg /** 66622944501Smrg * Pointer to array of struct drm_i915_gem_relocation_entry containing 66722944501Smrg * the relocations to be performed in this buffer. 66822944501Smrg */ 66922944501Smrg __u64 relocs_ptr; 67022944501Smrg 67122944501Smrg /** Required alignment in graphics aperture */ 67222944501Smrg __u64 alignment; 67322944501Smrg 67422944501Smrg /** 67522944501Smrg * Returned value of the updated offset of the object, for future 67622944501Smrg * presumed_offset writes. 67722944501Smrg */ 67822944501Smrg __u64 offset; 67922944501Smrg 68022944501Smrg#define EXEC_OBJECT_NEEDS_FENCE (1<<0) 681e88f27b3Smrg#define EXEC_OBJECT_NEEDS_GTT (1<<1) 682e88f27b3Smrg#define EXEC_OBJECT_WRITE (1<<2) 683e88f27b3Smrg#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) 68422944501Smrg __u64 flags; 685e88f27b3Smrg 68622944501Smrg __u64 rsvd1; 68722944501Smrg __u64 rsvd2; 68822944501Smrg}; 68922944501Smrg 69022944501Smrgstruct drm_i915_gem_execbuffer2 { 69122944501Smrg /** 69222944501Smrg * List of gem_exec_object2 structs 69322944501Smrg */ 69422944501Smrg __u64 buffers_ptr; 69522944501Smrg __u32 buffer_count; 69622944501Smrg 69722944501Smrg /** Offset in the batchbuffer to start execution from. */ 69822944501Smrg __u32 batch_start_offset; 69922944501Smrg /** Bytes used in batchbuffer from batch_start_offset */ 70022944501Smrg __u32 batch_len; 70122944501Smrg __u32 DR1; 70222944501Smrg __u32 DR4; 70322944501Smrg __u32 num_cliprects; 70422944501Smrg /** This is a struct drm_clip_rect *cliprects */ 70522944501Smrg __u64 cliprects_ptr; 70669dda199Smrg#define I915_EXEC_RING_MASK (7<<0) 70769dda199Smrg#define I915_EXEC_DEFAULT (0<<0) 708d049871aSmrg#define I915_EXEC_RENDER (1<<0) 70969dda199Smrg#define I915_EXEC_BSD (2<<0) 71069dda199Smrg#define I915_EXEC_BLT (3<<0) 711e88f27b3Smrg#define I915_EXEC_VEBOX (4<<0) 712e88f27b3Smrg 713e88f27b3Smrg/* Used for switching the constants addressing mode on gen4+ RENDER ring. 714e88f27b3Smrg * Gen6+ only supports relative addressing to dynamic state (default) and 715e88f27b3Smrg * absolute addressing. 716e88f27b3Smrg * 717e88f27b3Smrg * These flags are ignored for the BSD and BLT rings. 718e88f27b3Smrg */ 719e88f27b3Smrg#define I915_EXEC_CONSTANTS_MASK (3<<6) 720e88f27b3Smrg#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ 721e88f27b3Smrg#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) 722e88f27b3Smrg#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ 72313d1d17dSmrg __u64 flags; 724e88f27b3Smrg __u64 rsvd1; /* now used for context info */ 72522944501Smrg __u64 rsvd2; 72622944501Smrg}; 72722944501Smrg 728e88f27b3Smrg/** Resets the SO write offset registers for transform feedback on gen7. */ 729e88f27b3Smrg#define I915_EXEC_GEN7_SOL_RESET (1<<8) 730e88f27b3Smrg 731e88f27b3Smrg/** Request a privileged ("secure") batch buffer. Note only available for 732e88f27b3Smrg * DRM_ROOT_ONLY | DRM_MASTER processes. 733e88f27b3Smrg */ 734e88f27b3Smrg#define I915_EXEC_SECURE (1<<9) 735e88f27b3Smrg 736e88f27b3Smrg/** Inform the kernel that the batch is and will always be pinned. This 737e88f27b3Smrg * negates the requirement for a workaround to be performed to avoid 738e88f27b3Smrg * an incoherent CS (such as can be found on 830/845). If this flag is 739e88f27b3Smrg * not passed, the kernel will endeavour to make sure the batch is 740e88f27b3Smrg * coherent with the CS before execution. If this flag is passed, 741e88f27b3Smrg * userspace assumes the responsibility for ensuring the same. 742e88f27b3Smrg */ 743e88f27b3Smrg#define I915_EXEC_IS_PINNED (1<<10) 744e88f27b3Smrg 745baaff307Smrg/** Provide a hint to the kernel that the command stream and auxiliary 746e88f27b3Smrg * state buffers already holds the correct presumed addresses and so the 747e88f27b3Smrg * relocation process may be skipped if no buffers need to be moved in 748e88f27b3Smrg * preparation for the execbuffer. 749e88f27b3Smrg */ 750e88f27b3Smrg#define I915_EXEC_NO_RELOC (1<<11) 751e88f27b3Smrg 752e88f27b3Smrg/** Use the reloc.handle as an index into the exec object array rather 753e88f27b3Smrg * than as the per-file handle. 754e88f27b3Smrg */ 755e88f27b3Smrg#define I915_EXEC_HANDLE_LUT (1<<12) 756e88f27b3Smrg 757424e9256Smrg/** Used for switching BSD rings on the platforms with two BSD rings */ 758424e9256Smrg#define I915_EXEC_BSD_MASK (3<<13) 759424e9256Smrg#define I915_EXEC_BSD_DEFAULT (0<<13) /* default ping-pong mode */ 760424e9256Smrg#define I915_EXEC_BSD_RING1 (1<<13) 761424e9256Smrg#define I915_EXEC_BSD_RING2 (2<<13) 762424e9256Smrg 763424e9256Smrg#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15) 764e88f27b3Smrg 765e88f27b3Smrg#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 766e88f27b3Smrg#define i915_execbuffer2_set_context_id(eb2, context) \ 767e88f27b3Smrg (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK 768e88f27b3Smrg#define i915_execbuffer2_get_context_id(eb2) \ 769e88f27b3Smrg ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) 770e88f27b3Smrg 77122944501Smrgstruct drm_i915_gem_pin { 77222944501Smrg /** Handle of the buffer to be pinned. */ 77322944501Smrg __u32 handle; 77422944501Smrg __u32 pad; 77522944501Smrg 77622944501Smrg /** alignment required within the aperture */ 77722944501Smrg __u64 alignment; 77822944501Smrg 77922944501Smrg /** Returned GTT offset of the buffer. */ 78022944501Smrg __u64 offset; 78122944501Smrg}; 78222944501Smrg 78322944501Smrgstruct drm_i915_gem_unpin { 78422944501Smrg /** Handle of the buffer to be unpinned. */ 78522944501Smrg __u32 handle; 78622944501Smrg __u32 pad; 78722944501Smrg}; 78822944501Smrg 78922944501Smrgstruct drm_i915_gem_busy { 79022944501Smrg /** Handle of the buffer to check for busy */ 79122944501Smrg __u32 handle; 79222944501Smrg 793e88f27b3Smrg /** Return busy status (1 if busy, 0 if idle). 794e88f27b3Smrg * The high word is used to indicate on which rings the object 795e88f27b3Smrg * currently resides: 796e88f27b3Smrg * 16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc) 797e88f27b3Smrg */ 79822944501Smrg __u32 busy; 79922944501Smrg}; 80022944501Smrg 801e88f27b3Smrg/** 802e88f27b3Smrg * I915_CACHING_NONE 803e88f27b3Smrg * 804e88f27b3Smrg * GPU access is not coherent with cpu caches. Default for machines without an 805e88f27b3Smrg * LLC. 806e88f27b3Smrg */ 807e88f27b3Smrg#define I915_CACHING_NONE 0 808e88f27b3Smrg/** 809e88f27b3Smrg * I915_CACHING_CACHED 810e88f27b3Smrg * 811e88f27b3Smrg * GPU access is coherent with cpu caches and furthermore the data is cached in 812e88f27b3Smrg * last-level caches shared between cpu cores and the gpu GT. Default on 813e88f27b3Smrg * machines with HAS_LLC. 814e88f27b3Smrg */ 815e88f27b3Smrg#define I915_CACHING_CACHED 1 816e88f27b3Smrg/** 817e88f27b3Smrg * I915_CACHING_DISPLAY 818e88f27b3Smrg * 819e88f27b3Smrg * Special GPU caching mode which is coherent with the scanout engines. 820e88f27b3Smrg * Transparently falls back to I915_CACHING_NONE on platforms where no special 821e88f27b3Smrg * cache mode (like write-through or gfdt flushing) is available. The kernel 822e88f27b3Smrg * automatically sets this mode when using a buffer as a scanout target. 823e88f27b3Smrg * Userspace can manually set this mode to avoid a costly stall and clflush in 824e88f27b3Smrg * the hotpath of drawing the first frame. 825e88f27b3Smrg */ 826e88f27b3Smrg#define I915_CACHING_DISPLAY 2 827e88f27b3Smrg 828e88f27b3Smrgstruct drm_i915_gem_caching { 829e88f27b3Smrg /** 830e88f27b3Smrg * Handle of the buffer to set/get the caching level of. */ 831e88f27b3Smrg __u32 handle; 832e88f27b3Smrg 833e88f27b3Smrg /** 834e88f27b3Smrg * Cacheing level to apply or return value 835e88f27b3Smrg * 836e88f27b3Smrg * bits0-15 are for generic caching control (i.e. the above defined 837e88f27b3Smrg * values). bits16-31 are reserved for platform-specific variations 838e88f27b3Smrg * (e.g. l3$ caching on gen7). */ 839e88f27b3Smrg __u32 caching; 840e88f27b3Smrg}; 841e88f27b3Smrg 84222944501Smrg#define I915_TILING_NONE 0 84322944501Smrg#define I915_TILING_X 1 84422944501Smrg#define I915_TILING_Y 2 84522944501Smrg 84622944501Smrg#define I915_BIT_6_SWIZZLE_NONE 0 84722944501Smrg#define I915_BIT_6_SWIZZLE_9 1 84822944501Smrg#define I915_BIT_6_SWIZZLE_9_10 2 84922944501Smrg#define I915_BIT_6_SWIZZLE_9_11 3 85022944501Smrg#define I915_BIT_6_SWIZZLE_9_10_11 4 85122944501Smrg/* Not seen by userland */ 85222944501Smrg#define I915_BIT_6_SWIZZLE_UNKNOWN 5 85322944501Smrg/* Seen by userland. */ 85422944501Smrg#define I915_BIT_6_SWIZZLE_9_17 6 85522944501Smrg#define I915_BIT_6_SWIZZLE_9_10_17 7 85622944501Smrg 85722944501Smrgstruct drm_i915_gem_set_tiling { 85822944501Smrg /** Handle of the buffer to have its tiling state updated */ 85922944501Smrg __u32 handle; 86022944501Smrg 86122944501Smrg /** 86222944501Smrg * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 86322944501Smrg * I915_TILING_Y). 86422944501Smrg * 86522944501Smrg * This value is to be set on request, and will be updated by the 86622944501Smrg * kernel on successful return with the actual chosen tiling layout. 86722944501Smrg * 86822944501Smrg * The tiling mode may be demoted to I915_TILING_NONE when the system 86922944501Smrg * has bit 6 swizzling that can't be managed correctly by GEM. 87022944501Smrg * 87122944501Smrg * Buffer contents become undefined when changing tiling_mode. 87222944501Smrg */ 87322944501Smrg __u32 tiling_mode; 87422944501Smrg 87522944501Smrg /** 87622944501Smrg * Stride in bytes for the object when in I915_TILING_X or 87722944501Smrg * I915_TILING_Y. 87822944501Smrg */ 87922944501Smrg __u32 stride; 88022944501Smrg 88122944501Smrg /** 88222944501Smrg * Returned address bit 6 swizzling required for CPU access through 88322944501Smrg * mmap mapping. 88422944501Smrg */ 88522944501Smrg __u32 swizzle_mode; 88622944501Smrg}; 88722944501Smrg 88822944501Smrgstruct drm_i915_gem_get_tiling { 88922944501Smrg /** Handle of the buffer to get tiling state for. */ 89022944501Smrg __u32 handle; 89122944501Smrg 89222944501Smrg /** 89322944501Smrg * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 89422944501Smrg * I915_TILING_Y). 89522944501Smrg */ 89622944501Smrg __u32 tiling_mode; 89722944501Smrg 89822944501Smrg /** 89922944501Smrg * Returned address bit 6 swizzling required for CPU access through 90022944501Smrg * mmap mapping. 90122944501Smrg */ 90222944501Smrg __u32 swizzle_mode; 903424e9256Smrg 904424e9256Smrg /** 905424e9256Smrg * Returned address bit 6 swizzling required for CPU access through 906424e9256Smrg * mmap mapping whilst bound. 907424e9256Smrg */ 908424e9256Smrg __u32 phys_swizzle_mode; 90922944501Smrg}; 91022944501Smrg 91122944501Smrgstruct drm_i915_gem_get_aperture { 91222944501Smrg /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 91322944501Smrg __u64 aper_size; 91422944501Smrg 91522944501Smrg /** 91622944501Smrg * Available space in the aperture used by i915_gem_execbuffer, in 91722944501Smrg * bytes 91822944501Smrg */ 91922944501Smrg __u64 aper_available_size; 92022944501Smrg}; 92122944501Smrg 92222944501Smrgstruct drm_i915_get_pipe_from_crtc_id { 92322944501Smrg /** ID of CRTC being requested **/ 92422944501Smrg __u32 crtc_id; 92522944501Smrg 92622944501Smrg /** pipe of requested CRTC **/ 92722944501Smrg __u32 pipe; 92822944501Smrg}; 92922944501Smrg 93022944501Smrg#define I915_MADV_WILLNEED 0 93122944501Smrg#define I915_MADV_DONTNEED 1 93222944501Smrg#define __I915_MADV_PURGED 2 /* internal state */ 93322944501Smrg 93422944501Smrgstruct drm_i915_gem_madvise { 93522944501Smrg /** Handle of the buffer to change the backing store advice */ 93622944501Smrg __u32 handle; 93722944501Smrg 93822944501Smrg /* Advice: either the buffer will be needed again in the near future, 93922944501Smrg * or wont be and could be discarded under memory pressure. 94022944501Smrg */ 94122944501Smrg __u32 madv; 94222944501Smrg 94322944501Smrg /** Whether the backing store still exists. */ 94422944501Smrg __u32 retained; 94522944501Smrg}; 94622944501Smrg 94722944501Smrg/* flags */ 94822944501Smrg#define I915_OVERLAY_TYPE_MASK 0xff 94922944501Smrg#define I915_OVERLAY_YUV_PLANAR 0x01 95022944501Smrg#define I915_OVERLAY_YUV_PACKED 0x02 95122944501Smrg#define I915_OVERLAY_RGB 0x03 95222944501Smrg 95322944501Smrg#define I915_OVERLAY_DEPTH_MASK 0xff00 95422944501Smrg#define I915_OVERLAY_RGB24 0x1000 95522944501Smrg#define I915_OVERLAY_RGB16 0x2000 95622944501Smrg#define I915_OVERLAY_RGB15 0x3000 95722944501Smrg#define I915_OVERLAY_YUV422 0x0100 95822944501Smrg#define I915_OVERLAY_YUV411 0x0200 95922944501Smrg#define I915_OVERLAY_YUV420 0x0300 96022944501Smrg#define I915_OVERLAY_YUV410 0x0400 96122944501Smrg 96222944501Smrg#define I915_OVERLAY_SWAP_MASK 0xff0000 96322944501Smrg#define I915_OVERLAY_NO_SWAP 0x000000 96422944501Smrg#define I915_OVERLAY_UV_SWAP 0x010000 96522944501Smrg#define I915_OVERLAY_Y_SWAP 0x020000 96622944501Smrg#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 96722944501Smrg 96822944501Smrg#define I915_OVERLAY_FLAGS_MASK 0xff000000 96922944501Smrg#define I915_OVERLAY_ENABLE 0x01000000 97022944501Smrg 97122944501Smrgstruct drm_intel_overlay_put_image { 97222944501Smrg /* various flags and src format description */ 97322944501Smrg __u32 flags; 97422944501Smrg /* source picture description */ 97522944501Smrg __u32 bo_handle; 97622944501Smrg /* stride values and offsets are in bytes, buffer relative */ 97722944501Smrg __u16 stride_Y; /* stride for packed formats */ 97822944501Smrg __u16 stride_UV; 97922944501Smrg __u32 offset_Y; /* offset for packet formats */ 98022944501Smrg __u32 offset_U; 98122944501Smrg __u32 offset_V; 98222944501Smrg /* in pixels */ 98322944501Smrg __u16 src_width; 98422944501Smrg __u16 src_height; 98522944501Smrg /* to compensate the scaling factors for partially covered surfaces */ 98622944501Smrg __u16 src_scan_width; 98722944501Smrg __u16 src_scan_height; 98822944501Smrg /* output crtc description */ 98922944501Smrg __u32 crtc_id; 99022944501Smrg __u16 dst_x; 99122944501Smrg __u16 dst_y; 99222944501Smrg __u16 dst_width; 99322944501Smrg __u16 dst_height; 99422944501Smrg}; 99522944501Smrg 99622944501Smrg/* flags */ 99722944501Smrg#define I915_OVERLAY_UPDATE_ATTRS (1<<0) 99822944501Smrg#define I915_OVERLAY_UPDATE_GAMMA (1<<1) 99922944501Smrgstruct drm_intel_overlay_attrs { 100022944501Smrg __u32 flags; 100122944501Smrg __u32 color_key; 100222944501Smrg __s32 brightness; 100322944501Smrg __u32 contrast; 100422944501Smrg __u32 saturation; 100522944501Smrg __u32 gamma0; 100622944501Smrg __u32 gamma1; 100722944501Smrg __u32 gamma2; 100822944501Smrg __u32 gamma3; 100922944501Smrg __u32 gamma4; 101022944501Smrg __u32 gamma5; 101122944501Smrg}; 101222944501Smrg 1013e88f27b3Smrg/* 1014e88f27b3Smrg * Intel sprite handling 1015e88f27b3Smrg * 1016e88f27b3Smrg * Color keying works with a min/mask/max tuple. Both source and destination 1017e88f27b3Smrg * color keying is allowed. 1018e88f27b3Smrg * 1019e88f27b3Smrg * Source keying: 1020e88f27b3Smrg * Sprite pixels within the min & max values, masked against the color channels 1021e88f27b3Smrg * specified in the mask field, will be transparent. All other pixels will 1022e88f27b3Smrg * be displayed on top of the primary plane. For RGB surfaces, only the min 1023e88f27b3Smrg * and mask fields will be used; ranged compares are not allowed. 1024e88f27b3Smrg * 1025e88f27b3Smrg * Destination keying: 1026e88f27b3Smrg * Primary plane pixels that match the min value, masked against the color 1027e88f27b3Smrg * channels specified in the mask field, will be replaced by corresponding 1028e88f27b3Smrg * pixels from the sprite plane. 1029e88f27b3Smrg * 1030e88f27b3Smrg * Note that source & destination keying are exclusive; only one can be 1031e88f27b3Smrg * active on a given plane. 1032e88f27b3Smrg */ 1033e88f27b3Smrg 1034e88f27b3Smrg#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */ 1035e88f27b3Smrg#define I915_SET_COLORKEY_DESTINATION (1<<1) 1036e88f27b3Smrg#define I915_SET_COLORKEY_SOURCE (1<<2) 1037e88f27b3Smrgstruct drm_intel_sprite_colorkey { 1038e88f27b3Smrg __u32 plane_id; 1039e88f27b3Smrg __u32 min_value; 1040e88f27b3Smrg __u32 channel_mask; 1041e88f27b3Smrg __u32 max_value; 1042e88f27b3Smrg __u32 flags; 1043e88f27b3Smrg}; 1044e88f27b3Smrg 1045e88f27b3Smrgstruct drm_i915_gem_wait { 1046e88f27b3Smrg /** Handle of BO we shall wait on */ 1047e88f27b3Smrg __u32 bo_handle; 1048e88f27b3Smrg __u32 flags; 1049e88f27b3Smrg /** Number of nanoseconds to wait, Returns time remaining. */ 1050e88f27b3Smrg __s64 timeout_ns; 1051e88f27b3Smrg}; 1052e88f27b3Smrg 1053e88f27b3Smrgstruct drm_i915_gem_context_create { 1054e88f27b3Smrg /* output: id of new context*/ 1055e88f27b3Smrg __u32 ctx_id; 1056e88f27b3Smrg __u32 pad; 1057e88f27b3Smrg}; 1058e88f27b3Smrg 1059e88f27b3Smrgstruct drm_i915_gem_context_destroy { 1060e88f27b3Smrg __u32 ctx_id; 1061e88f27b3Smrg __u32 pad; 1062e88f27b3Smrg}; 1063e88f27b3Smrg 1064e88f27b3Smrgstruct drm_i915_reg_read { 1065e88f27b3Smrg __u64 offset; 1066e88f27b3Smrg __u64 val; /* Return value */ 1067e88f27b3Smrg}; 1068e88f27b3Smrg 1069e88f27b3Smrgstruct drm_i915_reset_stats { 1070e88f27b3Smrg __u32 ctx_id; 1071e88f27b3Smrg __u32 flags; 1072e88f27b3Smrg 1073e88f27b3Smrg /* All resets since boot/module reload, for all contexts */ 1074e88f27b3Smrg __u32 reset_count; 1075e88f27b3Smrg 1076e88f27b3Smrg /* Number of batches lost when active in GPU, for this context */ 1077e88f27b3Smrg __u32 batch_active; 1078e88f27b3Smrg 1079e88f27b3Smrg /* Number of batches lost pending for execution, for this context */ 1080e88f27b3Smrg __u32 batch_pending; 1081e88f27b3Smrg 1082e88f27b3Smrg __u32 pad; 1083e88f27b3Smrg}; 1084e88f27b3Smrg 1085baaff307Smrgstruct drm_i915_gem_userptr { 1086baaff307Smrg __u64 user_ptr; 1087baaff307Smrg __u64 user_size; 1088baaff307Smrg __u32 flags; 1089baaff307Smrg#define I915_USERPTR_READ_ONLY 0x1 1090baaff307Smrg#define I915_USERPTR_UNSYNCHRONIZED 0x80000000 1091baaff307Smrg /** 1092424e9256Smrg * Returned handle for the object. 1093424e9256Smrg * 1094424e9256Smrg * Object handles are nonzero. 1095424e9256Smrg */ 1096baaff307Smrg __u32 handle; 1097baaff307Smrg}; 1098baaff307Smrg 1099424e9256Smrgstruct drm_i915_gem_context_param { 1100424e9256Smrg __u32 ctx_id; 1101424e9256Smrg __u32 size; 1102424e9256Smrg __u64 param; 1103424e9256Smrg#define I915_CONTEXT_PARAM_BAN_PERIOD 0x1 1104424e9256Smrg __u64 value; 1105424e9256Smrg}; 1106424e9256Smrg 1107e88f27b3Smrg#endif /* _I915_DRM_H_ */ 1108