i915_drm.h revision e88f27b3
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 22622944501Smrg 22722944501Smrg#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t) 22822944501Smrg#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH) 22922944501Smrg#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP) 23022944501Smrg#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t) 23122944501Smrg#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t) 23222944501Smrg#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t) 23322944501Smrg#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t) 23422944501Smrg#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t) 23522944501Smrg#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t) 23622944501Smrg#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t) 23722944501Smrg#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t) 23822944501Smrg#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t) 23922944501Smrg#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t) 24022944501Smrg#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 24122944501Smrg#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t) 24222944501Smrg#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t) 24369dda199Smrg#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init) 24422944501Smrg#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init) 24522944501Smrg#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer) 24622944501Smrg#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2) 24722944501Smrg#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin) 24822944501Smrg#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin) 24922944501Smrg#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy) 250e88f27b3Smrg#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching) 251e88f27b3Smrg#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching) 25222944501Smrg#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE) 25322944501Smrg#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT) 25422944501Smrg#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT) 25522944501Smrg#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) 25622944501Smrg#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread) 25722944501Smrg#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite) 25822944501Smrg#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap) 25922944501Smrg#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt) 26022944501Smrg#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain) 26122944501Smrg#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish) 26222944501Smrg#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling) 26322944501Smrg#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling) 26422944501Smrg#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture) 26522944501Smrg#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) 26622944501Smrg#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise) 267e88f27b3Smrg#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image) 26822944501Smrg#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs) 269e88f27b3Smrg#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 270e88f27b3Smrg#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey) 271e88f27b3Smrg#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait) 272e88f27b3Smrg#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create) 273e88f27b3Smrg#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy) 274e88f27b3Smrg#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read) 275e88f27b3Smrg#define DRM_IOCTL_I915_GET_RESET_STATS DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GET_RESET_STATS, struct drm_i915_reset_stats) 27622944501Smrg 27722944501Smrg/* Allow drivers to submit batchbuffers directly to hardware, relying 27822944501Smrg * on the security mechanisms provided by hardware. 27922944501Smrg */ 28022944501Smrgtypedef struct drm_i915_batchbuffer { 28122944501Smrg int start; /* agp offset */ 28222944501Smrg int used; /* nr bytes in use */ 28322944501Smrg int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 28422944501Smrg int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 28522944501Smrg int num_cliprects; /* mulitpass with multiple cliprects? */ 28622944501Smrg struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ 28722944501Smrg} drm_i915_batchbuffer_t; 28822944501Smrg 28922944501Smrg/* As above, but pass a pointer to userspace buffer which can be 29022944501Smrg * validated by the kernel prior to sending to hardware. 29122944501Smrg */ 29222944501Smrgtypedef struct _drm_i915_cmdbuffer { 29322944501Smrg char *buf; /* pointer to userspace command buffer */ 29422944501Smrg int sz; /* nr bytes in buf */ 29522944501Smrg int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */ 29622944501Smrg int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */ 29722944501Smrg int num_cliprects; /* mulitpass with multiple cliprects? */ 29822944501Smrg struct drm_clip_rect *cliprects; /* pointer to userspace cliprects */ 29922944501Smrg} drm_i915_cmdbuffer_t; 30022944501Smrg 30122944501Smrg/* Userspace can request & wait on irq's: 30222944501Smrg */ 30322944501Smrgtypedef struct drm_i915_irq_emit { 30422944501Smrg int *irq_seq; 30522944501Smrg} drm_i915_irq_emit_t; 30622944501Smrg 30722944501Smrgtypedef struct drm_i915_irq_wait { 30822944501Smrg int irq_seq; 30922944501Smrg} drm_i915_irq_wait_t; 31022944501Smrg 31122944501Smrg/* Ioctl to query kernel params: 31222944501Smrg */ 31322944501Smrg#define I915_PARAM_IRQ_ACTIVE 1 31422944501Smrg#define I915_PARAM_ALLOW_BATCHBUFFER 2 31522944501Smrg#define I915_PARAM_LAST_DISPATCH 3 31622944501Smrg#define I915_PARAM_CHIPSET_ID 4 31722944501Smrg#define I915_PARAM_HAS_GEM 5 31822944501Smrg#define I915_PARAM_NUM_FENCES_AVAIL 6 31922944501Smrg#define I915_PARAM_HAS_OVERLAY 7 32022944501Smrg#define I915_PARAM_HAS_PAGEFLIPPING 8 32122944501Smrg#define I915_PARAM_HAS_EXECBUF2 9 32213d1d17dSmrg#define I915_PARAM_HAS_BSD 10 32369dda199Smrg#define I915_PARAM_HAS_BLT 11 32469dda199Smrg#define I915_PARAM_HAS_RELAXED_FENCING 12 325e88f27b3Smrg#define I915_PARAM_HAS_COHERENT_RINGS 13 326e88f27b3Smrg#define I915_PARAM_HAS_EXEC_CONSTANTS 14 327e88f27b3Smrg#define I915_PARAM_HAS_RELAXED_DELTA 15 328e88f27b3Smrg#define I915_PARAM_HAS_GEN7_SOL_RESET 16 329e88f27b3Smrg#define I915_PARAM_HAS_LLC 17 330e88f27b3Smrg#define I915_PARAM_HAS_ALIASING_PPGTT 18 331e88f27b3Smrg#define I915_PARAM_HAS_WAIT_TIMEOUT 19 332e88f27b3Smrg#define I915_PARAM_HAS_SEMAPHORES 20 333e88f27b3Smrg#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 334e88f27b3Smrg#define I915_PARAM_HAS_VEBOX 22 335e88f27b3Smrg#define I915_PARAM_HAS_SECURE_BATCHES 23 336e88f27b3Smrg#define I915_PARAM_HAS_PINNED_BATCHES 24 337e88f27b3Smrg#define I915_PARAM_HAS_EXEC_NO_RELOC 25 338e88f27b3Smrg#define I915_PARAM_HAS_EXEC_HANDLE_LUT 26 339e88f27b3Smrg#define I915_PARAM_HAS_WT 27 34022944501Smrg 34122944501Smrgtypedef struct drm_i915_getparam { 34222944501Smrg int param; 34322944501Smrg int *value; 34422944501Smrg} drm_i915_getparam_t; 34522944501Smrg 34622944501Smrg/* Ioctl to set kernel params: 34722944501Smrg */ 34822944501Smrg#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1 34922944501Smrg#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2 35022944501Smrg#define I915_SETPARAM_ALLOW_BATCHBUFFER 3 35122944501Smrg#define I915_SETPARAM_NUM_USED_FENCES 4 35222944501Smrg 35322944501Smrgtypedef struct drm_i915_setparam { 35422944501Smrg int param; 35522944501Smrg int value; 35622944501Smrg} drm_i915_setparam_t; 35722944501Smrg 35822944501Smrg/* A memory manager for regions of shared memory: 35922944501Smrg */ 36022944501Smrg#define I915_MEM_REGION_AGP 1 36122944501Smrg 36222944501Smrgtypedef struct drm_i915_mem_alloc { 36322944501Smrg int region; 36422944501Smrg int alignment; 36522944501Smrg int size; 36622944501Smrg int *region_offset; /* offset from start of fb or agp */ 36722944501Smrg} drm_i915_mem_alloc_t; 36822944501Smrg 36922944501Smrgtypedef struct drm_i915_mem_free { 37022944501Smrg int region; 37122944501Smrg int region_offset; 37222944501Smrg} drm_i915_mem_free_t; 37322944501Smrg 37422944501Smrgtypedef struct drm_i915_mem_init_heap { 37522944501Smrg int region; 37622944501Smrg int size; 37722944501Smrg int start; 37822944501Smrg} drm_i915_mem_init_heap_t; 37922944501Smrg 38022944501Smrg/* Allow memory manager to be torn down and re-initialized (eg on 38122944501Smrg * rotate): 38222944501Smrg */ 38322944501Smrgtypedef struct drm_i915_mem_destroy_heap { 38422944501Smrg int region; 38522944501Smrg} drm_i915_mem_destroy_heap_t; 38622944501Smrg 38722944501Smrg/* Allow X server to configure which pipes to monitor for vblank signals 38822944501Smrg */ 38922944501Smrg#define DRM_I915_VBLANK_PIPE_A 1 39022944501Smrg#define DRM_I915_VBLANK_PIPE_B 2 39122944501Smrg 39222944501Smrgtypedef struct drm_i915_vblank_pipe { 39322944501Smrg int pipe; 39422944501Smrg} drm_i915_vblank_pipe_t; 39522944501Smrg 39622944501Smrg/* Schedule buffer swap at given vertical blank: 39722944501Smrg */ 39822944501Smrgtypedef struct drm_i915_vblank_swap { 39922944501Smrg drm_drawable_t drawable; 40022944501Smrg enum drm_vblank_seq_type seqtype; 40122944501Smrg unsigned int sequence; 40222944501Smrg} drm_i915_vblank_swap_t; 40322944501Smrg 40422944501Smrgtypedef struct drm_i915_hws_addr { 40522944501Smrg __u64 addr; 40622944501Smrg} drm_i915_hws_addr_t; 40722944501Smrg 40822944501Smrgstruct drm_i915_gem_init { 40922944501Smrg /** 41022944501Smrg * Beginning offset in the GTT to be managed by the DRM memory 41122944501Smrg * manager. 41222944501Smrg */ 41322944501Smrg __u64 gtt_start; 41422944501Smrg /** 41522944501Smrg * Ending offset in the GTT to be managed by the DRM memory 41622944501Smrg * manager. 41722944501Smrg */ 41822944501Smrg __u64 gtt_end; 41922944501Smrg}; 42022944501Smrg 42122944501Smrgstruct drm_i915_gem_create { 42222944501Smrg /** 42322944501Smrg * Requested size for the object. 42422944501Smrg * 42522944501Smrg * The (page-aligned) allocated size for the object will be returned. 42622944501Smrg */ 42722944501Smrg __u64 size; 42822944501Smrg /** 42922944501Smrg * Returned handle for the object. 43022944501Smrg * 43122944501Smrg * Object handles are nonzero. 43222944501Smrg */ 43322944501Smrg __u32 handle; 43422944501Smrg __u32 pad; 43522944501Smrg}; 43622944501Smrg 43722944501Smrgstruct drm_i915_gem_pread { 43822944501Smrg /** Handle for the object being read. */ 43922944501Smrg __u32 handle; 44022944501Smrg __u32 pad; 44122944501Smrg /** Offset into the object to read from */ 44222944501Smrg __u64 offset; 44322944501Smrg /** Length of data to read */ 44422944501Smrg __u64 size; 44522944501Smrg /** 44622944501Smrg * Pointer to write the data into. 44722944501Smrg * 44822944501Smrg * This is a fixed-size type for 32/64 compatibility. 44922944501Smrg */ 45022944501Smrg __u64 data_ptr; 45122944501Smrg}; 45222944501Smrg 45322944501Smrgstruct drm_i915_gem_pwrite { 45422944501Smrg /** Handle for the object being written to. */ 45522944501Smrg __u32 handle; 45622944501Smrg __u32 pad; 45722944501Smrg /** Offset into the object to write to */ 45822944501Smrg __u64 offset; 45922944501Smrg /** Length of data to write */ 46022944501Smrg __u64 size; 46122944501Smrg /** 46222944501Smrg * Pointer to read the data from. 46322944501Smrg * 46422944501Smrg * This is a fixed-size type for 32/64 compatibility. 46522944501Smrg */ 46622944501Smrg __u64 data_ptr; 46722944501Smrg}; 46822944501Smrg 46922944501Smrgstruct drm_i915_gem_mmap { 47022944501Smrg /** Handle for the object being mapped. */ 47122944501Smrg __u32 handle; 47222944501Smrg __u32 pad; 47322944501Smrg /** Offset in the object to map. */ 47422944501Smrg __u64 offset; 47522944501Smrg /** 47622944501Smrg * Length of data to map. 47722944501Smrg * 47822944501Smrg * The value will be page-aligned. 47922944501Smrg */ 48022944501Smrg __u64 size; 48122944501Smrg /** 48222944501Smrg * Returned pointer the data was mapped at. 48322944501Smrg * 48422944501Smrg * This is a fixed-size type for 32/64 compatibility. 48522944501Smrg */ 48622944501Smrg __u64 addr_ptr; 48722944501Smrg}; 48822944501Smrg 48922944501Smrgstruct drm_i915_gem_mmap_gtt { 49022944501Smrg /** Handle for the object being mapped. */ 49122944501Smrg __u32 handle; 49222944501Smrg __u32 pad; 49322944501Smrg /** 49422944501Smrg * Fake offset to use for subsequent mmap call 49522944501Smrg * 49622944501Smrg * This is a fixed-size type for 32/64 compatibility. 49722944501Smrg */ 49822944501Smrg __u64 offset; 49922944501Smrg}; 50022944501Smrg 50122944501Smrgstruct drm_i915_gem_set_domain { 50222944501Smrg /** Handle for the object */ 50322944501Smrg __u32 handle; 50422944501Smrg 50522944501Smrg /** New read domains */ 50622944501Smrg __u32 read_domains; 50722944501Smrg 50822944501Smrg /** New write domain */ 50922944501Smrg __u32 write_domain; 51022944501Smrg}; 51122944501Smrg 51222944501Smrgstruct drm_i915_gem_sw_finish { 51322944501Smrg /** Handle for the object */ 51422944501Smrg __u32 handle; 51522944501Smrg}; 51622944501Smrg 51722944501Smrgstruct drm_i915_gem_relocation_entry { 51822944501Smrg /** 51922944501Smrg * Handle of the buffer being pointed to by this relocation entry. 52022944501Smrg * 52122944501Smrg * It's appealing to make this be an index into the mm_validate_entry 52222944501Smrg * list to refer to the buffer, but this allows the driver to create 52322944501Smrg * a relocation list for state buffers and not re-write it per 52422944501Smrg * exec using the buffer. 52522944501Smrg */ 52622944501Smrg __u32 target_handle; 52722944501Smrg 52822944501Smrg /** 52922944501Smrg * Value to be added to the offset of the target buffer to make up 53022944501Smrg * the relocation entry. 53122944501Smrg */ 53222944501Smrg __u32 delta; 53322944501Smrg 53422944501Smrg /** Offset in the buffer the relocation entry will be written into */ 53522944501Smrg __u64 offset; 53622944501Smrg 53722944501Smrg /** 53822944501Smrg * Offset value of the target buffer that the relocation entry was last 53922944501Smrg * written as. 54022944501Smrg * 54122944501Smrg * If the buffer has the same offset as last time, we can skip syncing 54222944501Smrg * and writing the relocation. This value is written back out by 54322944501Smrg * the execbuffer ioctl when the relocation is written. 54422944501Smrg */ 54522944501Smrg __u64 presumed_offset; 54622944501Smrg 54722944501Smrg /** 54822944501Smrg * Target memory domains read by this operation. 54922944501Smrg */ 55022944501Smrg __u32 read_domains; 55122944501Smrg 55222944501Smrg /** 55322944501Smrg * Target memory domains written by this operation. 55422944501Smrg * 55522944501Smrg * Note that only one domain may be written by the whole 55622944501Smrg * execbuffer operation, so that where there are conflicts, 55722944501Smrg * the application will get -EINVAL back. 55822944501Smrg */ 55922944501Smrg __u32 write_domain; 56022944501Smrg}; 56122944501Smrg 56222944501Smrg/** @{ 56322944501Smrg * Intel memory domains 56422944501Smrg * 56522944501Smrg * Most of these just align with the various caches in 56622944501Smrg * the system and are used to flush and invalidate as 56722944501Smrg * objects end up cached in different domains. 56822944501Smrg */ 56922944501Smrg/** CPU cache */ 57022944501Smrg#define I915_GEM_DOMAIN_CPU 0x00000001 57122944501Smrg/** Render cache, used by 2D and 3D drawing */ 57222944501Smrg#define I915_GEM_DOMAIN_RENDER 0x00000002 57322944501Smrg/** Sampler cache, used by texture engine */ 57422944501Smrg#define I915_GEM_DOMAIN_SAMPLER 0x00000004 57522944501Smrg/** Command queue, used to load batch buffers */ 57622944501Smrg#define I915_GEM_DOMAIN_COMMAND 0x00000008 57722944501Smrg/** Instruction cache, used by shader programs */ 57822944501Smrg#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010 57922944501Smrg/** Vertex address cache */ 58022944501Smrg#define I915_GEM_DOMAIN_VERTEX 0x00000020 58122944501Smrg/** GTT domain - aperture and scanout */ 58222944501Smrg#define I915_GEM_DOMAIN_GTT 0x00000040 58322944501Smrg/** @} */ 58422944501Smrg 58522944501Smrgstruct drm_i915_gem_exec_object { 58622944501Smrg /** 58722944501Smrg * User's handle for a buffer to be bound into the GTT for this 58822944501Smrg * operation. 58922944501Smrg */ 59022944501Smrg __u32 handle; 59122944501Smrg 59222944501Smrg /** Number of relocations to be performed on this buffer */ 59322944501Smrg __u32 relocation_count; 59422944501Smrg /** 59522944501Smrg * Pointer to array of struct drm_i915_gem_relocation_entry containing 59622944501Smrg * the relocations to be performed in this buffer. 59722944501Smrg */ 59822944501Smrg __u64 relocs_ptr; 59922944501Smrg 60022944501Smrg /** Required alignment in graphics aperture */ 60122944501Smrg __u64 alignment; 60222944501Smrg 60322944501Smrg /** 60422944501Smrg * Returned value of the updated offset of the object, for future 60522944501Smrg * presumed_offset writes. 60622944501Smrg */ 60722944501Smrg __u64 offset; 60822944501Smrg}; 60922944501Smrg 61022944501Smrgstruct drm_i915_gem_execbuffer { 61122944501Smrg /** 61222944501Smrg * List of buffers to be validated with their relocations to be 61322944501Smrg * performend on them. 61422944501Smrg * 61522944501Smrg * This is a pointer to an array of struct drm_i915_gem_validate_entry. 61622944501Smrg * 61722944501Smrg * These buffers must be listed in an order such that all relocations 61822944501Smrg * a buffer is performing refer to buffers that have already appeared 61922944501Smrg * in the validate list. 62022944501Smrg */ 62122944501Smrg __u64 buffers_ptr; 62222944501Smrg __u32 buffer_count; 62322944501Smrg 62422944501Smrg /** Offset in the batchbuffer to start execution from. */ 62522944501Smrg __u32 batch_start_offset; 62622944501Smrg /** Bytes used in batchbuffer from batch_start_offset */ 62722944501Smrg __u32 batch_len; 62822944501Smrg __u32 DR1; 62922944501Smrg __u32 DR4; 63022944501Smrg __u32 num_cliprects; 63122944501Smrg /** This is a struct drm_clip_rect *cliprects */ 63222944501Smrg __u64 cliprects_ptr; 63322944501Smrg}; 63422944501Smrg 63522944501Smrgstruct drm_i915_gem_exec_object2 { 63622944501Smrg /** 63722944501Smrg * User's handle for a buffer to be bound into the GTT for this 63822944501Smrg * operation. 63922944501Smrg */ 64022944501Smrg __u32 handle; 64122944501Smrg 64222944501Smrg /** Number of relocations to be performed on this buffer */ 64322944501Smrg __u32 relocation_count; 64422944501Smrg /** 64522944501Smrg * Pointer to array of struct drm_i915_gem_relocation_entry containing 64622944501Smrg * the relocations to be performed in this buffer. 64722944501Smrg */ 64822944501Smrg __u64 relocs_ptr; 64922944501Smrg 65022944501Smrg /** Required alignment in graphics aperture */ 65122944501Smrg __u64 alignment; 65222944501Smrg 65322944501Smrg /** 65422944501Smrg * Returned value of the updated offset of the object, for future 65522944501Smrg * presumed_offset writes. 65622944501Smrg */ 65722944501Smrg __u64 offset; 65822944501Smrg 65922944501Smrg#define EXEC_OBJECT_NEEDS_FENCE (1<<0) 660e88f27b3Smrg#define EXEC_OBJECT_NEEDS_GTT (1<<1) 661e88f27b3Smrg#define EXEC_OBJECT_WRITE (1<<2) 662e88f27b3Smrg#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) 66322944501Smrg __u64 flags; 664e88f27b3Smrg 66522944501Smrg __u64 rsvd1; 66622944501Smrg __u64 rsvd2; 66722944501Smrg}; 66822944501Smrg 66922944501Smrgstruct drm_i915_gem_execbuffer2 { 67022944501Smrg /** 67122944501Smrg * List of gem_exec_object2 structs 67222944501Smrg */ 67322944501Smrg __u64 buffers_ptr; 67422944501Smrg __u32 buffer_count; 67522944501Smrg 67622944501Smrg /** Offset in the batchbuffer to start execution from. */ 67722944501Smrg __u32 batch_start_offset; 67822944501Smrg /** Bytes used in batchbuffer from batch_start_offset */ 67922944501Smrg __u32 batch_len; 68022944501Smrg __u32 DR1; 68122944501Smrg __u32 DR4; 68222944501Smrg __u32 num_cliprects; 68322944501Smrg /** This is a struct drm_clip_rect *cliprects */ 68422944501Smrg __u64 cliprects_ptr; 68569dda199Smrg#define I915_EXEC_RING_MASK (7<<0) 68669dda199Smrg#define I915_EXEC_DEFAULT (0<<0) 687d049871aSmrg#define I915_EXEC_RENDER (1<<0) 68869dda199Smrg#define I915_EXEC_BSD (2<<0) 68969dda199Smrg#define I915_EXEC_BLT (3<<0) 690e88f27b3Smrg#define I915_EXEC_VEBOX (4<<0) 691e88f27b3Smrg 692e88f27b3Smrg/* Used for switching the constants addressing mode on gen4+ RENDER ring. 693e88f27b3Smrg * Gen6+ only supports relative addressing to dynamic state (default) and 694e88f27b3Smrg * absolute addressing. 695e88f27b3Smrg * 696e88f27b3Smrg * These flags are ignored for the BSD and BLT rings. 697e88f27b3Smrg */ 698e88f27b3Smrg#define I915_EXEC_CONSTANTS_MASK (3<<6) 699e88f27b3Smrg#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */ 700e88f27b3Smrg#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6) 701e88f27b3Smrg#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */ 70213d1d17dSmrg __u64 flags; 703e88f27b3Smrg __u64 rsvd1; /* now used for context info */ 70422944501Smrg __u64 rsvd2; 70522944501Smrg}; 70622944501Smrg 707e88f27b3Smrg/** Resets the SO write offset registers for transform feedback on gen7. */ 708e88f27b3Smrg#define I915_EXEC_GEN7_SOL_RESET (1<<8) 709e88f27b3Smrg 710e88f27b3Smrg/** Request a privileged ("secure") batch buffer. Note only available for 711e88f27b3Smrg * DRM_ROOT_ONLY | DRM_MASTER processes. 712e88f27b3Smrg */ 713e88f27b3Smrg#define I915_EXEC_SECURE (1<<9) 714e88f27b3Smrg 715e88f27b3Smrg/** Inform the kernel that the batch is and will always be pinned. This 716e88f27b3Smrg * negates the requirement for a workaround to be performed to avoid 717e88f27b3Smrg * an incoherent CS (such as can be found on 830/845). If this flag is 718e88f27b3Smrg * not passed, the kernel will endeavour to make sure the batch is 719e88f27b3Smrg * coherent with the CS before execution. If this flag is passed, 720e88f27b3Smrg * userspace assumes the responsibility for ensuring the same. 721e88f27b3Smrg */ 722e88f27b3Smrg#define I915_EXEC_IS_PINNED (1<<10) 723e88f27b3Smrg 724e88f27b3Smrg/** Provide a hint to the kernel that the command stream and auxilliary 725e88f27b3Smrg * state buffers already holds the correct presumed addresses and so the 726e88f27b3Smrg * relocation process may be skipped if no buffers need to be moved in 727e88f27b3Smrg * preparation for the execbuffer. 728e88f27b3Smrg */ 729e88f27b3Smrg#define I915_EXEC_NO_RELOC (1<<11) 730e88f27b3Smrg 731e88f27b3Smrg/** Use the reloc.handle as an index into the exec object array rather 732e88f27b3Smrg * than as the per-file handle. 733e88f27b3Smrg */ 734e88f27b3Smrg#define I915_EXEC_HANDLE_LUT (1<<12) 735e88f27b3Smrg 736e88f27b3Smrg#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_HANDLE_LUT<<1) 737e88f27b3Smrg 738e88f27b3Smrg#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 739e88f27b3Smrg#define i915_execbuffer2_set_context_id(eb2, context) \ 740e88f27b3Smrg (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK 741e88f27b3Smrg#define i915_execbuffer2_get_context_id(eb2) \ 742e88f27b3Smrg ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK) 743e88f27b3Smrg 74422944501Smrgstruct drm_i915_gem_pin { 74522944501Smrg /** Handle of the buffer to be pinned. */ 74622944501Smrg __u32 handle; 74722944501Smrg __u32 pad; 74822944501Smrg 74922944501Smrg /** alignment required within the aperture */ 75022944501Smrg __u64 alignment; 75122944501Smrg 75222944501Smrg /** Returned GTT offset of the buffer. */ 75322944501Smrg __u64 offset; 75422944501Smrg}; 75522944501Smrg 75622944501Smrgstruct drm_i915_gem_unpin { 75722944501Smrg /** Handle of the buffer to be unpinned. */ 75822944501Smrg __u32 handle; 75922944501Smrg __u32 pad; 76022944501Smrg}; 76122944501Smrg 76222944501Smrgstruct drm_i915_gem_busy { 76322944501Smrg /** Handle of the buffer to check for busy */ 76422944501Smrg __u32 handle; 76522944501Smrg 766e88f27b3Smrg /** Return busy status (1 if busy, 0 if idle). 767e88f27b3Smrg * The high word is used to indicate on which rings the object 768e88f27b3Smrg * currently resides: 769e88f27b3Smrg * 16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc) 770e88f27b3Smrg */ 77122944501Smrg __u32 busy; 77222944501Smrg}; 77322944501Smrg 774e88f27b3Smrg/** 775e88f27b3Smrg * I915_CACHING_NONE 776e88f27b3Smrg * 777e88f27b3Smrg * GPU access is not coherent with cpu caches. Default for machines without an 778e88f27b3Smrg * LLC. 779e88f27b3Smrg */ 780e88f27b3Smrg#define I915_CACHING_NONE 0 781e88f27b3Smrg/** 782e88f27b3Smrg * I915_CACHING_CACHED 783e88f27b3Smrg * 784e88f27b3Smrg * GPU access is coherent with cpu caches and furthermore the data is cached in 785e88f27b3Smrg * last-level caches shared between cpu cores and the gpu GT. Default on 786e88f27b3Smrg * machines with HAS_LLC. 787e88f27b3Smrg */ 788e88f27b3Smrg#define I915_CACHING_CACHED 1 789e88f27b3Smrg/** 790e88f27b3Smrg * I915_CACHING_DISPLAY 791e88f27b3Smrg * 792e88f27b3Smrg * Special GPU caching mode which is coherent with the scanout engines. 793e88f27b3Smrg * Transparently falls back to I915_CACHING_NONE on platforms where no special 794e88f27b3Smrg * cache mode (like write-through or gfdt flushing) is available. The kernel 795e88f27b3Smrg * automatically sets this mode when using a buffer as a scanout target. 796e88f27b3Smrg * Userspace can manually set this mode to avoid a costly stall and clflush in 797e88f27b3Smrg * the hotpath of drawing the first frame. 798e88f27b3Smrg */ 799e88f27b3Smrg#define I915_CACHING_DISPLAY 2 800e88f27b3Smrg 801e88f27b3Smrgstruct drm_i915_gem_caching { 802e88f27b3Smrg /** 803e88f27b3Smrg * Handle of the buffer to set/get the caching level of. */ 804e88f27b3Smrg __u32 handle; 805e88f27b3Smrg 806e88f27b3Smrg /** 807e88f27b3Smrg * Cacheing level to apply or return value 808e88f27b3Smrg * 809e88f27b3Smrg * bits0-15 are for generic caching control (i.e. the above defined 810e88f27b3Smrg * values). bits16-31 are reserved for platform-specific variations 811e88f27b3Smrg * (e.g. l3$ caching on gen7). */ 812e88f27b3Smrg __u32 caching; 813e88f27b3Smrg}; 814e88f27b3Smrg 81522944501Smrg#define I915_TILING_NONE 0 81622944501Smrg#define I915_TILING_X 1 81722944501Smrg#define I915_TILING_Y 2 81822944501Smrg 81922944501Smrg#define I915_BIT_6_SWIZZLE_NONE 0 82022944501Smrg#define I915_BIT_6_SWIZZLE_9 1 82122944501Smrg#define I915_BIT_6_SWIZZLE_9_10 2 82222944501Smrg#define I915_BIT_6_SWIZZLE_9_11 3 82322944501Smrg#define I915_BIT_6_SWIZZLE_9_10_11 4 82422944501Smrg/* Not seen by userland */ 82522944501Smrg#define I915_BIT_6_SWIZZLE_UNKNOWN 5 82622944501Smrg/* Seen by userland. */ 82722944501Smrg#define I915_BIT_6_SWIZZLE_9_17 6 82822944501Smrg#define I915_BIT_6_SWIZZLE_9_10_17 7 82922944501Smrg 83022944501Smrgstruct drm_i915_gem_set_tiling { 83122944501Smrg /** Handle of the buffer to have its tiling state updated */ 83222944501Smrg __u32 handle; 83322944501Smrg 83422944501Smrg /** 83522944501Smrg * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 83622944501Smrg * I915_TILING_Y). 83722944501Smrg * 83822944501Smrg * This value is to be set on request, and will be updated by the 83922944501Smrg * kernel on successful return with the actual chosen tiling layout. 84022944501Smrg * 84122944501Smrg * The tiling mode may be demoted to I915_TILING_NONE when the system 84222944501Smrg * has bit 6 swizzling that can't be managed correctly by GEM. 84322944501Smrg * 84422944501Smrg * Buffer contents become undefined when changing tiling_mode. 84522944501Smrg */ 84622944501Smrg __u32 tiling_mode; 84722944501Smrg 84822944501Smrg /** 84922944501Smrg * Stride in bytes for the object when in I915_TILING_X or 85022944501Smrg * I915_TILING_Y. 85122944501Smrg */ 85222944501Smrg __u32 stride; 85322944501Smrg 85422944501Smrg /** 85522944501Smrg * Returned address bit 6 swizzling required for CPU access through 85622944501Smrg * mmap mapping. 85722944501Smrg */ 85822944501Smrg __u32 swizzle_mode; 85922944501Smrg}; 86022944501Smrg 86122944501Smrgstruct drm_i915_gem_get_tiling { 86222944501Smrg /** Handle of the buffer to get tiling state for. */ 86322944501Smrg __u32 handle; 86422944501Smrg 86522944501Smrg /** 86622944501Smrg * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X, 86722944501Smrg * I915_TILING_Y). 86822944501Smrg */ 86922944501Smrg __u32 tiling_mode; 87022944501Smrg 87122944501Smrg /** 87222944501Smrg * Returned address bit 6 swizzling required for CPU access through 87322944501Smrg * mmap mapping. 87422944501Smrg */ 87522944501Smrg __u32 swizzle_mode; 87622944501Smrg}; 87722944501Smrg 87822944501Smrgstruct drm_i915_gem_get_aperture { 87922944501Smrg /** Total size of the aperture used by i915_gem_execbuffer, in bytes */ 88022944501Smrg __u64 aper_size; 88122944501Smrg 88222944501Smrg /** 88322944501Smrg * Available space in the aperture used by i915_gem_execbuffer, in 88422944501Smrg * bytes 88522944501Smrg */ 88622944501Smrg __u64 aper_available_size; 88722944501Smrg}; 88822944501Smrg 88922944501Smrgstruct drm_i915_get_pipe_from_crtc_id { 89022944501Smrg /** ID of CRTC being requested **/ 89122944501Smrg __u32 crtc_id; 89222944501Smrg 89322944501Smrg /** pipe of requested CRTC **/ 89422944501Smrg __u32 pipe; 89522944501Smrg}; 89622944501Smrg 89722944501Smrg#define I915_MADV_WILLNEED 0 89822944501Smrg#define I915_MADV_DONTNEED 1 89922944501Smrg#define __I915_MADV_PURGED 2 /* internal state */ 90022944501Smrg 90122944501Smrgstruct drm_i915_gem_madvise { 90222944501Smrg /** Handle of the buffer to change the backing store advice */ 90322944501Smrg __u32 handle; 90422944501Smrg 90522944501Smrg /* Advice: either the buffer will be needed again in the near future, 90622944501Smrg * or wont be and could be discarded under memory pressure. 90722944501Smrg */ 90822944501Smrg __u32 madv; 90922944501Smrg 91022944501Smrg /** Whether the backing store still exists. */ 91122944501Smrg __u32 retained; 91222944501Smrg}; 91322944501Smrg 91422944501Smrg/* flags */ 91522944501Smrg#define I915_OVERLAY_TYPE_MASK 0xff 91622944501Smrg#define I915_OVERLAY_YUV_PLANAR 0x01 91722944501Smrg#define I915_OVERLAY_YUV_PACKED 0x02 91822944501Smrg#define I915_OVERLAY_RGB 0x03 91922944501Smrg 92022944501Smrg#define I915_OVERLAY_DEPTH_MASK 0xff00 92122944501Smrg#define I915_OVERLAY_RGB24 0x1000 92222944501Smrg#define I915_OVERLAY_RGB16 0x2000 92322944501Smrg#define I915_OVERLAY_RGB15 0x3000 92422944501Smrg#define I915_OVERLAY_YUV422 0x0100 92522944501Smrg#define I915_OVERLAY_YUV411 0x0200 92622944501Smrg#define I915_OVERLAY_YUV420 0x0300 92722944501Smrg#define I915_OVERLAY_YUV410 0x0400 92822944501Smrg 92922944501Smrg#define I915_OVERLAY_SWAP_MASK 0xff0000 93022944501Smrg#define I915_OVERLAY_NO_SWAP 0x000000 93122944501Smrg#define I915_OVERLAY_UV_SWAP 0x010000 93222944501Smrg#define I915_OVERLAY_Y_SWAP 0x020000 93322944501Smrg#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000 93422944501Smrg 93522944501Smrg#define I915_OVERLAY_FLAGS_MASK 0xff000000 93622944501Smrg#define I915_OVERLAY_ENABLE 0x01000000 93722944501Smrg 93822944501Smrgstruct drm_intel_overlay_put_image { 93922944501Smrg /* various flags and src format description */ 94022944501Smrg __u32 flags; 94122944501Smrg /* source picture description */ 94222944501Smrg __u32 bo_handle; 94322944501Smrg /* stride values and offsets are in bytes, buffer relative */ 94422944501Smrg __u16 stride_Y; /* stride for packed formats */ 94522944501Smrg __u16 stride_UV; 94622944501Smrg __u32 offset_Y; /* offset for packet formats */ 94722944501Smrg __u32 offset_U; 94822944501Smrg __u32 offset_V; 94922944501Smrg /* in pixels */ 95022944501Smrg __u16 src_width; 95122944501Smrg __u16 src_height; 95222944501Smrg /* to compensate the scaling factors for partially covered surfaces */ 95322944501Smrg __u16 src_scan_width; 95422944501Smrg __u16 src_scan_height; 95522944501Smrg /* output crtc description */ 95622944501Smrg __u32 crtc_id; 95722944501Smrg __u16 dst_x; 95822944501Smrg __u16 dst_y; 95922944501Smrg __u16 dst_width; 96022944501Smrg __u16 dst_height; 96122944501Smrg}; 96222944501Smrg 96322944501Smrg/* flags */ 96422944501Smrg#define I915_OVERLAY_UPDATE_ATTRS (1<<0) 96522944501Smrg#define I915_OVERLAY_UPDATE_GAMMA (1<<1) 96622944501Smrgstruct drm_intel_overlay_attrs { 96722944501Smrg __u32 flags; 96822944501Smrg __u32 color_key; 96922944501Smrg __s32 brightness; 97022944501Smrg __u32 contrast; 97122944501Smrg __u32 saturation; 97222944501Smrg __u32 gamma0; 97322944501Smrg __u32 gamma1; 97422944501Smrg __u32 gamma2; 97522944501Smrg __u32 gamma3; 97622944501Smrg __u32 gamma4; 97722944501Smrg __u32 gamma5; 97822944501Smrg}; 97922944501Smrg 980e88f27b3Smrg/* 981e88f27b3Smrg * Intel sprite handling 982e88f27b3Smrg * 983e88f27b3Smrg * Color keying works with a min/mask/max tuple. Both source and destination 984e88f27b3Smrg * color keying is allowed. 985e88f27b3Smrg * 986e88f27b3Smrg * Source keying: 987e88f27b3Smrg * Sprite pixels within the min & max values, masked against the color channels 988e88f27b3Smrg * specified in the mask field, will be transparent. All other pixels will 989e88f27b3Smrg * be displayed on top of the primary plane. For RGB surfaces, only the min 990e88f27b3Smrg * and mask fields will be used; ranged compares are not allowed. 991e88f27b3Smrg * 992e88f27b3Smrg * Destination keying: 993e88f27b3Smrg * Primary plane pixels that match the min value, masked against the color 994e88f27b3Smrg * channels specified in the mask field, will be replaced by corresponding 995e88f27b3Smrg * pixels from the sprite plane. 996e88f27b3Smrg * 997e88f27b3Smrg * Note that source & destination keying are exclusive; only one can be 998e88f27b3Smrg * active on a given plane. 999e88f27b3Smrg */ 1000e88f27b3Smrg 1001e88f27b3Smrg#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */ 1002e88f27b3Smrg#define I915_SET_COLORKEY_DESTINATION (1<<1) 1003e88f27b3Smrg#define I915_SET_COLORKEY_SOURCE (1<<2) 1004e88f27b3Smrgstruct drm_intel_sprite_colorkey { 1005e88f27b3Smrg __u32 plane_id; 1006e88f27b3Smrg __u32 min_value; 1007e88f27b3Smrg __u32 channel_mask; 1008e88f27b3Smrg __u32 max_value; 1009e88f27b3Smrg __u32 flags; 1010e88f27b3Smrg}; 1011e88f27b3Smrg 1012e88f27b3Smrgstruct drm_i915_gem_wait { 1013e88f27b3Smrg /** Handle of BO we shall wait on */ 1014e88f27b3Smrg __u32 bo_handle; 1015e88f27b3Smrg __u32 flags; 1016e88f27b3Smrg /** Number of nanoseconds to wait, Returns time remaining. */ 1017e88f27b3Smrg __s64 timeout_ns; 1018e88f27b3Smrg}; 1019e88f27b3Smrg 1020e88f27b3Smrgstruct drm_i915_gem_context_create { 1021e88f27b3Smrg /* output: id of new context*/ 1022e88f27b3Smrg __u32 ctx_id; 1023e88f27b3Smrg __u32 pad; 1024e88f27b3Smrg}; 1025e88f27b3Smrg 1026e88f27b3Smrgstruct drm_i915_gem_context_destroy { 1027e88f27b3Smrg __u32 ctx_id; 1028e88f27b3Smrg __u32 pad; 1029e88f27b3Smrg}; 1030e88f27b3Smrg 1031e88f27b3Smrgstruct drm_i915_reg_read { 1032e88f27b3Smrg __u64 offset; 1033e88f27b3Smrg __u64 val; /* Return value */ 1034e88f27b3Smrg}; 1035e88f27b3Smrg 1036e88f27b3Smrgstruct drm_i915_reset_stats { 1037e88f27b3Smrg __u32 ctx_id; 1038e88f27b3Smrg __u32 flags; 1039e88f27b3Smrg 1040e88f27b3Smrg /* All resets since boot/module reload, for all contexts */ 1041e88f27b3Smrg __u32 reset_count; 1042e88f27b3Smrg 1043e88f27b3Smrg /* Number of batches lost when active in GPU, for this context */ 1044e88f27b3Smrg __u32 batch_active; 1045e88f27b3Smrg 1046e88f27b3Smrg /* Number of batches lost pending for execution, for this context */ 1047e88f27b3Smrg __u32 batch_pending; 1048e88f27b3Smrg 1049e88f27b3Smrg __u32 pad; 1050e88f27b3Smrg}; 1051e88f27b3Smrg 1052e88f27b3Smrg#endif /* _I915_DRM_H_ */ 1053